001package org.kuali.ole.deliver.api; 002 003import org.kuali.rice.core.api.CoreConstants; 004import org.kuali.rice.core.api.mo.AbstractDataTransferObject; 005import org.kuali.rice.core.api.mo.ModelBuilder; 006import org.kuali.rice.krms.api.KrmsConstants; 007import org.w3c.dom.Element; 008 009import javax.xml.bind.annotation.*; 010import java.io.Serializable; 011import java.util.Collection; 012 013/** 014 * Created with IntelliJ IDEA. 015 * User: ? 016 * Date: 5/28/12 017 * Time: 12:09 PM 018 * To change this template use File | Settings | File Templates. 019 */ 020@XmlRootElement(name = OlePatronNotesDefinition.Constants.ROOT_ELEMENT_NAME) 021@XmlAccessorType(XmlAccessType.NONE) 022@XmlType(name = OlePatronNotesDefinition.Constants.TYPE_NAME, propOrder = { 023 OlePatronNotesDefinition.Elements.NOTE_ID, 024 OlePatronNotesDefinition.Elements.PATRON_ID, 025 // OlePatronNotesDefinition.Elements.NOTE_TYPE_ID, 026 OlePatronNotesDefinition.Elements.NOTE_TEXT, 027 OlePatronNotesDefinition.Elements.NOTE_TYPE, 028 OlePatronNotesDefinition.Elements.ACTIVE, 029 //OlePatronNotesDefinition.Elements.PATRON, 030 CoreConstants.CommonElements.OBJECT_ID, 031 CoreConstants.CommonElements.VERSION_NUMBER, 032 CoreConstants.CommonElements.FUTURE_ELEMENTS 033}) 034public class OlePatronNotesDefinition extends AbstractDataTransferObject implements OlePatronNotesContract { 035 036 private static final long serialVersionUID = 1L; 037 038 @XmlElement(name = Elements.NOTE_ID, required = false) 039 private final String patronNoteId; 040 @XmlElement(name = Elements.PATRON_ID, required = false) 041 private final String olePatronId; 042 //@XmlElement(name = Elements.NOTE_TYPE_ID, required = false) 043 private final String patronNoteTypeId; 044 @XmlElement(name = Elements.NOTE_TEXT, required = false) 045 private final String patronNoteText; 046 @XmlElement(name = Elements.NOTE_TYPE, required = false) 047 private final OlePatronNoteTypeDefinition olePatronNoteType; 048 //@XmlElement(name = Elements.PATRON, required = false) 049 //private final OlePatronDefinition olePatron; 050 051 @XmlElement(name = CoreConstants.CommonElements.ACTIVE, required = false) 052 private final boolean active; 053 054 @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false) 055 private final String objectId; 056 057 058 @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false) 059 private final Long versionNumber; 060 061 @SuppressWarnings("unused") 062 @XmlAnyElement 063 private final Collection<Element> _futureElements = null; 064 065 public OlePatronNotesDefinition() { 066 patronNoteId = null; 067 olePatronId = null; 068 patronNoteTypeId = null; 069 patronNoteText = null; 070 olePatronNoteType = null; 071 //olePatron = null; 072 versionNumber = null; 073 active = false; 074 objectId = null; 075 } 076 077 public OlePatronNotesDefinition(Builder builder) { 078 patronNoteId = builder.getPatronNoteId(); 079 olePatronId = builder.getOlePatronId(); 080 patronNoteTypeId = builder.getOlePatronNoteType().getPatronNoteTypeId(); 081 patronNoteText = builder.getPatronNoteText(); 082 olePatronNoteType = builder.getOlePatronNoteType().build(); 083 //olePatron = builder.getOlePatron().build(); 084 versionNumber = builder.getVersionNumber(); 085 active = builder.isActive(); 086 objectId = builder.getObjectId(); 087 } 088 089 public static class Builder implements OlePatronNotesContract, ModelBuilder, Serializable { 090 private static final long serialVersionUID = 1L; 091 public String patronNoteId; 092 public String olePatronId; 093 public String patronNoteTypeId; 094 public String patronNoteText; 095 public OlePatronNoteTypeDefinition.Builder olePatronNoteType; 096 public OlePatronDefinition.Builder olePatron; 097 public Long versionNumber; 098 public boolean active; 099 public String objectId; 100 101 private Builder(String patronNoteId, String olePatronId, 102 String patronNoteText, 103 OlePatronNoteTypeDefinition.Builder olePatronNoteType) { 104 //OlePatronDefinition.Builder olePatron) { 105 106 setOlePatronId(olePatronId); 107 setPatronNoteText(patronNoteText); 108 setOlePatronNoteType(olePatronNoteType); 109 setPatronNoteTypeId(olePatronNoteType.getId()); 110 setPatronNoteId(patronNoteId); 111// setOlePatron(olePatron); 112// setOlePatron(olePatron); 113 114 } 115 116 public static Builder create(String patronNoteId, String olePatronId, 117 String patronNoteText, 118 OlePatronNoteTypeDefinition.Builder olePatronNoteType) { 119 //OlePatronDefinition.Builder olePatron) { 120 return new Builder(patronNoteId, olePatronId, patronNoteText, olePatronNoteType); 121 } 122 123 public static Builder create(OlePatronNotesContract patronNotesDefinition) { 124 Builder builder = Builder.create(patronNotesDefinition.getPatronNoteId(), 125 patronNotesDefinition.getOlePatronId(), 126 patronNotesDefinition.getPatronNoteText(), 127 OlePatronNoteTypeDefinition.Builder.create(patronNotesDefinition.getOlePatronNoteType())); 128 //OlePatronDefinition.Builder.create(patronNotesDefinition.getOlePatron())); 129 builder.setVersionNumber(patronNotesDefinition.getVersionNumber()); 130 builder.setActive(patronNotesDefinition.isActive()); 131 builder.setObjectId(patronNotesDefinition.getObjectId()); 132 return builder; 133 134 } 135 136 @Override 137 public String getPatronNoteId() { 138 return this.patronNoteId; 139 } 140 141 @Override 142 public String getOlePatronId() { 143 return this.olePatronId; 144 } 145 146 @Override 147 public String getPatronNoteText() { 148 return this.patronNoteText; 149 } 150 151 @Override 152 public OlePatronNoteTypeDefinition.Builder getOlePatronNoteType() { 153 return this.olePatronNoteType; 154 } 155 156 157 public OlePatronDefinition.Builder getOlePatron() { 158 return this.olePatron; 159 } 160 161 @Override 162 public Long getVersionNumber() { 163 return this.versionNumber; 164 } 165 166 @Override 167 public String getId() { 168 return this.patronNoteId; 169 } 170 171 @Override 172 public boolean isActive() { 173 return this.active; 174 } 175 176 @Override 177 public String getObjectId() { 178 return this.objectId; 179 } 180 181 public void setObjectId(String objectId) { 182 this.objectId = objectId; 183 } 184 185 public void setPatronNoteId(String patronNoteId) { 186 this.patronNoteId = patronNoteId; 187 } 188 189 public void setOlePatronId(String olePatronId) { 190 this.olePatronId = olePatronId; 191 } 192 193 public void setPatronNoteTypeId(String patronNoteTypeId) { 194 this.patronNoteTypeId = patronNoteTypeId; 195 } 196 197 public void setPatronNoteText(String patronNoteText) { 198 this.patronNoteText = patronNoteText; 199 } 200 201 public void setOlePatronNoteType(OlePatronNoteTypeDefinition.Builder olePatronNoteType) { 202 this.olePatronNoteType = olePatronNoteType; 203 } 204 205 public void setOlePatron(OlePatronDefinition.Builder olePatron) { 206 this.olePatron = olePatron; 207 } 208 209 public void setVersionNumber(Long versionNumber) { 210 this.versionNumber = versionNumber; 211 } 212 213 public void setActive(boolean active) { 214 this.active = active; 215 } 216 217 @Override 218 public OlePatronNotesDefinition build() { 219 return new OlePatronNotesDefinition(this); 220 } 221 } 222 223 @Override 224 public String getPatronNoteId() { 225 return this.patronNoteId; 226 } 227 228 @Override 229 public String getOlePatronId() { 230 return this.olePatronId; 231 } 232 233 @Override 234 public String getPatronNoteText() { 235 return this.patronNoteText; 236 } 237 238 @Override 239 public OlePatronNoteTypeDefinition getOlePatronNoteType() { 240 return this.olePatronNoteType; 241 } 242 243 @Override 244 public boolean isActive() { 245 return this.active; 246 } 247 248 @Override 249 public String getId() { 250 return this.patronNoteId; 251 } 252 253 @Override 254 public Long getVersionNumber() { 255 return this.versionNumber; 256 } 257 258 @Override 259 public String getObjectId() { 260 return this.objectId; 261 } 262 263 /*public OlePatronDefinition getOlePatron() { 264 return this.olePatron; 265 }*/ 266 static class Constants { 267 public static final String ROOT_ELEMENT_NAME = "olePatronNotesDefinition"; 268 public static final String TYPE_NAME = "olePatronNotesDefinitionType"; 269 } 270 271 static class Elements { 272 public static final String NOTE_ID = "patronNoteId"; 273 public static final String PATRON_ID = "olePatronId"; 274 public static final String NOTE_TYPE_ID = "patronNoteTypeId"; 275 public static final String NOTE_TEXT = "patronNoteText"; 276 public static final String NOTE_TYPE = "olePatronNoteType"; 277 public static final String PATRON = "olePatron"; 278 public static final String ACTIVE = "active"; 279 } 280 281 public static class Cache { 282 public static final String NAME = KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0 + "/" + Constants.TYPE_NAME; 283 } 284}