public void writeProperty(String propName, Object val) { if (objectContext != null) { // pass "false" to avoid unneeded fault processing objectContext.prepareForAccess(this, propName, false); // note how we notify ObjectContext of change BEFORE the object is // actually // changed... this is needed to take a valid current snapshot Object oldValue = readPropertyDirectly(propName); objectContext.propertyChanged(this, propName, oldValue, val); } writePropertyDirectly(propName, val); }
public Object readProperty(String propName) { if (objectContext != null) { objectContext.prepareForAccess(this, propName); } Object object = readPropertyDirectly(propName); // must resolve faults immediately if (object instanceof Fault) { object = ((Fault) object).resolveFault(this, propName); writePropertyDirectly(propName, object); } return object; }
public void writeProperty(String propName, Object val) { if (objectContext != null) { objectContext.prepareForAccess(this, propName); // note how we notify DataContext of change BEFORE the object is actually // changed... this is needed to take a valid current snapshot Object oldValue = readPropertyDirectly(propName); objectContext.propertyChanged(this, propName, oldValue, val); } writePropertyDirectly(propName, val); }
public Object readProperty(String propertyName) { if (objectContext != null) { // will resolve faults ourselves below as checking class descriptors // for the // "lazyFaulting" flag is inefficient. Passing "false" here to // suppress fault // processing objectContext.prepareForAccess(this, propertyName, false); } Object object = readPropertyDirectly(propertyName); if (object instanceof Fault) { object = ((Fault) object).resolveFault(this, propertyName); writePropertyDirectly(propertyName, object); } return object; }
public void setToOneTarget(String relationshipName, DataObject value, boolean setReverse) { willConnect(relationshipName, value); Object oldTarget = readProperty(relationshipName); if (oldTarget == value) { return; } getObjectContext().propertyChanged(this, relationshipName, oldTarget, value); if (setReverse) { // unset old reverse relationship if (oldTarget instanceof DataObject) { unsetReverseRelationship(relationshipName, (DataObject) oldTarget); } // set new reverse relationship if (value != null) { setReverseRelationship(relationshipName, value); } } objectContext.prepareForAccess(this, relationshipName, false); writePropertyDirectly(relationshipName, value); }
public void setToOneTarget( String relationshipName, DataObject value, boolean setReverse) { willConnect(relationshipName, value); Object oldTarget = readProperty(relationshipName); if (oldTarget == value) { return; } getDataContext().getObjectStore().recordArcCreated( this, value != null ? value.getObjectId() : null, relationshipName); if (setReverse) { // unset old reverse relationship if (oldTarget instanceof DataObject) { unsetReverseRelationship(relationshipName, (DataObject) oldTarget); } // set new reverse relationship if (value != null) { setReverseRelationship(relationshipName, value); } } objectContext.prepareForAccess(this, relationshipName); writePropertyDirectly(relationshipName, value); }