Search in sources :

Example 1 with ManifestMetadataType

use of org.olat.imscp.xml.manifest.ManifestMetadataType in project OpenOLAT by OpenOLAT.

the class ExportBinderAsCPResource method createImsManifest.

private ManifestType createImsManifest(Binder binder, List<Section> sections, List<Page> pages) {
    ManifestType manifest = cpObjectFactory.createManifestType();
    manifest.setIdentifier(UUID.randomUUID().toString());
    // schema
    ManifestMetadataType metadataType = cpObjectFactory.createManifestMetadataType();
    manifest.setMetadata(metadataType);
    // organizations
    OrganizationsType organizations = cpObjectFactory.createOrganizationsType();
    manifest.setOrganizations(organizations);
    OrganizationType organization = cpObjectFactory.createOrganizationType();
    organization.setIdentifier("binder_" + binder.getKey());
    organization.setTitle(binder.getTitle());
    organization.setStructure("hierarchical");
    organizations.getOrganization().add(organization);
    organizations.setDefault(organization);
    ResourcesType resources = cpObjectFactory.createResourcesType();
    manifest.setResources(resources);
    Map<Section, ItemType> sectionToItemMap = new HashMap<>();
    for (Section section : sections) {
        ItemType sectionItem = cpObjectFactory.createItemType();
        String itemIdentifier = "section_" + section.getKey().toString();
        String resourceIdentifier = "res_" + itemIdentifier;
        sectionItem.setTitle(section.getTitle());
        sectionItem.setIdentifier(itemIdentifier);
        sectionItem.setIdentifierref(resourceIdentifier);
        sectionItem.setIsvisible(Boolean.TRUE);
        organization.getItem().add(sectionItem);
        sectionToItemMap.put(section, sectionItem);
        ResourceType resource = cpObjectFactory.createResourceType();
        resource.setIdentifier(resourceIdentifier);
        resource.setType("webcontent");
        resource.setHref(sectionFilename(section));
        resources.getResource().add(resource);
    }
    for (Page page : pages) {
        ItemType sectionItem = sectionToItemMap.get(page.getSection());
        if (sectionItem == null) {
            continue;
        }
        ItemType pageItem = cpObjectFactory.createItemType();
        pageItem.setTitle(page.getTitle());
        String itemIdentifier = "page_" + page.getKey().toString();
        String resourceIdentifier = "res_" + itemIdentifier;
        pageItem.setIdentifier(itemIdentifier);
        pageItem.setIdentifierref(resourceIdentifier);
        pageItem.setIsvisible(Boolean.TRUE);
        sectionItem.getItem().add(pageItem);
        ResourceType resource = cpObjectFactory.createResourceType();
        resource.setIdentifier(resourceIdentifier);
        resource.setType("webcontent");
        resource.setHref(pageFilename(page));
        resources.getResource().add(resource);
    }
    return manifest;
}
Also used : ManifestMetadataType(org.olat.imscp.xml.manifest.ManifestMetadataType) ResourcesType(org.olat.imscp.xml.manifest.ResourcesType) ManifestType(org.olat.imscp.xml.manifest.ManifestType) OrganizationsType(org.olat.imscp.xml.manifest.OrganizationsType) HashMap(java.util.HashMap) ItemType(org.olat.imscp.xml.manifest.ItemType) ResourceType(org.olat.imscp.xml.manifest.ResourceType) Page(org.olat.modules.portfolio.Page) OrganizationType(org.olat.imscp.xml.manifest.OrganizationType) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section)

Example 2 with ManifestMetadataType

use of org.olat.imscp.xml.manifest.ManifestMetadataType in project OpenOLAT by OpenOLAT.

the class ManifestBuilder method createAssessmentItemBuilder.

/**
 * Create a manifest with some metadata specific to the
 * assessment item.
 *
 * @return
 */
