Exemplo n.º 1
0
 /**
  * Constructs an instance of <code>Attribute</code>.
  *
  * @param name A String representing <code>AttributeName</code> (the name of the attribute).
  * @param nameSpace A String representing the namespace in which <code>AttributeName</code>
  *     elements are interpreted.
  * @param values A List of DOM element representing the <code>AttributeValue</code> object.
  * @exception SAMLException if there is an error in the sender or in the element definition.
  */
 public Attribute(String name, String nameSpace, List values) throws SAMLException {
   super(name, nameSpace);
   if (values == null || values.isEmpty()) {
     if (SAMLUtilsCommon.debug.messageEnabled()) {
       SAMLUtilsCommon.debug.message("Attribute: AttributeValue is" + "required.");
     }
     throw new SAMLRequesterException(SAMLUtilsCommon.bundle.getString("nullInput"));
   }
   if (_attributeValue == null) {
     _attributeValue = new ArrayList();
   }
   // Make sure this is a list of AttributeValue
   Iterator iter = values.iterator();
   String tag = null;
   while (iter.hasNext()) {
     tag = ((Element) iter.next()).getLocalName();
     if ((tag == null) || (!tag.equals("AttributeValue"))) {
       if (SAMLUtilsCommon.debug.messageEnabled()) {
         SAMLUtilsCommon.debug.message("AttributeValue: wrong input.");
       }
       throw new SAMLRequesterException(SAMLUtilsCommon.bundle.getString("wrongInput"));
     }
   }
   _attributeValue = values;
 }
Exemplo n.º 2
0
 private NodeList getValueNodes(Node operation) {
   List<Node> valueNL = getChildNodes(operation, "value");
   if (valueNL.isEmpty()) {
     return null;
   }
   return valueNL.get(0).getChildNodes();
 }
Exemplo n.º 3
0
  public static Element[] filterChildElements(Element parent, String ns, String lname) {
    /*
    way too noisy
            if (LOGGER.isDebugEnabled()) {
                StringBuilder buf = new StringBuilder(100);
                buf.append("XmlaUtil.filterChildElements: ");
                buf.append(" ns=\"");
                buf.append(ns);
                buf.append("\", lname=\"");
                buf.append(lname);
                buf.append("\"");
                LOGGER.debug(buf.toString());
            }
    */

    List<Element> elems = new ArrayList<Element>();
    NodeList nlst = parent.getChildNodes();
    for (int i = 0, nlen = nlst.getLength(); i < nlen; i++) {
      Node n = nlst.item(i);
      if (n instanceof Element) {
        Element e = (Element) n;
        if ((ns == null || ns.equals(e.getNamespaceURI()))
            && (lname == null || lname.equals(e.getLocalName()))) {
          elems.add(e);
        }
      }
    }
    return elems.toArray(new Element[elems.size()]);
  }
  public ActionDescriptor getAction(int id) {
    // check global actions
    for (Iterator iterator = globalActions.iterator(); iterator.hasNext(); ) {
      ActionDescriptor actionDescriptor = (ActionDescriptor) iterator.next();

      if (actionDescriptor.getId() == id) {
        return actionDescriptor;
      }
    }

    // check steps
    for (Iterator iterator = steps.iterator(); iterator.hasNext(); ) {
      StepDescriptor stepDescriptor = (StepDescriptor) iterator.next();
      ActionDescriptor actionDescriptor = stepDescriptor.getAction(id);

      if (actionDescriptor != null) {
        return actionDescriptor;
      }
    }

    // check initial actions, which we now must have unique id's
    for (Iterator iterator = initialActions.iterator(); iterator.hasNext(); ) {
      ActionDescriptor actionDescriptor = (ActionDescriptor) iterator.next();

      if (actionDescriptor.getId() == id) {
        return actionDescriptor;
      }
    }

    return null;
  }
