org.dom4j.tree.DefaultElement Java Examples

The following examples show how to use org.dom4j.tree.DefaultElement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CPManifest.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
*/
  @Override
  public DefaultElement getElementByIdentifier(final String id) {
      if (id.equals(identifier)) {
          return this;
      }
      if (id.equals(CPCore.ORGANIZATIONS)) {
          return organizations;
      }

      DefaultElement e = organizations.getElementByIdentifier(id);
      if (e != null) {
          return e;
      }
      e = resources.getElementByIdentifier(id);

      if (e == null) {
          log.info("Element with id \"" + id + "\" not found in manifest!");
      }
      return e;
  }
 
Example #2
Source File: CPManifest.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
 * @param doc
 */
public void buildDocument(final DefaultDocument doc) {
    // Manifest is the root-node of the document, therefore we need to pass the
    // "doc"
    final DefaultElement manifestElement = new DefaultElement(CPCore.MANIFEST);

    manifestElement.add(new DefaultAttribute(CPCore.IDENTIFIER, this.identifier));
    manifestElement.add(new DefaultAttribute(CPCore.SCHEMALOCATION, this.schemaLocation));
    // manifestElement.setNamespace(this.getNamespace()); //FIXME: namespace

    doc.add(manifestElement);

    if (metadata != null) {
        metadata.buildDocument(manifestElement);
    }
    organizations.buildDocument(manifestElement);
    resources.buildDocument(manifestElement);

}
 
Example #3
Source File: CPCore.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
 * duplicates an element and inserts it after targetID
 * 
 * @param sourceID
 * @param targetID
 */
public String copyElement(final String sourceID, final String targetID) {
    final DefaultElement elementToCopy = rootNode.getElementByIdentifier(sourceID);
    if (elementToCopy == null) {
        throw new OLATRuntimeException(CPOrganizations.class, "element with identifier \"" + sourceID + "\" not found..!", new Exception());
    }

    if (elementToCopy instanceof CPItem) {
        final CPItem newItem = (CPItem) elementToCopy.clone();
        cloneResourceOfItemAndSubitems(newItem);
        addElementAfter(newItem, targetID);
        return newItem.getIdentifier();
    } else {
        // if (elementToCopy.getClass().equals(CPOrganization.class)) {
        // not yet supported
        throw new OLATRuntimeException(CPOrganizations.class, "You can only copy <item>-elements...!", new Exception());
    }

}
 
Example #4
Source File: DataMaster.java    From mts with GNU General Public License v3.0 6 votes vote down vote up
private void preparse(Runner runner) throws Exception {
    List<Element> elementsParameter = (List<Element>) root.elements("parameter");
    for (Element element : elementsParameter) {
        OperationParameter operationParameter = new OperationParameter(element);
        operationParameter.executeAndStat(runner);
    }


    List<Element> elementsTest = (List<Element>) root.elements("test");
    for (Element test : elementsTest) {
        XMLTree xmlTree;
        xmlTree = new XMLTree(test);
        xmlTree.compute(Parameter.EXPRESSION, false);
        xmlTree.replace(XMLElementDefaultParser.instance(), runner.getParameterPool());
        DefaultElementInterface.insertNode((DefaultElement) test.getParent(), test, xmlTree.getTreeRoot());
        root.remove(test);
    }
}
 
Example #5
Source File: XMLTree.java    From mts with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Restore this XMLTree to his original state
 */
public void restore() {
    for (int i = elementsOrder.size() - 1; i >= 0; i--) {
        Element e = elementsOrder.get(i);
        List<Element> list = elementsMap.get(e);
        if (null != list && !list.isEmpty()) {
            // all Elements in this list should have the same parent
            Element parent = list.get(0).getParent();
            if (null != parent) {
                DefaultElementInterface.insertNode((DefaultElement) parent, list.get(0), e);
                for (Node oldChild : list) {
                    parent.remove(oldChild);
                }

                if (1 == list.size() && e == root) {
                    root = elementsOrder.get(0);
                }

            } else {
                root = elementsOrder.get(0);
            }
        }
    }
}
 
Example #6
Source File: CPTreeController.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
 * Builds an html-info string about the current page and its linked resources
 * 
 * @return HTML-String
 */
