/** * Removes an assignment relationship of a LinkContract from an assignee node * * @param assignee The context node who will not longer have access to this LinkContract * @return NONE */ public boolean removeAssignee(ContextNode assignee) { boolean status = false; if (assignee == null) { // TBD // write error in debug log return status; } Iterator<Relation> allRelations = contextNode.getRelations(); Relation r = null; for (; allRelations.hasNext(); ) { r = allRelations.next(); ContextNode target = r.follow(); if (target.equals(assignee)) { // write debug log with information about the relation XRI that // is removed // TBD status = true; break; } } if (status) { contextNode.deleteRelation(XDILinkContractConstants.XRI_S_IS_DO, r.getTargetContextNodeXri()); } return status; }
public boolean removePermission(XDILinkContractPermission permission, ContextNode targetNode) { boolean status = false; XRI3Segment perm = null; switch (permission) { case LC_OP_GET: perm = XDILinkContractConstants.XRI_S_GET; break; case LC_OP_ADD: perm = XDILinkContractConstants.XRI_S_ADD; break; case LC_OP_MOD: perm = XDILinkContractConstants.XRI_S_MOD; break; case LC_OP_DEL: perm = XDILinkContractConstants.XRI_S_DEL; break; case LC_OP_ALL: perm = XDILinkContractConstants.XRI_S_ALL; break; default: // TBD // debug log break; } if (null == perm) { return status; } Iterator<Relation> allRelations = contextNode.getRelations(); Relation r = null; for (; allRelations.hasNext(); ) { r = allRelations.next(); if (r.getArcXri().equals(perm)) { ContextNode nodeWithPermission = r.follow(); if (nodeWithPermission.equals(targetNode)) { status = true; break; } } } if (status) { contextNode.deleteRelation(r.getArcXri(), r.getTargetContextNodeXri()); } return status; }