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.bugzilla.command;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  import de.smartics.maven.issue.command.AbstractCommand;
22  import de.smartics.maven.issue.command.ClassificationNavigationCommand;
23  import de.smartics.maven.issue.command.CommandArgument;
24  import de.smartics.maven.issue.command.CommandResult.Page;
25  
26  /**
27   * Implementation of the {@link ClassificationNavigationCommand} for Bugzilla.
28   */
29  public final class BugzillaClassificationNavigationCommand extends
30      AbstractCommand<ClassificationNavigationCommand> implements
31      ClassificationNavigationCommand
32  {
33    // ********************************* Fields *********************************
34  
35    // --- constants ------------------------------------------------------------
36  
37    /**
38     * The class version identifier.
39     * <p>
40     * The value of this constant is {@value}.
41     * </p>
42     */
43    private static final long serialVersionUID = 1L;
44  
45    // --- members --------------------------------------------------------------
46  
47    // ****************************** Initializer *******************************
48  
49    // ****************************** Constructors ******************************
50  
51    /**
52     * Default constructor.
53     *
54     * @param service the service on the command target to call.
55     * @param classification the classification for the context to navigate.
56     */
57    protected BugzillaClassificationNavigationCommand(final String service,
58        final CommandArgument<ClassificationNavigationCommand> classification)
59    {
60      super(service, attachDefaulArguments(classification));
61    }
62  
63    // ****************************** Inner Classes *****************************
64  
65    // ********************************* Methods ********************************
66  
67    // --- init -----------------------------------------------------------------
68  
69    private static List<CommandArgument<ClassificationNavigationCommand>> attachDefaulArguments(
70        final CommandArgument<ClassificationNavigationCommand> classification)
71    {
72      final List<CommandArgument<ClassificationNavigationCommand>> allArguments =
73          new ArrayList<CommandArgument<ClassificationNavigationCommand>>(2);
74      final CommandArgument<ClassificationNavigationCommand> action =
75          CommandArgument.create(
76              ClassificationNavigationCommand.Parameter.ACTION, "add");
77      allArguments.add(action);
78      allArguments.add(classification);
79      return allArguments;
80    }
81  
82    // --- get&set --------------------------------------------------------------
83  
84    // --- business -------------------------------------------------------------
85  
86    /**
87     * Signals that token is required to be read.
88     *
89     * @return <code>true</code>.
90     */
91    protected boolean isTokenRequiredToRead()
92    {
93      return true;
94    }
95  
96    /**
97     * {@inheritDoc}
98     *
99     * @see de.smartics.maven.issue.command.AbstractCommand#checkExpectation(de.smartics.maven.issue.command.CommandResult.Page)
100    */
101   @Override
102   protected Expectation checkExpectation(final Page page)
103   {
104     return Expectation.NO_EXPECTATION;
105   }
106 
107   /**
108    * {@inheritDoc}
109    *
110    * @see de.smartics.maven.issue.command.AbstractCommand#getCommandResultDescription(Page,Expectation)
111    */
112   @Override
113   protected String getCommandResultDescription(final Page page,
114       final Expectation expectation)
115   {
116     return null;
117   }
118 
119   // --- object basics --------------------------------------------------------
120 
121 }