You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by al...@apache.org on 2013/12/09 01:40:44 UTC

svn commit: r1549363 [3/5] - in /juddi/branches/juddi-3.3.x: ./ juddi-core-openjpa/src/test/resources/ juddi-core/src/main/java/org/apache/juddi/config/ juddi-core/src/main/java/org/apache/juddi/mapping/ juddi-core/src/main/java/org/apache/juddi/valida...

Modified: juddi/branches/juddi-3.3.x/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.3.x/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java?rev=1549363&r1=1549362&r2=1549363&view=diff
==============================================================================
--- juddi/branches/juddi-3.3.x/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java (original)
+++ juddi/branches/juddi-3.3.x/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java Mon Dec  9 00:40:43 2013
@@ -18,8 +18,6 @@ package org.apache.juddi.validation;
 
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 
@@ -41,16 +39,12 @@ import org.apache.juddi.config.Persisten
 import org.apache.juddi.config.Property;
 import org.apache.juddi.keygen.KeyGenerator;
 import org.apache.juddi.keygen.KeyGeneratorFactory;
-import org.apache.juddi.mapping.MappingModelToApi;
-import org.apache.juddi.model.BindingTemplate;
 import org.apache.juddi.model.Publisher;
 import org.apache.juddi.model.Tmodel;
-import org.apache.juddi.model.TmodelIdentifier;
 import org.apache.juddi.model.UddiEntity;
 import org.apache.juddi.model.UddiEntityPublisher;
 import org.apache.juddi.query.FindBusinessByPublisherQuery;
 import org.apache.juddi.query.FindTModelByPublisherQuery;
-import org.apache.juddi.v3.client.UDDIConstants;
 import org.apache.juddi.v3.error.AssertionNotFoundException;
 import org.apache.juddi.v3.error.ErrorMessage;
 import org.apache.juddi.v3.error.FatalErrorException;
@@ -82,16 +76,14 @@ import org.uddi.api_v3.SaveBinding;
 import org.uddi.api_v3.SaveBusiness;
 import org.uddi.api_v3.SaveService;
 import org.uddi.api_v3.SaveTModel;
