1 package org.kuali.ole.deliver.api;
2
3 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
4 import org.kuali.rice.core.api.mo.ModelBuilder;
5 import org.kuali.rice.kim.api.identity.address.EntityAddress;
6 import org.kuali.rice.krms.api.KrmsConstants;
7
8 import javax.xml.bind.annotation.*;
9 import java.io.Serializable;
10
11
12
13
14
15
16
17
18 @XmlRootElement(name = OleEntityAddressDefinition.Constants.ROOT_ELEMENT_NAME)
19 @XmlAccessorType(XmlAccessType.NONE)
20 @XmlType(name = OleEntityAddressDefinition.Constants.TYPE_NAME, propOrder = {
21 OleEntityAddressDefinition.Elements.OLE_ADDRESS,
22 OleEntityAddressDefinition.Elements.ENTITY_ADDRESS
23 })
24 public class OleEntityAddressDefinition extends AbstractDataTransferObject implements OleEntityAddressContract {
25
26 private static final long serialVersionUID = 1L;
27
28 @XmlElement(name = Elements.OLE_ADDRESS, required = false)
29 private final OleAddressDefinition oleAddressBo;
30 @XmlElement(name = Elements.ENTITY_ADDRESS, required = false)
31 private final EntityAddress entityAddressBo;
32
33 public OleEntityAddressDefinition() {
34 oleAddressBo = null;
35 entityAddressBo = null;
36 }
37
38 public OleEntityAddressDefinition(Builder builder) {
39 oleAddressBo = builder.getOleAddressBo().build();
40 entityAddressBo = builder.getEntityAddressBo().build();
41
42 }
43
44 @Override
45 public EntityAddress getEntityAddressBo() {
46 return entityAddressBo;
47 }
48
49 @Override
50 public OleAddressDefinition getOleAddressBo() {
51 return oleAddressBo;
52 }
53
54 public static class Builder implements OleEntityAddressContract, ModelBuilder, Serializable {
55 private static final long serialVersionUID = 1L;
56
57 public OleAddressDefinition.Builder oleAddressBo;
58 public EntityAddress.Builder entityAddressBo;
59
60 public String patronNoteId;
61 public String olePatronId;
62 public String patronNoteTypeId;
63 public String patronNoteText;
64 public OlePatronNoteTypeDefinition.Builder olePatronNoteType;
65 public OlePatronDefinition.Builder olePatron;
66 public Long versionNumber;
67 public boolean active;
68 public String objectId;
69
70 private Builder(OleAddressDefinition.Builder oleAddressBo, EntityAddress.Builder entityAddressBo) {
71
72 setOleAddressBo(oleAddressBo);
73 setEntityAddressBo(entityAddressBo);
74
75 }
76
77 public static Builder create(OleAddressDefinition.Builder oleAddressBo, EntityAddress.Builder entityAddressBo) {
78
79 return new Builder(oleAddressBo, entityAddressBo);
80 }
81
82 public static Builder create(OleEntityAddressContract oleEntityAddressContract) {
83 Builder builder = Builder.create(OleAddressDefinition.Builder.create(oleEntityAddressContract.getOleAddressBo()), EntityAddress.Builder.create(oleEntityAddressContract.getEntityAddressBo()));
84 return builder;
85
86 }
87
88
89 @Override
90 public OleAddressDefinition.Builder getOleAddressBo() {
91 return this.oleAddressBo;
92 }
93
94
95 public EntityAddress.Builder getEntityAddressBo() {
96 return this.entityAddressBo;
97 }
98
99 public void setOleAddressBo(OleAddressDefinition.Builder oleAddressBo) {
100 this.oleAddressBo = oleAddressBo;
101 }
102
103 public void setEntityAddressBo(EntityAddress.Builder entityAddressBo) {
104 this.entityAddressBo = entityAddressBo;
105 }
106
107 @Override
108 public OleEntityAddressDefinition build() {
109 return new OleEntityAddressDefinition(this);
110 }
111 }
112
113
114
115
116
117 static class Constants {
118 public static final String ROOT_ELEMENT_NAME = "oleEntityAddressDefinition";
119 public static final String TYPE_NAME = "oleEntityAddressDefinitionType";
120 }
121
122 static class Elements {
123 public static final String OLE_ADDRESS = "oleAddressBo";
124 public static final String ENTITY_ADDRESS = "entityAddressBo";
125
126 }
127
128 public static class Cache {
129 public static final String NAME = KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0 + "/" + Constants.TYPE_NAME;
130 }
131 }