public static ManifestBuilder createAssessmentItemBuilder() {
    ManifestBuilder builder = new ManifestBuilder();
    // schema
    ManifestMetadataType metadataType = createManifestMetadataType();
    builder.manifest.setMetadata(metadataType);
    // lom technical
    LomType lom = createLom(false, true);
    metadataType.getAny().add(mdObjectFactory.createLom(lom));
    return builder;
}
Also used : ManifestMetadataType(org.olat.imscp.xml.manifest.ManifestMetadataType) LomType(org.olat.imsmd.xml.manifest.LomType)

Example 3 with ManifestMetadataType

use of org.olat.imscp.xml.manifest.ManifestMetadataType in project OpenOLAT by OpenOLAT.

the class ManifestBuilder method createAssessmentTestBuilder.

/**
 * Create a manifest with some metadata specific to the
 * assessment test.
 *
 * @return
 */
public static ManifestBuilder createAssessmentTestBuilder() {
    ManifestBuilder builder = new ManifestBuilder();
    // schema
    ManifestMetadataType metadataType = createManifestMetadataType();
    metadataType.setSchema("QTIv2.1 Package");
    metadataType.setSchemaversion("1.0.0");
    builder.manifest.setMetadata(metadataType);
    // lom technical
    LomType lom = createLom(true, true);
    metadataType.getAny().add(mdObjectFactory.createLom(lom));
    return builder;
}
Also used : ManifestMetadataType(org.olat.imscp.xml.manifest.ManifestMetadataType) LomType(org.olat.imsmd.xml.manifest.LomType)

Example 4 with ManifestMetadataType

use of org.olat.imscp.xml.manifest.ManifestMetadataType in project openolat by klemens.

the class ManifestBuilder method createAssessmentItemBuilder.

/**
 * Create a manifest with some metadata specific to the
 * assessment item.
 *
 * @return
 */
public static ManifestBuilder createAssessmentItemBuilder() {
    ManifestBuilder builder = new ManifestBuilder();
    // schema
    ManifestMetadataType metadataType = createManifestMetadataType();
    builder.manifest.setMetadata(metadataType);
    // lom technical
    LomType lom = createLom(false, true);
    metadataType.getAny().add(mdObjectFactory.createLom(lom));
    return builder;
}
Also used : ManifestMetadataType(org.olat.imscp.xml.manifest.ManifestMetadataType) LomType(org.olat.imsmd.xml.manifest.LomType)

Example 5 with ManifestMetadataType

use of org.olat.imscp.xml.manifest.ManifestMetadataType in project openolat by klemens.

the class ManifestBuilder method createAssessmentTestBuilder.

/**
 * Create a manifest with some metadata specific to the
 * assessment test.
 *
 * @return
 */
public static ManifestBuilder createAssessmentTestBuilder() {
    ManifestBuilder builder = new ManifestBuilder();
    // schema
    ManifestMetadataType metadataType = createManifestMetadataType();
    metadataType.setSchema("QTIv2.1 Package");
    metadataType.setSchemaversion("1.0.0");
    builder.manifest.setMetadata(metadataType);
    // lom technical
    LomType lom = createLom(true, true);
    metadataType.getAny().add(mdObjectFactory.createLom(lom));
    return builder;
}
Also used : ManifestMetadataType(org.olat.imscp.xml.manifest.ManifestMetadataType) LomType(org.olat.imsmd.xml.manifest.LomType)

Aggregations

ManifestMetadataType (org.olat.imscp.xml.manifest.ManifestMetadataType)8 LomType (org.olat.imsmd.xml.manifest.LomType)4 HashMap (java.util.HashMap)2 ItemType (org.olat.imscp.xml.manifest.ItemType)2 ManifestType (org.olat.imscp.xml.manifest.ManifestType)2 OrganizationType (org.olat.imscp.xml.manifest.OrganizationType)2 OrganizationsType (org.olat.imscp.xml.manifest.OrganizationsType)2 ResourceType (org.olat.imscp.xml.manifest.ResourceType)2 ResourcesType (org.olat.imscp.xml.manifest.ResourcesType)2 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)2 Page (org.olat.modules.portfolio.Page)2 Section (org.olat.modules.portfolio.Section)2