-import org.uddi.api_v3.TModel;
 import org.uddi.v3_service.DispositionReportFaultMessage;
 
 /**
  * Provides validation of publish requests to Juddi
  *
  * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
- * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>
- * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a> Modified March
- * 2013 to validate string length and ref integrity
+ * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a> 
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a> Modified March 2013 to validate string length and ref integrity
  *
  * Advisory, be careful calling AppConfig.getConfiguration() from within
  * validation functions, it may inadvertently cause infinite loops during the
@@ -100,1860 +92,1833 @@ import org.uddi.v3_service.DispositionRe
  */
 public class ValidatePublish extends ValidateUDDIApi {
 
-        /**
-         * This flag will add additional output to stdout for debugging
-         * purposes, set this to true if
-         */
-        private static Log log = LogFactory.getLog(ValidatePublish.class);
+    /**
+     * This flag will add additional output to stdout for debugging purposes,
+     * set this to true if
+     */
+    private Log log = LogFactory.getLog(this.getClass());
 
-        public ValidatePublish(UddiEntityPublisher publisher) {
-                super(publisher);
-        }
-
-        public void validateDeleteBusiness(EntityManager em, DeleteBusiness body) throws DispositionReportFaultMessage {
-
-                // No null input
-                if (body == null) {
-                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-                }
+    public ValidatePublish(UddiEntityPublisher publisher) {
+        super(publisher);
+    }
 
-                // No null or empty list
-                List<String> entityKeyList = body.getBusinessKey();
-                if (entityKeyList == null || entityKeyList.size() == 0) {
-                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
-                }
-
-                HashSet<String> dupCheck = new HashSet<String>();
-                int i = 0;
-                for (String entityKey : entityKeyList) {
+    public void validateDeleteBusiness(EntityManager em, DeleteBusiness body) throws DispositionReportFaultMessage {
 
-                        // Per section 4.4: keys must be case-folded
-                        entityKey = entityKey.toLowerCase();
-                        entityKeyList.set(i, entityKey);
-
-                        boolean inserted = dupCheck.add(entityKey);
-                        if (!inserted) {
-                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
-                        }
-
-                        Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
-                        if (obj == null) {
-                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", entityKey));
-                        }
-
-                        if (!publisher.isOwner((UddiEntity) obj)) {
-                                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-                        }
-
-                        i++;
-                }
+        // No null input
+        if (body == null) {
+            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
         }
 
-        public void validateDeleteService(EntityManager em, DeleteService body) throws DispositionReportFaultMessage {
+        // No null or empty list
+        List<String> entityKeyList = body.getBusinessKey();
+        if (entityKeyList == null || entityKeyList.size() == 0) {
+            throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+        }
 
-                // No null input
-                if (body == null) {
-                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-                }
+        HashSet<String> dupCheck = new HashSet<String>();
+        int i = 0;
+        for (String entityKey : entityKeyList) {
 
-                // No null or empty list
-                List<String> entityKeyList = body.getServiceKey();
-                if (entityKeyList == null || entityKeyList.size() == 0) {
-                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
-                }
+            // Per section 4.4: keys must be case-folded
+            entityKey = entityKey.toLowerCase();
+            entityKeyList.set(i, entityKey);
 
-                HashSet<String> dupCheck = new HashSet<String>();
-                int i = 0;
-                for (String entityKey : entityKeyList) {
+            boolean inserted = dupCheck.add(entityKey);
+            if (!inserted) {
+                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+            }
 
-                        // Per section 4.4: keys must be case-folded
-                        entityKey = entityKey.toLowerCase();
-                        entityKeyList.set(i, entityKey);
+            Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
+            if (obj == null) {
+                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", entityKey));
+            }
 
-                        boolean inserted = dupCheck.add(entityKey);
-                        if (!inserted) {
-                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
-                        }
+            if (!publisher.isOwner((UddiEntity) obj)) {
+                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
+            }
 
-                        Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
-                        if (obj == null) {
-                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", entityKey));
-                        }
+            i++;
+        }
+    }
 
-                        if (!publisher.isOwner((UddiEntity) obj)) {
-                                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-                        }
+    public void validateDeleteService(EntityManager em, DeleteService body) throws DispositionReportFaultMessage {
 
-                        i++;
-                }
+        // No null input
+        if (body == null) {
+            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
         }
 
-        public void validateDeleteBinding(EntityManager em, DeleteBinding body) throws DispositionReportFaultMessage {
-
-                // No null input
-                if (body == null) {
-                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-                }
+        // No null or empty list
+        List<String> entityKeyList = body.getServiceKey();
+        if (entityKeyList == null || entityKeyList.size() == 0) {
+            throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+        }
 
-                // No null or empty list
-                List<String> entityKeyList = body.getBindingKey();
-                if (entityKeyList == null || entityKeyList.size() == 0) {
-                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
-                }
+        HashSet<String> dupCheck = new HashSet<String>();
+        int i = 0;
+        for (String entityKey : entityKeyList) {
 
-                // Checking for duplicates and existence
-                HashSet<String> dupCheck = new HashSet<String>();
-                int i = 0;
-                for (String entityKey : entityKeyList) {
-                        validateKeyLength(entityKey);
-                        // Per section 4.4: keys must be case-folded
-                        entityKey = entityKey.toLowerCase();
-                        entityKeyList.set(i, entityKey);
+            // Per section 4.4: keys must be case-folded
+            entityKey = entityKey.toLowerCase();
+            entityKeyList.set(i, entityKey);
 
-                        boolean inserted = dupCheck.add(entityKey);
-                        if (!inserted) {
-                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
-                        }
+            boolean inserted = dupCheck.add(entityKey);
+            if (!inserted) {
+                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+            }
 
-                        Object obj = em.find(org.apache.juddi.model.BindingTemplate.class, entityKey);
-                        if (obj == null) {
-                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BindingTemplateNotFound", entityKey));
-                        }
+            Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
+            if (obj == null) {
+                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", entityKey));
+            }
 
-                        if (!publisher.isOwner((UddiEntity) obj)) {
-                                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-                        }
+            if (!publisher.isOwner((UddiEntity) obj)) {
+                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
+            }
 
-                        i++;
-                }
+            i++;
         }
+    }
 
-        public void validateDeleteTModel(EntityManager em, DeleteTModel body) throws DispositionReportFaultMessage {
+    public void validateDeleteBinding(EntityManager em, DeleteBinding body) throws DispositionReportFaultMessage {
 
-                // No null input
-                if (body == null) {
-                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-                }
+        // No null input
+        if (body == null) {
+            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+        }
 
-                // No null or empty list
-                List<String> entityKeyList = body.getTModelKey();
-                if (entityKeyList == null || entityKeyList.size() == 0) {
-                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
-                }
+        // No null or empty list
+        List<String> entityKeyList = body.getBindingKey();
+        if (entityKeyList == null || entityKeyList.size() == 0) {
+            throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+        }
 
-                HashSet<String> dupCheck = new HashSet<String>();
-                int i = 0;
-                for (String entityKey : entityKeyList) {
-                        validateKeyLength(entityKey);
-                        // Per section 4.4: keys must be case-folded
-                        entityKey = entityKey.toLowerCase();
-                        entityKeyList.set(i, entityKey);
+        // Checking for duplicates and existence
+        HashSet<String> dupCheck = new HashSet<String>();
+        int i = 0;
+        for (String entityKey : entityKeyList) {
+            validateKeyLength(entityKey);
+            // Per section 4.4: keys must be case-folded
+            entityKey = entityKey.toLowerCase();
+            entityKeyList.set(i, entityKey);
 
-                        boolean inserted = dupCheck.add(entityKey);
-                        if (!inserted) {
-                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
-                        }
+            boolean inserted = dupCheck.add(entityKey);
+            if (!inserted) {
+                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+            }
 
-                        Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey);
-                        if (obj == null) {
-                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", entityKey));
-                        }
+            Object obj = em.find(org.apache.juddi.model.BindingTemplate.class, entityKey);
+            if (obj == null) {
+                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BindingTemplateNotFound", entityKey));
+            }
 
-                        if (!publisher.isOwner((UddiEntity) obj)) {
-                                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-                        }
+            if (!publisher.isOwner((UddiEntity) obj)) {
+                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
+            }
 
-                        i++;
-                }
+            i++;
         }
+    }
 
-        public void validateDeletePublisherAssertions(EntityManager em, DeletePublisherAssertions body) throws DispositionReportFaultMessage {
+    public void validateDeleteTModel(EntityManager em, DeleteTModel body) throws DispositionReportFaultMessage {
 
-                // No null input
-                if (body == null) {
-                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-                }
+        // No null input
+        if (body == null) {
+            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+        }
 
-                // No null or empty list
-                List<org.uddi.api_v3.PublisherAssertion> entityList = body.getPublisherAssertion();
-                if (entityList == null || entityList.size() == 0) {
-                        throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.NoPubAssertions"));
-                }
+        // No null or empty list
+        List<String> entityKeyList = body.getTModelKey();
+        if (entityKeyList == null || entityKeyList.size() == 0) {
+            throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+        }
 
-                for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
-                        validateKeyLength(entity.getFromKey());
-                        validateKeyLength(entity.getToKey());
-                        validatePublisherAssertion(em, entity);
+        HashSet<String> dupCheck = new HashSet<String>();
+        int i = 0;
+        for (String entityKey : entityKeyList) {
+            validateKeyLength(entityKey);
+            // Per section 4.4: keys must be case-folded
+            entityKey = entityKey.toLowerCase();
+            entityKeyList.set(i, entityKey);
 
-                        org.apache.juddi.model.PublisherAssertionId pubAssertionId = new org.apache.juddi.model.PublisherAssertionId(entity.getFromKey(), entity.getToKey());
-                        Object obj = em.find(org.apache.juddi.model.PublisherAssertion.class, pubAssertionId);
-                        if (obj == null) {
-                                throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
-                        } else {
-                                org.apache.juddi.model.PublisherAssertion pubAssertion = (org.apache.juddi.model.PublisherAssertion) obj;
-                                org.uddi.api_v3.KeyedReference keyedRef = entity.getKeyedReference();
-                                if (keyedRef == null) {
-                                        throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
-                                }
+            boolean inserted = dupCheck.add(entityKey);
+            if (!inserted) {
+                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+            }
 
-                                if (!pubAssertion.getTmodelKey().equalsIgnoreCase(keyedRef.getTModelKey())
-                                        || !pubAssertion.getKeyName().equalsIgnoreCase(keyedRef.getKeyName())
-                                        || !pubAssertion.getKeyValue().equalsIgnoreCase(keyedRef.getKeyValue())) {
-                                        throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
-                                }
+            Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey);
+            if (obj == null) {
+                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", entityKey));
+            }
 
-                        }
+            if (!publisher.isOwner((UddiEntity) obj)) {
+                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
+            }
 
-                }
+            i++;
         }
+    }
 
-        public void validateSaveBusiness(EntityManager em, SaveBusiness body, Configuration config) throws DispositionReportFaultMessage {
-
-                if (config == null) {
-                        try {
-                                config = AppConfig.getConfiguration();
-                        } catch (ConfigurationException ce) {
-                                log.error("Could not optain config. " + ce.getMessage(), ce);
-                        }
-                }
-                // No null input
-                if (body == null) {
-                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-                }
-
-                // No null or empty list
-                List<org.uddi.api_v3.BusinessEntity> entityList = body.getBusinessEntity();
-                if (entityList == null || entityList.size() == 0) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.savebusiness.NoInput"));
-                }
+    public void validateDeletePublisherAssertions(EntityManager em, DeletePublisherAssertions body) throws DispositionReportFaultMessage {
 
-                for (org.uddi.api_v3.BusinessEntity entity : entityList) {
-                        validateBusinessEntity(em, entity, config);
-                }
+        // No null input
+        if (body == null) {
+            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
         }
 
-        public void validateSaveBusinessMax(EntityManager em) throws DispositionReportFaultMessage {
-
-                //Obtain the maxSettings for this publisher or get the defaults
-                Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
-                Integer maxBusinesses = publisher.getMaxBusinesses();
-                try {
-                        if (maxBusinesses == null) {
-                                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_BUSINESSES_PER_PUBLISHER)) {
-                                        maxBusinesses = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_BUSINESSES_PER_PUBLISHER, -1);
-                                } else {
-                                        maxBusinesses = -1;
-                                }
-                        }
-                } catch (ConfigurationException e) {
-                        log.error(e.getMessage(), e);
-                        maxBusinesses = -1; //in case the configuration is not available
-                }
-                //if we have the maxBusinesses set for this publisher then we need to make sure we did not exceed it.
-                if (maxBusinesses > 0) {
-                        //get the businesses owned by this publisher
-                        List<?> businessKeysFound = FindBusinessByPublisherQuery.select(em, null, publisher, null);
-                        if (businessKeysFound != null && businessKeysFound.size() > maxBusinesses) {
-                                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxBusinessesExceeded"));
-                        }
-                }
-
+        // No null or empty list
+        List<org.uddi.api_v3.PublisherAssertion> entityList = body.getPublisherAssertion();
+        if (entityList == null || entityList.size() == 0) {
+            throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.NoPubAssertions"));
         }
 
-        public void validateSaveService(EntityManager em, SaveService body, Configuration config) throws DispositionReportFaultMessage {
-
-                if (config == null) {
-                        try {
-                                config = AppConfig.getConfiguration();
-                        } catch (ConfigurationException ce) {
-                                log.error("Could not optain config. " + ce.getMessage(), ce);
-                        }
-                }
-                // No null input
-                if (body == null) {
-                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-                }
+        for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
+            validateKeyLength(entity.getFromKey());
+            validateKeyLength(entity.getToKey());
+            validatePublisherAssertion(em, entity);
 
-                // No null or empty list
-                List<org.uddi.api_v3.BusinessService> entityList = body.getBusinessService();
-                if (entityList == null || entityList.size() == 0) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.saveservice.NoInput"));
+            org.apache.juddi.model.PublisherAssertionId pubAssertionId = new org.apache.juddi.model.PublisherAssertionId(entity.getFromKey(), entity.getToKey());
+            Object obj = em.find(org.apache.juddi.model.PublisherAssertion.class, pubAssertionId);
+            if (obj == null) {
+                throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
+            } else {
+                org.apache.juddi.model.PublisherAssertion pubAssertion = (org.apache.juddi.model.PublisherAssertion) obj;
+                org.uddi.api_v3.KeyedReference keyedRef = entity.getKeyedReference();
+                if (keyedRef == null) {
+                    throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
                 }
 
-                for (org.uddi.api_v3.BusinessService entity : entityList) {
-                        // Entity specific data validation
-                        validateBusinessService(em, entity, null, config);
+                if (!pubAssertion.getTmodelKey().equalsIgnoreCase(keyedRef.getTModelKey())
+                        || !pubAssertion.getKeyName().equalsIgnoreCase(keyedRef.getKeyName())
+                        || !pubAssertion.getKeyValue().equalsIgnoreCase(keyedRef.getKeyValue())) {
+                    throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
                 }
-        }
 
-        public void validateSaveServiceMax(EntityManager em, String businessKey) throws DispositionReportFaultMessage {
+            }
 
-                //Obtain the maxSettings for this publisher or get the defaults
-                Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
-                Integer maxServices = publisher.getMaxBusinesses();
-                try {
-                        if (maxServices == null) {
-                                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_SERVICES_PER_BUSINESS)) {
-                                        maxServices = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_SERVICES_PER_BUSINESS, -1);
-                                } else {
-                                        maxServices = -1;
-                                }
-                        }
-                } catch (ConfigurationException e) {
-                        log.error(e.getMessage(), e);
-                        maxServices = -1; //incase the configuration isn't available
-                }
-                //if we have the maxServices set for a business then we need to make sure we did not exceed it.
-                if (maxServices > 0) {
-                        //get the businesses owned by this publisher
-                        org.apache.juddi.model.BusinessEntity modelBusinessEntity = em.find(org.apache.juddi.model.BusinessEntity.class, businessKey);
-                        if (modelBusinessEntity.getBusinessServices() != null && modelBusinessEntity.getBusinessServices().size() > maxServices) {
-                                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxServicesExceeded"));
-                        }
-                }
         }
