public void addChildObject(WDBObject child) throws Exception { if (!children.containsKey(child.getClassName())) { this.children.put(child.getClassName(), child.getUid()); } else { throw new ClassCastException( "This entity of class \"" + this.classDefName + "\" has alreadly been extended to class \"" + child.getClassName() + "\""); } }
private void addEvaObject(EVA targetEva, WDBObject targetEvaObject, ParserAdapter scda) throws Exception { // TODO: Make sure we update the objects that we removed when replacing with new values if (targetEva.cardinality.equals(EVA.MULTIVALUED)) { ArrayList<String> targetObjectList = ((ArrayList) this.evaObjects.get(targetEva.name)); if (targetObjectList == null) { targetObjectList = new ArrayList<String>(); } targetObjectList.add( new String(targetEvaObject.classDefName + ":" + targetEvaObject.getUid())); this.evaObjects.put(targetEva.name, targetObjectList); } else if (targetEva.cardinality.equals(EVA.SINGLEVALUED)) { // For singlevalued EVAs, just put the UID as the value; this.evaObjects.put( targetEva.name, new String(targetEvaObject.classDefName + ":" + targetEvaObject.getUid())); } else { throw new NoSuchFieldException( "Attribute \"" + targetEva.name + "\" uses a invalid cardinality"); } }
private Boolean removeEvaObject(EVA targetEva, WDBObject targetEvaObject, ParserAdapter scda) throws Exception { if (targetEva.cardinality.equals(EVA.MULTIVALUED)) { ArrayList targetObjectList = ((ArrayList) this.evaObjects.get(targetEva.name)); if (targetObjectList == null) { return false; } Boolean result = targetObjectList.remove( new String(targetEvaObject.classDefName + ":" + targetEvaObject.getUid())); this.evaObjects.put(targetEva.name, targetObjectList); return result; } else if (targetEva.cardinality.equals(EVA.SINGLEVALUED)) { // For singlevalued EVAs, just put the UID as the value; Boolean result = (this.evaObjects.remove(targetEva.name)) != null; return result; } else { throw new NoSuchFieldException("Attribute \"" + targetEva + "\" uses a invalid cardinality"); } }
public void addParentObject(WDBObject parent) throws Exception { this.parents.put(parent.getClassName(), parent.getUid()); }