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 final MavenProject project, final MavenCommandFactory commandFactory,
65 final Console console, final String classification,
66 final ProductInfo productInfo, final String initialVersion)
67 {
68
69 super(project, commandFactory, console, productInfo);
70
71 this.classification = classification;
72 this.initialVersion = initialVersion;
73 }
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88 public void execute() throws MojoExecutionException, MojoFailureException
89 {
90 final ClassificationNavigationCommand navigationCommand =
91 createNavigationCommand(classification);
92 console.execute(navigationCommand);
93
94 final CommandResult<?> navigationResult = navigationCommand.getResult();
95 final String token = navigationResult.getToken();
96 final AddProductCommand addProductCommand =
97 createAddProductCommand(classification, token);
98 console.execute(addProductCommand);
99
100 updateComponents();
101 }
102
103 private ClassificationNavigationCommand createNavigationCommand(
104 final String classification)
105 {
106 final ClassificationNavigationCommand command =
107 commandFactory.createClassificationNavigationCommand(classification);
108 return command;
109 }
110
111 private AddProductCommand createAddProductCommand(
112 final String classification, final String token)
113 {
114 final String description = project.getDescription();
115 final String product = getProduct();
116 final String defaultMilestone = getDefaultMilestone();
117
118 final AddProductCommand command =
119 commandFactory.createAddProductCommand(classification, product,
120 description, defaultMilestone, initialVersion, token);
121 return command;
122 }
123
124
125
126 }