Search in sources :

Example 51 with OLATResourceable

use of org.olat.core.id.OLATResourceable in project OpenOLAT by OpenOLAT.

the class BinderRuntimeController method doAssessmentTool.

private Activateable2 doAssessmentTool(UserRequest ureq) {
    OLATResourceable ores = OresHelper.createOLATResourceableType("TestStatistics");
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
    WindowControl swControl = addToHistory(ureq, ores, null);
    if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach()) {
        AssessmentToolSecurityCallback secCallback = new AssessmentToolSecurityCallback(reSecurity.isEntryAdmin(), reSecurity.isEntryAdmin(), reSecurity.isCourseCoach(), reSecurity.isGroupCoach(), null);
        AssessableResource el = getAssessableElement();
        AssessmentToolController ctrl = new AssessmentToolController(ureq, swControl, toolbarPanel, getRepositoryEntry(), el, secCallback);
        listenTo(ctrl);
        assessmentToolCtrl = pushController(ureq, "Statistics", ctrl);
        currentToolCtr = assessmentToolCtrl;
        setActiveTool(assessmentLink);
        enableRuntimeNavBar(false);
        return assessmentToolCtrl;
    }
    return null;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentToolSecurityCallback(org.olat.modules.assessment.ui.AssessmentToolSecurityCallback) AssessableResource(org.olat.modules.assessment.ui.AssessableResource) WindowControl(org.olat.core.gui.control.WindowControl) AssessmentToolController(org.olat.modules.assessment.ui.AssessmentToolController)

Example 52 with OLATResourceable

use of org.olat.core.id.OLATResourceable in project OpenOLAT by OpenOLAT.

the class DeletedBinderController method doOpenBinder.

@Override
protected BinderController doOpenBinder(UserRequest ureq, Binder binder) {
    if (binder == null) {
        showWarning("warning.portfolio.not.found");
        return null;
    } else {
        removeAsListenerAndDispose(binderCtrl);
        OLATResourceable binderOres = OresHelper.createOLATResourceableInstance("Binder", binder.getKey());
        WindowControl swControl = addToHistory(ureq, binderOres, null);
        BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForDeletedBinder();
        BinderConfiguration config = BinderConfiguration.createConfig(binder);
        binderCtrl = new BinderController(ureq, swControl, stackPanel, secCallback, binder, config);
        listenTo(binderCtrl);
        stackPanel.pushController(binder.getTitle(), binderCtrl);
        return binderCtrl;
    }
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) BinderSecurityCallback(org.olat.modules.portfolio.BinderSecurityCallback) WindowControl(org.olat.core.gui.control.WindowControl) BinderConfiguration(org.olat.modules.portfolio.BinderConfiguration)

Example 53 with OLATResourceable

use of org.olat.core.id.OLATResourceable in project OpenOLAT by OpenOLAT.

the class TableOfContentController method doOpenPage.

private PageRunController doOpenPage(UserRequest ureq, Page page) {
    removeAsListenerAndDispose(pageCtrl);
    OLATResourceable pageOres = OresHelper.createOLATResourceableInstance("Entry", page.getKey());
    WindowControl swControl = addToHistory(ureq, pageOres, null);
    Page reloadedPage = portfolioService.getPageByKey(page.getKey());
    boolean openInEditMode = (secCallback.canEditPage(reloadedPage) && (reloadedPage.getPageStatus() == null || reloadedPage.getPageStatus() == PageStatus.draft || reloadedPage.getPageStatus() == PageStatus.inRevision));
    pageCtrl = new PageRunController(ureq, swControl, stackPanel, secCallback, reloadedPage, openInEditMode);
    listenTo(pageCtrl);
    stackPanel.pushController(page.getTitle(), pageCtrl);
    return pageCtrl;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) Page(org.olat.modules.portfolio.Page) WindowControl(org.olat.core.gui.control.WindowControl)

Example 54 with OLATResourceable

use of org.olat.core.id.OLATResourceable in project OpenOLAT by OpenOLAT.

the class BinderUserInformationsDAO method updateBinderUserInformations.

/**
 * Update (or create if not exists) the course informations for a user. To creation
 * of the user infos is made with doInSync.
 *
 * @param binder The binder
 * @param identity The identity
 */
public void updateBinderUserInformations(final Binder binder, final Identity identity) {
    int updatedRows = lowLevelUpdate(binder, identity);
    // to make it quick
    dbInstance.commit();
    if (updatedRows == 0) {
        OLATResourceable lockRes = OresHelper.createOLATResourceableInstance("BinderLaunchDate::Identity", identity.getKey());
        CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(lockRes, new SyncerExecutor() {

            @Override
            public void execute() {
                try {
                    int retryUpdatedRows = lowLevelUpdate(binder, identity);
                    if (retryUpdatedRows == 0) {
                        createAndPersistUserInfos(binder, identity);
                    }
                } catch (Exception e) {
                    log.error("Cannot update binder informations for: " + identity + " from " + identity, e);
                }
            }
        });
    }
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) SyncerExecutor(org.olat.core.util.coordinate.SyncerExecutor)

Example 55 with OLATResourceable

use of org.olat.core.id.OLATResourceable in project OpenOLAT by OpenOLAT.

the class PortfolioSite method createController.

@Override
protected Controller createController(UserRequest ureq, WindowControl wControl, SiteConfiguration config) {
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(PortfolioSite.class, 0l);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true);
    PortfolioPersonalToolController mainController = new PortfolioPersonalToolController(ureq, bwControl);
    return mainController;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) StateSite(org.olat.core.id.context.StateSite) WindowControl(org.olat.core.gui.control.WindowControl) PortfolioPersonalToolController(org.olat.modules.portfolio.ui.PortfolioPersonalToolController)

Aggregations

OLATResourceable (org.olat.core.id.OLATResourceable)924 WindowControl (org.olat.core.gui.control.WindowControl)304 Test (org.junit.Test)158 Identity (org.olat.core.id.Identity)154 RepositoryEntry (org.olat.repository.RepositoryEntry)130 ContextEntry (org.olat.core.id.context.ContextEntry)82 ArrayList (java.util.ArrayList)68 OLATResource (org.olat.resource.OLATResource)60 Controller (org.olat.core.gui.control.Controller)48 Date (java.util.Date)46 AssertException (org.olat.core.logging.AssertException)32 StateSite (org.olat.core.id.context.StateSite)30 SyncerExecutor (org.olat.core.util.coordinate.SyncerExecutor)30 ICourse (org.olat.course.ICourse)30 CourseNode (org.olat.course.nodes.CourseNode)28 DBCheckbox (org.olat.course.nodes.cl.model.DBCheckbox)28 BusinessControl (org.olat.core.id.context.BusinessControl)24 BusinessGroup (org.olat.group.BusinessGroup)24 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)22 BinderSecurityCallback (org.olat.modules.portfolio.BinderSecurityCallback)22