View Javadoc
1 /* 2 * $Header: /cvsroot/ebxmlrr/jaxr/src/com/sun/xml/registry/ebxml/infomodel/TelephoneNumberImpl.java,v 1.7 2002/10/31 01:47:44 farrukh_najmi Exp $ 3 * 4 * 5 */ 6 7 package com.sun.xml.registry.ebxml.infomodel; 8 9 import javax.xml.registry.*; 10 import javax.xml.registry.infomodel.*; 11 12 import com.sun.xml.registry.ebxml.*; 13 14 /*** 15 * Class Declaration for Class1 16 * @author <a href="mailto:Farrukh.Najmi@Sun.COM">Farrukh S. Najmi</a> 17 */ 18 public class TelephoneNumberImpl implements TelephoneNumber { 19 20 private String countryCode = null; 21 private String areaCode = null; 22 private String number = null; 23 private String extension = null; 24 private String url = null; 25 private String type = null; 26 27 private LifeCycleManagerImpl lcm = null; 28 29 //not accessable 30 private TelephoneNumberImpl() {} 31 32 public TelephoneNumberImpl(LifeCycleManagerImpl lcm) { 33 this.lcm = lcm; 34 } 35 36 public TelephoneNumberImpl(LifeCycleManagerImpl lcm, 37 org.oasis.ebxml.registry.bindings.rim.TelephoneNumberType tel) { 38 this.lcm = lcm; 39 areaCode = tel.getAreaCode(); 40 countryCode = tel.getCountryCode(); 41 extension = tel.getExtension(); 42 number = tel.getNumber(); 43 type = tel.getPhoneType(); 44 url = tel.getUrl(); 45 } 46 47 public String getCountryCode() throws JAXRException { 48 return countryCode; 49 } 50 51 public String getAreaCode() throws JAXRException { 52 return areaCode; 53 } 54 55 public String getNumber() throws JAXRException { 56 return number; 57 } 58 59 public String getExtension() throws JAXRException { 60 return extension; 61 } 62 63 public String getUrl() throws JAXRException { 64 return url; 65 } 66 67 public String getType() throws JAXRException { 68 return type; 69 } 70 71 public void setCountryCode(String par1) throws JAXRException { 72 countryCode = par1; 73 } 74 75 public void setAreaCode(String par1) throws JAXRException { 76 areaCode = par1; 77 } 78 79 public void setNumber(String par1) throws JAXRException { 80 number = par1; 81 } 82 83 public void setExtension(String par1) throws JAXRException { 84 extension = par1; 85 } 86 87 public void setUrl(String par1) throws JAXRException { 88 url = par1; 89 } 90 91 public void setType(String par1) throws JAXRException { 92 type = par1; 93 } 94 95 /*** 96 * This method takes this JAXR infomodel object and returns an 97 * equivalent binding object for it. Note it does the reverse of one 98 * of the constructors above. 99 */ 100 public org.oasis.ebxml.registry.bindings.rim.TelephoneNumber toBindingObject() throws JAXRException { 101 org.oasis.ebxml.registry.bindings.rim.TelephoneNumber ebPhone = 102 new org.oasis.ebxml.registry.bindings.rim.TelephoneNumber(); 103 104 setBindingObject(ebPhone); 105 106 return ebPhone; 107 } 108 109 protected void setBindingObject(org.oasis.ebxml.registry.bindings.rim.TelephoneNumberType ebTelephoneNumber) throws JAXRException { 110 111 ebTelephoneNumber.setCountryCode(getCountryCode()); 112 ebTelephoneNumber.setAreaCode(getAreaCode()); 113 ebTelephoneNumber.setNumber(getNumber()); 114 ebTelephoneNumber.setExtension(getExtension()); 115 ebTelephoneNumber.setUrl(getUrl()); 116 ebTelephoneNumber.setPhoneType(getType()); 117 } 118 119 public String toString() { 120 String str = ""; 121 122 try { 123 int registryLevel = 1; //??Get from RegistryService later 124 125 if (registryLevel == 0) { 126 str = getNumber(); 127 } 128 else { 129 if (getCountryCode() != null) { 130 str += "(" + getCountryCode() + ") "; 131 } 132 133 if (getAreaCode() != null) { 134 str += getAreaCode() + "-"; 135 } 136 if (getNumber() != null) { 137 str += getNumber(); 138 } 139 if (getType() != null) { 140 str += " (" + getType() + ")"; 141 } 142 } 143 } 144 catch (JAXRException e) { 145 e.printStackTrace(); 146 } 147 148 return str; 149 } 150 }

This page was automatically generated by Maven