View Javadoc

1   /*
2    * Copyright 2012-2013 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.issue.command;
17  
18  /**
19   * Factory interface to create commands.
20   */
21  public interface CommandFactory
22  {
23    // ********************************* Fields *********************************
24  
25    // --- constants ------------------------------------------------------------
26  
27    // ****************************** Initializer *******************************
28  
29    // ****************************** Inner Classes *****************************
30  
31    // ********************************* Methods ********************************
32  
33    // --- get&set --------------------------------------------------------------
34  
35    // --- business -------------------------------------------------------------
36  
37    /**
38     * Creates a command to navigate in the context of a selected classification.
39     *
40     * @param service the service on the command target to call.
41     * @param classification the classification that defines the context.
42     * @return the command instance.
43     */
44    ClassificationNavigationCommand createClassificationNavigationCommand(
45        String service,
46        CommandArgument<ClassificationNavigationCommand> classification);
47  
48    /**
49     * Creates a command to navigate in the context of a selected product using
50     * <code>add</code> action.
51     *
52     * @param service the service on the command target to call.
53     * @param product the product that defines the context.
54     * @return the command instance.
55     */
56    ProductNavigationCommand createProductNavigationCommand(String service,
57        CommandArgument<ProductNavigationCommand> product);
58  
59    /**
60     * Creates a command to navigate in the context of a selected product.
61     *
62     * @param service the service on the command target to call.
63     * @param action the action to execute.
64     * @param product the product that defines the context.
65     * @return the command instance.
66     */
67    ProductNavigationCommand createProductNavigationCommand(String service,
68        CommandArgument<ProductNavigationCommand> action,
69        CommandArgument<ProductNavigationCommand> product);
70  
71    /**
72     * Creates a command instance to add a new version to the issue management
73     * system.
74     *
75     * @param product the product to add the version to.
76     * @param version the version to add.
77     * @param token the token from the previous command to help the browser to
78     *          secure the request.
79     * @return the command instance.
80     */
81    AddVersionCommand createAddVersionCommand(
82        CommandArgument<AddVersionCommand> product,
83        CommandArgument<AddVersionCommand> version,
84        CommandArgument<AddVersionCommand> token);
85  
86    /**
87     * Creates a command instance to add a new milestone to the issue management
88     * system.
89     *
90     * @param product the product to add the version to.
91     * @param milestone the milestone to add.
92     * @param sortkey the sortkey for the milestone.
93     * @param token the token from the previous command to help the browser to
94     *          secure the request.
95     * @return the command instance.
96     */
97    AddMilestoneCommand createAddMilestoneCommand(
98        CommandArgument<AddMilestoneCommand> product,
99        CommandArgument<AddMilestoneCommand> milestone,
100       CommandArgument<AddMilestoneCommand> sortkey,
101       CommandArgument<AddMilestoneCommand> token);
102 
103   // CHECKSTYLE:OFF
104   /**
105    * Creates a command instance to add a new product to the issue management
106    * system.
107    *
108    * @param classification the classification for the product.
109    * @param product the product to add the version to.
110    * @param description the description to the product.
111    * @param defaultMilestone the initial default milestone of the product.
112    * @param version the first version of the product.
113    * @param token the token from the previous command to help the browser to
114    *          secure the request.
115    * @return the command instance.
116    */
117   AddProductCommand createAddProductCommand(
118       // NOPMD
119       CommandArgument<AddProductCommand> classification,
120       CommandArgument<AddProductCommand> product,
121       CommandArgument<AddProductCommand> description,
122       CommandArgument<AddProductCommand> defaultMilestone,
123       CommandArgument<AddProductCommand> version,
124       CommandArgument<AddProductCommand> token);
125 
126   /**
127    * Creates a command instance to add a new product to the issue management
128    * system.
129    *
130    * @param classification the classification for the product.
131    * @param product the product to add the version to.
132    * @param description the description to the product.
133    * @param defaultMilestone the initial default milestone of the product.
134    * @param version the first version of the product.
135    * @param token the token from the previous command to help the browser to
136    *          secure the request.
137    * @param component the component to add on product creation.
138    * @param componentDescription the description to the component.
139    * @param componentInitialOwner the initial owner of the component.
140    * @return the command instance.
141    */
142   AddProductCommand createAddProductCommand(
143       // NOPMD
144       CommandArgument<AddProductCommand> classification,
145       CommandArgument<AddProductCommand> product,
146       CommandArgument<AddProductCommand> description,
147       CommandArgument<AddProductCommand> defaultMilestone,
148       CommandArgument<AddProductCommand> version,
149       CommandArgument<AddProductCommand> token,
150       CommandArgument<AddProductCommand> component,
151       CommandArgument<AddProductCommand> componentDescription,
152       CommandArgument<AddProductCommand> componentInitialOwner);
153 
154   // CHECKSTYLE:ON
155 
156   // CHECKSTYLE:OFF
157   /**
158    * Creates a command instance to update an existing product to the issue
159    * management system.
160    *
161    * @param oldProduct the current name of the product.
162    * @param product the product to add the version to.
163    * @param description the description to the product.
164    * @param defaultMilestone the initial default milestone of the product.
165    * @param token the token from the previous command to help the browser to
166    *          secure the request.
167    * @return the command instance.
168    */
169   UpdateProductCommand createUpdateProductCommand(
170       // NOPMD
171       CommandArgument<UpdateProductCommand> oldProduct,
172       CommandArgument<UpdateProductCommand> product,
173       CommandArgument<UpdateProductCommand> description,
174       CommandArgument<UpdateProductCommand> defaultMilestone,
175       CommandArgument<UpdateProductCommand> token);
176 
177   // CHECKSTYLE:ON
178 
179   /**
180    * Creates a command instance to add a new component to a product to the issue
181    * management system.
182    *
183    * @param product the product to add the version to.
184    * @param component the name of the component to add to the product.
185    * @param description the description to the product.
186    * @param initialOwner the initial owner for issues to this component.
187    * @param token the token from the previous command to help the browser to
188    *          secure the request.
189    * @return the command instance.
190    */
191   AddComponentCommand createAddComponentCommand(
192       CommandArgument<AddComponentCommand> product,
193       CommandArgument<AddComponentCommand> component,
194       CommandArgument<AddComponentCommand> description,
195       CommandArgument<AddComponentCommand> initialOwner,
196       CommandArgument<AddComponentCommand> token);
197 
198   /**
199    * Creates a command instance to authenticate against the issue management
200    * system.
201    *
202    * @param login the login name for authentication.
203    * @param password the password for authentication.
204    * @return the command instance.
205    */
206   LoginCommand createLoginCommand(CommandArgument<LoginCommand> login,
207       CommandArgument<LoginCommand> password);
208 
209   /**
210    * Creates a command instance to logout from the issue management system.
211    *
212    * @return the command instance.
213    */
214   LogoutCommand createLogoutCommand();
215 
216   /**
217    * Checks if on creation of a new product, components have to be registered.
218    *
219    * @return <code>true</code> if at least on component has to be added on
220    *         creation of a product, <code>false</code> if a product can be
221    *         created without a component.
222    */
223   boolean requiresComponentOnProductCreation();
224 
225   // --- object basics --------------------------------------------------------
226 
227 }