View Javadoc

1   /*
2    * Copyright 2012 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.maven.bugzilla.command;
17  
18  import de.smartics.maven.issue.command.AddComponentCommand;
19  import de.smartics.maven.issue.command.AddMilestoneCommand;
20  import de.smartics.maven.issue.command.AddProductCommand;
21  import de.smartics.maven.issue.command.AddVersionCommand;
22  import de.smartics.maven.issue.command.ClassificationNavigationCommand;
23  import de.smartics.maven.issue.command.CommandArgument;
24  import de.smartics.maven.issue.command.CommandFactory;
25  import de.smartics.maven.issue.command.LoginCommand;
26  import de.smartics.maven.issue.command.LogoutCommand;
27  import de.smartics.maven.issue.command.ProductNavigationCommand;
28  import de.smartics.maven.issue.command.UpdateProductCommand;
29  
30  /**
31   * A factory for command to run against a Bugzilla issue management system.
32   */
33  public final class BugzillaCommandFactory implements CommandFactory
34  {
35    // ********************************* Fields *********************************
36  
37    // --- constants ------------------------------------------------------------
38  
39    // --- members --------------------------------------------------------------
40  
41    // ****************************** Initializer *******************************
42  
43    // ****************************** Constructors ******************************
44  
45    /**
46     * Default constructor.
47     */
48    public BugzillaCommandFactory()
49    {
50    }
51  
52    // ****************************** Inner Classes *****************************
53  
54    // ********************************* Methods ********************************
55  
56    // --- init -----------------------------------------------------------------
57  
58    // --- get&set --------------------------------------------------------------
59  
60    // --- business -------------------------------------------------------------
61  
62    /**
63     * {@inheritDoc}
64     *
65     * @see de.smartics.maven.issue.command.CommandFactory#createClassificationNavigationCommand(java.lang.String,
66     *      de.smartics.maven.issue.command.CommandArgument)
67     */
68    @Override
69    public ClassificationNavigationCommand createClassificationNavigationCommand(
70        final String service,
71        final CommandArgument<ClassificationNavigationCommand> classification)
72    {
73      return new BugzillaClassificationNavigationCommand(service, classification);
74    }
75  
76    /**
77     * {@inheritDoc}
78     *
79     * @see de.smartics.maven.issue.command.CommandFactory#createProductNavigationCommand(String,de.smartics.maven.issue.command.CommandArgument)
80     */
81    @Override
82    public ProductNavigationCommand createProductNavigationCommand(
83        final String service,
84        final CommandArgument<ProductNavigationCommand> product)
85    {
86      return new BugzillaProductNavigationCommand(service, product);
87    }
88  
89    /**
90     * {@inheritDoc}
91     *
92     * @see de.smartics.maven.issue.command.CommandFactory#createProductNavigationCommand(String,de.smartics.maven.issue.command.CommandArgument,de.smartics.maven.issue.command.CommandArgument)
93     */
94    @Override
95    public ProductNavigationCommand createProductNavigationCommand(
96        final String service,
97        final CommandArgument<ProductNavigationCommand> action,
98        final CommandArgument<ProductNavigationCommand> product)
99    {
100     return new BugzillaProductNavigationCommand(service, action, product);
101   }
102 
103   /**
104    * {@inheritDoc}
105    *
106    * @see de.smartics.maven.issue.command.CommandFactory#createAddVersionCommand(de.smartics.maven.issue.command.CommandArgument,
107    *      de.smartics.maven.issue.command.CommandArgument,
108    *      de.smartics.maven.issue.command.CommandArgument)
109    */
110   @Override
111   public AddVersionCommand createAddVersionCommand(
112       final CommandArgument<AddVersionCommand> product,
113       final CommandArgument<AddVersionCommand> version,
114       final CommandArgument<AddVersionCommand> token)
115   {
116     return new BugzillaAddVersionCommand(product, version, token);
117   }
118 
119   /**
120    * {@inheritDoc}
121    *
122    * @see de.smartics.maven.issue.command.CommandFactory#createAddMilestoneCommand(de.smartics.maven.issue.command.CommandArgument,
123    *      de.smartics.maven.issue.command.CommandArgument,
124    *      de.smartics.maven.issue.command.CommandArgument,
125    *      de.smartics.maven.issue.command.CommandArgument)
126    */
127   @Override
128   public AddMilestoneCommand createAddMilestoneCommand(
129       final CommandArgument<AddMilestoneCommand> product,
130       final CommandArgument<AddMilestoneCommand> milestone,
131       final CommandArgument<AddMilestoneCommand> sortkey,
132       final CommandArgument<AddMilestoneCommand> token)
133   {
134     return new BugzillaAddMilestoneCommand(product, milestone, sortkey, token);
135   }
136 
137   /**
138    * {@inheritDoc}
139    *
140    * @see de.smartics.maven.issue.command.CommandFactory#createAddVersionCommand(de.smartics.maven.issue.command.CommandArgument,
141    *      de.smartics.maven.issue.command.CommandArgument)
142    */
143   public LoginCommand createLoginCommand(
144       final CommandArgument<LoginCommand> login,
145       final CommandArgument<LoginCommand> password)
146   {
147     return new BugzillaLoginCommand(login, password);
148   }
149 
150   /**
151    * {@inheritDoc}
152    *
153    * @see de.smartics.maven.issue.command.CommandFactory#createLogoutCommand(de.smartics.maven.issue.command.CommandArgument,
154    *      de.smartics.maven.issue.command.CommandArgument)
155    */
156   @Override
157   public LogoutCommand createLogoutCommand()
158   {
159     return new BugzillaLogoutCommand();
160   }
161 
162   // CHECKSTYLE:OFF
163   /**
164    * {@inheritDoc}
165    *
166    * @see de.smartics.maven.issue.command.CommandFactory#createAddProductCommand(de.smartics.maven.issue.command.CommandArgument,
167    *      de.smartics.maven.issue.command.CommandArgument,
168    *      de.smartics.maven.issue.command.CommandArgument,
169    *      de.smartics.maven.issue.command.CommandArgument,
170    *      de.smartics.maven.issue.command.CommandArgument,
171    *      de.smartics.maven.issue.command.CommandArgument)
172    */
173   @Override
174   public AddProductCommand createAddProductCommand(// NOPMD
175       final CommandArgument<AddProductCommand> classification,
176       final CommandArgument<AddProductCommand> product,
177       final CommandArgument<AddProductCommand> description,
178       final CommandArgument<AddProductCommand> defaultMilestone,
179       final CommandArgument<AddProductCommand> version,
180       final CommandArgument<AddProductCommand> token)
181   {
182     return new BugzillaAddProductCommand(classification, product, description,
183         defaultMilestone, version, token);
184   }
185 
186   // CHECKSTYLE:ON
187 
188   // CHECKSTYLE:OFF
189   /**
190    * {@inheritDoc}
191    *
192    * @see de.smartics.maven.issue.command.CommandFactory#createUpdateProductCommand(de.smartics.maven.issue.command.CommandArgument,
193    *      de.smartics.maven.issue.command.CommandArgument,
194    *      de.smartics.maven.issue.command.CommandArgument,
195    *      de.smartics.maven.issue.command.CommandArgument,
196    *      de.smartics.maven.issue.command.CommandArgument)
197    */
198   @Override
199   public UpdateProductCommand createUpdateProductCommand(// NOPMD
200       final CommandArgument<UpdateProductCommand> oldProduct,
201       final CommandArgument<UpdateProductCommand> product,
202       final CommandArgument<UpdateProductCommand> description,
203       final CommandArgument<UpdateProductCommand> defaultMilestone,
204       final CommandArgument<UpdateProductCommand> token)
205   {
206     return new BugzillaUpdateProductCommand(oldProduct, product, description,
207         defaultMilestone, token);
208   }
209 
210   // CHECKSTYLE:ON
211 
212   /**
213    * {@inheritDoc}
214    *
215    * @see de.smartics.maven.issue.command.CommandFactory#createAddComponentCommand(de.smartics.maven.issue.command.CommandArgument,
216    *      de.smartics.maven.issue.command.CommandArgument,
217    *      de.smartics.maven.issue.command.CommandArgument,
218    *      de.smartics.maven.issue.command.CommandArgument,
219    *      de.smartics.maven.issue.command.CommandArgument)
220    */
221   @Override
222   public AddComponentCommand createAddComponentCommand(
223       final CommandArgument<AddComponentCommand> product,
224       final CommandArgument<AddComponentCommand> component,
225       final CommandArgument<AddComponentCommand> description,
226       final CommandArgument<AddComponentCommand> initialOwner,
227       final CommandArgument<AddComponentCommand> token)
228   {
229     return new BugzillaAddComponentCommand(product, component, description,
230         initialOwner, token);
231   }
232 
233   // --- object basics --------------------------------------------------------
234 
235 }