[8780cbec] | 1 | package com.nailabs.abac.process; |
---|
| 2 | |
---|
| 3 | import com.nailabs.abac.trust.*; |
---|
| 4 | import edu.stanford.peer.rbtm.credential.*; |
---|
| 5 | import java.util.*; |
---|
| 6 | |
---|
| 7 | /** |
---|
| 8 | * A control edge represents an edge in a trust target graph (<CODE>TTG</CODE>) |
---|
| 9 | * with the required roles to support this edge. |
---|
| 10 | */ |
---|
| 11 | public class ControlEdge extends EdgeOperation { |
---|
| 12 | /** Jared: Added this method to make XML processing easier */ |
---|
| 13 | public ControlEdge() { |
---|
| 14 | super(); |
---|
| 15 | type = "Control"; |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | public ControlEdge(Goal parent, Goal child, ProcessingState state) { |
---|
| 19 | super(parent, child, state, null); |
---|
| 20 | type = "Control"; |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | public void performAdditional(TTG graph) { |
---|
| 24 | SimpleTTNode parent = (SimpleTTNode)graph.getNodeByHash(getParent()); |
---|
| 25 | TargetNode child = (TargetNode)graph.getNodeByHash(getChild()); |
---|
| 26 | |
---|
| 27 | parent.addControlChild(child); |
---|
| 28 | child.addControlParent(parent); |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | public void performNewAdditional(TTG graph) { |
---|
| 32 | TargetNode child = (TargetNode)graph.getNodeByHash(getChild()); |
---|
| 33 | if(child == null) { |
---|
| 34 | child = (TargetNode)TTGNode.createNode(getChild()); |
---|
| 35 | child.getProcessingState().update(state); |
---|
| 36 | graph.putNodeByHash(child); |
---|
| 37 | } |
---|
| 38 | performAdditional(graph); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | public String toString() { |
---|
| 42 | StringBuffer buff = new StringBuffer("[ControlEdge "); |
---|
| 43 | buff.append(getParent()).append(" <<=== "); |
---|
| 44 | buff.append(getChild()).append(", state = "); |
---|
| 45 | buff.append(state).append("]"); |
---|
| 46 | return buff.toString(); |
---|
| 47 | } |
---|
| 48 | } |
---|