/** * Provide access to the entity's type. * * @param entity * @return * @throws ClassCastException * if entity is not an instance of {@link DynamicEntityImpl} */ public static DynamicType getType(DynamicEntity entity) throws ClassCastException { return ((DynamicEntityImpl) entity).getType(); }
public void _persistence_setHref(Link href) { set("_persistence_href", href, false); }
@Override public void beforeMarshal(Object source) { if (source instanceof DynamicEntity) { DynamicEntityImpl sourceImpl = (DynamicEntityImpl) source; PropertyChangeListener listener = sourceImpl._persistence_getPropertyChangeListener(); sourceImpl._persistence_setPropertyChangeListener(null); ((DynamicEntity) source).set("self", source); sourceImpl._persistence_setPropertyChangeListener(listener); } } });
public List<RelationshipInfo> _persistence_getRelationships() { List<RelationshipInfo> relationships = (List<RelationshipInfo>) get("_persistence_relationshipInfo"); if (relationships == null) { relationships = new ArrayList<RelationshipInfo>(); _persistence_setRelationships(relationships); } return relationships; }
public <T> T get(String propertyName) throws DynamicException { DynamicPropertiesManager dpm = fetchPropertiesManager(); if (dpm.contains(propertyName)) { if (_persistence_getFetchGroup() != null) { String errorMsg = _persistence_getFetchGroup().onUnfetchedAttribute(this, propertyName); if (errorMsg != null) { return (T) value; } catch (ClassCastException cce) { ClassDescriptor descriptor = getType().getDescriptor(); DatabaseMapping dm = null; if (descriptor != null) {
public boolean isSet(String propertyName) throws DynamicException { if (fetchPropertiesManager().contains(propertyName)) { if (_persistence_getFetchGroup() != null && !_persistence_getFetchGroup().containsAttributeInternal(propertyName)) { return false; } PropertyWrapper wrapper = propertiesMap.get(propertyName); if (wrapper == null) { // properties can be added after constructor is called wrapper = new PropertyWrapper(); propertiesMap.put(propertyName, wrapper); } return wrapper.isSet(); } else { throw DynamicException.invalidPropertyName(fetchPropertiesManager().getType(), propertyName); } }
public DynamicEntity set(String propertyName, Object value) { DatabaseMapping mapping = getType().getMapping(propertyName); checkSetType(mapping, value); Object currentValue = mapping.getAttributeValueFromObject(this); if (currentValue instanceof ValueHolderInterface) { ((ValueHolderInterface) currentValue).setValue(value); } else { mapping.setAttributeValueInObject(this, value); } return this; }
public Object getAttributeValueFromObject(Object entity) throws DescriptorException { Map<String, PropertyWrapper> propertiesMap = ((DynamicEntityImpl)entity).getPropertiesMap(); PropertyWrapper wrapper = propertiesMap.get(attributeName); // wrapper is never null return wrapper.getValue(); }
/** * Post construct. */ protected void postConstruct() { DynamicPropertiesManager dpm = fetchPropertiesManager(); dpm.postConstruct(this); }
public Link _persistence_getHref() { return get("_persistence_href"); }
/** * Instantiates a new dynamic entity impl. */ public DynamicEntityImpl() { postConstruct(); // life-cycle callback }
public <T> T get(String propertyName) throws DynamicException { DynamicPropertiesManager dpm = fetchPropertiesManager(); if (dpm.contains(propertyName)) { if (_persistence_getFetchGroup() != null) { String errorMsg = _persistence_getFetchGroup().onUnfetchedAttribute(this, propertyName); if (errorMsg != null) { return (T) value; } catch (ClassCastException cce) { ClassDescriptor descriptor = getType().getDescriptor(); DatabaseMapping dm = null; if (descriptor != null) {
public boolean isSet(String propertyName) throws DynamicException { if (fetchPropertiesManager().contains(propertyName)) { if (_persistence_getFetchGroup() != null && !_persistence_getFetchGroup().containsAttributeInternal(propertyName)) { return false; } PropertyWrapper wrapper = propertiesMap.get(propertyName); if (wrapper == null) { // properties can be added after constructor is called wrapper = new PropertyWrapper(); propertiesMap.put(propertyName, wrapper); } return wrapper.isSet(); } else { throw DynamicException.invalidPropertyName(fetchPropertiesManager().getType(), propertyName); } }
public List<RelationshipInfo> _persistence_getRelationships() { List<RelationshipInfo> relationships = (List<RelationshipInfo>) get("_persistence_relationshipInfo"); if (relationships == null) { relationships = new ArrayList<RelationshipInfo>(); _persistence_setRelationships(relationships); } return relationships; }
public Object getAttributeValueFromObject(Object entity) throws DescriptorException { Map<String, PropertyWrapper> propertiesMap = ((DynamicEntityImpl)entity).getPropertiesMap(); PropertyWrapper wrapper = propertiesMap.get(attributeName); // wrapper is never null return wrapper.getValue(); }
/** * Post construct. */ protected void postConstruct() { DynamicPropertiesManager dpm = fetchPropertiesManager(); dpm.postConstruct(this); }
public ItemLinks _persistence_getLinks() { return get("_persistence_links"); }
/** * Instantiates a new dynamic entity impl. */ public DynamicEntityImpl() { postConstruct(); // life-cycle callback }
/** * Provide access to the entity's type. * * @param entity * @return * @throws ClassCastException * if entity is not an instance of {@link DynamicEntityImpl} */ public static DynamicType getType(DynamicEntity entity) throws ClassCastException { return ((DynamicEntityImpl) entity).getType(); }