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 2014/01/18 18:24:42 UTC
svn commit: r1559368 [1/3] - in /juddi/trunk:
juddi-core/src/main/java/org/apache/juddi/validation/
juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/publish/
uddi-tck-runner/ uddi-tck/src/main/resources/META-INF/ uddi-tck/src/...
Author: alexoree
Date: Sat Jan 18 17:24:41 2014
New Revision: 1559368
URL: http://svn.apache.org/r1559368
Log:
JUDDI-764 adding test cases and resolving several problems. several test cases still fail. see @Ignore test cases
JUDDI-651 adding some basic tests for the gui
JUDDI-788 formating changes
Added:
juddi/trunk/uddi-tck/src/test/java/org/apache/juddi/v3/tck/JUDDI_200_GUI_IntegrationTest.java
Removed:
juddi/trunk/uddi-tck-runner/juddiv3.xml
Modified:
juddi/trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/publish/SimplePublishClerk.java
juddi/trunk/uddi-tck/src/main/resources/META-INF/uddi.xml
juddi/trunk/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_070_FindEntityIntegrationTest.java
Modified: juddi/trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java?rev=1559368&r1=1559367&r2=1559368&view=diff
==============================================================================
--- juddi/trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java (original)
+++ juddi/trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java Sat Jan 18 17:24:41 2014
@@ -14,7 +14,6 @@
* limitations under the License.
*
*/
-
package org.apache.juddi.validation;
import java.util.HashSet;
@@ -40,6 +39,7 @@ import org.uddi.v3_service.DispositionRe
import org.apache.juddi.model.UddiEntityPublisher;
import org.apache.juddi.query.util.FindQualifiers;
+import org.apache.juddi.v3.client.UDDIConstants;
import org.apache.juddi.v3.error.ErrorMessage;
import org.apache.juddi.v3.error.FatalErrorException;
import org.apache.juddi.v3.error.InvalidCombinationException;
@@ -49,526 +49,651 @@ import org.apache.juddi.v3.error.ValueNo
/**
* @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>
*/
public class ValidateInquiry extends ValidateUDDIApi {
- public ValidateInquiry(UddiEntityPublisher publisher) {
- super(publisher);
- }
-
- public void validateGetBusinessDetail(GetBusinessDetail 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.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) {
-
- // 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));
-
- i++;
- }
- }
-
- public void validateGetServiceDetail(GetServiceDetail 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"));
-
- HashSet<String> dupCheck = new HashSet<String>();
- int i = 0;
- for (String entityKey : entityKeyList) {
-
- // 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));
-
- i++;
- }
- }
-
- public void validateGetBindingDetail(GetBindingDetail 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.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) {
-
- // 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));
-
- i++;
- }
- }
-
- public void validateGetTModelDetail(GetTModelDetail 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.getTModelKey();
- 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) {
-
- // 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));
-
- i++;
- }
- }
-
- public void validateGetOperationalInfo(GetOperationalInfo 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.getEntityKey();
- 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) {
-
- // 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));
-
- i++;
- }
- }
-
-
- public void validateFindBusiness(FindBusiness body) throws DispositionReportFaultMessage {
- // No null input
- if (body == null)
- throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-
- if (body.getCategoryBag() == null && body.getFindTModel() == null && body.getTModelBag() == null && body.getName().size() == 0 &&
- body.getIdentifierBag() == null && body.getDiscoveryURLs() == null && body.getFindRelatedBusinesses() == null)
- throw new FatalErrorException(new ErrorMessage("errors.findbusiness.NoInput"));
-
- validateNames(body.getName());
- validateFindQualifiers(body.getFindQualifiers());
- validateTModelBag(body.getTModelBag());
- validateFindTModel(body.getFindTModel(), true);
- validateFindRelatedBusinesses(body.getFindRelatedBusinesses(), true);
- validateDiscoveryUrls(body.getDiscoveryURLs());
- validateIdentifierBag(body.getIdentifierBag());
- validateCategoryBag(body.getCategoryBag());
-
- }
-
- public void validateFindService(FindService body) throws DispositionReportFaultMessage {
- // No null input
- if (body == null)
- throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-
- if (body.getCategoryBag() == null && body.getFindTModel() == null && body.getTModelBag() == null && body.getName().size() == 0)
- throw new FatalErrorException(new ErrorMessage("errors.findservice.NoInput"));
-
- validateNames(body.getName());
- validateFindQualifiers(body.getFindQualifiers());
- validateTModelBag(body.getTModelBag());
- validateFindTModel(body.getFindTModel(), true);
- validateCategoryBag(body.getCategoryBag());
-
- }
-
- public void validateFindBinding(FindBinding body) throws DispositionReportFaultMessage {
- // No null input
- if (body == null)
- throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-
- if (body.getCategoryBag() == null && body.getFindTModel() == null && body.getTModelBag() == null)
- throw new FatalErrorException(new ErrorMessage("errors.findbinding.NoInput"));
-
- validateFindQualifiers(body.getFindQualifiers());
- validateTModelBag(body.getTModelBag());
- validateFindTModel(body.getFindTModel(), true);
- validateCategoryBag(body.getCategoryBag());
-
-
- }
-
- public void validateFindTModel(FindTModel body, boolean nullAllowed) throws DispositionReportFaultMessage {
- if (body == null) {
- // When FindTModel objects are embedded in other find calls, null is allowed.
- if (nullAllowed)
- return;
- else
- throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
- }
-
- if (body.getCategoryBag() == null && body.getIdentifierBag() == null && body.getName() == null)
- throw new FatalErrorException(new ErrorMessage("errors.findtmodel.NoInput"));
-
- validateFindQualifiers(body.getFindQualifiers());
- validateIdentifierBag(body.getIdentifierBag());
- validateCategoryBag(body.getCategoryBag());
- }
-
- public void validateFindRelatedBusinesses(FindRelatedBusinesses body, boolean nullAllowed) throws DispositionReportFaultMessage {
- if (body == null) {
- // When FindRelatedBusinesses objects are embedded in other find calls, null is allowed.
- if (nullAllowed)
- return;
- else
- throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
- }
-
- if ((body.getBusinessKey() == null || body.getBusinessKey().length() == 0 ) &&
- (body.getFromKey() == null || body.getFromKey().length() == 0) &&
- (body.getToKey() == null || body.getToKey().length() == 0))
- throw new FatalErrorException(new ErrorMessage("errors.findrelatedbusiness.NoInput"));
-
- boolean businessKeyExists = false;
- boolean fromKeyExists = false;
- if (body.getBusinessKey() != null && body.getBusinessKey().length() > 0) {
- businessKeyExists = true;
-
- // Per section 4.4: keys must be case-folded
- body.setBusinessKey(body.getBusinessKey().toLowerCase());
- }
- if (body.getFromKey() != null && body.getFromKey().length() > 0) {
- fromKeyExists = true;
- if (businessKeyExists)
- throw new FatalErrorException(new ErrorMessage("errors.findrelatedbusiness.MultipleInput"));
-
- // Per section 4.4: keys must be case-folded
- body.setFromKey(body.getFromKey().toLowerCase());
- }
- if (body.getToKey() != null && body.getToKey().length() > 0) {
- if (businessKeyExists || fromKeyExists)
- throw new FatalErrorException(new ErrorMessage("errors.findrelatedbusiness.MultipleInput"));
-
- // Per section 4.4: keys must be case-folded
- body.setToKey(body.getToKey().toLowerCase());
- }
-
- KeyedReference keyedRef = body.getKeyedReference();
- if (keyedRef != null) {
- if (keyedRef.getTModelKey() == null || keyedRef.getTModelKey().length() == 0 ||
- keyedRef.getKeyName() == null || keyedRef.getKeyName().length() == 0 ||
- keyedRef.getKeyValue() == null || keyedRef.getKeyValue().length() == 0)
- throw new ValueNotAllowedException(new ErrorMessage("errors.findrelatedbusiness.BlankKeyedRef"));
-
- validateKeyedReference(keyedRef);
- }
- }
-
- public void validateNames(List<org.uddi.api_v3.Name> names) throws DispositionReportFaultMessage {
- if (names != null) {
- for (Name n : names) {
- if (n.getValue() == null || n.getValue().length() == 0)
- throw new ValueNotAllowedException(new ErrorMessage("errors.names.NoValue"));
- ValidatePublish.validateLang(n.getLang());
- }
- }
- }
-
- public void validateTModelBag(TModelBag tmodelBag) throws DispositionReportFaultMessage {
- // tmodelBag is optional
- if (tmodelBag == null)
- return;
-
- if (tmodelBag.getTModelKey() == null || tmodelBag.getTModelKey().size() == 0)
- throw new ValueNotAllowedException(new ErrorMessage("errors.tmodelbag.NoInput"));
-
- List<String> keyList = tmodelBag.getTModelKey();
- int i = 0;
- for (String key : keyList) {
- // Per section 4.4: keys must be case-folded
- key = key.toLowerCase();
- keyList.set(i, key);
- i++;
- }
-
- }
-
- public void validateDiscoveryUrls(org.uddi.api_v3.DiscoveryURLs discUrls) throws DispositionReportFaultMessage {
- // Discovery Urls is optional
- if (discUrls == null)
- return;
-
- // If discUrls does exist, it must have at least one element
- List<org.uddi.api_v3.DiscoveryURL> discUrlList = discUrls.getDiscoveryURL();
- if (discUrlList == null || discUrlList.size() == 0)
- throw new ValueNotAllowedException(new ErrorMessage("errors.discurls.NoInput"));
- }
-
- public void validateCategoryBag(org.uddi.api_v3.CategoryBag categories) throws DispositionReportFaultMessage {
-
- // Category bag is optional
- if (categories == null)
- return;
-
- // If category bag does exist, it must have at least one element
- List<KeyedReference> elems = categories.getKeyedReference();
- List<KeyedReferenceGroup> krgs = categories.getKeyedReferenceGroup();
- if ((elems == null || elems.size() == 0) && (krgs == null || krgs.size() == 0))
- throw new ValueNotAllowedException(new ErrorMessage("errors.categorybag.NoInput"));
-
- for (KeyedReference elem : elems) {
- validateKeyedReference(elem);
- }
- for (KeyedReferenceGroup elem : krgs) {
- validateKeyedReferenceGroup(elem);
- }
- }
-
- public void validateIdentifierBag(org.uddi.api_v3.IdentifierBag identifiers) throws DispositionReportFaultMessage {
-
- // Identifier bag is optional
- if (identifiers == null)
- return;
-
- // If category bag does exist, it must have at least one element
- List<org.uddi.api_v3.KeyedReference> keyedRefList = identifiers.getKeyedReference();
- if (keyedRefList == null || keyedRefList.size() == 0)
- throw new ValueNotAllowedException(new ErrorMessage("errors.identifierbag.NoInput"));
-
- for (org.uddi.api_v3.KeyedReference keyedRef : keyedRefList) {
- validateKeyedReference(keyedRef);
- }
- }
-
- public void validateKeyedReferenceGroup (KeyedReferenceGroup krg) throws DispositionReportFaultMessage {
- // Keyed reference groups must contain a tModelKey
- if (krg.getTModelKey() == null || krg.getTModelKey().length() == 0)
- throw new ValueNotAllowedException(new ErrorMessage("errors.keyedreference.NoTModelKey"));
-
- // Per section 4.4: keys must be case-folded
- krg.setTModelKey(krg.getTModelKey().toLowerCase());
-
- List<KeyedReference> keyedRefs = krg.getKeyedReference();
- // Should being empty raise an error?
- if (keyedRefs != null && keyedRefs.size() > 0) {
- for (KeyedReference keyedRef : keyedRefs) {
- validateKeyedReference(keyedRef);
- }
- }
- }
-
- public void validateKeyedReference(KeyedReference kr) throws DispositionReportFaultMessage {
- if (kr == null)
- throw new ValueNotAllowedException(new ErrorMessage("errors.keyedreference.NullInput"));
-
- // Keyed references must contain a tModelKey and keyValue
- if (kr.getTModelKey() == null || kr.getTModelKey().length() == 0)
- throw new ValueNotAllowedException(new ErrorMessage("errors.keyedreference.NoTModelKey"));
-
- // Per section 4.4: keys must be case-folded
- kr.setTModelKey(kr.getTModelKey().toLowerCase());
-
- if (kr.getKeyValue() == null || kr.getKeyValue().length() == 0)
- throw new ValueNotAllowedException(new ErrorMessage("errors.keyedreference.NoKeyValue"));
- }
-
- private void validateFindQualifiers(org.uddi.api_v3.FindQualifiers findQualifiers) throws DispositionReportFaultMessage {
- if (findQualifiers == null)
- return;
-
- List<String> fqList = findQualifiers.getFindQualifier();
- if (fqList == null || fqList.size() == 0)
- throw new ValueNotAllowedException(new ErrorMessage("errors.findqualifiers.NoInput"));
-
-
- Hashtable<String, String> fqTable = new Hashtable<String, String>();
- for (String fq : fqList) {
- String result = fqTable.put(fq.toUpperCase(), fq.toUpperCase());
- if (result != null)
- throw new ValueNotAllowedException(new ErrorMessage("errors.findqualifiers.DuplicateValue", result));
-
- // Invalid combo: andAllKeys, orAllKeys, and orLikeKeys
- if (fq.equalsIgnoreCase(FindQualifiers.AND_ALL_KEYS) || fq.equalsIgnoreCase(FindQualifiers.AND_ALL_KEYS_TMODEL)) {
- if (fqTable.get(FindQualifiers.OR_ALL_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.OR_ALL_KEYS_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.OR_ALL_KEYS));
-
- if (fqTable.get(FindQualifiers.OR_LIKE_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.OR_LIKE_KEYS_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.OR_LIKE_KEYS));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.OR_ALL_KEYS) || fq.equalsIgnoreCase(FindQualifiers.OR_ALL_KEYS_TMODEL)) {
- if (fqTable.get(FindQualifiers.AND_ALL_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.AND_ALL_KEYS_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.AND_ALL_KEYS));
-
- if (fqTable.get(FindQualifiers.OR_LIKE_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.OR_LIKE_KEYS_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.OR_LIKE_KEYS));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.OR_LIKE_KEYS) || fq.equalsIgnoreCase(FindQualifiers.OR_LIKE_KEYS_TMODEL)) {
- if (fqTable.get(FindQualifiers.AND_ALL_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.AND_ALL_KEYS_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.AND_ALL_KEYS));
-
- if (fqTable.get(FindQualifiers.OR_ALL_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.OR_ALL_KEYS_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.OR_ALL_KEYS));
- }
-
- // Invalid combo: sortByNameAsc and sortByNameDesc
- if (fq.equalsIgnoreCase(FindQualifiers.SORT_BY_NAME_ASC) || fq.equalsIgnoreCase(FindQualifiers.SORT_BY_NAME_ASC_TMODEL)) {
- if (fqTable.get(FindQualifiers.SORT_BY_NAME_DESC.toUpperCase()) != null || fqTable.get(FindQualifiers.SORT_BY_NAME_DESC_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SORT_BY_NAME_DESC));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.SORT_BY_NAME_DESC) || fq.equalsIgnoreCase(FindQualifiers.SORT_BY_NAME_DESC_TMODEL)) {
- if (fqTable.get(FindQualifiers.SORT_BY_NAME_ASC.toUpperCase()) != null || fqTable.get(FindQualifiers.SORT_BY_NAME_ASC_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SORT_BY_NAME_ASC));
- }
-
- // Invalid combo: sortByDateAsc and sortByDateDesc
- if (fq.equalsIgnoreCase(FindQualifiers.SORT_BY_DATE_ASC) || fq.equalsIgnoreCase(FindQualifiers.SORT_BY_DATE_ASC_TMODEL)) {
- if (fqTable.get(FindQualifiers.SORT_BY_DATE_DESC.toUpperCase()) != null || fqTable.get(FindQualifiers.SORT_BY_DATE_DESC_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SORT_BY_DATE_DESC));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.SORT_BY_DATE_DESC) || fq.equalsIgnoreCase(FindQualifiers.SORT_BY_DATE_DESC_TMODEL)) {
- if (fqTable.get(FindQualifiers.SORT_BY_DATE_ASC.toUpperCase()) != null || fqTable.get(FindQualifiers.SORT_BY_DATE_ASC_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SORT_BY_DATE_ASC));
- }
-
- // Invalid combo: combineCategoryBags, serviceSubset and bindingSubset
- if (fq.equalsIgnoreCase(FindQualifiers.COMBINE_CATEGORY_BAGS) || fq.equalsIgnoreCase(FindQualifiers.COMBINE_CATEGORY_BAGS_TMODEL)) {
- if (fqTable.get(FindQualifiers.SERVICE_SUBSET.toUpperCase()) != null || fqTable.get(FindQualifiers.SERVICE_SUBSET_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SERVICE_SUBSET));
-
- if (fqTable.get(FindQualifiers.BINDING_SUBSET.toUpperCase()) != null || fqTable.get(FindQualifiers.BINDING_SUBSET_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.BINDING_SUBSET));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.SERVICE_SUBSET) || fq.equalsIgnoreCase(FindQualifiers.SERVICE_SUBSET_TMODEL)) {
- if (fqTable.get(FindQualifiers.COMBINE_CATEGORY_BAGS.toUpperCase()) != null || fqTable.get(FindQualifiers.COMBINE_CATEGORY_BAGS_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.COMBINE_CATEGORY_BAGS));
-
- if (fqTable.get(FindQualifiers.BINDING_SUBSET.toUpperCase()) != null || fqTable.get(FindQualifiers.BINDING_SUBSET_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.BINDING_SUBSET));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.BINDING_SUBSET) || fq.equalsIgnoreCase(FindQualifiers.BINDING_SUBSET_TMODEL)) {
- if (fqTable.get(FindQualifiers.SERVICE_SUBSET.toUpperCase()) != null || fqTable.get(FindQualifiers.SERVICE_SUBSET_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SERVICE_SUBSET));
-
- if (fqTable.get(FindQualifiers.COMBINE_CATEGORY_BAGS.toUpperCase()) != null || fqTable.get(FindQualifiers.COMBINE_CATEGORY_BAGS_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.COMBINE_CATEGORY_BAGS));
- }
-
- // Invalid combo: exactMatch and approximateMatch
- if (fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH) || fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH_TMODEL)) {
- if (fqTable.get(FindQualifiers.APPROXIMATE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.APPROXIMATE_MATCH_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.APPROXIMATE_MATCH));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.APPROXIMATE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.APPROXIMATE_MATCH_TMODEL)) {
- if (fqTable.get(FindQualifiers.EXACT_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.EXACT_MATCH_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.EXACT_MATCH));
- }
-
- // Invalid combo: exactMatch and caseInsensitiveMatch
- if (fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH) || fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH_TMODEL)) {
- if (fqTable.get(FindQualifiers.CASE_INSENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_INSENSITIVE_MATCH));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL)) {
- if (fqTable.get(FindQualifiers.EXACT_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.EXACT_MATCH_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.EXACT_MATCH));
- }
-
- // Invalid combo: binarySort and UTS-10
- if (fq.equalsIgnoreCase(FindQualifiers.BINARY_SORT) || fq.equalsIgnoreCase(FindQualifiers.BINARY_SORT_TMODEL)) {
- if (fqTable.get(FindQualifiers.UTS_10.toUpperCase()) != null || fqTable.get(FindQualifiers.UTS_10_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.UTS_10));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.UTS_10) || fq.equalsIgnoreCase(FindQualifiers.UTS_10_TMODEL)) {
- if (fqTable.get(FindQualifiers.BINARY_SORT.toUpperCase()) != null || fqTable.get(FindQualifiers.BINARY_SORT_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.BINARY_SORT));
- }
-
- // Invalid combo: diacriticSensitiveMatch and diacriticInsensitiveMatch
- if (fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_SENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_SENSITIVE_MATCH_TMODEL)) {
- if (fqTable.get(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.DIACRITIC_INSENSITIVE_MATCH));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH_TMODEL)) {
- if (fqTable.get(FindQualifiers.DIACRITIC_SENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.DIACRITIC_SENSITIVE_MATCH_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.DIACRITIC_SENSITIVE_MATCH));
- }
-
- // Invalid combo: exactMatch and diacriticInsensitiveMatch
- if (fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH) || fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH_TMODEL)) {
- if (fqTable.get(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.DIACRITIC_INSENSITIVE_MATCH));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH_TMODEL)) {
- if (fqTable.get(FindQualifiers.EXACT_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.EXACT_MATCH_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.EXACT_MATCH));
- }
-
- // Invalid combo: caseSensitiveSort and caseInsensitiveSort
- if (fq.equalsIgnoreCase(FindQualifiers.CASE_SENSITIVE_SORT) || fq.equalsIgnoreCase(FindQualifiers.CASE_SENSITIVE_SORT_TMODEL)) {
- if (fqTable.get(FindQualifiers.CASE_INSENSITIVE_SORT.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_INSENSITIVE_SORT_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_INSENSITIVE_SORT));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_SORT) || fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_SORT_TMODEL)) {
- if (fqTable.get(FindQualifiers.CASE_SENSITIVE_SORT.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_SENSITIVE_SORT_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_SENSITIVE_SORT));
- }
-
- // Invalid combo: caseSensitiveMatch and caseInsensitiveMatch
- if (fq.equalsIgnoreCase(FindQualifiers.CASE_SENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.CASE_SENSITIVE_MATCH_TMODEL)) {
- if (fqTable.get(FindQualifiers.CASE_INSENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_INSENSITIVE_MATCH));
- }
- else if (fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL)) {
- if (fqTable.get(FindQualifiers.CASE_SENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_SENSITIVE_MATCH_TMODEL.toUpperCase()) != null)
- throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_SENSITIVE_MATCH));
- }
-
- }
- }
+ public ValidateInquiry(UddiEntityPublisher publisher) {
+ super(publisher);
+ }
+
+ public void validateGetBusinessDetail(GetBusinessDetail 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.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) {
+
+ // 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));
+ }
+
+ i++;
+ }
+ }
+
+ public void validateGetServiceDetail(GetServiceDetail 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"));
+ }
+
+ HashSet<String> dupCheck = new HashSet<String>();
+ int i = 0;
+ for (String entityKey : entityKeyList) {
+
+ // 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));
+ }
+
+ i++;
+ }
+ }
+
+ public void validateGetBindingDetail(GetBindingDetail 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.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) {
+
+ // 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));
+ }
+
+ i++;
+ }
+ }
+
+ public void validateGetTModelDetail(GetTModelDetail 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.getTModelKey();
+ 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) {
+
+ // 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));
+ }
+
+ i++;
+ }
+ }
+
+ public void validateGetOperationalInfo(GetOperationalInfo 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.getEntityKey();
+ 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) {
+
+ // 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));
+ }
+
+ i++;
+ }
+ }
+
+ public void validateFindBusiness(FindBusiness body) throws DispositionReportFaultMessage {
+ // No null input
+ if (body == null) {
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+ }
+
+ if (body.getCategoryBag() == null && body.getFindTModel() == null && body.getTModelBag() == null && body.getName().size() == 0
+ && body.getIdentifierBag() == null && body.getDiscoveryURLs() == null && body.getFindRelatedBusinesses() == null) {
+ throw new FatalErrorException(new ErrorMessage("errors.findbusiness.NoInput"));
+ }
+
+ validateNames(body.getName());
+ validateFindQualifiers(body.getFindQualifiers());
+ validateTModelBag(body.getTModelBag());
+ validateFindTModel(body.getFindTModel(), true);
+ validateFindRelatedBusinesses(body.getFindRelatedBusinesses(), true);
+ validateDiscoveryUrls(body.getDiscoveryURLs());
+ validateIdentifierBag(body.getIdentifierBag());
+ validateCategoryBag(body.getCategoryBag());
+
+ }
+
+ public void validateFindService(FindService body) throws DispositionReportFaultMessage {
+ // No null input
+ if (body == null) {
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+ }
+
+ if (body.getCategoryBag() == null && body.getFindTModel() == null && body.getTModelBag() == null && body.getName().size() == 0) {
+ throw new FatalErrorException(new ErrorMessage("errors.findservice.NoInput"));
+ }
+
+ validateNames(body.getName());
+ validateFindQualifiers(body.getFindQualifiers());
+ validateTModelBag(body.getTModelBag());
+ validateFindTModel(body.getFindTModel(), true);
+ validateCategoryBag(body.getCategoryBag());
+
+ }
+
+ public void validateFindBinding(FindBinding body) throws DispositionReportFaultMessage {
+ // No null input
+ if (body == null) {
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+ }
+
+ if (body.getCategoryBag() == null && body.getFindTModel() == null && body.getTModelBag() == null) {
+ throw new FatalErrorException(new ErrorMessage("errors.findbinding.NoInput"));
+ }
+
+ validateFindQualifiers(body.getFindQualifiers());
+ validateTModelBag(body.getTModelBag());
+ validateFindTModel(body.getFindTModel(), true);
+ validateCategoryBag(body.getCategoryBag());
+ validateFindingBindingFQ(body.getFindQualifiers());
+ validateFindQualifiers_AppoximateMatchAndCombinedCatbag(body.getFindQualifiers());
+
+ }
+
+ public void validateFindTModel(FindTModel body, boolean nullAllowed) throws DispositionReportFaultMessage {
+ if (body == null) {
+ // When FindTModel objects are embedded in other find calls, null is allowed.
+ if (nullAllowed) {
+ return;
+ } else {
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+ }
+ }
+
+ if (body.getCategoryBag() == null && body.getIdentifierBag() == null && body.getName() == null) {
+ throw new FatalErrorException(new ErrorMessage("errors.findtmodel.NoInput"));
+ }
+
+ validateFindQualifiers(body.getFindQualifiers());
+ validateIdentifierBag(body.getIdentifierBag());
+ validateCategoryBag(body.getCategoryBag());
+ validateFindQualifiers_AppoximateMatchAndCombinedCatbag(body.getFindQualifiers());
+ }
+
+ public void validateFindRelatedBusinesses(FindRelatedBusinesses body, boolean nullAllowed) throws DispositionReportFaultMessage {
+ if (body == null) {
+ // When FindRelatedBusinesses objects are embedded in other find calls, null is allowed.
+ if (nullAllowed) {
+ return;
+ } else {
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+ }
+ }
+
+ if ((body.getBusinessKey() == null || body.getBusinessKey().length() == 0)
+ && (body.getFromKey() == null || body.getFromKey().length() == 0)
+ && (body.getToKey() == null || body.getToKey().length() == 0)) {
+ throw new FatalErrorException(new ErrorMessage("errors.findrelatedbusiness.NoInput"));
+ }
+
+ boolean businessKeyExists = false;
+ boolean fromKeyExists = false;
+ if (body.getBusinessKey() != null && body.getBusinessKey().length() > 0) {
+ businessKeyExists = true;
+
+ // Per section 4.4: keys must be case-folded
+ body.setBusinessKey(body.getBusinessKey().toLowerCase());
+ }
+ if (body.getFromKey() != null && body.getFromKey().length() > 0) {
+ fromKeyExists = true;
+ if (businessKeyExists) {
+ throw new FatalErrorException(new ErrorMessage("errors.findrelatedbusiness.MultipleInput"));
+ }
+
+ // Per section 4.4: keys must be case-folded
+ body.setFromKey(body.getFromKey().toLowerCase());
+ }
+ if (body.getToKey() != null && body.getToKey().length() > 0) {
+ if (businessKeyExists || fromKeyExists) {
+ throw new FatalErrorException(new ErrorMessage("errors.findrelatedbusiness.MultipleInput"));
+ }
+
+ // Per section 4.4: keys must be case-folded
+ body.setToKey(body.getToKey().toLowerCase());
+ }
+
+ KeyedReference keyedRef = body.getKeyedReference();
+ if (keyedRef != null) {
+ if (keyedRef.getTModelKey() == null || keyedRef.getTModelKey().length() == 0
+ || keyedRef.getKeyName() == null || keyedRef.getKeyName().length() == 0
+ || keyedRef.getKeyValue() == null || keyedRef.getKeyValue().length() == 0) {
+ throw new ValueNotAllowedException(new ErrorMessage("errors.findrelatedbusiness.BlankKeyedRef"));
+ }
+
+ validateKeyedReference(keyedRef);
+ }
+ validateFindQualifiers(body.getFindQualifiers());
+ validateFindRelatedBusinessesFindQualifiers(body.getFindQualifiers());
+ validateFindQualifiers_AppoximateMatchAndCombinedCatbag(body.getFindQualifiers());
+ }
+
+ public void validateNames(List<org.uddi.api_v3.Name> names) throws DispositionReportFaultMessage {
+ if (names != null) {
+ for (Name n : names) {
+ if (n.getValue() == null || n.getValue().length() == 0) {
+ throw new ValueNotAllowedException(new ErrorMessage("errors.names.NoValue"));
+ }
+ ValidatePublish.validateLang(n.getLang());
+ }
+ }
+ }
+
+ public void validateTModelBag(TModelBag tmodelBag) throws DispositionReportFaultMessage {
+ // tmodelBag is optional
+ if (tmodelBag == null) {
+ return;
+ }
+
+ if (tmodelBag.getTModelKey() == null || tmodelBag.getTModelKey().size() == 0) {
+ throw new ValueNotAllowedException(new ErrorMessage("errors.tmodelbag.NoInput"));
+ }
+
+ List<String> keyList = tmodelBag.getTModelKey();
+ int i = 0;
+ for (String key : keyList) {
+ // Per section 4.4: keys must be case-folded
+ key = key.toLowerCase();
+ keyList.set(i, key);
+ i++;
+ }
+
+ }
+
+ public void validateDiscoveryUrls(org.uddi.api_v3.DiscoveryURLs discUrls) throws DispositionReportFaultMessage {
+ // Discovery Urls is optional
+ if (discUrls == null) {
+ return;
+ }
+
+ // If discUrls does exist, it must have at least one element
+ List<org.uddi.api_v3.DiscoveryURL> discUrlList = discUrls.getDiscoveryURL();
+ if (discUrlList == null || discUrlList.size() == 0) {
+ throw new ValueNotAllowedException(new ErrorMessage("errors.discurls.NoInput"));
+ }
+ }
+
+ public void validateCategoryBag(org.uddi.api_v3.CategoryBag categories) throws DispositionReportFaultMessage {
+
+ // Category bag is optional
+ if (categories == null) {
+ return;
+ }
+
+ // If category bag does exist, it must have at least one element
+ List<KeyedReference> elems = categories.getKeyedReference();
+ List<KeyedReferenceGroup> krgs = categories.getKeyedReferenceGroup();
+ if ((elems == null || elems.size() == 0) && (krgs == null || krgs.size() == 0)) {
+ throw new ValueNotAllowedException(new ErrorMessage("errors.categorybag.NoInput"));
+ }
+
+ for (KeyedReference elem : elems) {
+ validateKeyedReference(elem);
+ }
+ for (KeyedReferenceGroup elem : krgs) {
+ validateKeyedReferenceGroup(elem);
+ }
+ }
+
+ public void validateIdentifierBag(org.uddi.api_v3.IdentifierBag identifiers) throws DispositionReportFaultMessage {
+
+ // Identifier bag is optional
+ if (identifiers == null) {
+ return;
+ }
+
+ // If category bag does exist, it must have at least one element
+ List<org.uddi.api_v3.KeyedReference> keyedRefList = identifiers.getKeyedReference();
+ if (keyedRefList == null || keyedRefList.size() == 0) {
+ throw new ValueNotAllowedException(new ErrorMessage("errors.identifierbag.NoInput"));
+ }
+
+ for (org.uddi.api_v3.KeyedReference keyedRef : keyedRefList) {
+ validateKeyedReference(keyedRef);
+ }
+ }
+
+ public void validateKeyedReferenceGroup(KeyedReferenceGroup krg) throws DispositionReportFaultMessage {
+ // Keyed reference groups must contain a tModelKey
+ if (krg.getTModelKey() == null || krg.getTModelKey().length() == 0) {
+ throw new ValueNotAllowedException(new ErrorMessage("errors.keyedreference.NoTModelKey"));
+ }
+
+ // Per section 4.4: keys must be case-folded
+ krg.setTModelKey(krg.getTModelKey().toLowerCase());
+
+ List<KeyedReference> keyedRefs = krg.getKeyedReference();
+ // Should being empty raise an error?
+ if (keyedRefs != null && keyedRefs.size() > 0) {
+ for (KeyedReference keyedRef : keyedRefs) {
+ validateKeyedReference(keyedRef);
+ }
+ }
+ }
+
+ public void validateKeyedReference(KeyedReference kr) throws DispositionReportFaultMessage {
+ if (kr == null) {
+ throw new ValueNotAllowedException(new ErrorMessage("errors.keyedreference.NullInput"));
+ }
+
+ // Keyed references must contain a tModelKey and keyValue
+ if (kr.getTModelKey() == null || kr.getTModelKey().length() == 0) {
+ throw new ValueNotAllowedException(new ErrorMessage("errors.keyedreference.NoTModelKey"));
+ }
+
+ // Per section 4.4: keys must be case-folded
+ kr.setTModelKey(kr.getTModelKey().toLowerCase());
+
+ if (kr.getKeyValue() == null || kr.getKeyValue().length() == 0) {
+ throw new ValueNotAllowedException(new ErrorMessage("errors.keyedreference.NoKeyValue"));
+ }
+ }
+
+ private void validateFindQualifiers(org.uddi.api_v3.FindQualifiers findQualifiers) throws DispositionReportFaultMessage {
+ if (findQualifiers == null) {
+ return;
+ }
+
+ List<String> fqList = findQualifiers.getFindQualifier();
+ if (fqList == null || fqList.size() == 0) {
+ throw new ValueNotAllowedException(new ErrorMessage("errors.findqualifiers.NoInput"));
+ }
+
+ Hashtable<String, String> fqTable = new Hashtable<String, String>();
+ for (String fq : fqList) {
+ String result = fqTable.put(fq.toUpperCase(), fq.toUpperCase());
+ if (result != null) {
+ throw new ValueNotAllowedException(new ErrorMessage("errors.findqualifiers.DuplicateValue", result));
+ }
+
+ // Invalid combo: andAllKeys, orAllKeys, and orLikeKeys
+ if (fq.equalsIgnoreCase(FindQualifiers.AND_ALL_KEYS) || fq.equalsIgnoreCase(FindQualifiers.AND_ALL_KEYS_TMODEL)) {
+ if (fqTable.get(FindQualifiers.OR_ALL_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.OR_ALL_KEYS_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.OR_ALL_KEYS));
+ }
+
+ if (fqTable.get(FindQualifiers.OR_LIKE_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.OR_LIKE_KEYS_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.OR_LIKE_KEYS));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.OR_ALL_KEYS) || fq.equalsIgnoreCase(FindQualifiers.OR_ALL_KEYS_TMODEL)) {
+ if (fqTable.get(FindQualifiers.AND_ALL_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.AND_ALL_KEYS_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.AND_ALL_KEYS));
+ }
+
+ if (fqTable.get(FindQualifiers.OR_LIKE_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.OR_LIKE_KEYS_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.OR_LIKE_KEYS));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.OR_LIKE_KEYS) || fq.equalsIgnoreCase(FindQualifiers.OR_LIKE_KEYS_TMODEL)) {
+ if (fqTable.get(FindQualifiers.AND_ALL_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.AND_ALL_KEYS_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.AND_ALL_KEYS));
+ }
+
+ if (fqTable.get(FindQualifiers.OR_ALL_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.OR_ALL_KEYS_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.OR_ALL_KEYS));
+ }
+ }
+
+ // Invalid combo: sortByNameAsc and sortByNameDesc
+ if (fq.equalsIgnoreCase(FindQualifiers.SORT_BY_NAME_ASC) || fq.equalsIgnoreCase(FindQualifiers.SORT_BY_NAME_ASC_TMODEL)) {
+ if (fqTable.get(FindQualifiers.SORT_BY_NAME_DESC.toUpperCase()) != null || fqTable.get(FindQualifiers.SORT_BY_NAME_DESC_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SORT_BY_NAME_DESC));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.SORT_BY_NAME_DESC) || fq.equalsIgnoreCase(FindQualifiers.SORT_BY_NAME_DESC_TMODEL)) {
+ if (fqTable.get(FindQualifiers.SORT_BY_NAME_ASC.toUpperCase()) != null || fqTable.get(FindQualifiers.SORT_BY_NAME_ASC_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SORT_BY_NAME_ASC));
+ }
+ }
+
+ // Invalid combo: sortByDateAsc and sortByDateDesc
+ if (fq.equalsIgnoreCase(FindQualifiers.SORT_BY_DATE_ASC) || fq.equalsIgnoreCase(FindQualifiers.SORT_BY_DATE_ASC_TMODEL)) {
+ if (fqTable.get(FindQualifiers.SORT_BY_DATE_DESC.toUpperCase()) != null || fqTable.get(FindQualifiers.SORT_BY_DATE_DESC_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SORT_BY_DATE_DESC));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.SORT_BY_DATE_DESC) || fq.equalsIgnoreCase(FindQualifiers.SORT_BY_DATE_DESC_TMODEL)) {
+ if (fqTable.get(FindQualifiers.SORT_BY_DATE_ASC.toUpperCase()) != null || fqTable.get(FindQualifiers.SORT_BY_DATE_ASC_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SORT_BY_DATE_ASC));
+ }
+ }
+
+ // Invalid combo: combineCategoryBags, serviceSubset and bindingSubset
+ if (fq.equalsIgnoreCase(FindQualifiers.COMBINE_CATEGORY_BAGS) || fq.equalsIgnoreCase(FindQualifiers.COMBINE_CATEGORY_BAGS_TMODEL)) {
+ if (fqTable.get(FindQualifiers.SERVICE_SUBSET.toUpperCase()) != null || fqTable.get(FindQualifiers.SERVICE_SUBSET_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SERVICE_SUBSET));
+ }
+
+ if (fqTable.get(FindQualifiers.BINDING_SUBSET.toUpperCase()) != null || fqTable.get(FindQualifiers.BINDING_SUBSET_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.BINDING_SUBSET));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.SERVICE_SUBSET) || fq.equalsIgnoreCase(FindQualifiers.SERVICE_SUBSET_TMODEL)) {
+ if (fqTable.get(FindQualifiers.COMBINE_CATEGORY_BAGS.toUpperCase()) != null || fqTable.get(FindQualifiers.COMBINE_CATEGORY_BAGS_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.COMBINE_CATEGORY_BAGS));
+ }
+
+ if (fqTable.get(FindQualifiers.BINDING_SUBSET.toUpperCase()) != null || fqTable.get(FindQualifiers.BINDING_SUBSET_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.BINDING_SUBSET));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.BINDING_SUBSET) || fq.equalsIgnoreCase(FindQualifiers.BINDING_SUBSET_TMODEL)) {
+ if (fqTable.get(FindQualifiers.SERVICE_SUBSET.toUpperCase()) != null || fqTable.get(FindQualifiers.SERVICE_SUBSET_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SERVICE_SUBSET));
+ }
+
+ if (fqTable.get(FindQualifiers.COMBINE_CATEGORY_BAGS.toUpperCase()) != null || fqTable.get(FindQualifiers.COMBINE_CATEGORY_BAGS_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.COMBINE_CATEGORY_BAGS));
+ }
+ }
+
+ // Invalid combo: exactMatch and approximateMatch
+ if (fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH) || fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.APPROXIMATE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.APPROXIMATE_MATCH_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.APPROXIMATE_MATCH));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.APPROXIMATE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.APPROXIMATE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.EXACT_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.EXACT_MATCH_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.EXACT_MATCH));
+ }
+ }
+
+ // Invalid combo: exactMatch and caseInsensitiveMatch
+ if (fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH) || fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.CASE_INSENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_INSENSITIVE_MATCH));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.EXACT_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.EXACT_MATCH_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.EXACT_MATCH));
+ }
+ }
+
+ // Invalid combo: binarySort and UTS-10
+ if (fq.equalsIgnoreCase(FindQualifiers.BINARY_SORT) || fq.equalsIgnoreCase(FindQualifiers.BINARY_SORT_TMODEL)) {
+ if (fqTable.get(FindQualifiers.UTS_10.toUpperCase()) != null || fqTable.get(FindQualifiers.UTS_10_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.UTS_10));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.UTS_10) || fq.equalsIgnoreCase(FindQualifiers.UTS_10_TMODEL)) {
+ if (fqTable.get(FindQualifiers.BINARY_SORT.toUpperCase()) != null || fqTable.get(FindQualifiers.BINARY_SORT_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.BINARY_SORT));
+ }
+ }
+
+ // Invalid combo: diacriticSensitiveMatch and diacriticInsensitiveMatch
+ if (fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_SENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_SENSITIVE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.DIACRITIC_INSENSITIVE_MATCH));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.DIACRITIC_SENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.DIACRITIC_SENSITIVE_MATCH_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.DIACRITIC_SENSITIVE_MATCH));
+ }
+ }
+
+ // Invalid combo: exactMatch and diacriticInsensitiveMatch
+ if (fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH) || fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.DIACRITIC_INSENSITIVE_MATCH));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.EXACT_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.EXACT_MATCH_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.EXACT_MATCH));
+ }
+ }
+
+ // Invalid combo: caseSensitiveSort and caseInsensitiveSort
+ if (fq.equalsIgnoreCase(FindQualifiers.CASE_SENSITIVE_SORT) || fq.equalsIgnoreCase(FindQualifiers.CASE_SENSITIVE_SORT_TMODEL)) {
+ if (fqTable.get(FindQualifiers.CASE_INSENSITIVE_SORT.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_INSENSITIVE_SORT_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_INSENSITIVE_SORT));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_SORT) || fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_SORT_TMODEL)) {
+ if (fqTable.get(FindQualifiers.CASE_SENSITIVE_SORT.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_SENSITIVE_SORT_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_SENSITIVE_SORT));
+ }
+ }
+
+ // Invalid combo: caseSensitiveMatch and caseInsensitiveMatch
+ if (fq.equalsIgnoreCase(FindQualifiers.CASE_SENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.CASE_SENSITIVE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.CASE_INSENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_INSENSITIVE_MATCH));
+ }
+ } else if (fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.CASE_SENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_SENSITIVE_MATCH_TMODEL.toUpperCase()) != null) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_SENSITIVE_MATCH));
+ }
+ }
+
+ }
+ }
+
+ private void validateFindingBindingFQ(org.uddi.api_v3.FindQualifiers findQualifiers) throws InvalidCombinationException {
+ if (findQualifiers == null) {
+ return;
+ }
+ for (int i = 0; i < findQualifiers.getFindQualifier().size(); i++) {
+ if (findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.BINARY_SORT) || findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.BINARY_SORT_TMODEL)) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", FindQualifiers.BINARY_SORT));
+ }
+ if (findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.CASE_INSENSITIVE_MATCH) || findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL)) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", FindQualifiers.CASE_INSENSITIVE_MATCH));
+ }
+ if (findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.CASE_SENSITIVE_MATCH) || findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.CASE_SENSITIVE_MATCH_TMODEL)) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", FindQualifiers.CASE_SENSITIVE_MATCH));
+ }
+ if (findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.CASE_INSENSITIVE_SORT) || findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.CASE_INSENSITIVE_SORT_TMODEL)) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", FindQualifiers.CASE_INSENSITIVE_SORT));
+ }
+ if (findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.CASE_SENSITIVE_SORT) || findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.CASE_SENSITIVE_SORT_TMODEL)) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", FindQualifiers.CASE_SENSITIVE_SORT_TMODEL));
+ }
+ if (findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.SORT_BY_NAME_ASC) || findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.SORT_BY_NAME_ASC_TMODEL)) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", FindQualifiers.SORT_BY_NAME_ASC));
+ }
+ if (findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.SORT_BY_NAME_DESC) || findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.SORT_BY_NAME_DESC_TMODEL)) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", FindQualifiers.SORT_BY_NAME_DESC));
+ }
+ }
+ }
+
+ private void validateFindRelatedBusinessesFindQualifiers(org.uddi.api_v3.FindQualifiers findQualifiers) throws InvalidCombinationException {
+ if (findQualifiers == null) {
+ return;
+ }
+ for (int i = 0; i < findQualifiers.getFindQualifier().size(); i++) {
+ if (findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.AND_ALL_KEYS) || findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.AND_ALL_KEYS_TMODEL)) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", FindQualifiers.AND_ALL_KEYS));
+ }
+ }
+ }
+
+ private void validateFindQualifiers_AppoximateMatchAndCombinedCatbag(org.uddi.api_v3.FindQualifiers findQualifiers) throws InvalidCombinationException {
+ if (findQualifiers == null) {
+ return;
+ }
+ boolean containsAPPROXIMATE_MATCH = false;
+ boolean containsCOMBINE_CATEGORY_BAGS = false;
+ for (int i = 0; i < findQualifiers.getFindQualifier().size(); i++) {
+ if (findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.APPROXIMATE_MATCH) || findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.APPROXIMATE_MATCH_TMODEL)) {
+ containsAPPROXIMATE_MATCH = true;
+ }
+ if (findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.COMBINE_CATEGORY_BAGS) || findQualifiers.getFindQualifier().get(i).equals(FindQualifiers.COMBINE_CATEGORY_BAGS_TMODEL)) {
+ containsCOMBINE_CATEGORY_BAGS = true;
+ }
+ }
+ if (containsAPPROXIMATE_MATCH && containsCOMBINE_CATEGORY_BAGS) {
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", FindQualifiers.COMBINE_CATEGORY_BAGS + " & " + FindQualifiers.APPROXIMATE_MATCH_TMODEL));
+ }
+
+ }
}
Modified: juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/publish/SimplePublishClerk.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/publish/SimplePublishClerk.java?rev=1559368&r1=1559367&r2=1559368&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/publish/SimplePublishClerk.java (original)
+++ juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/publish/SimplePublishClerk.java Sat Jan 18 17:24:41 2014
@@ -20,10 +20,6 @@ import org.uddi.api_v3.*;
import org.apache.juddi.api_v3.*;
import org.apache.juddi.v3.client.config.UDDIClerk;
import org.apache.juddi.v3.client.config.UDDIClient;
-import org.apache.juddi.v3.client.transport.Transport;
-import org.uddi.v3_service.UDDISecurityPortType;
-import org.uddi.v3_service.UDDIPublicationPortType;
-import org.apache.juddi.v3_service.JUDDIApiPortType;
/**
* This shows you to interact with a UDDI server by publishing a Business,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org