public static ActionDecision parseActionDecision(Node actionDecisionNode) throws PolicyException {
  ActionDecision actionDecision=null;
  Set nodeSet=XMLUtils.getChildNodes(actionDecisionNode,PolicyUtils.ATTRIBUTE_VALUE_PAIR);
  if ((nodeSet == null) || (nodeSet.isEmpty())) {
    debug.error("parseActionDecision: missing element " + PolicyUtils.ATTRIBUTE_VALUE_PAIR);
    return null;
  }
  Iterator nodes=nodeSet.iterator();
  Node node=(Node)nodes.next();
  String actionName=PolicyUtils.getAttributeName(node);
  Set actionValues=PolicyUtils.getAttributeValues(node);
  actionDecision=new ActionDecision(actionName,actionValues);
  long timeToLive=Long.MAX_VALUE;
  String ttlString=XMLUtils.getNodeAttributeValue(actionDecisionNode,ActionDecision.TIME_TO_LIVE);
  if (ttlString != null) {
    try {
      timeToLive=Long.parseLong(ttlString);
      if (timeToLive != Long.MAX_VALUE) {
        timeToLive+=clientClockSkew;
      }
    }
 catch (    Exception e) {
      debug.error("Error while parsing timeToLive in " + " ActionDecision:" + ttlString);
      Object[] args={new Long(timeToLive)};
      throw new PolicyException(ResBundleUtils.rbName,"invalid_time_to_live",args,e);
    }
  }
  actionDecision.setTimeToLive(timeToLive);
  Map advices=new HashMap();
  nodeSet=XMLUtils.getChildNodes(actionDecisionNode,ActionDecision.ADVICES);
  if (nodeSet != null) {
    nodes=nodeSet.iterator();
    node=(Node)nodes.next();
    nodeSet=XMLUtils.getChildNodes(node,PolicyUtils.ATTRIBUTE_VALUE_PAIR);
    if (nodeSet != null) {
      nodes=nodeSet.iterator();
      while (nodes.hasNext()) {
        node=(Node)nodes.next();
        String adviceName=PolicyUtils.getAttributeName(node);
        if (adviceName != null) {
          Set adviceMessages=PolicyUtils.getAttributeValues(node);
          advices.put(adviceName,adviceMessages);
        }
      }
    }
  }
  actionDecision.setAdvices(advices);
  return actionDecision;
}

public static ActionDecision parseActionDecision ( Node actionDecisionNode ) throws PolicyException { ActionDecision actionDecision = null ; Set nodeSet = XMLUtils . getChildNodes ( actionDecisionNode , PolicyUtils . ATTRIBUTE_VALUE_PAIR ) ; if ( ( nodeSet == null ) || ( nodeSet . isEmpty ( ) ) ) { debug . error ( "parseActionDecision: missing element " + PolicyUtils . ATTRIBUTE_VALUE_PAIR ) ; return null ; } Iterator nodes = nodeSet . iterator ( ) ; Node node = ( Node ) nodes . next ( ) ; String actionName = PolicyUtils . getAttributeName ( node ) ; Set actionValues = PolicyUtils . getAttributeValues ( node ) ; actionDecision = new ActionDecision ( actionName , actionValues ) ; long timeToLive = Long . MAX_VALUE ; String ttlString = XMLUtils . getNodeAttributeValue ( actionDecisionNode , ActionDecision . TIME_TO_LIVE ) ; if ( ttlString != null ) { try { timeToLive = Long . parseLong ( ttlString ) ; if ( timeToLive != Long . MAX_VALUE ) { timeToLive += clientClockSkew ; } } catch ( Exception e ) { debug . error ( "Error while parsing timeToLive in " + " ActionDecision:" + ttlString ) ; Object [ ] args = { new Long ( timeToLive ) } ; throw new PolicyException ( ResBundleUtils . rbName , "invalid_time_to_live" , args , e ) ; } } actionDecision . setTimeToLive ( timeToLive ) ; Map advices = new HashMap ( ) ; nodeSet = XMLUtils . getChildNodes ( actionDecisionNode , ActionDecision . ADVICES ) ; if ( nodeSet != null ) { nodes = nodeSet . iterator ( ) ; node = ( Node ) nodes . next ( ) ; nodeSet = XMLUtils . getChildNodes ( node , PolicyUtils . ATTRIBUTE_VALUE_PAIR ) ; if ( nodeSet != null ) { nodes = nodeSet . iterator ( ) ; while ( nodes . hasNext ( ) ) { node = ( Node ) nodes . next ( ) ; String adviceName = PolicyUtils . getAttributeName ( node ) ; if ( adviceName != null ) { Set adviceMessages = PolicyUtils . getAttributeValues ( node ) ; advices . put ( adviceName , adviceMessages ) ; } } } } actionDecision . setAdvices ( advices ) ; return actionDecision ; }
creates an actiondecisions object given a w3c dom node
