/** * Get or create a clone of an oav object. * @param targetstate The target state. * @param handles The handles. * @param todo The todo list. * @param oldval The old object. */ protected Object getClonedOAVObject(IOAVState targetstate, Map handles, List todo, Object oldval) { Object newval = handles.get(oldval); if(newval==null) { if(rootobjects.contains(oldval)) newval = targetstate.createRootObject(getType(oldval)); else newval = targetstate.createObject(getType(oldval)); handles.put(oldval, newval); todo.add(oldval); } return newval; }
/** * Get or create a clone of an oav object. * @param targetstate The target state. * @param handles The handles. * @param todo The todo list. * @param oldval The old object. */ protected Object getClonedOAVObject(IOAVState targetstate, Map handles, List todo, Object oldval) { Object newval = handles.get(oldval); if(newval==null) { if(rootobjects.contains(oldval)) newval = targetstate.createRootObject(getType(oldval)); else newval = targetstate.createObject(getType(oldval)); handles.put(oldval, newval); todo.add(oldval); } return newval; }
/** * Expunge stale objects. */ public void expungeStaleObjects() { WeakEntry entry; while((entry = (WeakEntry)queue.poll()) !=null) { OAVInternalObjectId id = (OAVInternalObjectId)entry.getArgument(); eventhandler.objectRemoved(id.getPhantomExternalId(), getType(id.getPhantomExternalId())); objects.remove(id); types.remove(id); // System.out.println("Removed: "+id); } }
/** * Expunge stale objects. */ public void expungeStaleObjects() { WeakEntry entry; while((entry = (WeakEntry)queue.poll()) !=null) { OAVInternalObjectId id = (OAVInternalObjectId)entry.getArgument(); eventhandler.objectRemoved(id.getPhantomExternalId(), getType(id.getPhantomExternalId())); objects.remove(id); types.remove(id); // System.out.println("Removed: "+id); } }
/** * Check if it is allowed to set or add an attribute value. * For this purpose it is checked if the value is either * a) a ObjectId -> type check via OAVObjectType * b) a normal Java object -> type check via OAVJavaType * Additionally multiplicity is checked. * @throws RuntimeException if value is not allowed. */ protected boolean checkValueCompatibility(Object object, OAVAttributeType attribute, Object value) { if(value!=null) { OAVObjectType atype = attribute.getType(); if(atype instanceof OAVJavaType) { if(!tmodel.getJavaType(value.getClass()).isSubtype(atype)) throw new RuntimeException("Value not of suitable type: "+object+" "+attribute+" "+value); } else if(!getType(value).isSubtype(atype)) { throw new RuntimeException("Value not of suitable type: "+object+" "+attribute+" "+value); } } return true; }
/** * Check if it is allowed to set or add an attribute value. * For this purpose it is checked if the value is either * a) a ObjectId -> type check via OAVObjectType * b) a normal Java object -> type check via OAVJavaType * Additionally multiplicity is checked. * @throws RuntimeException if value is not allowed. */ protected boolean checkValueCompatibility(Object object, OAVAttributeType attribute, Object value) { if(value!=null) { OAVObjectType atype = attribute.getType(); if(atype instanceof OAVJavaType) { if(!tmodel.getJavaType(value.getClass()).isSubtype(atype)) throw new RuntimeException("Value not of suitable type: "+object+" "+attribute+" "+value); } else if(!getType(value).isSubtype(atype)) { throw new RuntimeException("Value not of suitable type: "+object+" "+attribute+" "+value); } } return true; }
addJavaObjectUsage(object, attribute, value); eventhandler.objectModified(((OAVExternalObjectId)object).getInternalId().getPhantomExternalId(), getType(object), attribute, null, value);
removeJavaObjectUsage(object, attribute, value); eventhandler.objectModified(((OAVExternalObjectId)object).getInternalId().getPhantomExternalId(), getType(object), attribute, value, null);
addJavaObjectUsage(object, attribute, value); eventhandler.objectModified(((OAVExternalObjectId)object).getInternalId().getPhantomExternalId(), getType(object), attribute, null, value);
removeJavaObjectUsage(object, attribute, value); eventhandler.objectModified(((OAVExternalObjectId)object).getInternalId().getPhantomExternalId(), getType(object), attribute, value, null);
addJavaObjectUsage(object, attribute, value); eventhandler.objectModified(((OAVExternalObjectId)object).getInternalId().getPhantomExternalId(), getType(object), attribute, oldvalue, value);
addJavaObjectUsage(object, attribute, value); eventhandler.objectModified(((OAVExternalObjectId)object).getInternalId().getPhantomExternalId(), getType(object), attribute, oldvalue, value);