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);
}
}
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;
}
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;
}
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);
}
}
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;
}
Aggregations