View Javadoc
1   package io.apicurio.registry.maven;
2   
3   import io.apicurio.registry.rest.v3.beans.IfArtifactExists;
4   import io.apicurio.registry.types.ArtifactType;
5   
6   import java.io.File;
7   import java.util.List;
8   
9   public class RegisterArtifact {
10  
11      public List<File> getProtoPaths() {
12          return protoPaths;
13      }
14  
15      public void setProtoPaths(List<File> protoPaths) {
16          this.protoPaths = protoPaths;
17      }
18  
19      public enum AvroAutoRefsNamingStrategy {
20          INHERIT_PARENT_GROUP, USE_AVRO_NAMESPACE
21      }
22  
23      public enum VersionStrategy {
24          EXPLICIT_ONLY, API_INFO_VERSION
25      }
26  
27      private String groupId;
28      private String artifactId;
29      private String version;
30      private String artifactType;
31      private File file;
32      private IfArtifactExists ifExists;
33      private Boolean canonicalize;
34      private Boolean minify;
35      private Boolean autoRefs;
36      private AvroAutoRefsNamingStrategy avroAutoRefsNamingStrategy;
37      private Boolean isDraft;
38      private String contentType;
39      private VersionStrategy versionStrategy;
40      private List<RegisterArtifactReference> references;
41      private List<ExistingReference> existingReferences;
42      private List<File> protoPaths;
43  
44      /**
45       * Constructor.
46       */
47      public RegisterArtifact() {
48      }
49  
50      /**
51       * @return the groupId
52       */
53      public String getGroupId() {
54          return groupId;
55      }
56  
57      /**
58       * @param groupId the groupId to set
59       */
60      public void setGroupId(String groupId) {
61          this.groupId = groupId;
62      }
63  
64      /**
65       * @return the artifactId
66       */
67      public String getArtifactId() {
68          return artifactId;
69      }
70  
71      /**
72       * @param artifactId the artifactId to set
73       */
74      public void setArtifactId(String artifactId) {
75          this.artifactId = artifactId;
76      }
77  
78      /**
79       * @return the file
80       */
81      public File getFile() {
82          return file;
83      }
84  
85      /**
86       * @param file the file to set
87       */
88      public void setFile(File file) {
89          this.file = file;
90      }
91  
92      /**
93       * @return the ifExists
94       */
95      public IfArtifactExists getIfExists() {
96          return ifExists;
97      }
98  
99      /**
100      * @param ifExists the ifExists to set
101      */
102     public void setIfExists(IfArtifactExists ifExists) {
103         this.ifExists = ifExists;
104     }
105 
106     /**
107      * @return the canonicalize
108      */
109     public Boolean getCanonicalize() {
110         return canonicalize;
111     }
112 
113     /**
114      * @param canonicalize the canonicalize to set
115      */
116     public void setCanonicalize(Boolean canonicalize) {
117         this.canonicalize = canonicalize;
118     }
119 
120     /**
121      * @return the minify
122      */
123     public Boolean getMinify() {
124         return minify;
125     }
126 
127     /**
128      * @param minify the minify to set
129      */
130     public void setMinify(Boolean minify) {
131         this.minify = minify;
132     }
133 
134     /**
135      * @return the artifactType
136      */
137     public String getArtifactType() {
138         return artifactType;
139     }
140 
141     /**
142      * @param artifactType the artifact type to set
143      */
144     public void setArtifactType(String artifactType) {
145         this.artifactType = artifactType;
146     }
147 
148     /**
149      * @return the version
150      */
151     public String getVersion() {
152         return version;
153     }
154 
155     /**
156      * @param version the version to set
157      */
158     public void setVersion(String version) {
159         this.version = version;
160     }
161 
162     /**
163      * @return the content type
164      */
165     public String getContentType() {
166         return contentType;
167     }
168 
169     /**
170      * @param contentType the contentType to set
171      */
172     public void setContentType(String contentType) {
173         this.contentType = contentType;
174     }
175 
176     public VersionStrategy getVersionStrategy() {
177         return versionStrategy == null ? VersionStrategy.EXPLICIT_ONLY : versionStrategy;
178     }
179 
180     public void setVersionStrategy(VersionStrategy versionStrategy) {
181         this.versionStrategy = versionStrategy;
182     }
183 
184     /**
185      * @return the referenced artifacts
186      */
187     public List<RegisterArtifactReference> getReferences() {
188         return references;
189     }
190 
191     /**
192      * @param references the references to set
193      */
194     public void setReferences(List<RegisterArtifactReference> references) {
195         this.references = references;
196     }
197 
198     public Boolean getAutoRefs() {
199         return autoRefs;
200     }
201 
202     public void setAutoRefs(Boolean autoRefs) {
203         this.autoRefs = autoRefs;
204     }
205 
206     public AvroAutoRefsNamingStrategy getAvroAutoRefsNamingStrategy() {
207         if(Boolean.TRUE.equals(autoRefs) && avroAutoRefsNamingStrategy == null) {
208             if(ArtifactType.AVRO.equals(artifactType)) {
209                 return AvroAutoRefsNamingStrategy.USE_AVRO_NAMESPACE;
210             }
211             if(ArtifactType.ASYNCAPI.equals(artifactType)) {
212                 return AvroAutoRefsNamingStrategy.INHERIT_PARENT_GROUP;
213             }
214             return AvroAutoRefsNamingStrategy.INHERIT_PARENT_GROUP;
215         }
216         return avroAutoRefsNamingStrategy;
217     }
218 
219     public void setAvroAutoRefsNamingStrategy(AvroAutoRefsNamingStrategy avroAutoRefsNamingStrategy) {
220         this.avroAutoRefsNamingStrategy = avroAutoRefsNamingStrategy;
221     }
222 
223     public Boolean getIsDraft() {
224         return isDraft;
225     }
226 
227     public void setIsDraft(Boolean isDraft) {
228        this.isDraft = isDraft;
229     }
230 
231     public List<ExistingReference> getExistingReferences() {
232         return existingReferences;
233     }
234 
235     public void setExistingReferences(List<ExistingReference> existingReferences) {
236         this.existingReferences = existingReferences;
237     }
238 }