1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package de.smartics.maven.bugzilla;
17
18 import org.apache.maven.plugin.MojoExecutionException;
19 import org.apache.maven.plugin.MojoFailureException;
20 import org.apache.maven.project.MavenProject;
21
22 import de.smartics.maven.issue.command.AddProductCommand;
23 import de.smartics.maven.issue.command.ClassificationNavigationCommand;
24 import de.smartics.maven.issue.command.CommandResult;
25
26
27
28
29 final class MojoHelperProductAdd extends AbstractMojoHelperProduct
30 {
31
32
33
34
35
36
37
38
39
40
41 private final String classification;
42
43
44
45
46 private final String initialVersion;
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63 protected MojoHelperProductAdd(
64
65 final MavenProject project, final MavenCommandFactory commandFactory,
66 final Console console, final String classification,
67 final ProductInfo productInfo, final String initialVersion)
68 {
69
70 super(project, commandFactory, console, productInfo);
71
72 this.classification = classification;
73 this.initialVersion = initialVersion;
74 }
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89 public void execute() throws MojoExecutionException, MojoFailureException
90 {
91 final ClassificationNavigationCommand navigationCommand =
92 createNavigationCommand(classification);
93 console.execute(navigationCommand);
94
95 final CommandResult<?> navigationResult = navigationCommand.getResult();
96 final String token = navigationResult.getToken();
97 final AddProductCommand addProductCommand =
98 createAddProductCommand(classification, token);
99 console.execute(addProductCommand);
100
101 updateComponents();
102 }
103
104 private ClassificationNavigationCommand createNavigationCommand(
105 final String classification)
106 {
107 final ClassificationNavigationCommand command =
108 commandFactory.createClassificationNavigationCommand(classification);
109 return command;
110 }
111
112 private AddProductCommand createAddProductCommand(
113 final String classification, final String token)
114 throws MojoExecutionException
115 {
116 final String description = project.getDescription();
117 final String product = getProduct();
118 final String defaultMilestone = getDefaultMilestone();
119
120 final AddProductCommand command =
121 commandFactory.createAddProductCommand(classification, product,
122 description, defaultMilestone, initialVersion, token, productInfo,
123 getComponents());
124 return command;
125 }
126
127
128
129 }