Search in sources :

Example 1 with AssignmentImpl

use of org.olat.modules.portfolio.model.AssignmentImpl in project OpenOLAT by OpenOLAT.

the class PortfolioServiceImpl method updateAssignment.

@Override
public Assignment updateAssignment(Assignment assignment, String title, String summary, String content, AssignmentType type, boolean onlyAutoEvaluation, boolean reviewerSeeAutoEvaluation, boolean anonymousExternEvaluation, RepositoryEntry formEntry) {
    if (!StringHelper.containsNonWhitespace(assignment.getStorage())) {
        File newStorage = portfolioFileStorage.generateAssignmentSubDirectory();
        String newRelativeStorage = portfolioFileStorage.getRelativePath(newStorage);
        ((AssignmentImpl) assignment).setStorage(newRelativeStorage);
    }
    AssignmentImpl impl = (AssignmentImpl) assignment;
    impl.setTitle(title);
    impl.setSummary(summary);
    impl.setContent(content);
    impl.setType(type.name());
    impl.setOnlyAutoEvaluation(onlyAutoEvaluation);
    impl.setReviewerSeeAutoEvaluation(reviewerSeeAutoEvaluation);
    impl.setAnonymousExternalEvaluation(anonymousExternEvaluation);
    impl.setFormEntry(formEntry);
    return assignmentDao.updateAssignment(assignment);
}
Also used : AssignmentImpl(org.olat.modules.portfolio.model.AssignmentImpl) File(java.io.File)

Example 2 with AssignmentImpl

use of org.olat.modules.portfolio.model.AssignmentImpl in project OpenOLAT by OpenOLAT.

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 3 with AssignmentImpl

use of org.olat.modules.portfolio.model.AssignmentImpl in project OpenOLAT by OpenOLAT.

the class AssignmentDAO method createAssignment.

public Assignment createAssignment(Assignment templateReference, AssignmentStatus status, Section section) {
    AssignmentImpl assignment = new AssignmentImpl();
    assignment.setCreationDate(new Date());
    assignment.setLastModified(assignment.getCreationDate());
    assignment.setTitle(templateReference.getTitle());
    assignment.setSummary(templateReference.getSummary());
    assignment.setContent(templateReference.getContent());
    assignment.setSection(section);
    assignment.setType(templateReference.getAssignmentType().name());
    assignment.setTemplateReference(templateReference);
    assignment.setStatus(status.name());
    assignment.setOnlyAutoEvaluation(templateReference.isOnlyAutoEvaluation());
    assignment.setReviewerSeeAutoEvaluation(templateReference.isReviewerSeeAutoEvaluation());
    assignment.setAnonymousExternalEvaluation(templateReference.isAnonymousExternalEvaluation());
    assignment.setStorage(templateReference.getStorage());
    assignment.setFormEntry(templateReference.getFormEntry());
    ((SectionImpl) section).getAssignments().size();
    ((SectionImpl) section).getAssignments().add(assignment);
    dbInstance.getCurrentEntityManager().persist(assignment);
    dbInstance.getCurrentEntityManager().merge(section);
    return assignment;
}
Also used : AssignmentImpl(org.olat.modules.portfolio.model.AssignmentImpl) Date(java.util.Date)

Example 4 with AssignmentImpl

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

the class AssignmentDAO method createAssignment.

public Assignment createAssignment(String title, String summary, String content, String storage, AssignmentType type, AssignmentStatus status, Section section, boolean onlyAutoEvaluation, boolean reviewerSeeAutoEvaluation, boolean anonymousExternEvaluation, RepositoryEntry formEntry) {
    AssignmentImpl assignment = new AssignmentImpl();
    assignment.setCreationDate(new Date());
    assignment.setLastModified(assignment.getCreationDate());
    assignment.setTitle(title);
    assignment.setSummary(summary);
    assignment.setContent(content);
    assignment.setStorage(storage);
    assignment.setSection(section);
    assignment.setType(type.name());
    assignment.setStatus(status.name());
    assignment.setOnlyAutoEvaluation(onlyAutoEvaluation);
    assignment.setReviewerSeeAutoEvaluation(reviewerSeeAutoEvaluation);
    assignment.setAnonymousExternalEvaluation(anonymousExternEvaluation);
    assignment.setFormEntry(formEntry);
    ((SectionImpl) section).getAssignments().size();
    ((SectionImpl) section).getAssignments().add(assignment);
    dbInstance.getCurrentEntityManager().persist(assignment);
    dbInstance.getCurrentEntityManager().merge(section);
    return assignment;
}
Also used : AssignmentImpl(org.olat.modules.portfolio.model.AssignmentImpl) Date(java.util.Date)

Example 5 with AssignmentImpl

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

the class AssignmentDAO method moveAssignment.

public void moveAssignment(SectionImpl currentSection, Assignment assignment, SectionImpl newParentSection) {
    // load the assignments
    currentSection.getAssignments().size();
    newParentSection.getAssignments().size();
    int index = currentSection.getAssignments().indexOf(assignment);
    if (index >= 0) {
        Assignment reloadedAssignment = currentSection.getAssignments().remove(index);
        ((AssignmentImpl) reloadedAssignment).setSection(newParentSection);
        dbInstance.getCurrentEntityManager().merge(currentSection);
        newParentSection.getAssignments().add(reloadedAssignment);
        reloadedAssignment = dbInstance.getCurrentEntityManager().merge(reloadedAssignment);
        dbInstance.getCurrentEntityManager().merge(newParentSection);
    }
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) AssignmentImpl(org.olat.modules.portfolio.model.AssignmentImpl)

Aggregations

AssignmentImpl (org.olat.modules.portfolio.model.AssignmentImpl)16 Date (java.util.Date)8 File (java.io.File)4 Assignment (org.olat.modules.portfolio.Assignment)4 ArrayList (java.util.ArrayList)2 PersistenceHelper.makeFuzzyQueryString (org.olat.core.commons.persistence.PersistenceHelper.makeFuzzyQueryString)2 Page (org.olat.modules.portfolio.Page)2 EvaluationFormPart (org.olat.modules.portfolio.model.EvaluationFormPart)2 PageImpl (org.olat.modules.portfolio.model.PageImpl)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2