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);
}
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);
}
}
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;
}
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;
}
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);
}
}
Aggregations