View Javadoc
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 org.itracker.model.*;
22  
23  import java.util.Date;
24  import java.util.List;
25  import java.util.Locale;
26  import java.util.Set;
27  
28  
29  public interface ProjectService {
30  
31      public Project getProject(Integer projectId);
32  
33      public List<Project> getAllProjects();
34  
35      public List<Project> getAllAvailableProjects();
36  
37      public Component getProjectComponent(Integer componentId);
38  
39      public Component updateProjectComponent(Component component);
40  
41      public Component addProjectComponent(Integer projectId, Component component);
42  
43      public boolean removeProjectComponent(Integer projectId, Integer componentId);
44  
45      public Version getProjectVersion(Integer versionId);
46  
47      public Version updateProjectVersion(Version version);
48  
49      public Version addProjectVersion(Integer projectId, Version version);
50  
51      public boolean removeProjectVersion(Integer projectId, Integer versionId);
52  
53      public List<User> getProjectOwners(Integer projectId);
54  
55      public List<User> getListOfProjectOwners(Integer projectId);
56  
57      public boolean setProjectOwners(Project project, Set<Integer> newOwners);
58  
59      public List<CustomField> getProjectFields(Integer projectId);
60  
61      public List<CustomField> getListOfProjectFields(Integer projectId);
62  
63      public List<CustomField> getProjectFields(Integer projectId, Locale locale);
64  
65      public boolean setProjectFields(Project project, Set<Integer> newFields);
66  
67      public ProjectScript getProjectScript(Integer scriptId);
68  
69      public List<ProjectScript> getProjectScripts();
70  
71      public ProjectScript updateProjectScript(ProjectScript projectScript);
72  
73      public ProjectScript addProjectScript(Integer projectId, ProjectScript projectScript);
74  
75      public boolean removeProjectScript(Integer projectId, Integer scriptId);
76  
77      /**
78       * Counts the number of issues for a given component.
79       *
80       * @param componentId Id of the component to which the issues must be associated
81       * @return 0 if the component has no issues or doesn't exist
82       */
83      public Long countIssuesByComponent(Integer componentId);
84  
85      public Long getTotalNumberIssuesByProject(Integer projectId);
86  
87      public Long getTotalNumberOpenIssuesByProject(Integer projectId);
88  
89      public Long getTotalNumberResolvedIssuesByProject(Integer projectId);
90  
91      /**
92       * Counts the number of issues for a given version.
93       *
94       * @param versionId Id of the version to which the issues must be associated
95       * @return 0 if the version has no issues or doesn't exist
96       */
97      public Long countIssuesByVersion(Integer versionId);
98  
99      /**
100      * Returns the number of open and resolved issues in the given project.
101      * <p/>
102      * <p>PENDING: should use a class to hold statistics info to improve type-
103      * safety. </p>
104      *
105      * @return int[0] = open issues, int[1] = resolved issues
106      * @deprecated count open/closed issues with new methods: getTotalNumberOpenIssuesByProject, getTotalNumberResolvedIssuesByProject
107      */
108     public Long[] getProjectStats(Integer projectId);
109 
110     public Date getLatestIssueUpdatedDateByProjectId(Integer projectId);
111 
112     Project createProject(Project project, Integer userId);
113 
114     /**
115      * update a project, as the user with userId
116      *
117      * @return the updated project from Persistence
118      */
119     Project updateProject(Project project, Integer userId);
120 
121     /**
122      * Check if this project name is used by any of the projects which already exist in the database.
123      *
124      * @param updatedProjectId The updated project which will be use the new name.
125      * @return true if the name is unique.
126      */
127     Boolean isUniqueProjectName(String projectName, Integer updatedProjectId);
128 
129 }