Search in sources :

Example 11 with AssignmentImpl

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

the class AssignmentDAO method startEssayAssignment.

public Assignment startEssayAssignment(Assignment assigment, Page page, Identity assignee) {
    ((AssignmentImpl) assigment).setPage(page);
    ((AssignmentImpl) assigment).setAssignee(assignee);
    ((AssignmentImpl) assigment).setLastModified(new Date());
    assigment.setAssignmentStatus(AssignmentStatus.inProgress);
    return dbInstance.getCurrentEntityManager().merge(assigment);
}
Also used : AssignmentImpl(org.olat.modules.portfolio.model.AssignmentImpl) Date(java.util.Date)

Example 12 with AssignmentImpl

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

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

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

the class AssignmentDAO method startFormAssignment.

public Assignment startFormAssignment(Assignment assignment, Page page, Identity assignee) {
    ((AssignmentImpl) assignment).setPage(page);
    ((AssignmentImpl) assignment).setAssignee(assignee);
    ((AssignmentImpl) assignment).setLastModified(new Date());
    assignment.setAssignmentStatus(AssignmentStatus.inProgress);
    RepositoryEntry formEntry = assignment.getFormEntry();
    if (formEntry.getOlatResource().getResourceableTypeName().equals(formHandler.getSupportedType())) {
        File formFile = formHandler.getFormFile(formEntry);
        String formXml = FileUtils.load(formFile, "UTF-8");
        EvaluationFormPart formPart = new EvaluationFormPart();
        formPart.setContent(formXml);
        formPart.setFormEntry(formEntry);
        pageDao.persistPart(page.getBody(), formPart);
    }
    return dbInstance.getCurrentEntityManager().merge(assignment);
}
Also used : EvaluationFormPart(org.olat.modules.portfolio.model.EvaluationFormPart) AssignmentImpl(org.olat.modules.portfolio.model.AssignmentImpl) RepositoryEntry(org.olat.repository.RepositoryEntry) PersistenceHelper.makeFuzzyQueryString(org.olat.core.commons.persistence.PersistenceHelper.makeFuzzyQueryString) File(java.io.File) Date(java.util.Date)

Example 14 with AssignmentImpl

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

the class AssignmentDAO method startEssayAssignment.

public Assignment startEssayAssignment(Assignment assigment, Page page, Identity assignee) {
    ((AssignmentImpl) assigment).setPage(page);
    ((AssignmentImpl) assigment).setAssignee(assignee);
    ((AssignmentImpl) assigment).setLastModified(new Date());
    assigment.setAssignmentStatus(AssignmentStatus.inProgress);
    return dbInstance.getCurrentEntityManager().merge(assigment);
}
Also used : AssignmentImpl(org.olat.modules.portfolio.model.AssignmentImpl) Date(java.util.Date)

Example 15 with AssignmentImpl

use of org.olat.modules.portfolio.model.AssignmentImpl 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)

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