private String getCurrentPageInfoStringHTML() {
    // test if currentPage links to resource, which is used (linked) somewhere
    // else in the manifest
    final CPManager cpMgm = (CPManager) CoreSpringFactory.getBean(CPManager.class);
    final DefaultElement ele = cpMgm.getElementByIdentifier(cp, currentPage.getIdRef());
    boolean single = false;
    if (ele instanceof CPResource) {
        final CPResource res = (CPResource) ele;
        single = cpMgm.isSingleUsedResource(res, cp);
    }

    final StringBuilder b = new StringBuilder();
    b.append("<br /><ul>");
    b.append("<li><b>" + translate("cptreecontroller.pagetitle") + "</b> " + currentPage.getTitle() + "</li>");
    if (single) {
        b.append("<li><b>" + translate("cptreecontroller.file") + "</b> " + currentPage.getFileName() + "</li>");
    }
    b.append("</ul>");
    return b.toString();

}
 
Example #7
Source File: CPOrganization.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
*/
  @Override
  public void buildChildren() {
      final Iterator<DefaultElement> children = this.elementIterator();
      // iterate through children
      while (children.hasNext()) {
          final DefaultElement child = children.next();
          if (child.getName().equals(CPCore.ITEM)) {
              final CPItem item = new CPItem(child, this);
              item.setParentElement(this);
              item.buildChildren();
              item.setPosition(items.size());
              items.add(item);
          } else if (child.getName().equals(CPCore.TITLE)) {
              title = child.getText();
          } else if (child.getName().equals(CPCore.METADATA)) {
              metadata = new CPMetadata(child);
              metadata.setParentElement(this);
          } else {
              errors.add("Invalid IMS-Manifest ( unallowed element under <organization> )");
          }
      }

      this.clearContent();
      validateElement();
  }
 
Example #8
Source File: CPOrganization.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
*/
  @Override
  public void buildDocument(final DefaultElement parent) {

      final DefaultElement orgaElement = new DefaultElement(CPCore.ORGANIZATION);

      orgaElement.addAttribute(CPCore.IDENTIFIER, identifier);
      orgaElement.addAttribute(CPCore.STRUCTURE, structure);

      final DefaultElement titleElement = new DefaultElement(CPCore.TITLE);
      titleElement.setText(title);
      orgaElement.add(titleElement);

      if (metadata != null) {
          metadata.buildDocument(orgaElement);
      }
      for (final Iterator<CPItem> itItem = items.iterator(); itItem.hasNext();) {
          final CPItem item = itItem.next();
          item.buildDocument(orgaElement);
      }
      parent.add(orgaElement);

  }
 
Example #9
Source File: CPTreeController.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
 * Builds an html-info string about the current page and its linked resources. <br>
 * The untrusted text is already html escaped.
 * 
 * @return HTML-String
 */
private String getCurrentPageInfoStringHTML() {
    // test if currentPage links to resource, which is used (linked) somewhere
    // else in the manifest
    final CPManager cpMgm = (CPManager) CoreSpringFactory.getBean(CPManager.class);
    final DefaultElement ele = cpMgm.getElementByIdentifier(cp, currentPage.getIdRef());
    boolean single = false;
    if (ele instanceof CPResource) {
        final CPResource res = (CPResource) ele;
        single = cpMgm.isSingleUsedResource(res, cp);
    }

    final StringBuilder b = new StringBuilder();
    b.append("<br /><ul>");
    b.append("<li><b>" + translate("cptreecontroller.pagetitle") + "</b> " + StringHelper.escapeHtml(currentPage.getTitle()) + "</li>");
    if (single) {
        b.append("<li><b>" + translate("cptreecontroller.file") + "</b> " + StringHelper.escapeHtml(currentPage.getFileName()) + "</li>");
    }
    b.append("</ul>");
    return b.toString();

}
 
Example #10
Source File: CPManifest.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
*/
  @Override
  public DefaultElement getElementByIdentifier(final String id) {
      if (id.equals(identifier)) {
          return this;
      }
      if (id.equals(CPCore.ORGANIZATIONS)) {
          return organizations;
      }

      DefaultElement e = organizations.getElementByIdentifier(id);
      if (e != null) {
          return e;
      }
      e = resources.getElementByIdentifier(id);

      if (e == null) {
          log.info("Element with id \"" + id + "\" not found in manifest!");
      }
      return e;
  }
 
