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.CommandResult;
23 import de.smartics.maven.issue.command.ProductNavigationCommand;
24 import de.smartics.maven.issue.command.UpdateProductCommand;
25 import de.smartics.maven.issue.util.VersionHelper;
26
27
28
29
30 class MojoHelperProductUpdate extends AbstractMojoHelperProduct
31 {
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 protected MojoHelperProductUpdate(
52 final MavenProject project,
53 final MavenCommandFactory commandFactory, final Console console,
54 final ProductInfo productInfo)
55 {
56 super(project, commandFactory, console, productInfo);
57 }
58
59
60
61
62
63
64
65
66
67
68
69 void execute(final String oldProduct) throws MojoExecutionException,
70 MojoFailureException
71 {
72 final String version = VersionHelper.CURRENT;
73 final MojoHelperMilestone milestoneHelper =
74 new MojoHelperMilestone(project, commandFactory, console);
75 milestoneHelper.run(oldProduct, version);
76
77 final ProductNavigationCommand navigationCommand =
78 createProductNavigationCommand(oldProduct);
79 console.execute(navigationCommand);
80
81 final CommandResult<?> navigationResult = navigationCommand.getResult();
82 final String token = navigationResult.getToken();
83 final UpdateProductCommand updateProductCommand =
84 createUpdateProductCommand(oldProduct, token);
85 console.execute(updateProductCommand);
86
87 updateComponents();
88 }
89
90 private ProductNavigationCommand createProductNavigationCommand(
91 final String product)
92 {
93 final ProductNavigationCommand command =
94 commandFactory.createProductNavigationCommand(product);
95 return command;
96 }
97
98 private UpdateProductCommand createUpdateProductCommand(
99 final String oldProduct, final String token)
100 {
101 final String description = project.getDescription();
102 final String product = getProduct();
103 final String defaultMilestone = getDefaultMilestone();
104
105 final UpdateProductCommand command =
106 commandFactory.createUpdateProductCommand(oldProduct, product,
107 description, defaultMilestone, token);
108 return command;
109 }
110
111
112
113 }