Exemplo n.º 5
0
  private Node[] processIndexNode(
      final Node theNode,
      final Document theTargetDocument,
      final IndexEntryFoundListener theIndexEntryFoundListener) {
    theNode.normalize();

    boolean ditastyle = false;
    String textNode = null;

    final NodeList childNodes = theNode.getChildNodes();
    final StringBuilder textBuf = new StringBuilder();
    final List<Node> contents = new ArrayList<Node>();
    for (int i = 0; i < childNodes.getLength(); i++) {
      final Node child = childNodes.item(i);
      if (checkElementName(child)) {
        ditastyle = true;
        break;
      } else if (child.getNodeType() == Node.ELEMENT_NODE) {
        textBuf.append(XMLUtils.getStringValue((Element) child));
        contents.add(child);
      } else if (child.getNodeType() == Node.TEXT_NODE) {
        textBuf.append(child.getNodeValue());
        contents.add(child);
      }
    }
    textNode = IndexStringProcessor.normalizeTextValue(textBuf.toString());
    if (textNode.length() == 0) {
      textNode = null;
    }

    if (theNode.getAttributes().getNamedItem(elIndexRangeStartName) != null
        || theNode.getAttributes().getNamedItem(elIndexRangeEndName) != null) {
      ditastyle = true;
    }

    final ArrayList<Node> res = new ArrayList<Node>();
    if ((ditastyle)) {
      final IndexEntry[] indexEntries = indexDitaProcessor.processIndexDitaNode(theNode, "");

      for (final IndexEntry indexEntrie : indexEntries) {
        theIndexEntryFoundListener.foundEntry(indexEntrie);
      }

      final Node[] nodes = transformToNodes(indexEntries, theTargetDocument, null);
      for (final Node node : nodes) {
        res.add(node);
      }

    } else if (textNode != null) {
      final Node[] nodes =
          processIndexString(textNode, contents, theTargetDocument, theIndexEntryFoundListener);
      for (final Node node : nodes) {
        res.add(node);
      }
    } else {
      return new Node[0];
    }

    return (Node[]) res.toArray(new Node[res.size()]);
  }
Exemplo n.º 6
0
  private LinkedHashMap[] obtenerMapeos(CliGol cliGol, NodeList variables, String[] excluye) {

    LinkedHashMap<String, Object> mapa = new LinkedHashMap<String, Object>();

    LinkedHashMap<String, String> puntos = new LinkedHashMap<String, String>();

    List<String> ex = Arrays.asList(excluye);

    for (int i = 0; i < variables.getLength(); i++) {

      String nom = variables.item(i).getNodeName();

      if (!ex.contains(nom)) {

        String golMapdijo = GolMap.xmlGol(nom);

        String val = null;
        if (golMapdijo != null) {
          val = buscaValEnCli(golMapdijo, cliGol);
          mapa.put(nom, val);

          puntos.put(nom, variables.item(i).getTextContent());
        }
      }
    }

    return new LinkedHashMap[] {mapa, puntos};
  }
Exemplo n.º 7
0
 public static List list(NodeList self) {
   List answer = new ArrayList();
   Iterator it = DefaultGroovyMethods.iterator(self);
   while (it.hasNext()) {
     answer.add(it.next());
   }
   return answer;
 }
Exemplo n.º 8
0
 public int getLength() {
   int length = 0;
   for (int i = 0; i < nodeLists.size(); i++) {
     NodeList nl = (NodeList) nodeLists.get(i);
     length += nl.getLength();
   }
   return length;
 }
Exemplo n.º 9
0
 private String getNameText(Element e) // whoops;
     {
   List<String> parts = new ArrayList<String>();
   for (Element w : XML.getElementsByTagname(e, "w", false)) {
     parts.add(w.getTextContent().trim());
   }
   return StringUtils.join(parts, " ");
 }
Exemplo n.º 10
0
  /**
   * @param sourceFile File to read from
   * @return List of String objects with the shas
   */
  public static FileRequestFileContent readRequestFile(final File sourceFile) {
    if (!sourceFile.isFile() || !(sourceFile.length() > 0)) {
      return null;
    }
    Document d = null;
    try {
      d = XMLTools.parseXmlFile(sourceFile.getPath());
    } catch (final Throwable t) {
      logger.log(Level.SEVERE, "Exception in readRequestFile, during XML parsing", t);
      return null;
    }

    if (d == null) {
      logger.log(Level.SEVERE, "Could'nt parse the request file");
      return null;
    }

    final Element rootNode = d.getDocumentElement();

    if (rootNode.getTagName().equals(TAG_FrostFileRequestFile) == false) {
      logger.severe(
          "Error: xml request file does not contain the root tag '"
              + TAG_FrostFileRequestFile
              + "'");
      return null;
    }

    final String timeStampStr = XMLTools.getChildElementsTextValue(rootNode, TAG_timestamp);
    if (timeStampStr == null) {
      logger.severe("Error: xml file does not contain the tag '" + TAG_timestamp + "'");
      return null;
    }
    final long timestamp = Long.parseLong(timeStampStr);

    final List<Element> nodelist = XMLTools.getChildElementsByTagName(rootNode, TAG_shaList);
    if (nodelist.size() != 1) {
      logger.severe("Error: xml request files must contain only one element '" + TAG_shaList + "'");
      return null;
    }

    final Element rootShaNode = nodelist.get(0);

    final List<String> shaList = new LinkedList<String>();
    final List<Element> xmlKeys = XMLTools.getChildElementsByTagName(rootShaNode, TAG_sha);
    for (final Element el : xmlKeys) {

      final Text txtname = (Text) el.getFirstChild();
      if (txtname == null) {
        continue;
      }

      final String sha = txtname.getData();
      shaList.add(sha);
    }

    final FileRequestFileContent content = new FileRequestFileContent(timestamp, shaList);
    return content;
  }
