Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jeteam.bean.project
Class ProjectServiceBeanImpl  view ProjectServiceBeanImpl download ProjectServiceBeanImpl.java

java.lang.Object
  extended byorg.jeteam.bean.project.ProjectServiceBean
      extended byorg.jeteam.bean.project.ProjectServiceBeanImpl
All Implemented Interfaces:
javax.ejb.EnterpriseBean, java.io.Serializable, javax.ejb.SessionBean

public class ProjectServiceBeanImpl
extends ProjectServiceBean
implements javax.ejb.SessionBean


Field Summary
private  javax.ejb.SessionContext context
           
 
Constructor Summary
ProjectServiceBeanImpl()
           
 
Method Summary
 void addRole(ProjectDTO project, org.jeteam.bean.security.RoleDTO role)
           Adds a new role this this project, this may allow other users to be assigned to this project.
 void addTask(ProjectDTO project, org.jeteam.bean.task.TaskDTO task)
           Assigns a new task to this project, if the task has already been assigned to this project nothing happens.
 void addUser(ProjectDTO project, org.jeteam.bean.user.UserDTO user)
           Assigns a new user to this project, if the user has already been assigned to this project nothing happens.
 void addUsers(ProjectDTO project, org.jeteam.bean.user.UserDTO[] users)
           Adds the list of users to the existing list associated with the argument project.
 void clearRoles(ProjectDTO project)
           Removes all roles from the project.
 void clearTasks(ProjectDTO project)
           Removes all the tasks that have been created for this project.
 void clearUsers(ProjectDTO project)
           Removes all users from this project.
 ProjectDTO createProject(ProjectDTO project)
           When creating a new project make sure the project name does not already exists.
 void ejbActivate()
           
 void ejbPassivate()
           
 void ejbRemove()
           
 ProjectDTO[] getAllProjects()
           Returns all projects that can be found.
 ProjectDTO[] getProjects()
           Getting the projects will only return the ones that have not been logically deleted, use getAllProjects() in case you need to retrieve the complete list of projects.
 org.jeteam.bean.security.RoleDTO[] getRoles(ProjectDTO project)
           Returns the collection of roles that users must have before being able to be assigned to this project.
 org.jeteam.bean.config.StatusDTO getStatus(ProjectDTO project)
           Gets the status of this project.
 org.jeteam.bean.task.TaskDTO[] getTasks(ProjectDTO project)
           Returns all the tasks that have been created for this project.
 org.jeteam.bean.user.UserDTO[] getUsers(ProjectDTO project)
           Returns all the users associated with this project.
 void removeProject(ProjectDTO project)
           Removing a project will result in setting its 'deleted' attribute to the current date (not null ) so it will be logically deleted.
 void removeRole(ProjectDTO project, org.jeteam.bean.security.RoleDTO role)
           Removes a role from the project.
 void removeTask(ProjectDTO project, org.jeteam.bean.task.TaskDTO task)
           Removes the specified task from the argument project.
 void removeUser(ProjectDTO project, org.jeteam.bean.user.UserDTO user)
           Removing a user from a project will result in removing the user from the relationship, it will not be deleted.
 void setSessionContext(javax.ejb.SessionContext ctx)
           
 void setStatus(ProjectDTO project, org.jeteam.bean.config.StatusDTO status)
           Sets the status of this project.
 void updateProject(ProjectDTO project)
           Updates this project's information, this can be either the name or the description.
private  ProjectLocal verifyProject(ProjectDTO project)
          Checks if the argument project would be valid if persisted, meaning the name would not collide with another project (project names must always be unique).
private  java.lang.String verifyProjectName(ProjectDTO project)
          Verifies whether the argument project has a valid name.
 
Methods inherited from class org.jeteam.bean.project.ProjectServiceBean
ejbCreate, ejbPostCreate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

private javax.ejb.SessionContext context
Constructor Detail

ProjectServiceBeanImpl

public ProjectServiceBeanImpl()
Method Detail

createProject

public ProjectDTO createProject(ProjectDTO project)
                         throws ProjectException
Description copied from class: ProjectServiceBean

When creating a new project make sure the project name does not already exists.

Specified by:
createProject in class ProjectServiceBean

removeProject

public void removeProject(ProjectDTO project)
                   throws ProjectException
Description copied from class: ProjectServiceBean

Removing a project will result in setting its 'deleted' attribute to the current date (not null ) so it will be logically deleted.

Specified by:
removeProject in class ProjectServiceBean

getProjects

public ProjectDTO[] getProjects()
                         throws ProjectException
Description copied from class: ProjectServiceBean

Getting the projects will only return the ones that have not been logically deleted, use getAllProjects() in case you need to retrieve the complete list of projects.

Specified by:
getProjects in class ProjectServiceBean

getAllProjects

public ProjectDTO[] getAllProjects()
                            throws ProjectException
Description copied from class: ProjectServiceBean

Returns all projects that can be found.

Specified by:
getAllProjects in class ProjectServiceBean

getUsers

public org.jeteam.bean.user.UserDTO[] getUsers(ProjectDTO project)
                                        throws ProjectException
Description copied from class: ProjectServiceBean

Returns all the users associated with this project.

Specified by:
getUsers in class ProjectServiceBean

removeUser

public void removeUser(ProjectDTO project,
                       org.jeteam.bean.user.UserDTO user)
                throws ProjectException
Description copied from class: ProjectServiceBean