+    }
 
-        public void validateSaveBinding(EntityManager em, SaveBinding body, Configuration config) throws DispositionReportFaultMessage {
+    public void validateSaveBusiness(EntityManager em, SaveBusiness body, Configuration config) throws DispositionReportFaultMessage {
 
-                if (config == null) {
-                        try {
-                                config = AppConfig.getConfiguration();
-                        } catch (ConfigurationException ce) {
-                                log.error("Could not optain config. " + ce.getMessage(), ce);
-                        }
-                }
-                // No null input
-                if (body == null) {
-                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-                }
-
-                // No null or empty list
-                List<org.uddi.api_v3.BindingTemplate> entityList = body.getBindingTemplate();
-                if (entityList == null || entityList.size() == 0) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.savebinding.NoInput"));
-                }
-
-                for (org.uddi.api_v3.BindingTemplate entity : entityList) {
-                        validateBindingTemplate(em, entity, null, config);
-                }
+        if (config == null) {
+            try {
+                config = AppConfig.getConfiguration();
+            } catch (ConfigurationException ce) {
+                log.error("Could not optain config. " + ce.getMessage(), ce);
+            }
         }
-
-        public void validateSaveBindingMax(EntityManager em, String serviceKey) throws DispositionReportFaultMessage {
-
-                //Obtain the maxSettings for this publisher or get the defaults
-                Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
-                Integer maxBindings = publisher.getMaxBindingsPerService();
-                try {
-                        if (maxBindings == null) {
-                                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_BINDINGS_PER_SERVICE)) {
-                                        maxBindings = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_BINDINGS_PER_SERVICE, -1);
-                                } else {
-                                        maxBindings = -1;
-                                }
-                        }
-                } catch (ConfigurationException e) {
-                        log.error(e.getMessage(), e);
-                        maxBindings = -1; //incase the config isn't available
-                }
-                //if we have the maxBindings set for a service then we need to make sure we did not exceed it.
-                if (maxBindings > 0) {
-                        //get the bindings owned by this service
-                        org.apache.juddi.model.BusinessService modelBusinessService = em.find(org.apache.juddi.model.BusinessService.class, serviceKey);
-                        if (modelBusinessService.getBindingTemplates() != null && modelBusinessService.getBindingTemplates().size() > maxBindings) {
-                                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxBindingsExceeded"));
-                        }
-                }
+        // No null input
+        if (body == null) {
+            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
         }
 
-        public void validateSaveTModel(EntityManager em, SaveTModel body, Configuration config) throws DispositionReportFaultMessage {
-
-                if (config == null) {
-                        try {
-                                config = AppConfig.getConfiguration();
-                        } catch (ConfigurationException ce) {
-                                log.error("Could not optain config. " + ce.getMessage(), ce);
-                        }
-                }
-                // No null input
-                if (body == null) {
-                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-                }
-
-                // No null or empty list
-                List<org.uddi.api_v3.TModel> entityList = body.getTModel();
-                if (entityList == null || entityList.size() == 0) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.savetmodel.NoInput"));
-                }
+        // No null or empty list
+        List<org.uddi.api_v3.BusinessEntity> entityList = body.getBusinessEntity();
+        if (entityList == null || entityList.size() == 0) {
+            throw new ValueNotAllowedException(new ErrorMessage("errors.savebusiness.NoInput"));
+        }
 
-                for (org.uddi.api_v3.TModel entity : entityList) {
-                        validateTModel(em, entity, config);
-                }
+        for (org.uddi.api_v3.BusinessEntity entity : entityList) {
+            validateBusinessEntity(em, entity, config);
         }
+    }
 
-        public void validateSaveTModelMax(EntityManager em) throws DispositionReportFaultMessage {
+    public void validateSaveBusinessMax(EntityManager em) throws DispositionReportFaultMessage {
 
-                //Obtain the maxSettings for this publisher or get the defaults
-                Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
-                Integer maxTModels = publisher.getMaxTmodels();
-                try {
-                        if (maxTModels == null) {
-                                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_TMODELS_PER_PUBLISHER)) {
-                                        maxTModels = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_TMODELS_PER_PUBLISHER, -1);
-                                } else {
-                                        maxTModels = -1;
-                                }
-                        }
-                } catch (ConfigurationException e) {
-                        log.error(e.getMessage(), e);
-                        maxTModels = -1; //incase the config isn't available
-                }
-                //if we have the TModels set for a publisher then we need to make sure we did not exceed it.
-                if (maxTModels > 0) {
-                        //get the tmodels owned by this publisher
-                        List<?> tmodelKeysFound = FindTModelByPublisherQuery.select(em, null, publisher, null);
-                        if (tmodelKeysFound != null && tmodelKeysFound.size() > maxTModels) {
-                                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxTModelsExceeded"));
-                        }
+        //Obtain the maxSettings for this publisher or get the defaults
+        Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
+        Integer maxBusinesses = publisher.getMaxBusinesses();
+        try {
+            if (maxBusinesses == null) {
+                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_BUSINESSES_PER_PUBLISHER)) {
+                    maxBusinesses = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_BUSINESSES_PER_PUBLISHER, -1);
+                } else {
+                    maxBusinesses = -1;
                 }
