View Javadoc
1 /* 2 * $Header: /cvsroot/ebxmlrr/jaxr/src/com/sun/xml/registry/ebxml/infomodel/ExternalLinkImpl.java,v 1.11 2003/07/24 22:26:18 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 import java.util.*; 12 import java.io.*; 13 14 import com.sun.xml.registry.ebxml.LifeCycleManagerImpl; 15 16 import org.oasis.ebxml.registry.bindings.rim.ExternalLinkType; 17 import org.oasis.ebxml.registry.bindings.rim.ObjectRef; 18 19 /*** 20 * Class Declaration for Class1 21 * @author <a href="mailto:Farrukh.Najmi@Sun.COM">Farrukh S. Najmi</a> 22 */ 23 public class ExternalLinkImpl extends RegistryObjectImpl implements ExternalLink { 24 25 private String externalURI = null; 26 private boolean validateURI = true; 27 28 29 public ExternalLinkImpl(LifeCycleManagerImpl lcm) 30 throws JAXRException 31 { 32 super(lcm); 33 } 34 35 public ExternalLinkImpl(LifeCycleManagerImpl lcm, ExternalLinkType ebExtLink) 36 throws JAXRException 37 { 38 super(lcm, ebExtLink); 39 40 externalURI = ebExtLink.getExternalURI(); 41 } 42 43 public String toXML() throws JAXRException { 44 org.oasis.ebxml.registry.bindings.rim.RegistryObjectType ebObj = toBindingObject(); 45 StringWriter sw = new StringWriter(); 46 try { 47 ebObj.marshal(sw); 48 } catch (org.exolab.castor.xml.MarshalException x) { 49 throw new JAXRException(x); 50 } catch (org.exolab.castor.xml.ValidationException x) { 51 throw new JAXRException(x); 52 } 53 return sw.toString(); 54 } 55 56 public Collection getLinkedObjects() throws JAXRException { 57 String id = getKey().getId(); 58 59 String queryStr = 60 "SELECT id FROM RegistryObject ro, Association ass WHERE ass.targetObject = ro.id AND ass.associationType = '" + AssociationImpl.CANONICAL_ID_NODE_ASSOCIATION_TYPE_EXTERNALLY_LINKS + 61 "' AND ass.sourceObject = '" + id + "'"; 62 Query query = dqm.createQuery(Query.QUERY_TYPE_SQL, queryStr); 63 BulkResponse response = dqm.executeQuery(query); 64 checkBulkResponseExceptions(response); 65 return response.getCollection(); 66 } 67 68 public String getExternalURI() throws JAXRException { 69 return externalURI; 70 } 71 72 public void setExternalURI(String par1) throws JAXRException { 73 //Validate http URLs here see code in ebxmlrr LCM 74 75 externalURI = par1; 76 setModified(true); 77 } 78 79 public boolean getValidateURI() throws JAXRException { 80 return validateURI; 81 } 82 83 public void setValidateURI(boolean validateURI) throws JAXRException { 84 this.validateURI = validateURI; 85 } 86 87 public org.oasis.ebxml.registry.bindings.rim.ExternalLink toBindingObject() throws JAXRException 88 { 89 org.oasis.ebxml.registry.bindings.rim.ExternalLink ebExtLink = 90 new org.oasis.ebxml.registry.bindings.rim.ExternalLink(); 91 92 setBindingObject(ebExtLink); 93 94 return ebExtLink; 95 } 96 97 protected void setBindingObject(org.oasis.ebxml.registry.bindings.rim.ExternalLinkType ebExtLink) throws JAXRException { 98 super.setBindingObject(ebExtLink); 99 100 ebExtLink.setExternalURI(externalURI); 101 } 102 103 }

This page was automatically generated by Maven