Package org.olat.ims.cp.objects

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


      if (filePath != null && filePath != "") {
        LocalFileImpl f = (LocalFileImpl) cp.getRootDir().resolve(filePath);
        this.pageFile = f;
      }
    } else if(ele instanceof CPOrganization){
      CPOrganization orga = (CPOrganization)ele;
      this.cpRoot = true;
      this.title = orga.getTitle();
    }
  }
View Full Code Here


      Element parent = ((CPItem) currentElem).getParentElement();
      if (parent instanceof CPItem) {
        CPItem parentItem = (CPItem) parent;
        parentIdentifier = parentItem.getIdentifier();
      } else if (parent instanceof CPOrganization) {
        CPOrganization parentItem = (CPOrganization) parent;
        parentIdentifier = parentItem.getIdentifier();
      }
    }
    return parentIdentifier;
  }
View Full Code Here

  }

  public void testLoad() {
    ContentPackage relodedCP = mgr.load(cp.getRootDir(), cp.getResourcable());
    assertNotNull(relodedCP);
    CPOrganization orga = relodedCP.getFirstOrganizationInManifest();
    assertNotNull(orga);
    CPItem item = orga.getFirstItem();
    assertEquals(PAGE_TITLE, item.getTitle());
  }
View Full Code Here

      log.info("element not found (id " + nodeId + ")");
      return nodeList;
    }
    try {
      if (el.getName().equals(CPCore.ORGANIZATION)) {
        CPOrganization org = (CPOrganization) el;
        for (Iterator<CPItem> it = org.getItemIterator(); it.hasNext();) {
          CPItem item = it.next();
          addItem(nodeList, item);
        }
      } else if (el.getName().equals(CPCore.ITEM)) {
        CPItem pItem = (CPItem) el;
View Full Code Here

      CPItem item = (CPItem) elem;
      path.insert(0, slash).insert(1, getNodeIDForIdentifier(item.getIdentifier()));
      DefaultElement parent = item.getParentElement();
      if (parent != null) addElementToPath(parent, path);
    } else if (elem instanceof CPOrganization) {
      CPOrganization item = (CPOrganization) elem;
      path.insert(0, slash).insert(1, getNodeIDForIdentifier(item.getIdentifier()));
    }
  }
View Full Code Here

      File cpRoot = FileResourceManager.getInstance().unzipFileResource(ores);
      LocalFolderImpl vfsWrapper = new LocalFolderImpl(cpRoot);
      ContentPackage cp = load(vfsWrapper, ores);

      // Modify the copy of the template to get a unique identifier
      CPOrganization orga = setUniqueOrgaIdentifier(cp);
      setOrgaTitleToRepoEntryTitle(ores, orga);
      // Also set the translated title of the inital page.
      orga.getItems().get(0).setTitle(initalPageTitle);

      writeToFile(cp);
      return cp;

    } else {
View Full Code Here

   *
   * @param cp
   * @return The first organization of the content package.
   */
  private CPOrganization setUniqueOrgaIdentifier(ContentPackage cp) {
    CPOrganization orga = cp.getFirstOrganizationInManifest();
    String newOrgaIdentifier = "olatcp-" + CodeHelper.getForeverUniqueID();
    orga.setIdentifier(newOrgaIdentifier);
    return orga;
  }
View Full Code Here

    } else if (parentElement instanceof CPOrganization) {
      // parent is a <organization>
      if (newElement instanceof CPItem) {
        // add a new item to organization element
        CPOrganization org = (CPOrganization) parentElement;
        org.addItemAt((CPItem) newElement, position);
        return true;
      } else {
        throw new OLATRuntimeException(CPOrganizations.class, "you can only add <item>  elements to an <organization>-element",
            new Exception());
      }
View Full Code Here

          new Exception()); }
      if (parent instanceof CPItem) {
        CPItem p = (CPItem) parent;
        p.addItemAt((CPItem) newElement, beforeItem.getPosition() + 1);
      } else if (parent instanceof CPOrganization) {
        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());
      }
View Full Code Here

        // then remove item
        item.removeFromManifest();

      } else if (el instanceof CPOrganization) {
        // element is organization
        CPOrganization org = (CPOrganization) el;
        org.removeFromManifest(resourceFlag);
      } else if (el instanceof CPMetadata) {
        // element is <metadata>
        CPMetadata md = (CPMetadata) el;
        md.removeFromManifest();
      }
View Full Code Here

TOP

Related Classes of org.olat.ims.cp.objects.CPOrganization

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.