Search in sources :

Example 11 with EPFrontendManager

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

the class PortfolioHandler method readyToDelete.

@Override
public boolean readyToDelete(RepositoryEntry entry, Identity identity, Roles roles, Locale locale, ErrorList errors) {
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    PortfolioStructure map = ePFMgr.loadPortfolioStructure(entry.getOlatResource());
    if (map instanceof EPStructuredMapTemplate) {
        EPStructuredMapTemplate exercise = (EPStructuredMapTemplate) map;
        if (ePFMgr.isTemplateInUse(exercise, null, null, null)) {
            return false;
        }
    }
    ReferenceManager refM = CoreSpringFactory.getImpl(ReferenceManager.class);
    String referencesSummary = refM.getReferencesToSummary(entry.getOlatResource(), locale);
    if (referencesSummary != null) {
        Translator translator = Util.createPackageTranslator(RepositoryManager.class, locale);
        errors.setError(translator.translate("details.delete.error.references", new String[] { referencesSummary, entry.getDisplayname() }));
        return false;
    }
    return true;
}
Also used : EPStructuredMapTemplate(org.olat.portfolio.model.structel.EPStructuredMapTemplate) Translator(org.olat.core.gui.translator.Translator) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager) ReferenceManager(org.olat.resource.references.ReferenceManager)

Example 12 with EPFrontendManager

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

the class EfficiencyStatementArtefactHandler method createDetailsController.

@Override
public Controller createDetailsController(UserRequest ureq, WindowControl wControl, AbstractArtefact artefact, boolean readOnlyMode) {
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    String statementXml = ePFMgr.getArtefactFullTextContent(artefact);
    EfficiencyStatement statement = null;
    if (StringHelper.containsNonWhitespace(statementXml)) {
        try {
            statement = (EfficiencyStatement) myXStream.fromXML(statementXml);
        } catch (Exception e) {
            log.error("Cannot load efficiency statement from artefact", e);
        }
    }
    CertificateAndEfficiencyStatementController efficiencyCtrl = new CertificateAndEfficiencyStatementController(wControl, ureq, statement);
    return new LayoutMain3ColsController(ureq, wControl, efficiencyCtrl);
}
Also used : LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) CertificateAndEfficiencyStatementController(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementController) EfficiencyStatement(org.olat.course.assessment.EfficiencyStatement) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager)

Example 13 with EPFrontendManager

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

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)

Example 14 with EPFrontendManager

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

the class PortfolioHandler method copy.

@Override
public RepositoryEntry copy(Identity author, RepositoryEntry source, RepositoryEntry target) {
    OLATResource sourceResource = source.getOlatResource();
    OLATResource targetResource = target.getOlatResource();
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    PortfolioStructure structure = ePFMgr.loadPortfolioStructure(sourceResource);
    PortfolioStructure newStructure = EPXStreamHandler.copy(structure);
    ePFMgr.importPortfolioMapTemplate(newStructure, targetResource);
    return target;
}
Also used : PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) OLATResource(org.olat.resource.OLATResource) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager)

Example 15 with EPFrontendManager

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

the class PortfolioHandler method readyToDelete.

@Override
public boolean readyToDelete(RepositoryEntry entry, Identity identity, Roles roles, Locale locale, ErrorList errors) {
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    PortfolioStructure map = ePFMgr.loadPortfolioStructure(entry.getOlatResource());
    if (map instanceof EPStructuredMapTemplate) {
        EPStructuredMapTemplate exercise = (EPStructuredMapTemplate) map;
        if (ePFMgr.isTemplateInUse(exercise, null, null, null)) {
            return false;
        }
    }
    ReferenceManager refM = CoreSpringFactory.getImpl(ReferenceManager.class);
    String referencesSummary = refM.getReferencesToSummary(entry.getOlatResource(), locale);
    if (referencesSummary != null) {
        Translator translator = Util.createPackageTranslator(RepositoryManager.class, locale);
        errors.setError(translator.translate("details.delete.error.references", new String[] { referencesSummary, entry.getDisplayname() }));
        return false;
    }
    return true;
}
Also used : EPStructuredMapTemplate(org.olat.portfolio.model.structel.EPStructuredMapTemplate) Translator(org.olat.core.gui.translator.Translator) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager) ReferenceManager(org.olat.resource.references.ReferenceManager)

Aggregations

EPFrontendManager (org.olat.portfolio.manager.EPFrontendManager)20 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)10 RepositoryEntry (org.olat.repository.RepositoryEntry)8 Translator (org.olat.core.gui.translator.Translator)6 OLATResource (org.olat.resource.OLATResource)6 EPStructureManager (org.olat.portfolio.manager.EPStructureManager)4 PortfolioStructureMap (org.olat.portfolio.model.structel.PortfolioStructureMap)4 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 CalendarController (org.olat.commons.calendar.ui.CalendarController)2 WeeklyCalendarController (org.olat.commons.calendar.ui.WeeklyCalendarController)2 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)2 FolderRunController (org.olat.core.commons.modules.bc.FolderRunController)2 Controller (org.olat.core.gui.control.Controller)2 MediaResource (org.olat.core.gui.media.MediaResource)2 StreamedMediaResource (org.olat.core.gui.media.StreamedMediaResource)2 Roles (org.olat.core.id.Roles)2 EfficiencyStatement (org.olat.course.assessment.EfficiencyStatement)2