001 package org.kuali.ole.patron.api; 002 003 import org.kuali.rice.core.api.mo.AbstractDataTransferObject; 004 import org.kuali.rice.core.api.mo.ModelBuilder; 005 import org.kuali.rice.kim.api.identity.address.EntityAddress; 006 import org.kuali.rice.krms.api.KrmsConstants; 007 008 import javax.xml.bind.annotation.*; 009 import java.io.Serializable; 010 011 /** 012 * Created with IntelliJ IDEA. 013 * User: ? 014 * Date: 5/28/12 015 * Time: 12:09 PM 016 * To change this template use File | Settings | File Templates. 017 */ 018 @XmlRootElement(name = OleEntityAddressDefinition.Constants.ROOT_ELEMENT_NAME) 019 @XmlAccessorType(XmlAccessType.NONE) 020 @XmlType(name = OleEntityAddressDefinition.Constants.TYPE_NAME, propOrder = { 021 OleEntityAddressDefinition.Elements.OLE_ADDRESS, 022 OleEntityAddressDefinition.Elements.ENTITY_ADDRESS 023 }) 024 public class OleEntityAddressDefinition extends AbstractDataTransferObject implements OleEntityAddressContract { 025 026 private static final long serialVersionUID = 1L; 027 028 @XmlElement(name = Elements.OLE_ADDRESS, required = false) 029 private final OleAddressDefinition oleAddressBo; 030 @XmlElement(name = Elements.ENTITY_ADDRESS, required = false) 031 private final EntityAddress entityAddressBo; 032 033 public OleEntityAddressDefinition () { 034 oleAddressBo = null; 035 entityAddressBo = null; 036 } 037 038 public OleEntityAddressDefinition(Builder builder) { 039 oleAddressBo = builder.getOleAddressBo().build(); 040 entityAddressBo = builder.getEntityAddressBo().build(); 041 042 } 043 044 @Override 045 public EntityAddress getEntityAddressBo() { 046 return entityAddressBo; 047 } 048 049 @Override 050 public OleAddressDefinition getOleAddressBo() { 051 return oleAddressBo; 052 } 053 054 public static class Builder implements OleEntityAddressContract, ModelBuilder, Serializable { 055 private static final long serialVersionUID = 1L; 056 057 public OleAddressDefinition.Builder oleAddressBo; 058 public EntityAddress.Builder entityAddressBo; 059 060 public String patronNoteId; 061 public String olePatronId; 062 public String patronNoteTypeId; 063 public String patronNoteText; 064 public OlePatronNoteTypeDefinition.Builder olePatronNoteType; 065 public OlePatronDefinition.Builder olePatron; 066 public Long versionNumber; 067 public boolean active; 068 public String objectId; 069 070 private Builder (OleAddressDefinition.Builder oleAddressBo, EntityAddress.Builder entityAddressBo) { 071 072 setOleAddressBo(oleAddressBo); 073 setEntityAddressBo(entityAddressBo); 074 075 } 076 077 public static Builder create (OleAddressDefinition.Builder oleAddressBo, EntityAddress.Builder entityAddressBo){ 078 //OlePatronDefinition.Builder olePatron) { 079 return new Builder(oleAddressBo, entityAddressBo); 080 } 081 public static Builder create (OleEntityAddressContract oleEntityAddressContract) { 082 Builder builder = Builder.create(OleAddressDefinition.Builder.create(oleEntityAddressContract.getOleAddressBo()),EntityAddress.Builder.create(oleEntityAddressContract.getEntityAddressBo())); 083 return builder; 084 085 } 086 087 088 @Override 089 public OleAddressDefinition.Builder getOleAddressBo() { 090 return this.oleAddressBo; 091 } 092 093 094 public EntityAddress.Builder getEntityAddressBo() { 095 return this.entityAddressBo; 096 } 097 098 public void setOleAddressBo(OleAddressDefinition.Builder oleAddressBo) { 099 this.oleAddressBo = oleAddressBo; 100 } 101 102 public void setEntityAddressBo(EntityAddress.Builder entityAddressBo) { 103 this.entityAddressBo = entityAddressBo; 104 } 105 106 @Override 107 public OleEntityAddressDefinition build() { 108 return new OleEntityAddressDefinition(this); 109 } 110 } 111 112 113 /*public OlePatronDefinition getOlePatron() { 114 return this.olePatron; 115 }*/ 116 static class Constants { 117 public static final String ROOT_ELEMENT_NAME = "oleEntityAddressDefinition"; 118 public static final String TYPE_NAME = "oleEntityAddressDefinitionType"; 119 } 120 121 static class Elements { 122 public static final String OLE_ADDRESS = "oleAddressBo"; 123 public static final String ENTITY_ADDRESS = "entityAddressBo"; 124 125 } 126 127 public static class Cache { 128 public static final String NAME = KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0 + "/" + OleEntityAddressDefinition.Constants.TYPE_NAME; 129 } 130 }