org.olat.course.nodes.projectbroker.service
Class ProjectBrokerManagerImpl

java.lang.Object
  extended by org.olat.course.nodes.projectbroker.service.ProjectBrokerManagerImpl
All Implemented Interfaces:
ProjectBrokerManager, DeletableGroupData

public class ProjectBrokerManagerImpl
extends java.lang.Object
implements ProjectBrokerManager, DeletableGroupData

Author:
guretzki

Field Summary
 
Fields inherited from interface org.olat.course.nodes.projectbroker.service.ProjectBrokerManager
CUSTOMFIELD_LIST_DELIMITER
 
Method Summary
 boolean canBeCancelEnrollmentBy(Identity identity, Project project, ProjectBrokerModuleConfiguration moduleConfig)
          Return true when the project can be de-selected by an identity.
 boolean canBeProjectSelectedBy(Identity identity, Project project, ProjectBrokerModuleConfiguration moduleConfig, int nbrSelectedProjects, boolean isParticipantInAnyProject)
          return true, when the project can be selected by the user.
 boolean cancelProjectEnrollmentOf(Identity identity, Project project, ProjectBrokerModuleConfiguration moduleConfig)
          Remove certain identity as participant or candidate of a project (depending on project-broker configuration).
 DeletableReference checkIfReferenced(BusinessGroup group, java.util.Locale locale)
          Check if a group is used by deletable-group data element.
 ProjectBroker createAndSaveProjectBroker()
          Creates a new project-broker and save it.
 Project createAndSaveProjectFor(java.lang.String title, java.lang.String description, java.lang.Long projectBrokerId, BusinessGroup projectGroup)
          Create and save a new project.
 boolean deleteGroupDataFor(BusinessGroup group)
          Delete data for element which are be used by certain group.
 void deleteProject(Project project, boolean deleteGroup, CourseEnvironment courseEnv, CourseNode cNode)
          Delete a project and delete project-groups related to this project.
 void deleteProjectBroker(java.lang.Long projectBrokerId, CourseEnvironment courseEnvironment, CourseNode courseNode)
          Delete a project-broker and his projects and groups.
 boolean enrollProjectParticipant(Identity identity, Project project, ProjectBrokerModuleConfiguration moduleConfig, int nbrSelectedProjects, boolean isParticipantInAnyProject)
          Enroll certain identity as participant or candidate of a project (depending on project-broker configuration).
 boolean existProjectName(java.lang.Long projectBrokerId, java.lang.String newProjectTitle)
          Return true when a project with the same title already exist.
 java.lang.String getAttachmentBasePathRelToFolderRoot(CourseEnvironment courseEnvironment, CourseNode courseNode)
          Get attachment-folder relative path (without project-id).
 java.lang.String getAttamchmentRelativeRootPath(Project project, CourseEnvironment courseEnv, CourseNode cNode)
          Get attachment-file relative path.
 int getNbrSelectedProjects(Identity identity, java.util.List<Project> projectList)
          Get the number of total selected project for certain identity.
 java.lang.Long getProjectBrokerId(CoursePropertyManager cpm, CourseNode courseNode)
          Get saved project-broker-id.
 java.util.List<Project> getProjectListBy(java.lang.Long projectBrokerId)
          Returns a list of projects for certain project-broker.
 int getSelectedPlaces(Project project)
          Get number of selected places for certain project.
 java.lang.String getStateFor(Project project, Identity identity, ProjectBrokerModuleConfiguration moduleConfig)
          Get the state [STATE_ASSIGNED_ACCOUNT_MANAGER | STATE_NOT_ASSIGNED_ACCOUNT_MANAGER | STATE_NOT_ASSIGNED_ACCOUNT_MANAGER_NO_CANDIDATE | STATE_FINAL_ENROLLED | STATE_PROV_ENROLLED | STATE_COMPLETE | STATE_NOT_ASSIGNED | STATE_ENROLLED ] of a project
 boolean isCustomFieldValueValid(java.lang.String value, java.lang.String valueList)
          Return true when the custom-field value is one of possible-values (drop-down-mode) or when it could be any value (input field).
 boolean isParticipantInAnyProject(Identity identity, java.util.List<Project> projectList)
          return true, when identity is participant in any project of project-list.
 boolean isProjectCandidate(Identity identity, Project project)
           
 boolean isProjectManager(Identity identity, Project project)
          Check if a certain identity has the role of project-manager for certain project.
 boolean isProjectParticipant(Identity identity, Project project)
          Check if a certain identity is a participant of a project.
 void saveAttachedFile(Project project, java.lang.String fileName, VFSLeaf uploadedItem, CourseEnvironment courseEnv, CourseNode cNode)
          Save attachment file in the attachment-folder of a project.
 void saveProjectBrokerId(java.lang.Long projectBrokerId, CoursePropertyManager cpm, CourseNode courseNode)
          Save project-broker-id.
 void setProjectState(Project project, java.lang.String state)
          Set project-state [STATE_NOT_ASSIGNED | STATE_ASSIGNED].
 void signOutFormAllCandidateList(java.util.List<Identity> chosenIdentities, java.lang.Long projectBrokerId)
          Remove identities from all projects as candidates.
 void updateProject(Project project)
          Update and save an existing project.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProjectListBy

public java.util.List<Project> getProjectListBy(java.lang.Long projectBrokerId)
Description copied from interface: ProjectBrokerManager
Returns a list of projects for certain project-broker.

Specified by:
getProjectListBy in interface ProjectBrokerManager
Parameters:
projectbroker_id -
Returns:
List of projects for certain project-broker

createAndSaveProjectBroker

public ProjectBroker createAndSaveProjectBroker()
Description copied from interface: ProjectBrokerManager
Creates a new project-broker and save it.

Specified by:
createAndSaveProjectBroker in interface ProjectBrokerManager
Returns:

createAndSaveProjectFor

public Project createAndSaveProjectFor(java.lang.String title,
                                       java.lang.String description,
                                       java.lang.Long projectBrokerId,
                                       BusinessGroup projectGroup)
Description copied from interface: ProjectBrokerManager
Create and save a new project.

Specified by:
createAndSaveProjectFor in interface ProjectBrokerManager
Returns:

getSelectedPlaces

public int getSelectedPlaces(Project project)
Description copied from interface: ProjectBrokerManager
Get number of selected places for certain project.

Specified by:
getSelectedPlaces in interface ProjectBrokerManager
Returns:

isProjectManager

public boolean isProjectManager(Identity identity,
                                Project project)
Description copied from interface: ProjectBrokerManager
Check if a certain identity has the role of project-manager for certain project. Project-managers can edit, delete there projects. They can manage participants. They can lock into the drop-boxes and give feedback via return-boxes.

Specified by:
isProjectManager in interface ProjectBrokerManager
Returns:

updateProject

public void updateProject(Project project)
Description copied from interface: ProjectBrokerManager
Update and save an existing project.

Specified by:
updateProject in interface ProjectBrokerManager

isProjectParticipant

public boolean isProjectParticipant(Identity identity,
                                    Project project)
Description copied from interface: ProjectBrokerManager
Check if a certain identity is a participant of a project.

Specified by:
isProjectParticipant in interface ProjectBrokerManager
Returns:

isProjectCandidate

public boolean isProjectCandidate(Identity identity,
                                  Project project)

enrollProjectParticipant

public boolean enrollProjectParticipant(Identity identity,
                                        Project project,
                                        ProjectBrokerModuleConfiguration moduleConfig,
                                        int nbrSelectedProjects,
                                        boolean isParticipantInAnyProject)
Description copied from interface: ProjectBrokerManager
Enroll certain identity as participant or candidate of a project (depending on project-broker configuration).

Specified by:
enrollProjectParticipant in interface ProjectBrokerManager
Returns:

cancelProjectEnrollmentOf

public boolean cancelProjectEnrollmentOf(Identity identity,
                                         Project project,
                                         ProjectBrokerModuleConfiguration moduleConfig)
Description copied from interface: ProjectBrokerManager
Remove certain identity as participant or candidate of a project (depending on project-broker configuration).

Specified by:
cancelProjectEnrollmentOf in interface ProjectBrokerManager
Returns:

deleteProject

public void deleteProject(Project project,
                          boolean deleteGroup,
                          CourseEnvironment courseEnv,
                          CourseNode cNode)
Delete a project and delete project-groups related to this project. This method is cluster-save.

Specified by:
deleteProject in interface ProjectBrokerManager
deleteGroup - true: project group will be deleted too
See Also:
org.olat.course.nodes.projectbroker.service.ProjectBrokerManager#deleteProject(org.olat.course.nodes.projectbroker.datamodel.Project)

getNbrSelectedProjects

public int getNbrSelectedProjects(Identity identity,
                                  java.util.List<Project> projectList)
Description copied from interface: ProjectBrokerManager
Get the number of total selected project for certain identity.

Specified by:
getNbrSelectedProjects in interface ProjectBrokerManager
Returns:

canBeProjectSelectedBy

public boolean canBeProjectSelectedBy(Identity identity,
                                      Project project,
                                      ProjectBrokerModuleConfiguration moduleConfig,
                                      int nbrSelectedProjects,
                                      boolean isParticipantInAnyProject)
return true, when the project can be selected by the user.

Specified by:
canBeProjectSelectedBy in interface ProjectBrokerManager
Returns:
See Also:
org.olat.course.nodes.projectbroker.datamodel.Project#canBeSelectedBy(org.olat.core.id.Identity)

canBeCancelEnrollmentBy

public boolean canBeCancelEnrollmentBy(Identity identity,
                                       Project project,
                                       ProjectBrokerModuleConfiguration moduleConfig)
Description copied from interface: ProjectBrokerManager
Return true when the project can be de-selected by an identity.

Specified by:
canBeCancelEnrollmentBy in interface ProjectBrokerManager
Returns:

signOutFormAllCandidateList

public void signOutFormAllCandidateList(java.util.List<Identity> chosenIdentities,
                                        java.lang.Long projectBrokerId)
Description copied from interface: ProjectBrokerManager
Remove identities from all projects as candidates.

