You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by sv...@apache.org on 2005/02/02 03:23:57 UTC

cvs commit: ws-juddi/src/java/org/apache/juddi/datastore/jdbc JDBCDataStore.java

sviens      2005/02/01 18:23:57

  Modified:    src/java/org/apache/juddi/datastore/jdbc JDBCDataStore.java
  Log:
  The fetchBusiness method should not add empty CategoryBag or IdentifierBag to the returned Business.  The fetchBusiness method now checks to be sure there's something in each bag before adding it to the business.  The fetchService method had a similar issue with empty CategoryBag.  See JIRA issue JUDDI-43 for more information (http://issues.apache.org/jira/browse/JUDDI-43)
  
  Revision  Changes    Path
  1.9       +22 -10    ws-juddi/src/java/org/apache/juddi/datastore/jdbc/JDBCDataStore.java
  
  Index: JDBCDataStore.java
  ===================================================================
  RCS file: /home/cvs/ws-juddi/src/java/org/apache/juddi/datastore/jdbc/JDBCDataStore.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JDBCDataStore.java	19 Oct 2004 17:19:53 -0000	1.8
  +++ JDBCDataStore.java	2 Feb 2005 02:23:57 -0000	1.9
  @@ -487,13 +487,21 @@
           business.setNameVector(BusinessNameTable.select(businessKey,connection));
           business.setDescriptionVector(BusinessDescTable.select(businessKey,connection));
   
  -        IdentifierBag identifierBag = new IdentifierBag();
  -        identifierBag.setKeyedReferenceVector(BusinessIdentifierTable.select(businessKey,connection));
  -        business.setIdentifierBag(identifierBag);
  -
  -        CategoryBag categoryBag = new CategoryBag();
  -        categoryBag.setKeyedReferenceVector(BusinessCategoryTable.select(businessKey,connection));
  -        business.setCategoryBag(categoryBag);
  +        Vector idVector = BusinessIdentifierTable.select(businessKey,connection); 
  +        if (idVector.size() > 0) 
  +        { 
  +          IdentifierBag identifierBag = new IdentifierBag(); 
  +          identifierBag.setKeyedReferenceVector(idVector); 
  +          business.setIdentifierBag(identifierBag); 
  +        } 
  +
  +        Vector catVector = BusinessCategoryTable.select(businessKey,connection); 
  +        if (catVector.size() > 0) 
  +        { 
  +          CategoryBag categoryBag = new CategoryBag(); 
  +          categoryBag.setKeyedReferenceVector(catVector); 
  +          business.setCategoryBag(categoryBag); 
  +        } 
   
           DiscoveryURLs discoveryURLs = new DiscoveryURLs();
           discoveryURLs.setDiscoveryURLVector(DiscoveryURLTable.select(businessKey,connection));
  @@ -687,9 +695,13 @@
           service.setNameVector(ServiceNameTable.select(serviceKey,connection));
           service.setDescriptionVector(ServiceDescTable.select(serviceKey,connection));
   
  -        CategoryBag bag = new CategoryBag();
  -        bag.setKeyedReferenceVector(ServiceCategoryTable.select(serviceKey,connection));
  -        service.setCategoryBag(bag);
  +        Vector catVector = ServiceCategoryTable.select(serviceKey,connection); 
  +        if (catVector.size() > 0) 
  +        { 
  +          CategoryBag bag = new CategoryBag(); 
  +          bag.setKeyedReferenceVector(catVector); 
  +          service.setCategoryBag(bag); 
  +        }
   
           // 'fetch' the BusinessService's BindingTemplate objects
           Vector bindingVector = fetchBindingByServiceKey(serviceKey);