Example #11
Source File: CPCore.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
 * adds an element to the CP. Only accepts <resource> and <organization> elements
 * 
 * @param newElement
 * @return
 */
public void addElement(final DefaultElement newElement) {

    if (newElement instanceof CPResource) {
        rootNode.getResources().addResource((CPResource) newElement);
    } else if (newElement instanceof CPOrganization) {
        rootNode.getOrganizations().addOrganization((CPOrganization) newElement);
    } else if (newElement instanceof CPItem) {
        if (rootNode.getOrganizations().getOrganizations().size() > 0) {
            rootNode.getOrganizations().getOrganizations().elementAt(0).addItem((CPItem) newElement);
        }
    } else {
        throw new OLATRuntimeException(CPOrganizations.class, "invalid newElement for adding to manifest", new Exception());
    }

}
 
Example #12
Source File: XmppControllerImplTest.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Tests adding, removing IQ listeners and handling IQ stanzas.
 */
@Test
public void handlePackets() {
    // IQ packets
    IQ iq = new IQ();
    Element element = new DefaultElement("pubsub", Namespace.get(testNamespace));
    iq.setChildElement(element);
    agent.processUpstreamEvent(jid1, iq);
    assertThat(testXmppIqListener.handledIqs, hasSize(1));
    agent.processUpstreamEvent(jid2, iq);
    assertThat(testXmppIqListener.handledIqs, hasSize(2));
    // Message packets
    Packet message = new Message();
    agent.processUpstreamEvent(jid1, message);
    assertThat(testXmppMessageListener.handledMessages, hasSize(1));
    agent.processUpstreamEvent(jid2, message);
    assertThat(testXmppMessageListener.handledMessages, hasSize(2));
    Packet presence = new Presence();
    agent.processUpstreamEvent(jid1, presence);
    assertThat(testXmppPresenceListener.handledPresenceStanzas, hasSize(1));
    agent.processUpstreamEvent(jid2, presence);
    assertThat(testXmppPresenceListener.handledPresenceStanzas, hasSize(2));
}
 
Example #13
Source File: CPItem.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
*/
  @Override
  public void buildChildren() {
      final Iterator<DefaultElement> children = this.elementIterator();
      // iterate through children
      while (children.hasNext()) {
          final DefaultElement child = children.next();
          if (child.getName().equals(CPCore.ITEM)) {
              final CPItem item = new CPItem(child, this);
              item.buildChildren();
              item.setPosition(items.size());
              item.setParentElement(this);
              items.add(item);
          } else if (child.getName().equals(CPCore.TITLE)) {
              title = child.getText();
          } else if (child.getName().equals(CPCore.METADATA)) {
              // TODO: implement LOM METADATA
              metadata = new CPMetadata(child);
              metadata.setParentElement(this);
          }
      }
      this.clearContent();
      validateElement();
  }
 
Example #14
Source File: CPManifest.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
 * @param doc
 */
public void buildDocument(final DefaultDocument doc) {
    // Manifest is the root-node of the document, therefore we need to pass the
    // "doc"
    final DefaultElement manifestElement = new DefaultElement(CPCore.MANIFEST);

    manifestElement.add(new DefaultAttribute(CPCore.IDENTIFIER, this.identifier));
    manifestElement.add(new DefaultAttribute(CPCore.SCHEMALOCATION, this.schemaLocation));
    // manifestElement.setNamespace(this.getNamespace()); //FIXME: namespace

    doc.add(manifestElement);

    if (metadata != null) {
        metadata.buildDocument(manifestElement);
    }
    organizations.buildDocument(manifestElement);
    resources.buildDocument(manifestElement);

}
 
Example #15
Source File: CPCore.java    From olat with Apache License 2.0 5 votes vote down vote up
/**
 * removes an element with identifier "identifier" from the manifest
 * 
 * @param identifier
 *            the identifier if the element to remove
 * @param booleanFlag
 *            indicates whether to remove linked resources as well...! (needed for moving elements)
 */
