Search in sources :

Example 1 with EPStructureManager

use of org.olat.portfolio.manager.EPStructureManager in project OpenOLAT by OpenOLAT.

the class PortfolioCourseNode method updateModuleConfigDefaults.

@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
    ModuleConfiguration config = getModuleConfiguration();
    if (isNewNode) {
        MSCourseNode.initDefaultConfig(config);
        config.setConfigurationVersion(CURRENT_CONFIG_VERSION);
    }
    if (config.getConfigurationVersion() < 2) {
        if (config.get(PortfolioCourseNodeConfiguration.REPO_SOFT_KEY) == null) {
            Object mapKey = config.get(PortfolioCourseNodeConfiguration.MAP_KEY);
            if (mapKey instanceof Long) {
                EPStructureManager eSTMgr = (EPStructureManager) CoreSpringFactory.getBean("epStructureManager");
                RepositoryEntry re = eSTMgr.loadPortfolioRepositoryEntryByMapKey((Long) mapKey);
                config.set(PortfolioCourseNodeConfiguration.REPO_SOFT_KEY, re.getSoftkey());
            }
        }
        config.setConfigurationVersion(2);
    }
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) RepositoryEntry(org.olat.repository.RepositoryEntry) EPStructureManager(org.olat.portfolio.manager.EPStructureManager)

Example 2 with EPStructureManager

use of org.olat.portfolio.manager.EPStructureManager in project OpenOLAT by OpenOLAT.

the class PortfolioHandler method createResource.

@Override
public RepositoryEntry createResource(Identity initialAuthor, String displayname, String description, Object createObject, Locale locale) {
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    EPStructureManager eSTMgr = CoreSpringFactory.getImpl(EPStructureManager.class);
    RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
    OLATResource resource = eSTMgr.createPortfolioMapTemplateResource();
    RepositoryEntry re = repositoryService.create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
    PortfolioStructureMap mapTemp = eSTMgr.createAndPersistPortfolioMapTemplateFromEntry(initialAuthor, re);
    // add a page, as each map should have at least one per default!
    Translator pt = Util.createPackageTranslator(EPCreateMapController.class, locale);
    String pageTitle = pt.translate("new.page.title");
    String pageDescription = pt.translate("new.page.desc");
    ePFMgr.createAndPersistPortfolioPage(mapTemp, pageTitle, pageDescription);
    DBFactory.getInstance().commit();
    return re;
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) Translator(org.olat.core.gui.translator.Translator) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager) EPStructureManager(org.olat.portfolio.manager.EPStructureManager) RepositoryService(org.olat.repository.RepositoryService)

Example 3 with EPStructureManager

use of org.olat.portfolio.manager.EPStructureManager in project openolat by klemens.

the class PortfolioHandler method createResource.

@Override
public RepositoryEntry createResource(Identity initialAuthor, String displayname, String description, Object createObject, Locale locale) {
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    EPStructureManager eSTMgr = CoreSpringFactory.getImpl(EPStructureManager.class);
    RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
    OLATResource resource = eSTMgr.createPortfolioMapTemplateResource();
    RepositoryEntry re = repositoryService.create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
    PortfolioStructureMap mapTemp = eSTMgr.createAndPersistPortfolioMapTemplateFromEntry(initialAuthor, re);
    // add a page, as each map should have at least one per default!
    Translator pt = Util.createPackageTranslator(EPCreateMapController.class, locale);
    String pageTitle = pt.translate("new.page.title");
    String pageDescription = pt.translate("new.page.desc");
    ePFMgr.createAndPersistPortfolioPage(mapTemp, pageTitle, pageDescription);
    DBFactory.getInstance().commit();
    return re;
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) Translator(org.olat.core.gui.translator.Translator) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager) EPStructureManager(org.olat.portfolio.manager.EPStructureManager) RepositoryService(org.olat.repository.RepositoryService)

Example 4 with EPStructureManager

use of org.olat.portfolio.manager.EPStructureManager in project openolat by klemens.

the class PortfolioCourseNode method updateModuleConfigDefaults.

@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
    ModuleConfiguration config = getModuleConfiguration();
    if (isNewNode) {
        MSCourseNode.initDefaultConfig(config);
        config.setConfigurationVersion(CURRENT_CONFIG_VERSION);
    }
    if (config.getConfigurationVersion() < 2) {
        if (config.get(PortfolioCourseNodeConfiguration.REPO_SOFT_KEY) == null) {
            Object mapKey = config.get(PortfolioCourseNodeConfiguration.MAP_KEY);
            if (mapKey instanceof Long) {
                EPStructureManager eSTMgr = (EPStructureManager) CoreSpringFactory.getBean("epStructureManager");
                RepositoryEntry re = eSTMgr.loadPortfolioRepositoryEntryByMapKey((Long) mapKey);
                config.set(PortfolioCourseNodeConfiguration.REPO_SOFT_KEY, re.getSoftkey());
            }
        }
        config.setConfigurationVersion(2);
    }
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) RepositoryEntry(org.olat.repository.RepositoryEntry) EPStructureManager(org.olat.portfolio.manager.EPStructureManager)

Example 5 with EPStructureManager

use of org.olat.portfolio.manager.EPStructureManager in project OpenOLAT by OpenOLAT.

the class PortfolioHandler method importResource.

@Override
public RepositoryEntry importResource(Identity initialAuthor, String initialAuthorAlt, String displayname, String description, boolean withReferences, Locale locale, File file, String filename) {
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    EPStructureManager eSTMgr = CoreSpringFactory.getImpl(EPStructureManager.class);
    RepositoryEntry re = null;
    PortfolioStructure structure = EPXStreamHandler.getAsObject(file, false);
    if (structure != null) {
        OLATResource resource = eSTMgr.createPortfolioMapTemplateResource();
        re = CoreSpringFactory.getImpl(RepositoryService.class).create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
        ePFMgr.importPortfolioMapTemplate(structure, resource);
    }
    return re;
}
Also used : PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager) EPStructureManager(org.olat.portfolio.manager.EPStructureManager)

Aggregations

EPStructureManager (org.olat.portfolio.manager.EPStructureManager)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 EPFrontendManager (org.olat.portfolio.manager.EPFrontendManager)4 OLATResource (org.olat.resource.OLATResource)4 Translator (org.olat.core.gui.translator.Translator)2 ModuleConfiguration (org.olat.modules.ModuleConfiguration)2 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)2 PortfolioStructureMap (org.olat.portfolio.model.structel.PortfolioStructureMap)2 RepositoryManager (org.olat.repository.RepositoryManager)2 RepositoryService (org.olat.repository.RepositoryService)2