View Javadoc
1 /* 2 * $Header: /cvsroot/ebxmlrr/jaxr/src/com/sun/xml/registry/ebxml/infomodel/ExternalIdentifierImpl.java,v 1.10 2002/11/29 17:42:30 farrukh_najmi Exp $ 3 * 4 * 5 */ 6 7 package com.sun.xml.registry.ebxml.infomodel; 8 9 import java.util.*; 10 import java.io.*; 11 12 import javax.xml.registry.*; 13 import javax.xml.registry.infomodel.*; 14 15 import com.sun.xml.registry.ebxml.LifeCycleManagerImpl; 16 17 import org.oasis.ebxml.registry.bindings.rim.ExternalIdentifierType; 18 import org.oasis.ebxml.registry.bindings.rim.ObjectRef; 19 20 /*** 21 * Class Declaration for Class1 22 * @author <a href="mailto:Farrukh.Najmi@Sun.COM">Farrukh S. Najmi</a> 23 */ 24 public class ExternalIdentifierImpl extends RegistryObjectImpl 25 implements ExternalIdentifier 26 { 27 private RegistryObject registryObject = null; 28 private RegistryObjectRef schemeRef = null; 29 private String value = null; 30 31 public ExternalIdentifierImpl(LifeCycleManagerImpl lcm) 32 throws JAXRException 33 { 34 super(lcm); 35 } 36 37 public ExternalIdentifierImpl(LifeCycleManagerImpl lcm, ExternalIdentifierType ebExtIdentifier, 38 RegistryObject registryObject) 39 throws JAXRException 40 { 41 super(lcm,ebExtIdentifier); 42 43 this.registryObject = registryObject; 44 schemeRef = new RegistryObjectRef(lcm,ebExtIdentifier.getIdentificationScheme()); 45 value = ebExtIdentifier.getValue(); 46 } 47 48 public String toXML() throws JAXRException { 49 org.oasis.ebxml.registry.bindings.rim.RegistryObjectType ebObj = toBindingObject(); 50 StringWriter sw = new StringWriter(); 51 try { 52 ebObj.marshal(sw); 53 } catch (org.exolab.castor.xml.MarshalException x) { 54 throw new JAXRException(x); 55 } catch (org.exolab.castor.xml.ValidationException x) { 56 throw new JAXRException(x); 57 } 58 return sw.toString(); 59 } 60 61 public RegistryObject getRegistryObject() throws JAXRException { 62 return registryObject; 63 } 64 65 void setRegistryObject(RegistryObject registryObject) throws JAXRException { 66 this.registryObject = registryObject; 67 setModified(true); 68 } 69 70 public String getValue() throws JAXRException { 71 return value; 72 } 73 74 public void setValue(String par1) throws JAXRException { 75 value = par1; 76 setModified(true); 77 } 78 79 public ClassificationScheme getIdentificationScheme() throws JAXRException { 80 ClassificationScheme scheme = null; 81 if (schemeRef != null) { 82 scheme = (ClassificationScheme)schemeRef.getRegistryObject("ClassificationScheme"); 83 } 84 85 return scheme; 86 } 87 88 public void setIdentificationScheme(ClassificationScheme scheme) throws JAXRException { 89 schemeRef = new RegistryObjectRef(lcm, scheme); 90 setModified(true); 91 } 92 93 public org.oasis.ebxml.registry.bindings.rim.ExternalIdentifier toBindingObject() throws JAXRException 94 { 95 org.oasis.ebxml.registry.bindings.rim.ExternalIdentifier ebExtId = 96 new org.oasis.ebxml.registry.bindings.rim.ExternalIdentifier(); 97 98 setBindingObject(ebExtId); 99 100 return ebExtId; 101 } 102 103 protected void setBindingObject(org.oasis.ebxml.registry.bindings.rim.ExternalIdentifierType ebExtId) throws JAXRException { 104 super.setBindingObject(ebExtId); 105 106 org.oasis.ebxml.registry.bindings.rim.ObjectRef ebSchemeRef = 107 new org.oasis.ebxml.registry.bindings.rim.ObjectRef(); 108 ebSchemeRef.setId(schemeRef.getId()); 109 110 ebExtId.setIdentificationScheme(ebSchemeRef); 111 ebExtId.setValue(getValue()); 112 } 113 114 /*** 115 * Used by LifeCycleManagerImpl.saveObjects 116 * 117 */ 118 public HashSet getRegistryObjectRefs() { 119 HashSet refs = new HashSet(); 120 121 //refs.addAll(super.getRegistryObjectRefs()); 122 123 if (schemeRef != null) { 124 refs.add(schemeRef); 125 } 126 127 return refs; 128 } 129 130 131 }

This page was automatically generated by Maven