public void removeElement(final String identifier, final boolean resourceFlag) {

    final DefaultElement el = rootNode.getElementByIdentifier(identifier);
    if (el != null) {
        if (el instanceof CPItem) {
            // element is CPItem
            final CPItem item = (CPItem) el;

            // first remove resources
            if (resourceFlag) {
                // Delete children (depth first search)
                removeChildElements(item, resourceFlag);

                // remove referenced resource
                final CPResource res = (CPResource) rootNode.getElementByIdentifier(item.getIdentifierRef());
                if (res != null && referencesCount(res) == 1) {
                    res.removeFromManifest();
                }
            }
            // then remove item
            item.removeFromManifest();

        } else if (el instanceof CPOrganization) {
            // element is organization
            final CPOrganization org = (CPOrganization) el;
            org.removeFromManifest(resourceFlag);
        } else if (el instanceof CPMetadata) {
            // element is <metadata>
            final CPMetadata md = (CPMetadata) el;
            md.removeFromManifest();
        }
    } else {
        throw new OLATRuntimeException(CPOrganizations.class, "couldn't remove element with id \"" + identifier + "\"! Element not found in manifest ",
                new Exception());

    }
}
 
Example #16
Source File: CPCore.java    From olat with Apache License 2.0 5 votes vote down vote up
/**
 * Searches for <item>-elements or <dependency>-elements which references to the resource with id "resourceIdentifier" if an element is found, search is aborted and
 * the found element is returned
 * 
 * @param resourceIdentifier
 * @return the found element or null
 */
public DefaultElement findReferencesToResource(final String resourceIdentifier) {

    // search for <item identifierref="resourceIdentifier" >
    for (final Iterator<CPOrganization> it = rootNode.getOrganizations().getOrganizationIterator(); it.hasNext();) {
        final CPOrganization org = it.next();
        for (final Iterator<CPItem> itO = org.getItems().iterator(); itO.hasNext();) {
            final CPItem item = itO.next();
            final CPItem found = _findReferencesToRes(item, resourceIdentifier);
            if (found != null) {
                return found;
            }
        }
    }

    // search for <dependency identifierref="resourceIdentifier" >
    for (final Iterator<CPResource> itRes = rootNode.getResources().getResourceIterator(); itRes.hasNext();) {
        final CPResource res = itRes.next();
        for (final Iterator<CPDependency> itDep = res.getDependencyIterator(); itDep.hasNext();) {
            final CPDependency dep = itDep.next();
            if (dep.getIdentifierRef().equals(resourceIdentifier)) {
                return dep;
            }
        }
    }

    return null;
}
 
Example #17
Source File: CPResources.java    From olat with Apache License 2.0 5 votes vote down vote up
/**
 * this constructor i used when building up the cp (parsing XML manifest)
 * 
 * @param me
 */
public CPResources(final DefaultElement me) {
    super(me.getName());
    resources = new Vector<CPResource>();
    errors = new Vector<String>();

    setAttributes(me.attributes());
    setContent(me.content());
}
 
Example #18
Source File: CPItem.java    From olat with Apache License 2.0 5 votes vote down vote up
public void setParentElement(final DefaultElement parent) {
    if (parent.getClass().equals(CPItem.class) || parent.getClass().equals(CPOrganization.class)) {
        this.parent = parent;
    } else {
        throw new OLATRuntimeException(CPOrganizations.class, "error while setting parentElement in element \"" + this.identifier
                + "\". Only <item> or <organization> as parent-element allowed", new Exception());
    }
}
 
Example #19
Source File: CPResource.java    From olat with Apache License 2.0 5 votes vote down vote up
/**
*/
  @Override
  public void buildDocument(final DefaultElement parent) {
      // String base = "";
      // if(xmlbase != null && !xmlbase.equals("")) base="
      // xml:base=\""+xmlbase+"\"";

      // TODO: xml base imlement !!!

      final DefaultElement resourceElement = new DefaultElement(CPCore.RESOURCE);

      resourceElement.addAttribute(CPCore.IDENTIFIER, identifier);
      resourceElement.addAttribute(CPCore.TYPE, type);
      resourceElement.addAttribute(CPCore.HREF, href);
      if (!xmlbase.equals("")) {
          resourceElement.addAttribute(CPCore.BASE, xmlbase);
      }

      if (metadata != null) {
          metadata.buildDocument(resourceElement);
      }

      // build files
      for (final Iterator<CPFile> itFiles = files.iterator(); itFiles.hasNext();) {
          final CPFile file = itFiles.next();
          file.buildDocument(resourceElement);
      }

      // build dependencies
      for (final Iterator<CPDependency> itDep = dependencies.iterator(); itDep.hasNext();) {
          final CPDependency dep = itDep.next();
          dep.buildDocument(resourceElement);
      }

      parent.add(resourceElement);
  }
 
