View Javadoc
1   /*
2    * Copyright 2009 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *     
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.commons.ihe.xds.core.metadata;
17  
18  import lombok.EqualsAndHashCode;
19  import lombok.Getter;
20  import lombok.Setter;
21  import lombok.ToString;
22  import org.openehealth.ipf.commons.ihe.xds.core.ExtraMetadataHolder;
23  import org.openehealth.ipf.commons.ihe.xds.core.metadata.jaxbadapters.StringMap;
24  import org.openehealth.ipf.commons.ihe.xds.core.metadata.jaxbadapters.StringMapAdapter;
25  
26  import javax.xml.bind.annotation.XmlAccessType;
27  import javax.xml.bind.annotation.XmlAccessorType;
28  import javax.xml.bind.annotation.XmlElement;
29  import javax.xml.bind.annotation.XmlRootElement;
30  import javax.xml.bind.annotation.XmlType;
31  import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
32  import java.io.Serializable;
33  import java.util.List;
34  import java.util.Map;
35  
36  /**
37   * Represents an XDS association.
38   * <p>
39   * All members of this class are allowed to be <code>null</code>.
40   * @author Jens Riemschneider
41   */
42  @XmlAccessorType(XmlAccessType.FIELD)
43  @XmlType(name = "Association", propOrder = {
44          "entryUuid", "sourceUuid", "targetUuid", "associationType", "label", "docCode",
45          "previousVersion", "originalStatus", "newStatus", "associationPropagation", "availabilityStatus",
46          "extraMetadata"})
47  @XmlRootElement(name = "association")
48  @EqualsAndHashCode(doNotUseGetters = true)
49  @ToString(doNotUseGetters = true)
50  public class Association implements Serializable, ExtraMetadataHolder {
51  
52      private static final long serialVersionUID = -4556980177483609469L;
53  
54      private String targetUuid;
55      private String sourceUuid;
56      private AssociationType associationType;
57      private AssociationLabel label;
58      private String entryUuid;
59      private Code docCode;
60      private String previousVersion;
61      private AvailabilityStatus originalStatus;
62      private AvailabilityStatus newStatus;
63      private Boolean associationPropagation;
64      private AvailabilityStatus availabilityStatus;
65  
66      @XmlJavaTypeAdapter(StringMapAdapter.class)
67      @XmlElement(name = "extraMetadata", type = StringMap.class)
68      @Getter @Setter private Map<String, List<String>> extraMetadata;
69  
70      /**
71       * Constructs an association.
72       */
73      public Association() {}
74      
75      /**
76       * Constructs an association.
77       * @param associationType
78       *          the type of the association.
79       * @param entryUuid
80       *          UUID of the association entry.
81       * @param sourceUuid
82       *          the UUID of the source object.
83       * @param targetUuid
84       *          the UUID of the target object.
85       */
86      public Association(AssociationType associationType, String entryUuid, String sourceUuid, String targetUuid) {
87          this.associationType = associationType;
88          this.entryUuid = entryUuid;
89          this.sourceUuid = sourceUuid;
90          this.targetUuid = targetUuid;
91      }
92  
93      /**
94       * @return the UUID of the target object.
95       */
96      public String getTargetUuid() {
97          return targetUuid;
98      }
99  
100     /**
101      * @param targetUuid
102      *          the UUID of the target object.
103      */
104     public void setTargetUuid(String targetUuid) {
105         this.targetUuid = targetUuid;
106     }
107 
108     /**
109      * @return the UUID of the source object.
110      */
111     public String getSourceUuid() {
112         return sourceUuid;
113     }
114 
115     /**
116      * @param sourceUuid
117      *          the UUID of the source object.
118      */
119     public void setSourceUuid(String sourceUuid) {
120         this.sourceUuid = sourceUuid;
121     }
122 
123     /**
124      * @return the type of this association.
125      */
126     public AssociationType getAssociationType() {
127         return associationType;
128     }
129 
130     /**
131      * @param associationType
132      *          the type of this association.
133      */
134     public void setAssociationType(AssociationType associationType) {
135         this.associationType = associationType;
136     }
137 
138     /**
139      * @return the label of the association.
140      */
141     public AssociationLabel getLabel() {
142         return label;
143     }
144 
145     /**
146      * @param label
147      *          the label of the association.
148      */
149     public void setLabel(AssociationLabel label) {
150         this.label = label;
151     }
152 
153     /**
154      * @return UUID of this association entry.
155      */
156     public String getEntryUuid() {
157         return entryUuid;
158     }
159 
160     /**
161      * @param entryUuid
162      *          UUID of this association entry.
163      */
164     public void setEntryUuid(String entryUuid) {
165         this.entryUuid = entryUuid;
166     }
167 
168     /**
169      * @return code describing the association (e.g. the type of transformation,
170      *          reason for replacement).
171      */
172     public Code getDocCode() {
173         return docCode;
174     }
175 
176     /**
177      * @param docCode
178      *          code describing the association (e.g. the type of transformation,
179      *          reason for replacement).
180      */
181     public void setDocCode(Code docCode) {
182         this.docCode = docCode;
183     }
184 
185     /**
186      *
187      * @return previous version slot value
188      */
189     public String getPreviousVersion() {
190         return previousVersion;
191     }
192 
193     /**
194      *
195      * @param previousVersion
196      *          value of previous version in XDS metadata update association
197      */
198     public void setPreviousVersion(String previousVersion) {
199         this.previousVersion = previousVersion;
200     }
201 
202     /**
203      * @return original status slot value
204      */
205     public AvailabilityStatus getOriginalStatus() {
206         return originalStatus;
207     }
208 
209     /**
210      * @param originalStatus
211      *           value of originalStatus in update availabilityStatus
212      */
213     public void setOriginalStatus(AvailabilityStatus originalStatus) {
214         this.originalStatus = originalStatus;
215     }
216 
217     /**
218      * @return new status slot value
219      */
220     public AvailabilityStatus getNewStatus() {
221         return newStatus;
222     }
223 
224     /**
225      * @param newStatus
226      *           value of newStatus in update availabilityStatus
227      */
228     public void setNewStatus(AvailabilityStatus newStatus) {
229         this.newStatus = newStatus;
230     }
231 
232     /**
233      * @return associationPropagation annotation value
234      */
235     public Boolean getAssociationPropagation() {
236         return associationPropagation;
237     }
238 
239     /**
240      * @param associationPropagation
241      *           value of associationPropagation annotation
242      */
243     public void setAssociationPropagation(Boolean associationPropagation) {
244         this.associationPropagation = associationPropagation;
245     }
246 
247     /**
248      *
249      * @return availabilityStatus value in XDS metadata update association
250      */
251     public AvailabilityStatus getAvailabilityStatus() {
252         return availabilityStatus;
253     }
254 
255     /**
256      *
257      * @param availabilityStatus
258      *           value of availabilityStatus in XDS metadata update association
259      */
260     public void setAvailabilityStatus(AvailabilityStatus availabilityStatus) {
261         this.availabilityStatus = availabilityStatus;
262     }
263 
264 }