View Javadoc
1 /* 2 * $Header: /cvsroot/ebxmlrr/jaxr/src/com/sun/xml/registry/ebxml/infomodel/PostalAddressImpl.java,v 1.10 2003/07/18 15:18:07 farrukh_najmi Exp $ 3 * 4 * 5 */ 6 7 package com.sun.xml.registry.ebxml.infomodel; 8 9 import com.sun.xml.registry.ebxml.*; 10 11 import javax.xml.registry.*; 12 import javax.xml.registry.infomodel.*; 13 import java.util.*; 14 15 /*** 16 * Class Declaration for Class1 17 * @author <a href="mailto:Farrukh.Najmi@Sun.COM">Farrukh S. Najmi</a> 18 */ 19 public class PostalAddressImpl extends ExtensibleObjectImpl implements PostalAddress { 20 21 private String street = null; 22 private String streetNumber = null; 23 private String city = null; 24 private String stateOrProvince = null; 25 private String postalCode = null; 26 private String country = null; 27 private String type = null; 28 private ClassificationScheme postalScheme = null; 29 30 private PostalAddressImpl() { 31 super(null); 32 } 33 34 public PostalAddressImpl(LifeCycleManagerImpl lcm) { 35 super(lcm); 36 } 37 38 public PostalAddressImpl(LifeCycleManagerImpl lcm, 39 org.oasis.ebxml.registry.bindings.rim.PostalAddressType address) { 40 super(lcm); 41 // Todo: Pass ExtensibleObject components to super class??? 42 43 if (address == null) { 44 return; 45 } 46 city = address.getCity(); 47 country = address.getCountry(); 48 postalCode = address.getPostalCode(); 49 stateOrProvince = address.getStateOrProvince(); 50 street = address.getStreet(); 51 streetNumber = address.getStreetNumber(); 52 } 53 54 public String getStreet() throws JAXRException { 55 if (street == null) { 56 street = ""; 57 } 58 return street; 59 } 60 61 public void setStreet(String par1) throws JAXRException { 62 street = par1; 63 } 64 65 public String getStreetNumber() throws JAXRException { 66 if (streetNumber == null) { 67 streetNumber = ""; 68 } 69 return streetNumber; 70 } 71 72 public void setStreetNumber(String par1) throws JAXRException { 73 streetNumber = par1; 74 } 75 76 public String getCity() throws JAXRException { 77 if (city == null) { 78 city = ""; 79 } 80 return city; 81 } 82 83 public void setCity(String par1) throws JAXRException { 84 city = par1; 85 } 86 87 public String getStateOrProvince() throws JAXRException { 88 if (stateOrProvince == null) { 89 stateOrProvince = ""; 90 } 91 return stateOrProvince; 92 } 93 94 public void setStateOrProvince(String par1) throws JAXRException { 95 stateOrProvince = par1; 96 } 97 98 public String getPostalCode() throws JAXRException { 99 if (postalCode == null) { 100 postalCode = ""; 101 } 102 return postalCode; 103 } 104 105 public void setPostalCode(String par1) throws JAXRException { 106 postalCode = par1; 107 } 108 109 public String getCountry() throws JAXRException { 110 if (country == null) { 111 country = ""; 112 } 113 return country; 114 } 115 116 public void setCountry(String par1) throws JAXRException { 117 country = par1; 118 } 119 120 public String getType() throws JAXRException { 121 if (type == null) { 122 type = ""; 123 } 124 return type; 125 } 126 127 public void setType(String par1) throws JAXRException { 128 type = par1; 129 } 130 131 public void setPostalScheme(ClassificationScheme par1) throws JAXRException { 132 postalScheme = par1; 133 } 134 135 public ClassificationScheme getPostalScheme() throws JAXRException { 136 return postalScheme; 137 } 138 139 void setBindingObject(org.oasis.ebxml.registry.bindings.rim.PostalAddressType ebAddr) throws JAXRException { 140 ebAddr.setStreet(street); 141 ebAddr.setStreetNumber(streetNumber); 142 ebAddr.setCity(city); 143 ebAddr.setStateOrProvince(stateOrProvince); 144 ebAddr.setPostalCode(postalCode); 145 ebAddr.setCountry(country); 146 //ebsetType(type); 147 } 148 149 public String toString() { 150 String addrStr = ""; 151 152 try { 153 addrStr = getStreetNumber() + " " + getStreet() + ", " + 154 getCity() + " " + getStateOrProvince() + " " + 155 getPostalCode() + ", " + getCountry(); 156 157 Collection slots = getSlots(); 158 159 Iterator slotsIter = slots.iterator(); 160 while (slotsIter.hasNext()) { 161 Slot slot = (Slot)slotsIter.next(); 162 Collection values = slot.getValues(); 163 164 Iterator valuesIter = values.iterator(); 165 while(valuesIter.hasNext()) { 166 String value = (String)valuesIter.next(); 167 addrStr += " " + value; 168 } 169 if (slotsIter.hasNext()) { 170 addrStr += ","; 171 } 172 } 173 } 174 catch (JAXRException e) { 175 e.printStackTrace(); 176 addrStr = e.toString(); 177 } 178 179 return addrStr; 180 } 181 }

This page was automatically generated by Maven