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 23 import javax.xml.bind.annotation.XmlAccessType; 24 import javax.xml.bind.annotation.XmlAccessorType; 25 import javax.xml.bind.annotation.XmlType; 26 import java.io.Serializable; 27 28 /** 29 * Represents a recipient containing a person and/or organization 30 * and/or telecommunication address. 31 * <p> 32 * All members of this class are allowed to be <code>null</code>. 33 * <p> 34 * If both, the person and the organization, are defined, the person is 35 * expected to be a member of the specified organization. 36 * @author Jens Riemschneider 37 */ 38 @XmlAccessorType(XmlAccessType.FIELD) 39 @XmlType(name = "Recipient", propOrder = {"person", "organization", "telecom"}) 40 @EqualsAndHashCode(doNotUseGetters = true) 41 @ToString(doNotUseGetters = true) 42 public class Recipient implements Serializable { 43 private static final long serialVersionUID = -8192511869759795939L; 44 45 @Getter @Setter private Person person; 46 @Getter @Setter private Organization organization; 47 @Getter @Setter private Telecom telecom; 48 49 /** 50 * Constructs a recipient. 51 */ 52 public Recipient() {} 53 54 /** 55 * Constructs a recipient. 56 * @param organization 57 * the organization. 58 * @param person 59 * the person. 60 * @deprecated please use {@link #Recipient(Organization, Person, Telecom)} instead. 61 */ 62 @Deprecated 63 public Recipient(Organization organization, Person person) { 64 this(organization, person, null); 65 } 66 67 /** 68 * Constructs a recipient. 69 * @param organization 70 * the organization. 71 * @param person 72 * the person. 73 * @param telecom 74 * telecommunication address. 75 */ 76 public Recipient(Organization organization, Person person, Telecom telecom) { 77 this.organization = organization; 78 this.person = person; 79 this.telecom = telecom; 80 } 81 82 }