+            }
+        } catch (ConfigurationException e) {
+            log.error(e.getMessage(), e);
+            maxBusinesses = -1; //in case the configuration is not available
+        }
+        //if we have the maxBusinesses set for this publisher then we need to make sure we did not exceed it.
+        if (maxBusinesses > 0) {
+            //get the businesses owned by this publisher
+            List<?> businessKeysFound = FindBusinessByPublisherQuery.select(em, null, publisher, null);
+            if (businessKeysFound != null && businessKeysFound.size() > maxBusinesses) {
+                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxBusinessesExceeded"));
+            }
         }
 
-        public void validateAddPublisherAssertions(EntityManager em, AddPublisherAssertions body) throws DispositionReportFaultMessage {
+    }
 
-                // No null input
-                if (body == null) {
-                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-                }
+    public void validateSaveService(EntityManager em, SaveService body, Configuration config) throws DispositionReportFaultMessage {
 
-                // No null or empty list
-                List<org.uddi.api_v3.PublisherAssertion> entityList = body.getPublisherAssertion();
-                if (entityList == null || entityList.size() == 0) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.addpublisherassertions.NoInput"));
-                }
-
-                for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
-                        validatePublisherAssertion(em, entity);
-                }
+        if (config == null) {
+            try {
+                config = AppConfig.getConfiguration();
+            } catch (ConfigurationException ce) {
+                log.error("Could not optain config. " + ce.getMessage(), ce);
+            }
+        }
+        // No null input
+        if (body == null) {
+            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
         }
 
-        public void validateSetPublisherAssertions(EntityManager em, Holder<List<org.uddi.api_v3.PublisherAssertion>> body) throws DispositionReportFaultMessage {
+        // No null or empty list
+        List<org.uddi.api_v3.BusinessService> entityList = body.getBusinessService();
+        if (entityList == null || entityList.size() == 0) {
+            throw new ValueNotAllowedException(new ErrorMessage("errors.saveservice.NoInput"));
+        }
 
-                // No null input
-                if (body == null) {
-                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-                }
+        for (org.uddi.api_v3.BusinessService entity : entityList) {
+            // Entity specific data validation
+            validateBusinessService(em, entity, null, config);
+        }
+    }
 
-                // Assertion list can be null or empty - it signifies that publisher is deleting all their assertions
-                List<org.uddi.api_v3.PublisherAssertion> entityList = body.value;
-                if (entityList != null && entityList.size() > 0) {
+    public void validateSaveServiceMax(EntityManager em, String businessKey) throws DispositionReportFaultMessage {
 
-                        for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
-                                validatePublisherAssertion(em, entity);
-                        }
+        //Obtain the maxSettings for this publisher or get the defaults
+        Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
+        Integer maxServices = publisher.getMaxBusinesses();
+        try {
+            if (maxServices == null) {
+                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_SERVICES_PER_BUSINESS)) {
+                    maxServices = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_SERVICES_PER_BUSINESS, -1);
+                } else {
+                    maxServices = -1;
                 }
+            }
+        } catch (ConfigurationException e) {
+            log.error(e.getMessage(), e);
+            maxServices = -1; //incase the configuration isn't available
         }
-
-        void validateNotSigned(org.uddi.api_v3.BusinessEntity item) throws ValueNotAllowedException {
-                if (item == null) {
-                        return;
-                }
-                if (item.getBusinessKey() == null && !item.getSignature().isEmpty()) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessKey"));
-                }
-                if (item.getBusinessServices() != null && !item.getSignature().isEmpty()) {
-                        for (int i = 0; i < item.getBusinessServices().getBusinessService().size(); i++) {
-                                if (item.getBusinessServices().getBusinessService().get(i).getBusinessKey() == null
-                                        || item.getBusinessServices().getBusinessService().get(i).getBusinessKey().length() == 0) {
-                                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "business/Service(" + i + ")/businessKey"));
-                                }
-                                if (item.getBusinessServices().getBusinessService().get(i).getServiceKey() == null
-                                        || item.getBusinessServices().getBusinessService().get(i).getServiceKey().length() == 0) {
-                                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "business/Service(" + i + ")/serviceKey"));
-                                }
-                                if (item.getBusinessServices().getBusinessService().get(i).getBindingTemplates() != null) {
-                                        for (int k = 0; k < item.getBusinessServices().getBusinessService().get(i).getBindingTemplates().getBindingTemplate().size(); k++) {
-                                                if (item.getBusinessServices().getBusinessService().get(i).getBindingTemplates().getBindingTemplate().get(k).getBindingKey() == null
-                                                        || item.getBusinessServices().getBusinessService().get(i).getBindingTemplates().getBindingTemplate().get(k).getBindingKey().length() == 0) {
-                                                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "business/Service(" + i + ")/bindingTemplate)" + k + ")/bindingKey"));
-                                                }
-                                        }
-                                }
-                        }
-                }
+        //if we have the maxServices set for a business then we need to make sure we did not exceed it.
+        if (maxServices > 0) {
+            //get the businesses owned by this publisher
+            org.apache.juddi.model.BusinessEntity modelBusinessEntity = em.find(org.apache.juddi.model.BusinessEntity.class, businessKey);
+            if (modelBusinessEntity.getBusinessServices() != null && modelBusinessEntity.getBusinessServices().size() > maxServices) {
+                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxServicesExceeded"));
+            }
         }
+    }
 
-        void validateNotSigned(org.uddi.api_v3.BindingTemplate item) throws ValueNotAllowedException {
-                if (item == null) {
-                        return;
-                }
-                if (item.getBindingKey() == null && !item.getSignature().isEmpty()) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "bindingKey"));
-                }
-                if (item.getServiceKey() == null && !item.getSignature().isEmpty()) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "serviceKey"));
-                }
-        }
+    public void validateSaveBinding(EntityManager em, SaveBinding body, Configuration config) throws DispositionReportFaultMessage {
 
-        void validateNotSigned(org.uddi.api_v3.TModel item) throws ValueNotAllowedException {
-                if (item == null) {
-                        return;
-                }
-                if (item.getTModelKey() == null && !item.getSignature().isEmpty()) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "tModelKey"));
-                }
+        if (config == null) {
+            try {
+                config = AppConfig.getConfiguration();
+            } catch (ConfigurationException ce) {
+                log.error("Could not optain config. " + ce.getMessage(), ce);
+            }
+        }
+        // No null input
+        if (body == null) {
+            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
         }
 
-        void validateNotSigned(org.uddi.api_v3.BusinessService item) throws ValueNotAllowedException {
-                if (item == null) {
-                        return;
-                }
-                if (item.getBusinessKey() == null && !item.getSignature().isEmpty()) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessKey"));
-                }
-                if (item.getServiceKey() == null && !item.getSignature().isEmpty()) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "serviceKey"));
-                }
-                //if i'm signed and a key isn't defined in a bt
-                if (item.getBindingTemplates() != null && !item.getSignature().isEmpty()) {
-                        for (int i = 0; i < item.getBindingTemplates().getBindingTemplate().size(); i++) {
-                                if (item.getBindingTemplates().getBindingTemplate().get(i).getBindingKey() == null
-                                        || item.getBindingTemplates().getBindingTemplate().get(i).getBindingKey().length() == 0) {
-                                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessService/bindingTemplate(" + i + ")/bindingKey"));
-                                }
-                        }
-                }
+        // No null or empty list
+        List<org.uddi.api_v3.BindingTemplate> entityList = body.getBindingTemplate();
+        if (entityList == null || entityList.size() == 0) {
+            throw new ValueNotAllowedException(new ErrorMessage("errors.savebinding.NoInput"));
         }
 