Exemplo n.º 11
0
 public static NodeList breadthFirst(Element self) {
   List result = new ArrayList();
   NodeList thisLevel = createNodeList(self);
   while (thisLevel.getLength() > 0) {
     result.add(thisLevel);
     thisLevel = getNextLevel(thisLevel);
   }
   return new NodeListsHolder(result);
 }
Exemplo n.º 12
0
 private static void addResult(List results, Object result) {
   if (result != null) {
     if (result instanceof Collection) {
       results.addAll((Collection) result);
     } else {
       results.add(result);
     }
   }
 }
Exemplo n.º 13
0
 private static NodeList getNextLevel(NodeList thisLevel) {
   List result = new ArrayList();
   for (int i = 0; i < thisLevel.getLength(); i++) {
     Node n = thisLevel.item(i);
     if (n instanceof Element) {
       result.add(getChildElements((Element) n, "*"));
     }
   }
   return new NodeListsHolder(result);
 }
Exemplo n.º 14
0
  private List<Node> getChildNodes(Node parentNode, String tagName) {
    List<Node> nodeList = new ArrayList<Node>();
    for (Node child = parentNode.getFirstChild(); child != null; child = child.getNextSibling()) {
      if (child.getNodeType() == Node.ELEMENT_NODE && tagName.equals(child.getNodeName())) {
        nodeList.add(child);
      }
    }

    return nodeList;
  }
Exemplo n.º 15
0
  @Override
  protected void fillVoiceXmlDocument(
      Document document, Element formElement, VoiceXmlDialogueContext dialogueContext)
      throws VoiceXmlDocumentRenderingException {

    List<String> submitNameList = new ArrayList<String>();
    VariableList submitVariableList = mSubmitParameters;
    if (submitVariableList != null) {
      addVariables(formElement, submitVariableList);

      for (Entry<String, String> entry : mSubmitParameters) {
        submitNameList.add(entry.getKey());
      }
    }

    Element subdialogueElement = DomUtils.appendNewElement(formElement, SUBDIALOG_ELEMENT);
    subdialogueElement.setAttribute(NAME_ATTRIBUTE, SUBDIALOGUE_FORM_ITEM_NAME);
    subdialogueElement.setAttribute(SRC_ATTRIBUTE, mUri);

    if (!submitNameList.isEmpty()) {
      subdialogueElement.setAttribute(NAME_LIST_ATTRIBUTE, StringUtils.join(submitNameList, " "));
    }

    for (Parameter parameter : mParameters) {
      Element paramElement = DomUtils.appendNewElement(subdialogueElement, PARAM_ELEMENT);
      paramElement.setAttribute(NAME_ATTRIBUTE, parameter.getName());
      setAttribute(paramElement, VALUE_ATTRIBUTE, parameter.getValue());
      setAttribute(paramElement, EXPR_ATTRIBUTE, parameter.getExpression());
    }

    SubmitMethod submitMethod = mMethod;
    if (submitMethod != null) {
      subdialogueElement.setAttribute(METHOD_ATTRIBUTE, submitMethod.name());
    }

    DocumentFetchConfiguration fetchConfiguration = mFetchConfiguration;
    if (fetchConfiguration != null) {
      applyFetchAudio(subdialogueElement, fetchConfiguration.getFetchAudio());
      applyRessourceFetchConfiguration(subdialogueElement, fetchConfiguration);
    }

    Element filledElement = DomUtils.appendNewElement(subdialogueElement, FILLED_ELEMENT);

    createVarElement(
        filledElement, SUBDIALOGUE_RESULT_VARIABLE_NAME, "dialog." + SUBDIALOGUE_FORM_ITEM_NAME);

    if (mPostDialogueScript != null) {
      createScript(filledElement, mPostDialogueScript);
    }

    createScript(
        filledElement,
        RIVR_SCOPE_OBJECT + ".addValueResult(" + SUBDIALOGUE_RESULT_VARIABLE_NAME + ");");
    createGotoSubmit(filledElement);
  }
