Search in sources :

Example 11 with PageImpl

use of org.olat.modules.portfolio.model.PageImpl in project openolat by klemens.

the class BinderDAO method syncMovedAssignment.

private void syncMovedAssignment(SectionImpl currentSection, SectionImpl newSection, Assignment assignment) {
    currentSection.getAssignments().size();
    newSection.getAssignments().size();
    currentSection.getAssignments().remove(assignment);
    ((AssignmentImpl) assignment).setSection(newSection);
    assignment = dbInstance.getCurrentEntityManager().merge(assignment);
    newSection.getAssignments().add(assignment);
    Page page = assignment.getPage();
    if (page != null) {
        currentSection.getPages().remove(page);
        newSection.getPages().add(page);
        ((PageImpl) page).setSection(newSection);
        dbInstance.getCurrentEntityManager().merge(page);
    }
}
Also used : PageImpl(org.olat.modules.portfolio.model.PageImpl) AssignmentImpl(org.olat.modules.portfolio.model.AssignmentImpl) Page(org.olat.modules.portfolio.Page)

Example 12 with PageImpl

use of org.olat.modules.portfolio.model.PageImpl in project openolat by klemens.

the class PortfolioServiceImpl method changeSectionStatus.

@Override
public Section changeSectionStatus(Section section, SectionStatus status, Identity coach) {
    PageStatus newPageStatus;
    if (status == SectionStatus.closed) {
        newPageStatus = PageStatus.closed;
    } else {
        newPageStatus = PageStatus.inRevision;
    }
    Section reloadedSection = binderDao.loadSectionByKey(section.getKey());
    List<Page> pages = reloadedSection.getPages();
    for (Page page : pages) {
        if (page != null) {
            ((PageImpl) page).setPageStatus(newPageStatus);
            pageDao.updatePage(page);
            if (newPageStatus == PageStatus.closed) {
                // set user informations to done
                pageUserInfosDao.updateStatus(page, PageUserStatus.done);
            }
        }
    }
    ((SectionImpl) reloadedSection).setSectionStatus(status);
    reloadedSection = binderDao.updateSection(reloadedSection);
    return reloadedSection;
}
Also used : PageImpl(org.olat.modules.portfolio.model.PageImpl) PageStatus(org.olat.modules.portfolio.PageStatus) AssessedPage(org.olat.modules.portfolio.model.AssessedPage) Page(org.olat.modules.portfolio.Page) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) SectionImpl(org.olat.modules.portfolio.model.SectionImpl) AssessmentSectionImpl(org.olat.modules.portfolio.model.AssessmentSectionImpl)

Aggregations

PageImpl (org.olat.modules.portfolio.model.PageImpl)12 Page (org.olat.modules.portfolio.Page)8 Section (org.olat.modules.portfolio.Section)8 Date (java.util.Date)6 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)6 AssessedPage (org.olat.modules.portfolio.model.AssessedPage)6 PageStatus (org.olat.modules.portfolio.PageStatus)4 AssessmentSectionImpl (org.olat.modules.portfolio.model.AssessmentSectionImpl)4 SectionImpl (org.olat.modules.portfolio.model.SectionImpl)4 Binder (org.olat.modules.portfolio.Binder)2 SectionStatus (org.olat.modules.portfolio.SectionStatus)2 AssessedBinder (org.olat.modules.portfolio.model.AssessedBinder)2 AssignmentImpl (org.olat.modules.portfolio.model.AssignmentImpl)2 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)2