-        public void validateBusinessEntity(EntityManager em, org.uddi.api_v3.BusinessEntity businessEntity, Configuration config) throws DispositionReportFaultMessage {
+        for (org.uddi.api_v3.BindingTemplate entity : entityList) {
+            validateBindingTemplate(em, entity, null, config);
+        }
+    }
 
-                // A supplied businessEntity can't be null
-                if (businessEntity == null) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.businessentity.NullInput"));
-                }
+    public void validateSaveBindingMax(EntityManager em, String serviceKey) throws DispositionReportFaultMessage {
 
-                boolean entityExists = false;
-                validateNotSigned(businessEntity);
-                String entityKey = businessEntity.getBusinessKey();
-                if (entityKey == null || entityKey.length() == 0) {
-                        KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
-                        entityKey = keyGen.generate();
-                        businessEntity.setBusinessKey(entityKey);
+        //Obtain the maxSettings for this publisher or get the defaults
+        Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
+        Integer maxBindings = publisher.getMaxBindingsPerService();
+        try {
+            if (maxBindings == null) {
+                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_BINDINGS_PER_SERVICE)) {
+                    maxBindings = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_BINDINGS_PER_SERVICE, -1);
                 } else {
-                        // Per section 4.4: keys must be case-folded
-                        entityKey = entityKey.toLowerCase();
-                        businessEntity.setBusinessKey(entityKey);
-                        validateKeyLength(entityKey);
-                        Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
-                        if (obj != null) {
-                                entityExists = true;
-
-                                // Make sure publisher owns this entity.
-                                if (!publisher.isOwner((UddiEntity) obj)) {
-                                        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-                                }
-                        } else {
-                                // Inside this block, we have a key proposed by the publisher on a new entity
-
-                                // Validate key and then check to see that the proposed key is valid for this publisher
-                                ValidateUDDIKey.validateUDDIv3Key(entityKey);
-                                if (!publisher.isValidPublisherKey(em, entityKey)) {
-                                        throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
-                                }
-
-                        }
-                }
-
-                if (!entityExists) {
-                        // Check to make sure key isn't used by another entity.
-                        if (!isUniqueKey(em, entityKey)) {
-                                throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.KeyExists", entityKey));
-                        }
+                    maxBindings = -1;
                 }
-
-                // was TODO: validate "checked" categories or category groups (see section 5.2.3 of spec)? optional to support
-                //covered by ref integrity checks
-
-                validateNames(businessEntity.getName());
-                validateDiscoveryUrls(businessEntity.getDiscoveryURLs());
-                validateContacts(businessEntity.getContacts(), config);
-                validateCategoryBag(businessEntity.getCategoryBag(), config);
-                validateIdentifierBag(businessEntity.getIdentifierBag(), config);
-                validateDescriptions(businessEntity.getDescription());
-                validateBusinessServices(em, businessEntity.getBusinessServices(), businessEntity, config);
-
+            }
+        } catch (ConfigurationException e) {
+            log.error(e.getMessage(), e);
+            maxBindings = -1; //incase the config isn't available
+        }
+        //if we have the maxBindings set for a service then we need to make sure we did not exceed it.
+        if (maxBindings > 0) {
+            //get the bindings owned by this service
+            org.apache.juddi.model.BusinessService modelBusinessService = em.find(org.apache.juddi.model.BusinessService.class, serviceKey);
+            if (modelBusinessService.getBindingTemplates() != null && modelBusinessService.getBindingTemplates().size() > maxBindings) {
+                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxBindingsExceeded"));
+            }
         }
+    }
 
