public JEVisObject GetLinkedObject() { try { foreach (JEVisRelationship relationship in GetRelationships(JEVisConstants.ObjectRelationship.LINK, JEVisConstants.Direction.FORWARD)) { try { JEVisObject originalObj = relationship.GetEndObject(); if (originalObj != null) { return(originalObj); } /** TODO: maybe return some spezial object of the user has not access to the otherObject **/ } catch (Exception e) { logger.Error(e); } } } catch (Exception e) { logger.Error(e); } return(null); }
public JEVisObject GetOtherObject(JEVisObject jEVisObject) { if (jEVisObject.GetID() == GetStartID()) { return(GetEndObject()); } else { return(GetStartObject()); } }
public bool IsAllowedUnder(JEVisObject otherObject) { bool classIsAllowedUnderClass = GetJEVisClass().IsAllowedUnder(otherObject.GetJEVisClass()); bool isDirectory = this.ds.GetJEVisClass("Directory").getHeirs().contains(this.GetJEVisClass()); bool isUnique = GetJEVisClass().IsUnique(); bool isAlreadyUnderParent = false; if (otherObject.GetParents() != null) { foreach (JEVisObject child in otherObject.GetChildren()) { try { if (child.GetJEVisClassName().Equals(GetJEVisClassName())) { isAlreadyUnderParent = true; } } catch (Exception ex) { } } } /** * first check if its allowed to be created under other object class */ if (classIsAllowedUnderClass) { if (!isUnique) { /** * if its not unique its always allowed to be created */ return(true); } else /** * if it is a directory and its of the same class of its parent its allowed to be created */if (!isAlreadyUnderParent) { /** * if it is unique and not already created its allowed to be created */ return(true); } else { return(isDirectory && otherObject.GetJEVisClassName().Equals(GetJEVisClassName())); } } return(false); }
public JEVisClass GetJEVisClass() { if (IsLink()) { JEVisObject linkedObject = GetLinkedObject(); if (linkedObject != null) { return(linkedObject.GetJEVisClass()); } } return(this.ds.GetJEVisClass(this.json.GetJEVisClass())); }
public List <JEVisAttribute> GetAttributes() { if (IsLink()) { JEVisObject linkedObject = GetLinkedObject(); if (linkedObject != null) { return(this.ds.GetAttributes(linkedObject.SetId())); } } return(this.ds.GetAttributes(GetId())); }
public JEVisRelationship BuildRelationship(JEVisObject otherObj, int type, int direction) { JEVisRelationship rel; if (direction == JEVisConstants.Direction.FORWARD) { rel = this.ds.BuildRelationship(GetId(), otherObj.SetId(), type); if (type == JEVisConstants.ObjectRelationship.PARENT) { otherObj.NotifyListeners(new JEVisEvent(rel.GetEndObject(), JEVisEvent.TYPE.OBJECT_NEW_CHILD, rel.GetStartObject())); } } else { rel = otherObj.BuildRelationship(this, type, JEVisConstants.Direction.FORWARD); } return(rel); }
public int CompareTo(JEVisObject o) { return(GetId().CompareTo(o.SetId())); }