1 /*
2 * This software was designed and created by Jason Carroll.
3 * Copyright (c) 2002, 2003, 2004 Jason Carroll.
4 * The author can be reached at jcarroll@cowsultants.com
5 * ITracker website: http://www.cowsultants.com
6 * ITracker forums: http://www.cowsultants.com/phpBB/index.php
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it only under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19 package org.itracker.services;
20
21 import java.util.Date;
22 import java.util.List;
23 import java.util.Locale;
24 import java.util.Set;
25
26 import org.itracker.model.Component;
27 import org.itracker.model.CustomField;
28 import org.itracker.model.Project;
29 import org.itracker.model.ProjectScript;
30 import org.itracker.model.User;
31 import org.itracker.model.Version;
32
33
34 public interface ProjectService {
35
36 public Project getProject(Integer projectId);
37
38 public List<Project> getAllProjects();
39
40 public List<Project> getAllAvailableProjects();
41
42 public Component getProjectComponent(Integer componentId);
43
44 public Component updateProjectComponent(Component component);
45
46 public Component addProjectComponent(Integer projectId, Component component);
47
48 public boolean removeProjectComponent(Integer projectId, Integer componentId);
49
50 public Version getProjectVersion(Integer versionId);
51
52 public Version updateProjectVersion(Version version);
53
54 public Version addProjectVersion(Integer projectId, Version version);
55
56 public boolean removeProjectVersion(Integer projectId, Integer versionId);
57
58 public List<User> getProjectOwners(Integer projectId);
59
60 public List<User> getListOfProjectOwners(Integer projectId);
61
62 public boolean setProjectOwners(Project project, Set<Integer> newOwners) ;
63
64 public List<CustomField> getProjectFields(Integer projectId);
65
66 public List<CustomField> getListOfProjectFields(Integer projectId);
67
68 public List<CustomField> getProjectFields(Integer projectId, Locale locale);
69
70 public boolean setProjectFields(Project project, Set<Integer> newFields);
71
72 public ProjectScript getProjectScript(Integer scriptId);
73
74 public List<ProjectScript> getProjectScripts();
75
76 public ProjectScript updateProjectScript(ProjectScript projectScript);
77
78 public ProjectScript addProjectScript(Integer projectId, ProjectScript projectScript);
79
80 public boolean removeProjectScript(Integer projectId, Integer scriptId);
81
82 /**
83 * Counts the number of issues for a given component.
84 *
85 * @param componentId Id of the component to which the issues must be associated
86 * @return 0 if the component has no issues or doesn't exist
87 */
88 public Long countIssuesByComponent(Integer componentId);
89
90 public Long getTotalNumberIssuesByProject(Integer projectId);
91 public Long getTotalNumberOpenIssuesByProject(Integer projectId);
92 public Long getTotalNumberResolvedIssuesByProject(Integer projectId);
93
94 /**
95 * Counts the number of issues for a given version.
96 *
97 * @param versionId Id of the version to which the issues must be associated
98 * @return 0 if the version has no issues or doesn't exist
99 */
100 public Long countIssuesByVersion(Integer versionId);
101
102 /**
103 * Returns the number of open and resolved issues in the given project.
104 *
105 * <p>PENDING: should use a class to hold statistics info to improve type-
106 * safety. </p>
107 * @deprecated count open/closed issues with new methods: getTotalNumberOpenIssuesByProject, getTotalNumberResolvedIssuesByProject
108 *
109 * @return int[0] = open issues, int[1] = resolved issues
110 */
111 public Long[] getProjectStats(Integer projectId);
112
113 public Date getLatestIssueUpdatedDateByProjectId(Integer projectId);
114
115 /**
116 * Creates a new issue in a project.
117 * @param model an Issue representing the new issue information
118 * @param projectId the projectId the issue belongs to
119 * @param userId the id of registered creator of the new issue
120 * @param createdById the id of the actual creator of the issue. This would normally be the same as the userId.
121 * @return an Issue containing the newly created issue, or null if the create failed
122 */
123 Project createProject(Project project, Integer userId);
124
125 /**
126 * update a project, as the user with userId
127 * @param project
128 * @param userId
129 * @return the updated project from Persistence
130 */
131 Project updateProject(Project project, Integer userId);
132
133 /**
134 * Check if this project name is used by any of the projects which already exist in the database.
135 *
136 * @param projectName
137 * @param updatedProjectId The updated project which will be use the new name.
138 * @return true if the name is unique.
139 */
140 Boolean isUniqueProjectName(String projectName , Integer updatedProjectId );
141
142 }