public boolean isToMany() { refreshFromPath(true); return super.isToMany(); }
public boolean relationshipMatch(Object node, Relationship rel) { if (!(node instanceof Relationship)) { return true; } /** * We do not allow A->B->A chains, where relationships * are to-one */ DbRelationship prev = (DbRelationship) node; return !(!rel.isToMany() && prev.getReverseRelationship() == rel); } }
public boolean relationshipMatch(Object node, Relationship rel) { if (!(node instanceof Relationship)) { return true; } /** * We do not allow A->B->A chains, where relationships are * to-one */ DbRelationship prev = (DbRelationship) node; return !(!rel.isToMany() && prev.getReverseRelationship() == rel); } }
/** * Overrides Object.toString() to return informative description. */ public String toString() { return new ToStringBuilder(this).append("name", getName()).append( "toMany", isToMany()).toString(); } }
/** * Returns true if an ObjEntity contains at least one toOne relationship. */ public boolean hasToOneRelationships(ObjEntity anObjEntity) { if (anObjEntity == null) { return false; } for (Relationship r : anObjEntity.getRelationships()) { if (false == r.isToMany()) { return true; } } return false; }
/** * Returns label for relationship on the graph, considering its "mandatory" * and "to-many" properties */ private static String getRelationshipLabel(Relationship rel) { if (rel == null) { return null; } if (rel.isToMany()) { return "0..*"; } return rel.isMandatory() ? "1" : "0..1"; }
/** * Returns true if an ObjEntity contains at least one toMany relationship. */ public boolean hasToManyRelationships(ObjEntity anObjEntity) { if (anObjEntity == null) { return false; } for (Relationship r : anObjEntity.getRelationships()) { if (r.isToMany()) { return true; } } return false; }
/** * Returns true if an ObjEntity contains at least one toMany relationship. */ public boolean hasToManyRelationships(ObjEntity anObjEntity) { if (anObjEntity == null) { return false; } Iterator it = anObjEntity.getRelationships().iterator(); while (it.hasNext()) { Relationship r = (Relationship) it.next(); if (r.isToMany()) { return true; } } return false; }
/** * Returns true if an ObjEntity contains at least one toOne relationship. */ public boolean hasToOneRelationships(ObjEntity anObjEntity) { if (anObjEntity == null) { return false; } for (Relationship r : anObjEntity.getRelationships()) { if (!r.isToMany()) { return true; } } return false; }
/** * Returns true if an ObjEntity contains at least one toMany relationship. */ public boolean hasToManyRelationships(ObjEntity anObjEntity) { if (anObjEntity == null) { return false; } for (Relationship r : anObjEntity.getRelationships()) { if (r.isToMany()) { return true; } } return false; }
/** * Returns true if an ObjEntity contains at least one toOne relationship, * ignoring those declared in superentities. */ public boolean hasToOneDeclaredRelationships(ObjEntity anObjEntity) { if (anObjEntity == null) { return false; } for (Relationship r : anObjEntity.getDeclaredRelationships()) { if (!r.isToMany()) { return true; } } return false; }
/** * Returns true if an ObjEntity contains at least one toOne relationship, ignoring * those declared in superentities. */ public boolean hasToOneDeclaredRelationships(ObjEntity anObjEntity) { if (anObjEntity == null) { return false; } for (Relationship r : anObjEntity.getDeclaredRelationships()) { if (!r.isToMany()) { return true; } } return false; }
/** * Returns true if an ObjEntity contains at least one toMany relationship, ignoring * those declared in superentities. * * @since 1.2 */ public boolean hasToManyDeclaredRelationships(ObjEntity anObjEntity) { if (anObjEntity == null) { return false; } Iterator it = anObjEntity.getDeclaredRelationships().iterator(); while (it.hasNext()) { Relationship r = (Relationship) it.next(); if (r.isToMany()) { return true; } } return false; }
/** * Returns true if an ObjEntity contains at least one toMany relationship, * ignoring those declared in superentities. * * @since 1.2 */ public boolean hasToManyDeclaredRelationships(ObjEntity anObjEntity) { if (anObjEntity == null) { return false; } for (Relationship r : anObjEntity.getDeclaredRelationships()) { if (r.isToMany()) { return true; } } return false; }
/** * Returns true if an ObjEntity contains at least one toOne relationship. */ public boolean hasToOneRelationships(ObjEntity anObjEntity) { if (anObjEntity == null) { return false; } Iterator it = anObjEntity.getRelationships().iterator(); while (it.hasNext()) { Relationship r = (Relationship) it.next(); if (false == r.isToMany()) { return true; } } return false; }
/** * Returns true if an ObjEntity contains at least one toMany relationship, ignoring * those declared in superentities. * * @since 1.2 */ public boolean hasToManyDeclaredRelationships(ObjEntity anObjEntity) { if (anObjEntity == null) { return false; } for (Relationship r : anObjEntity.getDeclaredRelationships()) { if (r.isToMany()) { return true; } } return false; }
@Override public boolean isToMany() { refreshFromDeferredPath(); recalculateToManyValue(); return super.isToMany(); }
/** * Overrides Object.toString() to return informative description. */ @Override public String toString() { return new ToStringBuilder(this) .append("name", getName()) .append("toMany", isToMany()).toString(); }
public void arcDeleted(Object nodeId, Object targetNodeId, Object arcId) { DataObject source = findObject(nodeId); // find whether this is to-one or to-many ObjEntity sourceEntity = context.getEntityResolver().lookupObjEntity(source); Relationship relationship = sourceEntity.getRelationship(arcId.toString()); DataObject target = findObject(targetNodeId); if (relationship.isToMany()) { source.removeToManyTarget(relationship.getName(), target, false); } else { source.setToOneTarget(relationship.getName(), null, false); } }
public void arcCreated(Object nodeId, Object targetNodeId, Object arcId) { DataObject source = findObject(nodeId); if(source == null) { return; } // find whether this is to-one or to-many ObjEntity sourceEntity = context.getEntityResolver().lookupObjEntity(source); Relationship relationship = sourceEntity.getRelationship(arcId.toString()); DataObject target = findObject(targetNodeId); if (relationship.isToMany()) { source.addToManyTarget(relationship.getName(), target, false); } else { source.setToOneTarget(relationship.getName(), target, false); } }