-        public void validateBusinessServices(EntityManager em, org.uddi.api_v3.BusinessServices businessServices, org.uddi.api_v3.BusinessEntity parent, Configuration config)
-                throws DispositionReportFaultMessage {
-                // Business services is optional
-                if (businessServices == null) {
-                        return;
-                }
-                List<org.uddi.api_v3.BusinessService> businessServiceList = businessServices.getBusinessService();
-                if (businessServiceList == null || businessServiceList.size() == 0) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.businessservices.NoInput"));
-                }
+    public void validateSaveTModel(EntityManager em, SaveTModel body, Configuration config) throws DispositionReportFaultMessage {
 
-                for (org.uddi.api_v3.BusinessService businessService : businessServiceList) {
-                        validateBusinessService(em, businessService, parent, config);
-                }
+        if (config == null) {
+            try {
+                config = AppConfig.getConfiguration();
+            } catch (ConfigurationException ce) {
+                log.error("Could not optain config. " + ce.getMessage(), ce);
+            }
+        }
+        // No null input
+        if (body == null) {
+            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+        }
 
+        // No null or empty list
+        List<org.uddi.api_v3.TModel> entityList = body.getTModel();
+        if (entityList == null || entityList.size() == 0) {
+            throw new ValueNotAllowedException(new ErrorMessage("errors.savetmodel.NoInput"));
         }
 
-        public void validateBusinessService(EntityManager em, org.uddi.api_v3.BusinessService businessService, org.uddi.api_v3.BusinessEntity parent, Configuration config)
-                throws DispositionReportFaultMessage {
+        for (org.uddi.api_v3.TModel entity : entityList) {
+            validateTModel(em, entity, config);
+        }
+    }
 
-                // A supplied businessService can't be null
-                if (businessService == null) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.businessservice.NullInput"));
-                }
+    public void validateSaveTModelMax(EntityManager em) throws DispositionReportFaultMessage {
 
-                validateNotSigned(businessService);
-                // Retrieve the service's passed key
-                String entityKey = businessService.getServiceKey();
-                if (entityKey != null && entityKey.length() > 0) {
-                        // Per section 4.4: keys must be case-folded
-                        entityKey = entityKey.toLowerCase();
-                        validateKeyLength(entityKey);
-                        businessService.setServiceKey(entityKey);
+        //Obtain the maxSettings for this publisher or get the defaults
+        Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
+        Integer maxTModels = publisher.getMaxTmodels();
+        try {
+            if (maxTModels == null) {
+                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_TMODELS_PER_PUBLISHER)) {
+                    maxTModels = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_TMODELS_PER_PUBLISHER, -1);
+                } else {
+                    maxTModels = -1;
                 }
-
-                // The parent key is either supplied or provided by the higher call to the parent entity save.  If the passed-in parent's business key differs from 
-                // the (non-null) business key retrieved from the service, then we have a possible service projection.
-                String parentKey = businessService.getBusinessKey();
-                if (parentKey != null && parentKey.length() > 0) {
-                        // Per section 4.4: keys must be case-folded
-                        parentKey = parentKey.toLowerCase();
+            }
+        } catch (ConfigurationException e) {
+            log.error(e.getMessage(), e);
+            maxTModels = -1; //incase the config isn't available
+        }
+        //if we have the TModels set for a publisher then we need to make sure we did not exceed it.
+        if (maxTModels > 0) {
+            //get the tmodels owned by this publisher
+            List<?> tmodelKeysFound = FindTModelByPublisherQuery.select(em, null, publisher, null);
+            if (tmodelKeysFound != null && tmodelKeysFound.size() > maxTModels) {
+                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxTModelsExceeded"));
+            }
+        }
+    }
+
+    public void validateAddPublisherAssertions(EntityManager em, AddPublisherAssertions body) throws DispositionReportFaultMessage {
+
+        // No null input
+        if (body == null) {
+            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+        }
+
+        // No null or empty list
+        List<org.uddi.api_v3.PublisherAssertion> entityList = body.getPublisherAssertion();
+        if (entityList == null || entityList.size() == 0) {
+            throw new ValueNotAllowedException(new ErrorMessage("errors.addpublisherassertions.NoInput"));
+        }
+
+        for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
+            validatePublisherAssertion(em, entity);
+        }
+    }
+
+    public void validateSetPublisherAssertions(EntityManager em, Holder<List<org.uddi.api_v3.PublisherAssertion>> body) throws DispositionReportFaultMessage {
+
+        // No null input
+        if (body == null) {
+            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+        }
+
+        // Assertion list can be null or empty - it signifies that publisher is deleting all their assertions
+        List<org.uddi.api_v3.PublisherAssertion> entityList = body.value;
+        if (entityList != null && entityList.size() > 0) {
+
+            for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
+                validatePublisherAssertion(em, entity);
+            }
+        }
+    }
+    
+    void validateNotSigned(org.uddi.api_v3.BusinessEntity item) throws ValueNotAllowedException{
+        if (item==null)
+            return;
+        if (item.getBusinessKey()==null && !item.getSignature().isEmpty())
+            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessKey"));
+        if (item.getBusinessServices()!=null && !item.getSignature().isEmpty())
+        {
+            for (int i=0; i < item.getBusinessServices().getBusinessService().size(); i++){
+                if (item.getBusinessServices().getBusinessService().get(i).getBusinessKey()==null ||
+                        item.getBusinessServices().getBusinessService().get(i).getBusinessKey().length()==0){
+                    throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "business/Service("+i+")/businessKey"));        
+                }
+                if (item.getBusinessServices().getBusinessService().get(i).getServiceKey()==null ||
+                        item.getBusinessServices().getBusinessService().get(i).getServiceKey().length()==0){
+                    throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "business/Service("+i+")/serviceKey"));        
+                }
+                if (item.getBusinessServices().getBusinessService().get(i).getBindingTemplates()!=null){
+                    for (int k=0; k < item.getBusinessServices().getBusinessService().get(i).getBindingTemplates().getBindingTemplate().size(); k++){
+                        if (item.getBusinessServices().getBusinessService().get(i).getBindingTemplates().getBindingTemplate().get(k).getBindingKey()==null ||
+                                item.getBusinessServices().getBusinessService().get(i).getBindingTemplates().getBindingTemplate().get(k).getBindingKey().length()==0)
+                        {
+                            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "business/Service("+i+")/bindingTemplate)"+k+")/bindingKey"));        
+                        }
+                    }
+                }
+            }
+        }
+    }
+    
+    void validateNotSigned(org.uddi.api_v3.BindingTemplate item) throws ValueNotAllowedException{
+        if (item==null)
+            return;
+        if (item.getBindingKey()==null && !item.getSignature().isEmpty())
+            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "bindingKey"));
+        if (item.getServiceKey()==null && !item.getSignature().isEmpty())
+            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "serviceKey"));
+    }
+    void validateNotSigned(org.uddi.api_v3.TModel item) throws ValueNotAllowedException{
+        if (item==null)
+            return;
+        if (item.getTModelKey()==null && !item.getSignature().isEmpty())
+            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "tModelKey"));
+    }
+    
+    void validateNotSigned(org.uddi.api_v3.BusinessService item) throws ValueNotAllowedException{
+        if (item==null)
+            return;
+        if (item.getBusinessKey()==null && !item.getSignature().isEmpty())
+            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessKey"));
+        if (item.getServiceKey()==null && !item.getSignature().isEmpty())
+            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "serviceKey"));
+        //if i'm signed and a key isn't defined in a bt
+        if (item.getBindingTemplates()!=null && !item.getSignature().isEmpty())
+            for (int i=0; i < item.getBindingTemplates().getBindingTemplate().size(); i++)
+            {
+                if (item.getBindingTemplates().getBindingTemplate().get(i).getBindingKey()==null ||
+                        item.getBindingTemplates().getBindingTemplate().get(i).getBindingKey().length()==0)
+                {
+                    throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessService/bindingTemplate(" + i + ")/bindingKey"));
+                }
+        }
+    }
+
+    public void validateBusinessEntity(EntityManager em, org.uddi.api_v3.BusinessEntity businessEntity, Configuration config) throws DispositionReportFaultMessage {
+
+        // A supplied businessEntity can't be null
+        if (businessEntity == null) {
+            throw new ValueNotAllowedException(new ErrorMessage("errors.businessentity.NullInput"));
+        }
+
+        boolean entityExists = false;
+        validateNotSigned(businessEntity);
+        String entityKey = businessEntity.getBusinessKey();
+        if (entityKey == null || entityKey.length() == 0) {
+            KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
+            entityKey = keyGen.generate();
+            businessEntity.setBusinessKey(entityKey);
+        } else {
+            // Per section 4.4: keys must be case-folded
+            entityKey = entityKey.toLowerCase();
+            businessEntity.setBusinessKey(entityKey);
+            validateKeyLength(entityKey);
+            Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
+            if (obj != null) {
+                entityExists = true;
+
+                // Make sure publisher owns this entity.
+                if (!publisher.isOwner((UddiEntity) obj)) {
+                    throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
+                }
+            } else {
+                // Inside this block, we have a key proposed by the publisher on a new entity
+
+                // Validate key and then check to see that the proposed key is valid for this publisher
+                ValidateUDDIKey.validateUDDIv3Key(entityKey);
+                if (!publisher.isValidPublisherKey(em, entityKey)) {
+                    throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
+                }
+
+            }
+        }
+
+        if (!entityExists) {
+            // Check to make sure key isn't used by another entity.
+            if (!isUniqueKey(em, entityKey)) {
+                throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.KeyExists", entityKey));
+            }
+        }
+
+        // was TODO: validate "checked" categories or category groups (see section 5.2.3 of spec)? optional to support
+        //covered by ref integrity checks
+
+        validateNames(businessEntity.getName());
+        validateDiscoveryUrls(businessEntity.getDiscoveryURLs());
+        validateContacts(businessEntity.getContacts(), config);
+        validateCategoryBag(businessEntity.getCategoryBag(), config,false);
+        validateIdentifierBag(businessEntity.getIdentifierBag(), config,false);
+        validateDescriptions(businessEntity.getDescription());
+        validateBusinessServices(em, businessEntity.getBusinessServices(), businessEntity, config);
+
+    }
+
+    public void validateBusinessServices(EntityManager em, org.uddi.api_v3.BusinessServices businessServices, org.uddi.api_v3.BusinessEntity parent, Configuration config)
+            throws DispositionReportFaultMessage {
+        // Business services is optional
+        if (businessServices == null) {
+            return;
+        }
+        List<org.uddi.api_v3.BusinessService> businessServiceList = businessServices.getBusinessService();
+        if (businessServiceList == null || businessServiceList.size() == 0) {
+            throw new ValueNotAllowedException(new ErrorMessage("errors.businessservices.NoInput"));
+        }
+
+        for (org.uddi.api_v3.BusinessService businessService : businessServiceList) {
+            validateBusinessService(em, businessService, parent, config);
+        }
+
+    }
+
+    public void validateBusinessService(EntityManager em, org.uddi.api_v3.BusinessService businessService, org.uddi.api_v3.BusinessEntity parent, Configuration config)
+            throws DispositionReportFaultMessage {
+
+        // A supplied businessService can't be null
+        if (businessService == null) {
+            throw new ValueNotAllowedException(new ErrorMessage("errors.businessservice.NullInput"));
+        }
+
+        validateNotSigned(businessService);
+        // Retrieve the service's passed key
+        String entityKey = businessService.getServiceKey();
+        if (entityKey != null && entityKey.length() > 0) {
+            // Per section 4.4: keys must be case-folded
+            entityKey = entityKey.toLowerCase();
+            validateKeyLength(entityKey);
+            businessService.setServiceKey(entityKey);
+        }
+
+        // The parent key is either supplied or provided by the higher call to the parent entity save.  If the passed-in parent's business key differs from 
+        // the (non-null) business key retrieved from the service, then we have a possible service projection.
+        String parentKey = businessService.getBusinessKey();
+        if (parentKey != null && parentKey.length() > 0) {
+            // Per section 4.4: keys must be case-folded
+            parentKey = parentKey.toLowerCase();
+            businessService.setBusinessKey(parentKey);
+        }
+
+        boolean isProjection = false;
+        if (parent != null) {
+            if (parentKey != null && parentKey.length() > 0) {
+                if (!parentKey.equalsIgnoreCase(parent.getBusinessKey())) {
+                    // Possible projected service - if we have differing parent businesses but a service key was not provided, this is an error as it is not possible 
+                    // for the business that doesn't "own" the service to generate the key for it.
+                    if (entityKey == null || entityKey.length() == 0) {
+                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceKeyNotProvidedWithProjection", parentKey + ", " + parent.getBusinessKey()));
+                    }
+
+                    isProjection = true;
+                }
+            } else {
+                parentKey = parent.getBusinessKey();
+            }
+        }
+
+        // Projections don't require as rigorous testing as only the projected service's business key and service key are examined for validity.
+        if (isProjection) {
+
+         
+            Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
+            // Can't project a service that doesn't exist!
+            if (obj == null) {
+                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ProjectedServiceNotFound", parentKey + ", " + entityKey));
+            } else {
+                // If the supplied business key doesn't match the existing service's business key, the projection is invalid.
+                org.apache.juddi.model.BusinessService bs = (org.apache.juddi.model.BusinessService) obj;
+                if (!businessService.getBusinessKey().equalsIgnoreCase(bs.getBusinessEntity().getEntityKey())) {
+                    throw new InvalidProjectionException(new ErrorMessage("errors.invalidprojection.ParentMismatch", businessService.getBusinessKey() + ", " + bs.getBusinessEntity().getEntityKey()));
+                }
+            }
+            obj = null;
+        } else {
+            boolean entityExists = false;
+            if (entityKey == null || entityKey.length() == 0) {
+                KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
+                entityKey = keyGen.generate();
+                businessService.setServiceKey(entityKey);
+            } else {
+
+                Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
+                if (obj != null) {
+                    entityExists = true;
+
+                    org.apache.juddi.model.BusinessService bs = (org.apache.juddi.model.BusinessService) obj;
+
+                    // If the object exists, and the parentKey was not found to this point, then a save on an existing service with a blank
+                    // business key has occurred.  It is set here and added to the entity being saved - a necessary step for the object to be
+                    // persisted properly. (This condition makes some validation tests below unnecessary as the parent is "verified" but it's OK to
+                    // still run them).
+                    if (parentKey == null || parentKey.length() == 0) {
+                        parentKey = bs.getBusinessEntity().getEntityKey();
                         businessService.setBusinessKey(parentKey);
-                }
-
-                boolean isProjection = false;
-                if (parent != null) {
-                        if (parentKey != null && parentKey.length() > 0) {
-                                if (!parentKey.equalsIgnoreCase(parent.getBusinessKey())) {
-                                        // Possible projected service - if we have differing parent businesses but a service key was not provided, this is an error as it is not possible 
-                                        // for the business that doesn't "own" the service to generate the key for it.
-                                        if (entityKey == null || entityKey.length() == 0) {
-                                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceKeyNotProvidedWithProjection", parentKey + ", " + parent.getBusinessKey()));
-                                        }
+                    }
 
-                                        isProjection = true;
-                                }
+                    // Make sure publisher owns this entity.
+                    if (!publisher.isOwner((UddiEntity) obj)) {
+                        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
+                    }
+
+                    // If existing service trying to be saved has a different parent key, then we have a problem
+                    if (!parentKey.equalsIgnoreCase(bs.getBusinessEntity().getEntityKey())) {
+                        // if both businesses are owned by this publisher then we allow it.
+                        // we already check the current business is owned, lets see if the old one is too
+                        if (!publisher.isOwner(bs.getBusinessEntity())) {
+                            throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.businessservice.ParentMismatch", parentKey + ", " + bs.getBusinessEntity().getEntityKey()));
                         } else {
-                                parentKey = parent.getBusinessKey();
+                            if (log.isDebugEnabled()) {
+                                log.debug("Services moved from business " + bs.getBusinessEntity() + " to " + businessService.getBusinessKey());
+                            }
                         }
-                }
-
-                // Projections don't require as rigorous testing as only the projected service's business key and service key are examined for validity.
-                if (isProjection) {
+                    }
 
-
-                        Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
-                        // Can't project a service that doesn't exist!
-                        if (obj == null) {
-                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ProjectedServiceNotFound", parentKey + ", " + entityKey));
-                        } else {
-                                // If the supplied business key doesn't match the existing service's business key, the projection is invalid.
-                                org.apache.juddi.model.BusinessService bs = (org.apache.juddi.model.BusinessService) obj;
-                                if (!businessService.getBusinessKey().equalsIgnoreCase(bs.getBusinessEntity().getEntityKey())) {
-                                        throw new InvalidProjectionException(new ErrorMessage("errors.invalidprojection.ParentMismatch", businessService.getBusinessKey() + ", " + bs.getBusinessEntity().getEntityKey()));
-                                }
-                        }
-                        obj = null;
                 } else {
-                        boolean entityExists = false;
-                        if (entityKey == null || entityKey.length() == 0) {
-                                KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
-                                entityKey = keyGen.generate();
-                                businessService.setServiceKey(entityKey);
-                        } else {
+                    // Inside this block, we have a key proposed by the publisher on a new entity
 
-                                Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
-                                if (obj != null) {
-                                        entityExists = true;
-
-                                        org.apache.juddi.model.BusinessService bs = (org.apache.juddi.model.BusinessService) obj;
-
-                                        // If the object exists, and the parentKey was not found to this point, then a save on an existing service with a blank
-                                        // business key has occurred.  It is set here and added to the entity being saved - a necessary step for the object to be
-                                        // persisted properly. (This condition makes some validation tests below unnecessary as the parent is "verified" but it's OK to
-                                        // still run them).
-                                        if (parentKey == null || parentKey.length() == 0) {
-                                                parentKey = bs.getBusinessEntity().getEntityKey();
-                                                businessService.setBusinessKey(parentKey);
-                                        }
+                    // Validate key and then check to see that the proposed key is valid for this publisher
+                    ValidateUDDIKey.validateUDDIv3Key(entityKey);
+                    if (!publisher.isValidPublisherKey(em, entityKey)) {
+                        throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
+                    }
 
-                                        // Make sure publisher owns this entity.
-                                        if (!publisher.isOwner((UddiEntity) obj)) {
-                                                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-                                        }
-
-                                        // If existing service trying to be saved has a different parent key, then we have a problem
-                                        if (!parentKey.equalsIgnoreCase(bs.getBusinessEntity().getEntityKey())) {
-                                                // if both businesses are owned by this publisher then we allow it.
-                                                // we already check the current business is owned, lets see if the old one is too
-                                                if (!publisher.isOwner(bs.getBusinessEntity())) {
-                                                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.businessservice.ParentMismatch", parentKey + ", " + bs.getBusinessEntity().getEntityKey()));
-                                                } else {
-                                                        if (log.isDebugEnabled()) {
-                                                                log.debug("Services moved from business " + bs.getBusinessEntity() + " to " + businessService.getBusinessKey());
-                                                        }
-                                                }
-                                        }
-
-                                } else {
-                                        // Inside this block, we have a key proposed by the publisher on a new entity
-
-                                        // Validate key and then check to see that the proposed key is valid for this publisher
-                                        ValidateUDDIKey.validateUDDIv3Key(entityKey);
-                                        if (!publisher.isValidPublisherKey(em, entityKey)) {
-                                                throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
-                                        }
-
-                                }
-
-                        }
-
-                        // Parent key must be passed if this is a new entity
-                        if (!entityExists) {
-                                if (parentKey == null || parentKey.length() == 0) {
-                                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentBusinessNotFound", parentKey));
-                                }
-                        }
-
-                        // If parent key IS passed, whether new entity or not, it must be valid.  Additionally, the current publisher must be the owner of the parent.  Note that
-                        // if a parent ENTITY was passed in, then we don't need to check for any of this since this is part of a higher call.
-                        if (parentKey != null) {
-                                if (parent == null) {
-                                        Object parentTemp = em.find(org.apache.juddi.model.BusinessEntity.class, parentKey);
-                                        if (parentTemp == null) {
-                                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentBusinessNotFound", parentKey));
-                                        }
-
-                                        // Make sure publisher owns this parent entity.
-                                        if (!publisher.isOwner((UddiEntity) parentTemp)) {
-                                                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwnerParent", parentKey));
-                                        }
-                                }
-                        }
-
-                        if (!entityExists) {
-                                // Check to make sure key isn't used by another entity.
-                                if (!isUniqueKey(em, entityKey)) {
-                                        throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.KeyExists", entityKey));
-                                }
-                        }
+                }
 
-                        // TODO: validate "checked" categories or category groups (see section 5.2.3 of spec)? optional to support
+            }
 
-                        validateNames(businessService.getName());
-                        validateCategoryBag(businessService.getCategoryBag(), config);
-                        validateDescriptions(businessService.getDescription());
-                        validateBindingTemplates(em, businessService.getBindingTemplates(), businessService, config);
+            // Parent key must be passed if this is a new entity
+            if (!entityExists) {
+                if (parentKey == null || parentKey.length() == 0) {
+                    throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentBusinessNotFound", parentKey));
                 }
+            }
 
-        }
+            // If parent key IS passed, whether new entity or not, it must be valid.  Additionally, the current publisher must be the owner of the parent.  Note that
+            // if a parent ENTITY was passed in, then we don't need to check for any of this since this is part of a higher call.
+            if (parentKey != null) {
+                if (parent == null) {
+                    Object parentTemp = em.find(org.apache.juddi.model.BusinessEntity.class, parentKey);
+                    if (parentTemp == null) {
+                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentBusinessNotFound", parentKey));
+                    }
 
-        public void validateBindingTemplates(EntityManager em, org.uddi.api_v3.BindingTemplates bindingTemplates, org.uddi.api_v3.BusinessService parent, Configuration config)
-                throws DispositionReportFaultMessage {
-                // Binding templates is optional
-                if (bindingTemplates == null) {
-                        return;
+                    // Make sure publisher owns this parent entity.
+                    if (!publisher.isOwner((UddiEntity) parentTemp)) {
+                        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwnerParent", parentKey));
+                    }
                 }
+            }
 
-                List<org.uddi.api_v3.BindingTemplate> bindingTemplateList = bindingTemplates.getBindingTemplate();
-                if (bindingTemplateList == null || bindingTemplateList.size() == 0) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplates.NoInput"));
+            if (!entityExists) {
+                // Check to make sure key isn't used by another entity.
+                if (!isUniqueKey(em, entityKey)) {
+                    throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.KeyExists", entityKey));
                 }
+            }
 
-                for (org.uddi.api_v3.BindingTemplate bindingTemplate : bindingTemplateList) {
-                        validateBindingTemplate(em, bindingTemplate, parent, config);
-                }
+            // TODO: validate "checked" categories or category groups (see section 5.2.3 of spec)? optional to support
 
+            validateNames(businessService.getName());
+            validateCategoryBag(businessService.getCategoryBag(), config,false);
+            validateDescriptions(businessService.getDescription());
+            validateBindingTemplates(em, businessService.getBindingTemplates(), businessService, config);
         }
 
-        public void validateBindingTemplate(EntityManager em, org.uddi.api_v3.BindingTemplate bindingTemplate,
-                org.uddi.api_v3.BusinessService parent, Configuration config)
-                throws DispositionReportFaultMessage {
-
-                // A supplied bindingTemplate can't be null
-                if (bindingTemplate == null) {
-                        throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplate.NullInput"));
-                }
+    }
 
-                // Retrieve the binding's passed key
-                String entityKey = bindingTemplate.getBindingKey();
-                if (entityKey != null && entityKey.length() > 0) {
-                        // Per section 4.4: keys must be case-folded
-                        entityKey = entityKey.toLowerCase();
-                        bindingTemplate.setBindingKey(entityKey);
-                        validateKeyLength(entityKey);
-                }
-
-                // The parent key is either supplied or provided by the higher call to the parent entity save.  If it is provided in both instances, if they differ, an 
-                // error occurs.
-                String parentKey = bindingTemplate.getServiceKey();
-                if (parentKey != null && parentKey.length() > 0) {
-                        // Per section 4.4: keys must be case-folded
-                        parentKey = parentKey.toLowerCase();
-                        bindingTemplate.setServiceKey(parentKey);
-                }
-
-                if (parent != null) {
-                        if (parentKey != null && parentKey.length() > 0) {
-                                if (!parentKey.equalsIgnoreCase(parent.getServiceKey())) {
-                                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.bindingtemplate.ParentMismatch", parentKey + ", " + parent.getBusinessKey()));
-                                }
-                        } else {
-                                parentKey = parent.getServiceKey();
-                        }
-                }
+    public void validateBindingTemplates(EntityManager em, org.uddi.api_v3.BindingTemplates bindingTemplates, org.uddi.api_v3.BusinessService parent, Configuration config)
+            throws DispositionReportFaultMessage {
+        // Binding templates is optional
+        if (bindingTemplates == null) {
+            return;
+        }
 
-                boolean entityExists = false;
-                if (entityKey == null || entityKey.length() == 0) {
-                        validateNotSigned(bindingTemplate);
-                        KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
-                        entityKey = keyGen.generate();
-                        bindingTemplate.setBindingKey(entityKey);
-                } else {
+        List<org.uddi.api_v3.BindingTemplate> bindingTemplateList = bindingTemplates.getBindingTemplate();
+        if (bindingTemplateList == null || bindingTemplateList.size() == 0) {
+            throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplates.NoInput"));
+        }
 
-                        Object obj = em.find(org.apache.juddi.model.BindingTemplate.class, entityKey);
-                        if (obj != null) {
-                                entityExists = true;
-
-                                org.apache.juddi.model.BindingTemplate bt = (org.apache.juddi.model.BindingTemplate) obj;
-
-                                // If the object exists, and the parentKey was not found to this point, then a save on an existing binding with a blank
-                                // service key has occurred.  It is set here and added to the entity being saved - a necessary step for the object to be
-                                // persisted properly. (This condition makes some validation tests below unnecessary as the parent is "verified" but it's OK to
-                                // still run them).
-                                if (parentKey == null || parentKey.length() == 0) {
-                                        parentKey = bt.getBusinessService().getEntityKey();
-                                        bindingTemplate.setServiceKey(parentKey);

[... 1921 lines stripped ...]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org