Exemplo n.º 16
0
 public Node item(int index) {
   int relativeIndex = index;
   for (int i = 0; i < nodeLists.size(); i++) {
     NodeList nl = (NodeList) nodeLists.get(i);
     if (relativeIndex < nl.getLength()) {
       return nl.item(relativeIndex);
     }
     relativeIndex -= nl.getLength();
   }
   return null;
 }
Exemplo n.º 17
0
  public static void echo(List annotationAttrs) {
    if (annotationAttrs.size() > 0) {
      for (int i = 0; i < annotationAttrs.size(); i++) {
        String[] annotationAttr = (String[]) annotationAttrs.get(i);

        System.out.println(annotationAttr[0]);
        System.out.println(annotationAttr[1]);
        System.out.println(annotationAttr[2]);
      }
    }
  }
Exemplo n.º 18
0
  public static byte[] convertToJSON(
      IExtensionHelpers helpers, IHttpRequestResponse requestResponse) {

    byte[] request = requestResponse.getRequest();

    if (Objects.equals(helpers.analyzeRequest(request).getMethod(), "GET")) {
      request = helpers.toggleRequestMethod(request);
    }

    IRequestInfo requestInfo = helpers.analyzeRequest(request);

    int bodyOffset = requestInfo.getBodyOffset();

    byte content_type = requestInfo.getContentType();

    String body = new String(request, bodyOffset, request.length - bodyOffset);

    String json = "";

    Boolean success = true;

    try {
      if (content_type == 3) {
        JSONObject xmlJSONObject = XML.toJSONObject(body);
        json = xmlJSONObject.toString(2);
      } else if (content_type == 0 || content_type == 1) {
        Map<String, String> params = splitQuery(body);
        Gson gson = new Gson();
        json = gson.toJson(params);
      } else {
        json = body;
      }
    } catch (Exception e) {
      success = false;
    }

    if (!success) {
      return request;
    } else {

      List<String> headers;

      headers = helpers.analyzeRequest(request).getHeaders();

      Iterator<String> iter = headers.iterator();
      while (iter.hasNext()) {
        if (iter.next().contains("Content-Type")) iter.remove();
      }

      headers.add("Content-Type: application/json;charset=UTF-8");

      return helpers.buildHttpMessage(headers, json.getBytes());
    }
  }
Exemplo n.º 19
0
  public List parsePage(String pageCode) {
    List sections = new ArrayList();
    List folders = new ArrayList();
    List files = new ArrayList();
    int start = pageCode.indexOf("<div id=\"list-view\" class=\"view\"");
    int end = pageCode.indexOf("<div id=\"gallery-view\" class=\"view\"");
    String usefulSection = "";
    if (start != -1 && end != -1) {
      usefulSection = pageCode.substring(start, end);
    } else {
      debug("Could not parse page");
    }
    try {
      DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
      InputSource is = new InputSource();
      is.setCharacterStream(new StringReader(usefulSection));
      Document doc = db.parse(is);

      NodeList divs = doc.getElementsByTagName("div");
      for (int i = 0; i < divs.getLength(); i++) {
        Element div = (Element) divs.item(i);
        boolean isFolder = false;
        if (div.getAttribute("class").equals("filename")) {
          NodeList imgs = div.getElementsByTagName("img");
          for (int j = 0; j < imgs.getLength(); j++) {
            Element img = (Element) imgs.item(j);
            if (img.getAttribute("class").indexOf("folder") > 0) {
              isFolder = true;
            } else {
              isFolder = false; // it's a file
            }
          }

          NodeList anchors = div.getElementsByTagName("a");
          Element anchor = (Element) anchors.item(0);
          String attr = anchor.getAttribute("href");
          String fileName = anchor.getAttribute("title");
          String fileURL;
          if (isFolder && !attr.equals("#")) {
            folders.add(attr);
            folders.add(fileName);
          } else if (!isFolder && !attr.equals("#")) {
            // Dropbox uses ajax to get the file for download, so the url isn't enough. We must be
            // sneaky here.
            fileURL = "https://dl.dropbox.com" + attr.substring(23) + "?dl=1";
            files.add(fileURL);
            files.add(fileName);
          }
        }
      }
    } catch (Exception e) {
      debug(e.toString());
    }

    sections.add(files);
    sections.add(folders);

    return sections;
  }
