@ SuppressWarnings ( "rawtypes" ) private void setEffectNode ( AbstractNode midd , ExternalNode3 extNode ) throws MIDDException { // Replace current external nodes in the MIDD with the extNode (XACML 3 external node) if ( ! ( midd instanceof InternalNode ) ) { throw new IllegalArgumentException ( "MIDD argument must not be an ExternalNode" ) ; } InternalNode currentNode = ( InternalNode ) midd ; Stack < InternalNode > stackNodes = new Stack < InternalNode > ( ) ; stackNodes . push ( currentNode ) ; while ( ! stackNodes . empty ( ) ) { InternalNode n = stackNodes . pop ( ) ; // Change indeterminate state of the internal node, // - By default is NotApplicable (XACML 3.0, sec 7.3.5, 7.19.3) // - If the attribute "MustBePresent" is true, then state is "Indeterminate_P" if Effect is "Permit", // "Indeterminate_D" if Effect is "Deny" - XACML 3.0, section 7.11 if ( n . getStateIN ( ) == DecisionType . Indeterminate ) { // this attribute has 'MustBePresent'=true if ( ruleEffect == DecisionType . Deny ) { n . setState ( new InternalNodeState ( nl . uva . sne . midd . DecisionType . Indeterminate_D ) ) ; } else if ( ruleEffect == DecisionType . Permit ) { n . setState ( new InternalNodeState ( nl . uva . sne . midd . DecisionType . Indeterminate_P ) ) ; } } // else { // n.setState(new InternalNodeState(nl.uva.sne.midd.DecisionType.NotApplicable)); // } // search for all children of the poped internal node @ SuppressWarnings ( "unchecked" ) Iterator < AbstractEdge > it = n . getEdges ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { AbstractEdge edge = it . next ( ) ; AbstractNode child = edge . getSubDiagram ( ) ; if ( child instanceof InternalNode ) { stackNodes . push ( ( InternalNode ) child ) ; } else { edge . setSubDiagram ( extNode ) ; // set the final edge pointing to the xacml3 external node. } } } }
Set indicated external - xacml3 node to be the leaves of the MIDD