Example #20
Source File: CPResources.java    From olat with Apache License 2.0 5 votes vote down vote up
@Override
public void buildDocument(final DefaultElement parent) {
    final DefaultElement resourceElement = new DefaultElement(CPCore.RESOURCES);

    for (final Iterator<CPResource> itResources = resources.iterator(); itResources.hasNext();) {
        final CPResource res = itResources.next();
        res.buildDocument(resourceElement);
    }
    parent.add(resourceElement);
}
 
Example #21
Source File: ConflictRiskAna.java    From Decca with MIT License 5 votes vote down vote up
public Element getConflictElement() {
	Element conflictEle = new DefaultElement("conflictJar");
	conflictEle.addAttribute("groupId-artifactId", nodeConflict.getGroupId() + ":" + nodeConflict.getArtifactId());
	StringBuilder versions = new StringBuilder();
	for (String version : nodeConflict.getVersions()) {
		versions.append(version);
	}
	conflictEle.addAttribute("versions", versions.toString());
	int riskLevel = getRiskLevel();
	conflictEle.addAttribute("riskLevel", "" + riskLevel);
	Element versionsEle = conflictEle.addElement("versions");
	for (DepJar depJar : nodeConflict.getDepJars()) {
		versionsEle.add(depJar.geJarConflictEle());
	}

	Element risksEle = conflictEle.addElement("RiskMethods");
	risksEle.addAttribute("tip", "methods would be referenced but not be loaded");
	if (riskLevel == 3 || riskLevel == 4) {
		int cnt = 0;
		for (String rchedMthd : getPrintRisk()) {
			if(cnt==10)
				break;
			if (!nodeConflict.getUsedDepJar().containsMthd(rchedMthd)) {
				Element riskEle = risksEle.addElement("RiskMthd");
				riskEle.addText(rchedMthd.replace('<', ' ').replace('>', ' '));
				cnt++;
			}
		}
	} else {

	}
	return conflictEle;
}
 
Example #22
Source File: CPResources.java    From olat with Apache License 2.0 5 votes vote down vote up
/**
 * this constructor i used when building up the cp (parsing XML manifest)
 * 
 * @param me
 */
public CPResources(final DefaultElement me) {
    super(me.getName());
    resources = new Vector<CPResource>();
    errors = new Vector<String>();

    setAttributes(me.attributes());
    setContent(me.content());
}
 
Example #23
Source File: CPCore.java    From olat with Apache License 2.0 5 votes vote down vote up
/**
 * parses the document, builds manifest-datamodel-tree-structure
 */
public void buildTree() {
    if (doc != null) {
        rootNode = new CPManifest(this, (DefaultElement) doc.getRootElement());
        rootNode.buildChildren();
    }
}
 
Example #24
Source File: CPCore.java    From olat with Apache License 2.0 5 votes vote down vote up
/**
 * adds an element to the cp. Adds it after the item with identifier "id"
 * 
 * @param newElement
 * @param id
 * @return
 */
public boolean addElementAfter(final DefaultElement newElement, final String id) {
    final DefaultElement beforeElement = rootNode.getElementByIdentifier(id);

    if (beforeElement == null) {
        return false;
    }

    if (beforeElement instanceof CPItem) {
        // beforeElement is a <item>
        // ==> newElement has to be an <item>
        final CPItem beforeItem = (CPItem) beforeElement;
        final DefaultElement parent = beforeItem.getParentElement();
        if (!(newElement instanceof CPItem)) {
            throw new OLATRuntimeException(CPOrganizations.class, "only <item> element allowed", new Exception());
        }
        if (parent instanceof CPItem) {
            final CPItem p = (CPItem) parent;
            p.addItemAt((CPItem) newElement, beforeItem.getPosition() + 1);
        } else if (parent instanceof CPOrganization) {
            final CPOrganization o = (CPOrganization) parent;
            o.addItemAt((CPItem) newElement, beforeItem.getPosition() + 1);
        } else {
            throw new OLATRuntimeException(CPOrganizations.class, "you cannot add an <item> element to a " + parent.getName() + " element", new Exception());
        }

    }

    return true;
}
 