Removing a user from a project will result in removing the user from the relationship, it will not be deleted.

Specified by:
removeUser in class ProjectServiceBean

clearUsers

public void clearUsers(ProjectDTO project)
                throws ProjectException
Description copied from class: ProjectServiceBean

Removes all users from this project.

Specified by:
clearUsers in class ProjectServiceBean

updateProject

public void updateProject(ProjectDTO project)
                   throws ProjectException
Description copied from class: ProjectServiceBean

Updates this project's information, this can be either the name or the description. The name can be changed but must remain unique.

Specified by:
updateProject in class ProjectServiceBean

addUser

public void addUser(ProjectDTO project,
                    org.jeteam.bean.user.UserDTO user)
             throws ProjectException
Description copied from class: ProjectServiceBean

Assigns a new user to this project, if the user has already been assigned to this project nothing happens.

Specified by:
addUser in class ProjectServiceBean

addTask

public void addTask(ProjectDTO project,
                    org.jeteam.bean.task.TaskDTO task)
             throws ProjectException
Description copied from class: ProjectServiceBean

Assigns a new task to this project, if the task has already been assigned to this project nothing happens.

Specified by:
addTask in class ProjectServiceBean

setStatus

public void setStatus(ProjectDTO project,
                      org.jeteam.bean.config.StatusDTO status)
               throws ProjectException
Description copied from class: ProjectServiceBean

Sets the status of this project.

Specified by:
setStatus in class ProjectServiceBean

getStatus

public org.jeteam.bean.config.StatusDTO getStatus(ProjectDTO project)
                                           throws ProjectException
Description copied from class: ProjectServiceBean

Gets the status of this project.

Specified by:
getStatus in class ProjectServiceBean

getRoles

public org.jeteam.bean.security.RoleDTO[] getRoles(ProjectDTO project)
                                            throws ProjectException
Description copied from class: ProjectServiceBean

Returns the collection of roles that users must have before being able to be assigned to this project. If a user has one of the roles associated to him/her, he can be assigned to the project.

Specified by:
getRoles in class ProjectServiceBean

addRole

public void addRole(ProjectDTO project,
                    org.jeteam.bean.security.RoleDTO role)
             throws ProjectException
Description copied from class: ProjectServiceBean

Adds a new role this this project, this may allow other users to be assigned to this project. If the role is already assinged to this project nothing happens.

Specified by:
addRole in class ProjectServiceBean

removeRole

public void removeRole(ProjectDTO project,
                       org.jeteam.bean.security.RoleDTO role)
                throws ProjectException
Description copied from class: ProjectServiceBean

Removes a role from the project.

This may cause for some confusion since all associated users that do not have roles anymore required by the project will be removed from the project.

Specified by:
removeRole in class ProjectServiceBean

clearRoles

public void clearRoles(ProjectDTO project)
                throws ProjectException
Description copied from class: ProjectServiceBean

Removes all roles from the project.

This will remove all associated users from this project, so use it with care!

Specified by:
clearRoles in class ProjectServiceBean

addUsers

public void addUsers(ProjectDTO project,
                     org.jeteam.bean.user.UserDTO[] users)
              throws ProjectException
Description copied from class: ProjectServiceBean

Adds the list of users to the existing list associated with the argument project.

Specified by:
addUsers in class ProjectServiceBean

getTasks

public org.jeteam.bean.task.TaskDTO[] getTasks(ProjectDTO project)
                                        throws ProjectException
Description copied from class: ProjectServiceBean

Returns all the tasks that have been created for this project.

Specified by:
getTasks in class ProjectServiceBean

clearTasks

public void clearTasks(ProjectDTO project)
                throws ProjectException
Description copied from class: ProjectServiceBean

Removes all the tasks that have been created for this project.

Specified by:
clearTasks in class ProjectServiceBean

removeTask

public void removeTask(ProjectDTO project,
                       org.jeteam.bean.task.TaskDTO task)
                throws ProjectException
Description copied from class: ProjectServiceBean

Removes the specified task from the argument project. The task must exist, and must be associated with the project.

Specified by:
removeTask in class ProjectServiceBean

verifyProject

private final ProjectLocal verifyProject(ProjectDTO project)
                                  throws ProjectException,
                                         java.lang.Exception
Checks if the argument project would be valid if persisted, meaning the name would not collide with another project (project names must always be unique).

There are two different scenarios: creation and updating.

Creation :
The argument does not have an Id (it is null), in this case the argument's name is checked for uniqueness.

Updating :
The argument has an Id (it is not null), in this case the argument's name is checked for uniqueness only if the name of the project matches the name of the project with the same id, because this would mean the project already needs update of its name.


verifyProjectName

private java.lang.String verifyProjectName(ProjectDTO project)
                                    throws ProjectException
Verifies whether the argument project has a valid name. It is checked if the name (or argument) is null or represents only whitespace or no characters at all.


setSessionContext

public void setSessionContext(javax.ejb.SessionContext ctx)
Specified by:
setSessionContext in interface javax.ejb.SessionBean

ejbRemove

public void ejbRemove()
Specified by:
ejbRemove in interface javax.ejb.SessionBean

ejbPassivate

public void ejbPassivate()
Specified by:
ejbPassivate in interface javax.ejb.SessionBean

ejbActivate

public void ejbActivate()
Specified by:
ejbActivate in interface javax.ejb.SessionBean