Specified by:
signOutFormAllCandidateList in interface ProjectBrokerManager

getStateFor

public java.lang.String getStateFor(Project project,
                                    Identity identity,
                                    ProjectBrokerModuleConfiguration moduleConfig)
Description copied from interface: ProjectBrokerManager
Get the state [STATE_ASSIGNED_ACCOUNT_MANAGER | STATE_NOT_ASSIGNED_ACCOUNT_MANAGER | STATE_NOT_ASSIGNED_ACCOUNT_MANAGER_NO_CANDIDATE | STATE_FINAL_ENROLLED | STATE_PROV_ENROLLED | STATE_COMPLETE | STATE_NOT_ASSIGNED | STATE_ENROLLED ] of a project

Specified by:
getStateFor in interface ProjectBrokerManager
Returns:

deleteProjectBroker

public void deleteProjectBroker(java.lang.Long projectBrokerId,
                                CourseEnvironment courseEnvironment,
                                CourseNode courseNode)
Description copied from interface: ProjectBrokerManager
Delete a project-broker and his projects and groups.

Specified by:
deleteProjectBroker in interface ProjectBrokerManager

saveAttachedFile

public void saveAttachedFile(Project project,
                             java.lang.String fileName,
                             VFSLeaf uploadedItem,
                             CourseEnvironment courseEnv,
                             CourseNode cNode)
Description copied from interface: ProjectBrokerManager
Save attachment file in the attachment-folder of a project.

Specified by:
saveAttachedFile in interface ProjectBrokerManager

isCustomFieldValueValid

public boolean isCustomFieldValueValid(java.lang.String value,
                                       java.lang.String valueList)
Description copied from interface: ProjectBrokerManager
Return true when the custom-field value is one of possible-values (drop-down-mode) or when it could be any value (input field).

Specified by:
isCustomFieldValueValid in interface ProjectBrokerManager
Returns:

getAttamchmentRelativeRootPath

public java.lang.String getAttamchmentRelativeRootPath(Project project,
                                                       CourseEnvironment courseEnv,
                                                       CourseNode cNode)
Description copied from interface: ProjectBrokerManager
Get attachment-file relative path. E.g. course//projectbroker_attach//

Specified by:
getAttamchmentRelativeRootPath in interface ProjectBrokerManager
Returns:

getAttachmentBasePathRelToFolderRoot

public java.lang.String getAttachmentBasePathRelToFolderRoot(CourseEnvironment courseEnvironment,
                                                             CourseNode courseNode)
Description copied from interface: ProjectBrokerManager
Get attachment-folder relative path (without project-id). THis path can be used to delete all attachment-file for certain project-broker. E.g. course//projectbroker_attach/

Specified by:
getAttachmentBasePathRelToFolderRoot in interface ProjectBrokerManager
Returns:

isParticipantInAnyProject

public boolean isParticipantInAnyProject(Identity identity,
                                         java.util.List<Project> projectList)
return true, when identity is participant in any project of project-list.

Specified by:
isParticipantInAnyProject in interface ProjectBrokerManager
Parameters:
identity -
projectList -
Returns:

deleteGroupDataFor

public boolean deleteGroupDataFor(BusinessGroup group)
Description copied from interface: DeletableGroupData
Delete data for element which are be used by certain group.

Specified by:
deleteGroupDataFor in interface DeletableGroupData
Parameters:
group - Delete data for this group
Returns:
true: data deleted , false: no data deleted

checkIfReferenced

public DeletableReference checkIfReferenced(BusinessGroup group,
                                            java.util.Locale locale)
Description copied from interface: DeletableGroupData
Check if a group is used by deletable-group data element. E.g. projectbroker has references to certain groups

Specified by:
checkIfReferenced in interface DeletableGroupData
Parameters:
group - Check reference for this group
locale - locale can be used to translate element-type. E.g. project-broker to Themenboerse
Returns:
DeletableReference object, when the group is used, deleteable.Reference.isReferenced return true

setProjectState

public void setProjectState(Project project,
                            java.lang.String state)
Description copied from interface: ProjectBrokerManager
Set project-state [STATE_NOT_ASSIGNED | STATE_ASSIGNED].

Specified by:
setProjectState in interface ProjectBrokerManager

getProjectBrokerId

public java.lang.Long getProjectBrokerId(CoursePropertyManager cpm,
                                         CourseNode courseNode)
Description copied from interface: ProjectBrokerManager
Get saved project-broker-id.

Specified by:
getProjectBrokerId in interface ProjectBrokerManager
Returns:

saveProjectBrokerId

public void saveProjectBrokerId(java.lang.Long projectBrokerId,
                                CoursePropertyManager cpm,
                                CourseNode courseNode)
Description copied from interface: ProjectBrokerManager
Save project-broker-id.

Specified by:
saveProjectBrokerId in interface ProjectBrokerManager

existProjectName

public boolean existProjectName(java.lang.Long projectBrokerId,
                                java.lang.String newProjectTitle)
Description copied from interface: ProjectBrokerManager
Return true when a project with the same title already exist.

Specified by:
existProjectName in interface ProjectBrokerManager
Returns: