Search in sources :

Example 1 with EventType

use of org.olat.course.nodes.projectbroker.datamodel.Project.EventType in project OpenOLAT by OpenOLAT.

the class ProjectBrokerManagerImpl method updateProjectAndInvalidateCache.

private void updateProjectAndInvalidateCache(final Project project) {
    // avoid hibernate exception : object with same identifier already exist in session.
    // reload object from db, because project is a detached object but could be already in hibernate session
    Project reloadedProject = (Project) dbInstance.loadObject(project, true);
    // set all value on reloadedProject with values from updated project
    reloadedProject.setTitle(project.getTitle());
    reloadedProject.setState(project.getState());
    for (Project.EventType eventType : Project.EventType.values()) {
        reloadedProject.setProjectEvent(project.getProjectEvent(eventType));
    }
    reloadedProject.setMaxMembers(project.getMaxMembers());
    reloadedProject.setMailNotificationEnabled(project.isMailNotificationEnabled());
    reloadedProject.setDescription(project.getDescription());
    for (int index = 0; index < project.getCustomFieldSize(); index++) {
        reloadedProject.setCustomFieldValue(index, project.getCustomFieldValue(index));
    }
    reloadedProject.setAttachedFileName(project.getAttachmentFileName());
    dbInstance.updateObject(reloadedProject);
    // invalide with removing from cache
    projectCache.remove(project.getProjectBroker().getKey().toString());
}
Also used : Project(org.olat.course.nodes.projectbroker.datamodel.Project) EventType(org.olat.course.nodes.projectbroker.datamodel.Project.EventType)

Example 2 with EventType

use of org.olat.course.nodes.projectbroker.datamodel.Project.EventType in project openolat by klemens.

the class ProjectBrokerManagerImpl method updateProjectAndInvalidateCache.

private void updateProjectAndInvalidateCache(final Project project) {
    // avoid hibernate exception : object with same identifier already exist in session.
    // reload object from db, because project is a detached object but could be already in hibernate session
    Project reloadedProject = (Project) dbInstance.loadObject(project, true);
    // set all value on reloadedProject with values from updated project
    reloadedProject.setTitle(project.getTitle());
    reloadedProject.setState(project.getState());
    for (Project.EventType eventType : Project.EventType.values()) {
        reloadedProject.setProjectEvent(project.getProjectEvent(eventType));
    }
    reloadedProject.setMaxMembers(project.getMaxMembers());
    reloadedProject.setMailNotificationEnabled(project.isMailNotificationEnabled());
    reloadedProject.setDescription(project.getDescription());
    for (int index = 0; index < project.getCustomFieldSize(); index++) {
        reloadedProject.setCustomFieldValue(index, project.getCustomFieldValue(index));
    }
    reloadedProject.setAttachedFileName(project.getAttachmentFileName());
    dbInstance.updateObject(reloadedProject);
    // invalide with removing from cache
    projectCache.remove(project.getProjectBroker().getKey().toString());
}
Also used : Project(org.olat.course.nodes.projectbroker.datamodel.Project) EventType(org.olat.course.nodes.projectbroker.datamodel.Project.EventType)

Aggregations

Project (org.olat.course.nodes.projectbroker.datamodel.Project)2 EventType (org.olat.course.nodes.projectbroker.datamodel.Project.EventType)2