View Javadoc
1 /* 2 * $Header: /cvsroot/ebxmlrr/jaxr/src/com/sun/xml/registry/ebxml/infomodel/RegistryPackageImpl.java,v 1.11 2004/03/23 19:26:41 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.*; 15 16 import org.oasis.ebxml.registry.bindings.rim.RegistryPackageType; 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 RegistryPackageImpl extends RegistryEntryImpl implements RegistryPackage { 24 25 public RegistryPackageImpl(LifeCycleManagerImpl lcm) 26 throws JAXRException 27 { 28 super(lcm); 29 } 30 31 public RegistryPackageImpl(LifeCycleManagerImpl lcm, RegistryPackageType ebPkg) 32 throws JAXRException 33 { 34 super(lcm, ebPkg); 35 } 36 37 public String toXML() throws JAXRException { 38 org.oasis.ebxml.registry.bindings.rim.RegistryObjectType ebObj = toBindingObject(); 39 StringWriter sw = new StringWriter(); 40 try { 41 ebObj.marshal(sw); 42 } catch (org.exolab.castor.xml.MarshalException x) { 43 throw new JAXRException(x); 44 } catch (org.exolab.castor.xml.ValidationException x) { 45 throw new JAXRException(x); 46 } 47 return sw.toString(); 48 } 49 50 public void addRegistryObject(RegistryObject registryObject) throws JAXRException { 51 BusinessQueryManagerImpl bqm = (BusinessQueryManagerImpl)(lcm.getRegistryService().getBusinessQueryManager()); 52 Concept assocType = bqm.findConceptByPath("/urn:uuid:6902675f-2f18-44b8-888b-c91db8b96b4d/" + AssociationImpl.ASSOCIATION_TYPE_HAS_MEMBER); 53 Association ass = lcm.createAssociation(registryObject, assocType); 54 addAssociation(ass); 55 //No need to call setModified(true) since RIM modified object is an Assoociation 56 } 57 58 public void addRegistryObjects(Collection registryObjects) throws JAXRException { 59 Iterator iter = registryObjects.iterator(); 60 while (iter.hasNext()) { 61 RegistryObject registryObject = (RegistryObject)iter.next(); 62 addRegistryObject(registryObject); 63 } 64 //No need to call setModified(true) since RIM modified object is an Assoociation 65 } 66 67 public void removeRegistryObject(RegistryObject registryObject) throws JAXRException { 68 Iterator iter = getAssociations().iterator(); 69 while (iter.hasNext()) { 70 Association ass = (Association)iter.next(); 71 if (ass.getTargetObject() == registryObject) { 72 if (ass.getAssociationType().getValue().equalsIgnoreCase(AssociationImpl.ASSOCIATION_TYPE_HAS_MEMBER)) { 73 removeAssociation(ass); 74 } 75 } 76 } 77 78 //No need to call setModified(true) since RIM modified object is an Assoociation 79 } 80 81 public void removeRegistryObjects(Collection registryObjects) throws JAXRException { 82 Iterator iter = registryObjects.iterator(); 83 while (iter.hasNext()) { 84 RegistryObject registryObject = (RegistryObject)iter.next(); 85 removeRegistryObject(registryObject); 86 } 87 //No need to call setModified(true) since RIM modified object is an Assoociation 88 } 89 90 public Set getRegistryObjects() throws JAXRException { 91 Set members = new HashSet(); 92 93 Iterator iter = getAssociations().iterator(); 94 while (iter.hasNext()) { 95 Association ass = (Association)iter.next(); 96 if (ass.getAssociationType().getValue().equalsIgnoreCase(AssociationImpl.ASSOCIATION_TYPE_HAS_MEMBER)) { 97 members.add(ass.getTargetObject()); 98 } 99 } 100 101 return members; 102 } 103 104 public org.oasis.ebxml.registry.bindings.rim.RegistryPackage toBindingObject() throws JAXRException 105 { 106 org.oasis.ebxml.registry.bindings.rim.RegistryPackage ebPkg = 107 new org.oasis.ebxml.registry.bindings.rim.RegistryPackage(); 108 109 setBindingObject(ebPkg); 110 111 return ebPkg; 112 } 113 114 protected void setBindingObject(org.oasis.ebxml.registry.bindings.rim.RegistryPackageType ebPkg) throws JAXRException { 115 super.setBindingObject(ebPkg); 116 117 } 118 119 }

This page was automatically generated by Maven