Package org.dom4j.tree

Examples of org.dom4j.tree.DefaultElement


   */
  public void buildChildren() {
    Iterator<DefaultElement> children = this.elementIterator();
    // iterate through children
    while (children.hasNext()) {
      DefaultElement child = children.next();
      if (child.getName().equals(CPCore.ITEM)) {
        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> )");
      }
View Full Code Here


   *
   * @see org.olat.ims.cp.objects.CPNode#getXML(java.lang.StringBuilder)
   */
  public void buildDocument(DefaultElement parent) {

    DefaultElement orgaElement = new DefaultElement(CPCore.ORGANIZATION);

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

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

    if (metadata != null) {
      metadata.buildDocument(orgaElement);
    }
View Full Code Here

   * @see org.olat.ims.cp.objects.CPNode#getElementByIdentifier(java.lang.String)
   */
  public DefaultElement getElementByIdentifier(String id) {
    if (identifier.equals(id)) return this;

    DefaultElement e;
    for (Iterator<CPItem> it = items.iterator(); it.hasNext();) {
      CPItem item = it.next();
      e = item.getElementByIdentifier(id);
      if (e != null) return e;
    }
View Full Code Here

   */
  public void buildChildren() {
    Iterator<DefaultElement> children = this.elementIterator();
    // iterate through children
    while (children.hasNext()) {
      DefaultElement child = children.next();
      if (child.getName().equals(CPCore.ITEM)) {
        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);
      }
    }
View Full Code Here

  /**
   *
   * @see org.olat.ims.cp.objects.CPNode#getXML(java.lang.StringBuilder)
   */
  public void buildDocument(DefaultElement parent) {
    DefaultElement itemElement = new DefaultElement(CPCore.ITEM);

    itemElement.addAttribute(CPCore.IDENTIFIER, identifier);
    if (!identifierRef.equals("")) itemElement.addAttribute(CPCore.IDENTIFIERREF, identifierRef);
    itemElement.addAttribute(CPCore.ISVISIBLE, isVisibleString());

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

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

    for (Iterator<CPItem> itItem = items.iterator(); itItem.hasNext();) {
      CPItem item = itItem.next();
      item.buildDocument(itemElement);
View Full Code Here

   */
  public CPPage(String identifier, ContentPackage cp) {
    this.log = Logger.getLogger(CPPage.class.getName());
    this.identifier = identifier;
    CPManagerImpl cpMgm = (CPManagerImpl) CPManager.getInstance();
    DefaultElement ele = cpMgm.getElementByIdentifier(cp, identifier);
    if (ele instanceof CPItem) {
      CPItem pageItem = (CPItem) ele;
      this.cpRoot = false;
      this.idRef = pageItem.getIdentifierRef();
      this.title = pageItem.getTitle();
View Full Code Here

  }

  protected CPResource getResource() {
    CPResource resource = null;
    CPManager mgr = CPManager.getInstance();
    DefaultElement resElement = mgr.getElementByIdentifier(cp, idRef);
    if (resElement instanceof CPResource) {
      resource = (CPResource)resElement;
    }
    return resource;
  }
View Full Code Here

   */
  private String getCurrentPageInfoStringHTML() {
    // test if currentPage links to resource, which is used (linked) somewhere
    // else in the manifest
    CPManager cpMgm = CPManager.getInstance();
    DefaultElement ele = cpMgm.getElementByIdentifier(cp, currentPage.getIdRef());
    boolean single = false;
    if (ele instanceof CPResource) {
      CPResource res = (CPResource) ele;
      single = cpMgm.isSingleUsedResource(res, cp);
    }
View Full Code Here

   * Retrieves the parent identifier of the current page
   *
   * @return The identifier of the current page's parent
   */
  private String getParentIdentifier() {
    DefaultElement currentElem = CPManager.getInstance().getElementByIdentifier(cp, currentPage.getIdentifier());

    // Get the parent node to be displayed after deletion.
    String parentIdentifier = null;
    if (currentElem instanceof CPItem) {
      Element parent = ((CPItem) currentElem).getParentElement();
View Full Code Here

  /**
   * @see org.olat.ims.cp.objects.CPNode#getElementByIdentifier(java.lang.String)
   */
  public DefaultElement getElementByIdentifier(String id) {
    if (identifier.equals(id)) return this;
    DefaultElement e;
    for (Iterator<CPItem> it = items.iterator(); it.hasNext();) {
      CPItem item = it.next();
      e = item.getElementByIdentifier(id);
      if (e != null) return e;
    }
View Full Code Here

TOP

Related Classes of org.dom4j.tree.DefaultElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.