Exemplo n.º 20
0
 protected List<BudgetLineItem> findSubAwardLineItems(
     BudgetPeriod budgetPeriod, Integer subAwardNumber) {
   List<BudgetLineItem> lineItems = new ArrayList<BudgetLineItem>();
   if (budgetPeriod.getBudgetLineItems() != null) {
     for (BudgetLineItem item : budgetPeriod.getBudgetLineItems()) {
       if (ObjectUtils.equals(item.getSubAwardNumber(), subAwardNumber)) {
         lineItems.add(item);
       }
     }
   }
   return lineItems;
 }
  /**
   * readUsers
   *
   * @return List
   */
  public List<User> readUsers() {
    List<User> list = new ArrayList<User>();
    Element element;
    User user;
    NodeList users = OrganizationElementFactory.getListUsers(this.getUsersElement());

    for (int i = 0; i < users.getLength(); i++) {
      element = (Element) users.item(i);
      user = factory.elementToUser(element);
      list.add(user);
    }
    return list;
  }
Exemplo n.º 22
0
 @Test
 public void testElementsByTagNameWithoutNamespace() throws Exception {
   String xml =
       "<?xml version=\"1.0\"?><html><head><title>TITLE</title></head><body><p>Good morning</p><p>How are you?</p></body></html>";
   DocumentBuilder builder = builderFactory.newDocumentBuilder();
   Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes("UTF-8")));
   NodeList plist = doc.getElementsByTagName("p");
   List<String> pTexts = new ArrayList<String>();
   for (int i = 0; i < plist.getLength(); i++) {
     pTexts.add(plist.item(i).getFirstChild().getTextContent());
   }
   Assert.assertEquals(pTexts, Arrays.asList("Good morning", "How are you?"));
 }
  public List<Language> readLangauges() {
    List<Language> list = new ArrayList<Language>();
    Element element;
    Language lang;

    NodeList languages = factory.getListLanguages(this.getLanguagesElement());
    for (int i = 0; i < languages.getLength(); i++) {
      element = (Element) languages.item(i);
      lang = factory.elementToLanguage(element);
      list.add(lang);
    }
    return list;
  }
  /**
   * readRoles
   *
   * @return List
   */
  public List<Role> readRoles() {
    List<Role> list = new ArrayList<Role>();
    Element element;
    Role role;
    NodeList roles = OrganizationElementFactory.getListRoles(this.getRolesElement());

    for (int i = 0; i < roles.getLength(); i++) {
      element = (Element) roles.item(i);
      role = factory.elementToRole(element);
      list.add(role);
    }
    return list;
  }
  /**
   * readAssignedRoles
   *
   * @param anUser User
   * @return List
   */
  public List<Role> readAssignedRoles(User anUser) {
    List<Role> list = new ArrayList<Role>();
    Element userElement = this.getUserElement(anUser);
    Element element;
    Role role;
    NodeList roles = OrganizationElementFactory.getListRoles(userElement);

    for (int i = 0; i < roles.getLength(); i++) {
      element = (Element) roles.item(i);
      role = new Role(factory.elementToBase(element).getId());
      list.add(role);
    }
    return list;
  }
Exemplo n.º 26
0
  /**
   * Returns a String representation of the <code>&lt;saml:Attribute&gt;</code> element.
   *
   * @param includeNS Determines whether or not the namespace qualifier is prepended to the Element
   *     when converted
   * @param declareNS Determines whether or not the namespace is declared within the Element.
   * @return A string containing the valid XML for this element
   */
  public String toString(boolean includeNS, boolean declareNS) {
    StringBuffer result = new StringBuffer(1000);
    String prefix = "";
    String uri = "";
    if (includeNS) {
      prefix = SAMLConstants.ASSERTION_PREFIX;
    }
    if (declareNS) {
      uri = SAMLConstants.assertionDeclareStr;
    }
    result
        .append("<")
        .append(prefix)
        .append("Attribute")
        .append(uri)
        .append(" AttributeName=\"")
        .append(_attributeName)
        .append("\" AttributeNamespace=\"")
        .append(_attributeNameSpace)
        .append("\">\n");

    Iterator iter = _attributeValue.iterator();
    while (iter.hasNext()) {
      result.append(XMLUtils.printAttributeValue((Element) iter.next(), prefix)).append("\n");
    }
    result.append("</").append(prefix).append("Attribute>\n");
    return result.toString();
  }
