View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello
4    any modifications will be overwritten.
5    ==============================================================
6    */
7   
8   package org.apache.maven.continuum.xmlrpc.project;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import org.apache.continuum.xmlrpc.release.ContinuumReleaseResult;
15  import org.apache.continuum.xmlrpc.repository.AbstractPurgeConfiguration;
16  import org.apache.continuum.xmlrpc.repository.DirectoryPurgeConfiguration;
17  import org.apache.continuum.xmlrpc.repository.LocalRepository;
18  import org.apache.continuum.xmlrpc.repository.RepositoryPurgeConfiguration;
19  import org.apache.continuum.xmlrpc.utils.BuildTrigger;
20  import org.apache.maven.continuum.xmlrpc.scm.ChangeFile;
21  import org.apache.maven.continuum.xmlrpc.scm.ChangeSet;
22  import org.apache.maven.continuum.xmlrpc.scm.ScmResult;
23  import org.apache.maven.continuum.xmlrpc.system.Installation;
24  import org.apache.maven.continuum.xmlrpc.system.Profile;
25  import org.apache.maven.continuum.xmlrpc.system.SystemConfiguration;
26  
27  /**
28   * 
29   *         This class is the result of add maven project action.
30   *       
31   * 
32   * @version $Revision$ $Date$
33   */
34  @SuppressWarnings( "all" )
35  public class AddingResult
36      implements java.io.Serializable
37  {
38  
39        //--------------------------/
40       //- Class/Member Variables -/
41      //--------------------------/
42  
43      /**
44       * Field projects.
45       */
46      private java.util.List<ProjectSummary> projects;
47  
48      /**
49       * Field projectGroups.
50       */
51      private java.util.List<ProjectGroupSummary> projectGroups;
52  
53  
54        //-----------/
55       //- Methods -/
56      //-----------/
57  
58      /**
59       * Method addProject.
60       * 
61       * @param projectSummary
62       */
63      public void addProject( ProjectSummary projectSummary )
64      {
65          getProjects().add( projectSummary );
66      } //-- void addProject( ProjectSummary )
67  
68      /**
69       * Method addProjectGroup.
70       * 
71       * @param projectGroupSummary
72       */
73      public void addProjectGroup( ProjectGroupSummary projectGroupSummary )
74      {
75          getProjectGroups().add( projectGroupSummary );
76      } //-- void addProjectGroup( ProjectGroupSummary )
77  
78      /**
79       * Method getProjectGroups.
80       * 
81       * @return List
82       */
83      public java.util.List<ProjectGroupSummary> getProjectGroups()
84      {
85          if ( this.projectGroups == null )
86          {
87              this.projectGroups = new java.util.ArrayList<ProjectGroupSummary>();
88          }
89  
90          return this.projectGroups;
91      } //-- java.util.List<ProjectGroupSummary> getProjectGroups()
92  
93      /**
94       * Method getProjects.
95       * 
96       * @return List
97       */
98      public java.util.List<ProjectSummary> getProjects()
99      {
100         if ( this.projects == null )
101         {
102             this.projects = new java.util.ArrayList<ProjectSummary>();
103         }
104 
105         return this.projects;
106     } //-- java.util.List<ProjectSummary> getProjects()
107 
108     /**
109      * Method removeProject.
110      * 
111      * @param projectSummary
112      */
113     public void removeProject( ProjectSummary projectSummary )
114     {
115         getProjects().remove( projectSummary );
116     } //-- void removeProject( ProjectSummary )
117 
118     /**
119      * Method removeProjectGroup.
120      * 
121      * @param projectGroupSummary
122      */
123     public void removeProjectGroup( ProjectGroupSummary projectGroupSummary )
124     {
125         getProjectGroups().remove( projectGroupSummary );
126     } //-- void removeProjectGroup( ProjectGroupSummary )
127 
128     /**
129      * Set the projectGroups field.
130      * 
131      * @param projectGroups
132      */
133     public void setProjectGroups( java.util.List<ProjectGroupSummary> projectGroups )
134     {
135         this.projectGroups = projectGroups;
136     } //-- void setProjectGroups( java.util.List )
137 
138     /**
139      * Set the projects field.
140      * 
141      * @param projects
142      */
143     public void setProjects( java.util.List<ProjectSummary> projects )
144     {
145         this.projects = projects;
146     } //-- void setProjects( java.util.List )
147 
148     
149             private java.util.List errors = new java.util.ArrayList();
150 
151             /**
152              * Add an error that happened during adding the project to Continuum.
153              *
154              * @param errorKey error id (so it can be internationalized later)
155              */
156             public void addError( String errorKey )
157             {
158                 errors.add( errorKey );
159             }
160 
161             /**
162              * Get the errors that happened during adding the project to Continuum.
163              * There is an entry with the error key (so it can be internationalized later) for each error.
164              *
165              * @return {@link java.util.List} &lt; {@link String} >
166              */
167             public java.util.List getErrors()
168             {
169                 return errors;
170             }
171 
172             /**
173              * Quick check to see if there are any errors.
174              *
175              * @return boolean indicating if there are any errors.
176              */
177             public boolean hasErrors()
178             {
179                 return ( errors != null ) && ( !errors.isEmpty() );
180             }
181 
182             /**
183              * Returns a string representation of the errors.
184              *
185              * @return a string representation of the errors.
186              */
187             public String getErrorsAsString()
188             {
189                 if ( !hasErrors() )
190                 {
191                     return null;
192                 }
193 
194                 StringBuffer message = new StringBuffer();
195                 for ( java.util.Iterator i = errors.iterator(); i.hasNext(); )
196                 {
197                     String error = (String) i.next();
198                     message.append( error );
199                     message.append( "\n" );
200                 }
201                 return message.toString();
202             }
203           
204 }