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