001: package org.emforge.projectmanager;
002:
003: import java.util.Collection;
004:
005: import org.acegisecurity.AccessDeniedException;
006: import org.acegisecurity.userdetails.UserDetails;
007: import org.emforge.projectmanager.base.MilestoneDO;
008: import org.emforge.projectmanager.base.ProjectDO;
009:
010: import ru.emdev.EmForge.security.EmForgeUserDetails;
011: import ru.emdev.EmForge.security.dao.Role;
012:
013: /**
014: * ProjectService is responsible for all operations related to projects.<br>
015: * Service should be used everywhere (instead of currently used DAO) for security.<br>
016: * The mathods check if user allowed to do some action or not.<br>
017: * It is required to inform GUI about availability some actions.
018: *
019: * @author akakunin
020: */
021: public interface ProjectService {
022:
023: /** Predefined roles for Projects */
024: public static final String ROLE_MANAGER = "Manager";
025: public static final String ROLE_DEVELOPER = "Developer";
026: public static final String ROLE_TESTER = "Tester";
027: public static final String ROLE_USER = "User";
028:
029: /** Basic Project Operations */
030: public Collection<ProjectDO> getAllProjects()
031: throws AccessDeniedException, ProjectServiceException;
032:
033: /**
034: * Get Project by Id
035: *
036: * @param i_projectId
037: * @return null if specified project not found
038: * @throws AccessDeniedException
039: * @throws ProjectServiceException
040: */
041: public ProjectDO getProject(Long i_projectId)
042: throws AccessDeniedException, ProjectServiceException;
043:
044: /**
045: * @param i_projectId
046: * @return
047: */
048: public boolean canGetProject(Long i_projectId);
049:
050: /**
051: * Get project by Name
052: *
053: * @param i_projectWikiName
054: * @return null if specified project not found
055: * @throws AccessDeniedException
056: * @throws ProjectServiceException
057: */
058: public ProjectDO getProject(String i_projectWikiName)
059: throws AccessDeniedException, ProjectServiceException;
060:
061: /**
062: * @param i_projectWikiName
063: * @return
064: */
065: public boolean canGetProject(String i_projectWikiName);
066:
067: /**
068: * @param i_project
069: * @throws AccessDeniedException
070: * @throws ProjectServiceException
071: */
072: public void saveProject(ProjectDO i_project)
073: throws AccessDeniedException, ProjectServiceException;
074:
075: /**
076: * @return
077: */
078: public boolean canCreateProject();
079:
080: /**
081: * @param i_project
082: * @return
083: */
084: public boolean canChangeProject(ProjectDO i_project);
085:
086: /**
087: * @param i_project
088: * @throws AccessDeniedException
089: * @throws ProjectServiceException
090: */
091: public void deleteProject(ProjectDO i_project)
092: throws AccessDeniedException, ProjectServiceException;
093:
094: /**
095: * @param i_project
096: * @return
097: */
098: public boolean canDeleteProject(ProjectDO i_project);
099:
100: /** Add User into Project with specified Role */
101: public void addUser(ProjectDO i_project, UserDetails i_user,
102: Role i_role) throws AccessDeniedException,
103: ProjectServiceException;
104:
105: /** Delete User's Role from Project */
106: public void deleteUserRole(ProjectDO i_project, UserDetails i_user,
107: Role i_role) throws AccessDeniedException,
108: ProjectServiceException;
109:
110: /**
111: * Returns true - if specified user has specified role in project
112: */
113: public boolean hasRole(ProjectDO i_project, UserDetails i_user,
114: Role i_role) throws AccessDeniedException,
115: ProjectServiceException;
116:
117: /**
118: * Returns true - if specified user has specified role in project. Used role name as argument
119: */
120: public boolean hasRole(ProjectDO i_project, UserDetails i_user,
121: String i_role) throws AccessDeniedException,
122: ProjectServiceException;
123:
124: /**
125: * Returns Users with specified role
126: */
127: public Collection<EmForgeUserDetails> getUsers(ProjectDO i_project,
128: String i_roleName) throws AccessDeniedException,
129: ProjectServiceException;
130:
131: /**
132: * Returns Users with specified role
133: */
134: public Collection<EmForgeUserDetails> getUsers(ProjectDO i_project,
135: Role i_role) throws AccessDeniedException,
136: ProjectServiceException;
137:
138: /**
139: * Returns All users, has any role in the project
140: */
141: public Collection<EmForgeUserDetails> getAllProjectUsers(
142: ProjectDO i_project) throws AccessDeniedException,
143: ProjectServiceException;
144:
145: /**
146: * Returns Avialable Roles for specified Project
147: *
148: * @param i_project
149: * @return
150: */
151: public Collection<Role> getAvialableRoles(ProjectDO i_project)
152: throws AccessDeniedException, ProjectServiceException;
153:
154: /**
155: * @param i_milestoneId
156: * @return
157: * @throws AccessDeniedException
158: * @throws ProjectServiceException
159: */
160: public MilestoneDO getMilestone(Long i_milestoneId)
161: throws AccessDeniedException, ProjectServiceException;
162:
163: /**
164: * @param i_name
165: * @return
166: * @throws AccessDeniedException
167: * @throws ProjectServiceException
168: */
169: public MilestoneDO getMilestone(String i_name)
170: throws AccessDeniedException, ProjectServiceException;
171:
172: /**
173: * @param i_milestoneId
174: * @return
175: */
176: public boolean canGetMilestone(Long i_milestoneId);
177:
178: /**
179: * @param i_name
180: * @return
181: */
182: public boolean canGetMilestone(String i_name);
183:
184: /**
185: * @param i_project
186: * @return
187: * @throws AccessDeniedException
188: * @throws ProjectServiceException
189: */
190: public Collection<MilestoneDO> getMilestones(ProjectDO i_project)
191: throws AccessDeniedException, ProjectServiceException;
192:
193: /**
194: * @param i_project
195: * @return
196: * @throws AccessDeniedException
197: * @throws ProjectServiceException
198: */
199: public Collection<MilestoneDO> getOpenedMilestones(
200: ProjectDO i_project) throws AccessDeniedException,
201: ProjectServiceException;
202:
203: /**
204: * @param i_project
205: * @return
206: * @throws AccessDeniedException
207: * @throws ProjectServiceException
208: */
209: public Collection<MilestoneDO> getClosedMilestones(
210: ProjectDO i_project) throws AccessDeniedException,
211: ProjectServiceException;
212:
213: /**
214: * @param i_project
215: * @return
216: */
217: public boolean canGetMilestones(ProjectDO i_project);
218:
219: /**
220: * @param i_milestone
221: * @throws AccessDeniedException
222: * @throws ProjectServiceException
223: */
224: public void saveMilestone(MilestoneDO i_milestone)
225: throws AccessDeniedException, ProjectServiceException;
226:
227: /**
228: * @param i_project
229: * @return
230: */
231: public boolean canCreateMilestone(ProjectDO i_project);
232:
233: /**
234: * @param i_milestone
235: * @return
236: */
237: public boolean canChangeMilestone(MilestoneDO i_milestone);
238:
239: /**
240: * @param i_milestone
241: * @throws AccessDeniedException
242: * @throws ProjectServiceException
243: */
244: public void deleteMilestone(MilestoneDO i_milestone)
245: throws AccessDeniedException, ProjectServiceException;
246:
247: /**
248: * @param i_milestone
249: * @return
250: */
251: public boolean canDeleteMilestone(MilestoneDO i_milestone);
252:
253: /**
254: * @param project
255: */
256: public void initProjectRoles(ProjectDO project);
257: }
|