1   package com.atlassian.plugins.codegen;
2   
3   import static com.google.common.base.Preconditions.checkNotNull;
4   
5   /**
6    * Holds the new AMPS version that should be updated in the pom.
7    * If the POM already has an amps.version property, it will be updated. Otherwise a new property will be created.
8    * Also, if the amps plugin is using a hardcoded version, it will be updated to use the amps.version property.
9    */
10  public class AmpsVersionUpdate implements PluginProjectChange
11  {
12      public static final String PLUGIN = "plugin";
13      public static final String MANAGEMENT = "management";
14  
15      private final String version;
16      private final String type;
17      private final boolean applyConfig;
18      private final boolean applyProp;
19      
20  
21      public static AmpsVersionUpdate ampsVersionUpdate(String version,String type,boolean applyConfig,boolean applyProp)
22      {
23          return new AmpsVersionUpdate(version,type,applyConfig,applyProp);
24      }
25  
26      private AmpsVersionUpdate(String version, String type,boolean applyConfig,boolean applyProp)
27      {
28          this.version = checkNotNull(version, "version");
29          this.type = checkNotNull(type, "type");
30          this.applyConfig = applyConfig;
31          this.applyProp = applyProp;
32      }
33  
34      public String getVersion()
35      {
36          return version;
37      }
38  
39      public String getType()
40      {
41          return type;
42      }
43  
44      public boolean isApplyConfig()
45      {
46          return applyConfig;
47      }
48  
49      public boolean isApplyProp()
50      {
51          return applyProp;
52      }
53  
54      @Override
55      public String toString()
56      {
57          return "[AMPS " + type + " Version Update: " + version + "]";
58      }
59  }