View Javadoc

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