Exemplo n.º 27
0
  /**
   * Adds <code>AttributeValue</code> to the Attribute.
   *
   * @param element An Element object representing <code>AttributeValue</code>.
   * @exception SAMLException
   */
  public void addAttributeValue(Element element) throws SAMLException {
    if (element == null) {
      if (SAMLUtilsCommon.debug.messageEnabled()) {
        SAMLUtilsCommon.debug.message("addAttributeValue: input  is null.");
      }
      throw new SAMLRequesterException(SAMLUtilsCommon.bundle.getString("nullInput"));
    }

    String tag = element.getLocalName();
    if ((tag == null) || (!tag.equals("AttributeValue"))) {
      if (SAMLUtilsCommon.debug.messageEnabled()) {
        SAMLUtilsCommon.debug.message("AttributeValue: wrong input.");
      }
      throw new SAMLRequesterException(SAMLUtilsCommon.bundle.getString("wrongInput"));
    }
    try {
      if (_attributeValue == null) {
        _attributeValue = new ArrayList();
      }
      if (!(_attributeValue.add(element))) {
        if (SAMLUtilsCommon.debug.messageEnabled()) {
          SAMLUtilsCommon.debug.message(
              "Attribute: failed to " + "add to the attribute value list.");
        }
        throw new SAMLRequesterException(SAMLUtilsCommon.bundle.getString("addListError"));
      }
    } catch (Exception e) {
      SAMLUtilsCommon.debug.error("addAttributeValue error", e);
      throw new SAMLRequesterException("Exception in addAttributeValue" + e.getMessage());
    }
  }
Exemplo n.º 28
0
 /**
  * Adds <code>AttributeValue</code> to the Attribute.
  *
  * @param value A String representing <code>AttributeValue</code>.
  * @exception SAMLException
  */
 public void addAttributeValue(String value) throws SAMLException {
   if (value == null || value.length() == 0) {
     if (SAMLUtilsCommon.debug.messageEnabled()) {
       SAMLUtilsCommon.debug.message("addAttributeValue: Input is null");
     }
     throw new SAMLRequesterException(SAMLUtilsCommon.bundle.getString("nullInput"));
   }
   StringBuffer sb = new StringBuffer(300);
   sb.append("<")
       .append(SAMLConstants.ASSERTION_PREFIX)
       .append("AttributeValue")
       .append(SAMLConstants.assertionDeclareStr)
       .append(">")
       .append(value)
       .append("</")
       .append(SAMLConstants.ASSERTION_PREFIX)
       .append("AttributeValue>");
   try {
     Element ele =
         XMLUtils.toDOMDocument(sb.toString().trim(), SAMLUtilsCommon.debug).getDocumentElement();
     if (_attributeValue == null) {
       _attributeValue = new ArrayList();
     }
     if (!(_attributeValue.add(ele))) {
       if (SAMLUtilsCommon.debug.messageEnabled()) {
         SAMLUtilsCommon.debug.message(
             "Attribute: failed to " + "add to the attribute value list.");
       }
       throw new SAMLRequesterException(SAMLUtilsCommon.bundle.getString("addListError"));
     }
   } catch (Exception e) {
     SAMLUtilsCommon.debug.error("addAttributeValue error", e);
     throw new SAMLRequesterException("Exception in addAttributeValue" + e.getMessage());
   }
 }
  /**
   * Add a step
   *
   * @param descriptor The step descriptor to add
   * @throws IllegalArgumentException if the descriptor's ID already exists in the workflow
   */
  public void addStep(StepDescriptor descriptor) {
    if (getStep(descriptor.getId()) != null) {
      throw new IllegalArgumentException("Step with id " + descriptor.getId() + " already exists");
    }

    steps.add(descriptor);
  }
Exemplo n.º 30
0
  /** @deprecated use immediateChildrenByTagName( Element parent, String tagName ) */
  public static NodeList getImmediateChildElementsByTagName(Element parent, String tagName)
      throws DOMException {
    final List nodes = new ArrayList();
    for (Node child = parent.getFirstChild(); child != null; child = child.getNextSibling())
      if (child instanceof Element && ((Element) child).getTagName().equals(tagName))
        nodes.add(child);
    return new NodeList() {
      public int getLength() {
        return nodes.size();
      }

      public Node item(int i) {
        return (Node) nodes.get(i);
      }
    };
  }