ws-scout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r153471 - webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
Date Fri, 11 Feb 2005 22:50:49 GMT
Author: geirm
Date: Fri Feb 11 14:50:48 2005
New Revision: 153471

URL: http://svn.apache.org/viewcvs?view=rev&rev=153471
Log:
midwork commit - need to do more cleanup, but this is starting to work.  

It had no hope as we were passing in keys rather than objects to be saved
as new object (like a new Organization) has no key - it's assigned by
the registry


Modified:
    webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java

Modified: webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
URL: http://svn.apache.org/viewcvs/webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java?view=diff&r1=153470&r2=153471
==============================================================================
--- webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
(original)
+++ webservices/scout/trunk/modules/scout/src/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
Fri Feb 11 14:50:48 2005
@@ -142,6 +142,7 @@
     public BulkResponse saveObjects(Collection col ) throws JAXRException
     {
         BulkResponseImpl bulk = new BulkResponseImpl();
+
         Iterator iter = col.iterator();
         //TODO:Check if juddi can provide a facility to store a collection of heterogenous
         //objects
@@ -150,45 +151,52 @@
         Collection exc = new ArrayList();
         bulk.setCollection(suc);
         bulk.setExceptions(exc);
+
         while(iter.hasNext())
         {
             keys.clear();
             RegistryObject reg = (RegistryObject)iter.next();
             keys.add(reg.getKey());
             BulkResponse  br = null;
+
+            Collection c = new ArrayList();
+            c.add(reg);
+
             if(reg instanceof javax.xml.registry.infomodel.Association)
             {
-                br = saveAssociations(keys, true);
+                br = saveAssociations(c, true);
             } else
             if(reg instanceof javax.xml.registry.infomodel.ClassificationScheme)
             {
-                br = saveClassificationSchemes(keys );
+                br = saveClassificationSchemes(c);
             }
             else
             if(reg instanceof javax.xml.registry.infomodel.Concept)
             {
-                br = saveConcepts(keys );
+                br = saveConcepts(c);
             }else
             if(reg instanceof javax.xml.registry.infomodel.Organization)
             {
-                br = saveOrganizations(keys );
+                br = saveOrganizations(c);
             }else
             if(reg instanceof javax.xml.registry.infomodel.Service)
             {
-                br = saveServices(keys );
+                br = saveServices(c);
             }else
             if(reg instanceof javax.xml.registry.infomodel.ServiceBinding)
             {
-                br = saveServiceBindings(keys );
+                br = saveServiceBindings(c);
             }
 
-            if(br != null ) updateBulkResponse(bulk,br);
+            if(br != null ) {
+                updateBulkResponse(bulk,br);
+            }
         }
 
         return bulk;
     }
 
-    public BulkResponse saveAssociations(Collection associationKeys, boolean replace) throws
JAXRException
+    public BulkResponse saveAssociations(Collection associationObjects, boolean replace)
throws JAXRException
     {    //TODO
         return null;
     }
@@ -584,13 +592,55 @@
         return token;
     }
 
+
+    /**
+     *   TODO - fix me!
+     * @param bulk
+     * @param br
+     * @throws JAXRException
+     */
     private void updateBulkResponse(BulkResponseImpl bulk, BulkResponse  br)
     throws JAXRException
     {
-        bulk.getCollection().addAll(br.getCollection());
-        bulk.getExceptions().addAll(br.getExceptions());
-        if(bulk.getStatus() == JAXRResponse.STATUS_SUCCESS)
+        if (bulk == null || br == null) {
+            return;
+        }
+
+        /**
+         * TODO - fix when we fix BulkResponse
+         */
+
+        Collection data = br.getCollection();
+
+        if (data != null) {
+
+            Collection c = bulk.getCollection();
+
+            if (c == null) {
+                c = new ArrayList();
+            }
+
+            bulk.setCollection(c);
+            c.addAll(data);
+        }
+
+        data = br.getExceptions();
+
+        if (data != null) {
+            Collection c = bulk.getExceptions();
+
+            if (c == null) {
+                c = new ArrayList();
+            }
+
+            c.addAll(data);
+
+            bulk.setExceptions(c);
+        }
+
+        if(bulk.getStatus() == JAXRResponse.STATUS_SUCCESS) {
             bulk.setStatus(br.getStatus());
+        }
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: scout-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: scout-dev-help@ws.apache.org


Mime
View raw message