Example #25
Source File: CPMetadata.java    From olat with Apache License 2.0 5 votes vote down vote up
/**
*/
  @Override
  public void buildDocument(final DefaultElement parent) {
      final DefaultElement metaElement = new DefaultElement(CPCore.METADATA);
      metaElement.setContent(this.content());
      parent.add(metaElement);
  }
 
Example #26
Source File: CPCore.java    From olat with Apache License 2.0 5 votes vote down vote up
public void moveElement(final String nodeID, final String newParentID, final int position) {
    final DefaultElement elementToMove = rootNode.getElementByIdentifier(nodeID);
    if (elementToMove != null) {
        if (elementToMove instanceof CPItem) {
            removeElement(nodeID, false);
            addElement(elementToMove, newParentID, position);
        } else if (elementToMove instanceof CPOrganization) {
            // not yet supported
        } else {
            throw new OLATRuntimeException(CPOrganizations.class, "Only <item>-elements are moveable...!", new Exception());
        }
    }
}
 
Example #27
Source File: ClsDupJarPairRisk.java    From Decca with MIT License 5 votes vote down vote up
public Element getConflictElement() {
	int riskLevel = getRiskLevel();	
	Element conflictEle = new DefaultElement("conflict");
	conflictEle.addAttribute("jar-1", jarPair.getJar1().toString());
	conflictEle.addAttribute("jar-2", jarPair.getJar2().toString());
	conflictEle.addAttribute("riskLevel", "" + riskLevel);
	conflictEle.add(jarPair.getJar1().getClsConflictEle(1));
	conflictEle.add(jarPair.getJar2().getClsConflictEle(2));
	Element risksEle = conflictEle.addElement("RiskMethods");
	risksEle.addAttribute("tip", "methods would be referenced but not be loaded");
	if (riskLevel == -1) {
		return null;
	}
	int cnt = 0;
	for (String rchedMthd : getPrintMthds()) {
		if (cnt == 10) {
			break;
		}
		if (!jarPair.getJar1().containsMthd(rchedMthd) || !jarPair.getJar2().containsMthd(rchedMthd)) {
			Element riskEle = risksEle.addElement("RiskMthd");
			riskEle.addText(rchedMthd.replace('<', ' ').replace('>', ' '));
			cnt++;
		}
	}

	return conflictEle;
}
 
Example #28
Source File: XMLDocUtil.java    From boubei-tss with Apache License 2.0 5 votes vote down vote up
/**
 * 将Map中数据按 key/value 设置到xml节点的各个属性上 name/value。
 * 支持多值的情况,即某个属性的值为Object[]数组时。
 * @param attributesMap
 * @param dataNodeName
 * @return 格式如<row id = "1" name = "Jon"/>
 */
public static  Element map2AttributeNode(Map<String, Object> map, String dataNodeName){
    Element node = new DefaultElement(dataNodeName);       
    for ( Entry<String, Object> entry : map.entrySet() ) {
        String name = entry.getKey();
        Object value = entry.getValue();
        if(value != null){
            node.addAttribute(name, value.toString());
        }
    }
    return node;
}
 
Example #29
Source File: DepJar.java    From Decca with MIT License 5 votes vote down vote up
public Element geJarConflictEle() {
	Element nodeEle = new DefaultElement("version");
	nodeEle.addAttribute("versionId", getVersion());
	nodeEle.addAttribute("loaded", "" + isSelected());
	for (NodeAdapter node : this.getNodeAdapters()) {
		nodeEle.add(node.getPathElement());
	}
	return nodeEle;
}
 
Example #30
Source File: CPResources.java    From olat with Apache License 2.0 5 votes vote down vote up
/**
*/
  @Override
  public DefaultElement getElementByIdentifier(final String id) {
      DefaultElement e;
      for (final Iterator<CPResource> itResources = resources.iterator(); itResources.hasNext();) {
          final CPResource res = itResources.next();
          e = res.getElementByIdentifier(id);
          if (e != null) {
              return e;
          }
      }
      return null;
  }