Examples of CPItem


Examples of org.olat.ims.cp.objects.CPItem

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

    // search for <dependency identifierref="resourceIdentifier" >
View Full Code Here

Examples of org.olat.ims.cp.objects.CPItem

   * @return
   */
  private CPItem _findReferencesToRes(CPItem item, String id) {
    if (item.getIdentifierRef().equals(id)) return item;
    for (Iterator<CPItem> itO = item.getItems().iterator(); itO.hasNext();) {
      CPItem it = itO.next();
      CPItem found = _findReferencesToRes(it, id);
      if (found != null) return found;
    }
    return null;
  }
View Full Code Here

Examples of org.olat.ims.cp.objects.CPItem

   * @return
   */
  public String getPageByItemID(String id) {
    DefaultElement ele = getElementByIdentifier(id);
    if (ele instanceof CPItem) {
      CPItem item = (CPItem) ele;
      if (item.getIdentifierRef() == null || item.getIdentifierRef().equals("")) { return null; }
      DefaultElement resElement = getElementByIdentifier(item.getIdentifierRef());
      if (resElement instanceof CPResource) {
        CPResource res = (CPResource) resElement;
        return res.getFullHref();
      } else {
        Logger log = Logger.getLogger(this.getClass().getName());
View Full Code Here

Examples of org.olat.ims.cp.objects.CPItem

   */
  public String getItemTitle(String itemID) {
    DefaultElement ele = getElementByIdentifier(itemID);
    if (ele == null) { return null; }
    if (ele instanceof CPItem) {
      CPItem item = (CPItem) ele;
      return item.getTitle();
    } else {
      return null;
    }

  }
View Full Code Here

Examples of org.olat.ims.cp.objects.CPItem

  }

  // *** CP manipulation ***

  String addBlankPage(String title) {
    CPItem newPage = new CPItem();
    newPage.setTitle(title);
    cpcore.addElement(newPage);
    return newPage.getIdentifier();
  }
View Full Code Here

Examples of org.olat.ims.cp.objects.CPItem

    cpcore.addElement(newPage);
    return newPage.getIdentifier();
  }

  String addBlankPage(String parentID, String title) {
    CPItem newPage = new CPItem();
    newPage.setTitle(title);
    cpcore.addElement(newPage, parentID, 0);
    return newPage.getIdentifier();
  }
View Full Code Here

Examples of org.olat.ims.cp.objects.CPItem

  }

  protected void updatePage(CPPage page) {
    DefaultElement ele = cpcore.getElementByIdentifier(page.getIdentifier());
    if (ele instanceof CPItem) {
      CPItem item = (CPItem) ele;
      item.setTitle(page.getTitle());
      item.setMetadata(page.getMetadata());
      String itemIdentifierRef = item.getIdentifierRef();
      if (itemIdentifierRef == null || itemIdentifierRef.equals("")) {
        // This item has no linked resource yet. Add one if there is a page file
        // attached.
        VFSLeaf pageFile = page.getPageFile();
        if (pageFile != null) {
          CPResource res = new CPResource();
          CPFile file = new CPFile(pageFile);
          res.addFile(file);
          // TODO:GW Set type according to file
          res.setType("text/html");
          res.setHref(file.getHref());
          item.setIdentifierRef(res.getIdentifier());
          cpcore.getRootNode().getResources().addResource(res);
        }
      } else {// this item has already a linked resource
        // this is not supported, we don't change linked resources...
      }
View Full Code Here

Examples of org.olat.ims.cp.objects.CPItem

    treeData.setContentPackage(this);
    return treeData;
  }

  protected CPPage getFirstPageToDisplay() {
    CPItem it = cpcore.getFirstPageToDisplay();
    if (it == null) {
      // in case the manifest has no item at all -> use organisation identifyer
      // instead
      return new CPPage(cpcore.getFirstOrganizationInManifest().getIdentifier(), this);
    } else {
      // display the found item
      return new CPPage(it.getIdentifier(), this);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.