juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfa...@apache.org
Subject svn commit: r730483 - in /webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi: api/impl/ mapping/ query/ query/util/
Date Wed, 31 Dec 2008 21:17:12 GMT
Author: jfaath
Date: Wed Dec 31 13:17:11 2008
New Revision: 730483

URL: http://svn.apache.org/viewvc?rev=730483&view=rev
Log:
JUDDI-159:  implemented category group searching

Added:
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBindingByCategoryGroupQuery.java
  (with props)
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBusinessByCategoryGroupQuery.java
  (with props)
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByCategoryGroupQuery.java
  (with props)
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindServiceByCategoryGroupQuery.java
  (with props)
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindTModelByCategoryGroupQuery.java
  (with props)
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/util/KeyedRefGroupTModelComparator.java
  (with props)
Modified:
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByCategoryQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByIdentifierQuery.java

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java?rev=730483&r1=730482&r2=730483&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
Wed Dec 31 13:17:11 2008
@@ -28,16 +28,20 @@
 import org.apache.juddi.query.FetchBusinessEntitiesQuery;
 import org.apache.juddi.query.FetchBusinessServicesQuery;
 import org.apache.juddi.query.FetchTModelsQuery;
+import org.apache.juddi.query.FindBindingByCategoryGroupQuery;
 import org.apache.juddi.query.FindBindingByCategoryQuery;
 import org.apache.juddi.query.FindBindingByTModelKeyQuery;
+import org.apache.juddi.query.FindBusinessByCategoryGroupQuery;
 import org.apache.juddi.query.FindBusinessByCategoryQuery;
 import org.apache.juddi.query.FindBusinessByDiscoveryURLQuery;
 import org.apache.juddi.query.FindBusinessByIdentifierQuery;
 import org.apache.juddi.query.FindBusinessByNameQuery;
 import org.apache.juddi.query.FindBusinessByTModelKeyQuery;
+import org.apache.juddi.query.FindServiceByCategoryGroupQuery;
 import org.apache.juddi.query.FindServiceByCategoryQuery;
 import org.apache.juddi.query.FindServiceByNameQuery;
 import org.apache.juddi.query.FindServiceByTModelKeyQuery;
+import org.apache.juddi.query.FindTModelByCategoryGroupQuery;
 import org.apache.juddi.query.FindTModelByCategoryQuery;
 import org.apache.juddi.query.FindTModelByIdentifierQuery;
 import org.apache.juddi.query.FindTModelByNameQuery;
@@ -105,6 +109,7 @@
 		
 		keysFound = FindBindingByTModelKeyQuery.select(em, findQualifiers, body.getTModelBag(),
body.getServiceKey(), keysFound);
 		keysFound = FindBindingByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(),
body.getServiceKey(), keysFound);
+		keysFound = FindBindingByCategoryGroupQuery.select(em, findQualifiers, body.getCategoryBag(),
body.getServiceKey(), keysFound);
 
 		BindingDetail result = new BindingDetail();
 		ListDescription listDesc = new ListDescription();
@@ -176,6 +181,7 @@
 		keysFound = FindBusinessByIdentifierQuery.select(em, findQualifiers, body.getIdentifierBag(),
keysFound);
 		keysFound = FindBusinessByDiscoveryURLQuery.select(em, findQualifiers, body.getDiscoveryURLs(),
keysFound);
 		keysFound = FindBusinessByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(),
keysFound);
+		keysFound = FindBusinessByCategoryGroupQuery.select(em, findQualifiers, body.getCategoryBag(),
keysFound);
 		keysFound = FindBusinessByNameQuery.select(em, findQualifiers, body.getName(), keysFound);
 
 		BusinessList result = new BusinessList();
@@ -327,6 +333,7 @@
 		List<?> keysFound = null;
 		FindServiceByTModelKeyQuery.select(em, findQualifiers, body.getTModelBag(), body.getBusinessKey(),
keysFound);
 		keysFound = FindServiceByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(),
body.getBusinessKey(), keysFound);
+		keysFound = FindServiceByCategoryGroupQuery.select(em, findQualifiers, body.getCategoryBag(),
body.getBusinessKey(), keysFound);
 		keysFound = FindServiceByNameQuery.select(em, findQualifiers, body.getName(), body.getBusinessKey(),
keysFound);
 
 		ServiceList result = new ServiceList();
@@ -371,6 +378,7 @@
 		List<?> keysFound = null;
 		keysFound = FindTModelByIdentifierQuery.select(em, findQualifiers, body.getIdentifierBag(),
keysFound);
 		keysFound = FindTModelByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(),
keysFound);
+		keysFound = FindTModelByCategoryGroupQuery.select(em, findQualifiers, body.getCategoryBag(),
keysFound);
 		keysFound = FindTModelByNameQuery.select(em, findQualifiers, body.getName(), keysFound);
 
 		TModelList result = new TModelList();

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java?rev=730483&r1=730482&r2=730483&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
Wed Dec 31 13:17:11 2008
@@ -332,7 +332,7 @@
 	}
 
 	public static void mapCategoryBag(org.uddi.api_v3.CategoryBag apiCategoryBag,
-											org.apache.juddi.model.CategoryBag modelCategoryBag)
+									  org.apache.juddi.model.CategoryBag modelCategoryBag)
 				   throws DispositionReportFaultMessage {
 
 		if (apiCategoryBag != null) {
@@ -347,23 +347,40 @@
 						apiKeyedReference.getTModelKey(), apiKeyedReference.getKeyName(), apiKeyedReference.getKeyValue()));
 				}
 				if (elem.getValue() instanceof org.uddi.api_v3.KeyedReferenceGroup) {
+					org.uddi.api_v3.KeyedReferenceGroup apiKeyedReferenceGroup = (org.uddi.api_v3.KeyedReferenceGroup)
elem.getValue();
+
+					org.apache.juddi.model.KeyedReferenceGroup modelKeyedReferenceGroup = new org.apache.juddi.model.KeyedReferenceGroup();
 					List<org.apache.juddi.model.KeyedReferenceGroup> modelKeyedReferenceGroups=modelCategoryBag.getKeyedReferenceGroups();
 					//modelKeyedReferenceGroups.clear();
-					org.uddi.api_v3.KeyedReferenceGroup apiKeyedReferenceGroup = (org.uddi.api_v3.KeyedReferenceGroup)
elem.getValue();
-					org.apache.juddi.model.KeyedReferenceGroup modelKeyedReferenceGroup = new org.apache.juddi.model.KeyedReferenceGroup(modelCategoryBag,apiKeyedReferenceGroup.getTModelKey());
+					
+					mapKeyedReferenceGroup(apiKeyedReferenceGroup, modelKeyedReferenceGroup, modelCategoryBag);
+					
 					modelKeyedReferenceGroups.add(modelKeyedReferenceGroup);
-					if (apiKeyedReferenceGroup.getKeyedReference() != null) {
-						List<org.apache.juddi.model.KeyedReference> modelKeyedReferences = modelKeyedReferenceGroup.getKeyedReferences();
-						for (org.uddi.api_v3.KeyedReference apiKeyedReference : apiKeyedReferenceGroup.getKeyedReference())
{
-							modelKeyedReferences.add(new org.apache.juddi.model.KeyedReference(modelKeyedReferenceGroup,

-								apiKeyedReference.getTModelKey(), apiKeyedReference.getKeyName(), apiKeyedReference.getKeyValue()));
-						}
-					}
 				}
 			}
 		}
 	}
 
+	public static void mapKeyedReferenceGroup(org.uddi.api_v3.KeyedReferenceGroup apiKeyedReferenceGroup,
+											  org.apache.juddi.model.KeyedReferenceGroup modelKeyedReferenceGroup,
+											  org.apache.juddi.model.CategoryBag modelCategoryBag)
+				   throws DispositionReportFaultMessage {
+		if (apiKeyedReferenceGroup != null) {
+			modelKeyedReferenceGroup.setCategoryBag(modelCategoryBag);
+			modelKeyedReferenceGroup.setTmodelKey(apiKeyedReferenceGroup.getTModelKey());
+			
+			if (apiKeyedReferenceGroup.getKeyedReference() != null) {
+				List<org.apache.juddi.model.KeyedReference> modelKeyedReferences = modelKeyedReferenceGroup.getKeyedReferences();
+				for (org.uddi.api_v3.KeyedReference apiKeyedReference : apiKeyedReferenceGroup.getKeyedReference())
{
+					modelKeyedReferences.add(new org.apache.juddi.model.KeyedReference(modelKeyedReferenceGroup,

+						apiKeyedReference.getTModelKey(), apiKeyedReference.getKeyName(), apiKeyedReference.getKeyValue()));
+				}
+			}
+			
+		}
+		
+	}
+	
 	public static void mapTModelInstanceDetails(org.uddi.api_v3.TModelInstanceDetails apiTModelInstDetails,

 												List<org.apache.juddi.model.TmodelInstanceInfo> modelTModelInstInfoList,
 												org.apache.juddi.model.BindingTemplate modelBindingTemplate) 

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java?rev=730483&r1=730482&r2=730483&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
Wed Dec 31 13:17:11 2008
@@ -361,7 +361,7 @@
 
 		List<JAXBElement<?>> apiCategoryList = apiCategoryBag.getContent();
 		apiCategoryList.clear();
-
+		
 		for (org.apache.juddi.model.KeyedReference modelKeyedReference : modelCategoryBag.getKeyedReferences())
{
 			org.uddi.api_v3.KeyedReference apiKeyedReference = new org.uddi.api_v3.KeyedReference();
 			apiKeyedReference.setTModelKey(modelKeyedReference.getTmodelKeyRef());
@@ -371,19 +371,30 @@
 		}
 		for (org.apache.juddi.model.KeyedReferenceGroup modelKeyedReferenceGroup : modelCategoryBag.getKeyedReferenceGroups())
{
 			org.uddi.api_v3.KeyedReferenceGroup apiKeyedReferenceGroup = new org.uddi.api_v3.KeyedReferenceGroup();
-			apiKeyedReferenceGroup.setTModelKey(modelKeyedReferenceGroup.getTmodelKey());
-			for (org.apache.juddi.model.KeyedReference modelKeyedReference : modelKeyedReferenceGroup.getKeyedReferences())
{
-				org.uddi.api_v3.KeyedReference apiKeyedReference = new org.uddi.api_v3.KeyedReference();
-				apiKeyedReference.setTModelKey(modelKeyedReference.getTmodelKeyRef());
-				apiKeyedReference.setKeyName(modelKeyedReference.getKeyName());
-				apiKeyedReference.setKeyValue(modelKeyedReference.getKeyValue());
-				apiKeyedReferenceGroup.getKeyedReference().add(apiKeyedReference);
-			}
+
+			mapKeyedReferenceGroup(modelKeyedReferenceGroup, apiKeyedReferenceGroup);
+			
 			apiCategoryList.add(new ObjectFactory().createKeyedReferenceGroup(apiKeyedReferenceGroup));
 		}
 		return apiCategoryBag;
 	}
 
+	public static void mapKeyedReferenceGroup(org.apache.juddi.model.KeyedReferenceGroup modelKeyedReferenceGroup,

+											  org.uddi.api_v3.KeyedReferenceGroup apiKeyedReferenceGroup) 
+				   throws DispositionReportFaultMessage {
+
+		apiKeyedReferenceGroup.setTModelKey(modelKeyedReferenceGroup.getTmodelKey());
+
+		for (org.apache.juddi.model.KeyedReference modelKeyedReference : modelKeyedReferenceGroup.getKeyedReferences())
{
+			org.uddi.api_v3.KeyedReference apiKeyedReference = new org.uddi.api_v3.KeyedReference();
+			apiKeyedReference.setTModelKey(modelKeyedReference.getTmodelKeyRef());
+			apiKeyedReference.setKeyName(modelKeyedReference.getKeyName());
+			apiKeyedReference.setKeyValue(modelKeyedReference.getKeyValue());
+			apiKeyedReferenceGroup.getKeyedReference().add(apiKeyedReference);
+		}
+		
+	}
+	
 	public static void mapTModelInstanceDetails(List<org.apache.juddi.model.TmodelInstanceInfo>
modelTModelInstInfoList, 
 												org.uddi.api_v3.TModelInstanceDetails apiTModelInstDetails,
 												org.uddi.api_v3.BindingTemplate apiBindingTemplate) 

Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBindingByCategoryGroupQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBindingByCategoryGroupQuery.java?rev=730483&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBindingByCategoryGroupQuery.java
(added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBindingByCategoryGroupQuery.java
Wed Dec 31 13:17:11 2008
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.juddi.query;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.apache.juddi.query.util.DynamicQuery;
+import org.apache.juddi.query.util.FindQualifiers;
+import org.uddi.api_v3.CategoryBag;
+
+/**
+ * Returns the list of binding keys possessing the keyedReferenceGroups in the passed category
bag.
+ * Output is restricted by list of binding keys passed in.  If null, all binding templates
are searched.
+ * Output is produced by building the appropriate JPA query based on input and find qualifiers.
+ * 
+ * From specification:
+ * "This optional argument is a list of category references in the form of keyedReference
elements and keyedReferenceGroup 
+ * structures.  When used, the returned bindingDetail for this API will contain elements
matching all of the categories 
+ * passed (logical AND by default).   Specifying the appropriate findQualifiers can override
this behavior.
+ * 
+ * A given keyedReferenceGroup "X" (e.g., within a given categoryBag) matches a keyedReferenceGroup
"Y" in the registry if 
+ * and only if the tModelKey assigned to the keyedReferenceGroup X matches the tModelKey
assigned to the keyedReferenceGroup 
+ * Y and the set of keyedReferences in "X" are a subset of the set of keyedReferences in
"Y."  The order of individual 
+ * keyedReferences within a keyedReferenceGroup is not important. Matching rules for the
individual contained keyedReference 
+ * elements are the same as above."
+ * 
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class FindBindingByCategoryGroupQuery {
+	
+	private static final String ENTITY_NAME_CHILD = "BindingCategoryBag";
+	
+	private static FindEntityByCategoryGroupQuery findQuery;
+	
+	static {
+		findQuery = new FindEntityByCategoryGroupQuery(BindingTemplateQuery.ENTITY_NAME, 
+													   BindingTemplateQuery.ENTITY_ALIAS, 
+													   BindingTemplateQuery.KEY_NAME, 
+													   BindingTemplateQuery.ENTITY_FIELD, 
+													   ENTITY_NAME_CHILD);
+	}
+	
+	public static List<?> select(EntityManager em, FindQualifiers fq, CategoryBag categoryBag,
String parentKey, List<?> keysIn) {
+		if (parentKey != null && parentKey.length() > 0) {
+			DynamicQuery.Parameter param = new DynamicQuery.Parameter(BindingTemplateQuery.ENTITY_ALIAS
+ "." + BindingTemplateQuery.KEY_NAME_PARENT, parentKey, DynamicQuery.PREDICATE_EQUALS); 
+			return findQuery.select(em, fq, categoryBag, keysIn, param);
+		}
+		else
+			return findQuery.select(em, fq, categoryBag, keysIn);
+	}
+}

Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBindingByCategoryGroupQuery.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBusinessByCategoryGroupQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBusinessByCategoryGroupQuery.java?rev=730483&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBusinessByCategoryGroupQuery.java
(added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBusinessByCategoryGroupQuery.java
Wed Dec 31 13:17:11 2008
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.juddi.query;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.apache.juddi.query.util.FindQualifiers;
+import org.uddi.api_v3.CategoryBag;
+
+/**
+ * Returns the list of business keys possessing the keyedReferenceGroups in the passed category
bag.
+ * Output is restricted by list of business keys passed in.  If null, all business entities
are searched.
+ * Output is produced by building the appropriate JPA query based on input and find qualifiers.
+ * 
+ * From specification:
+ * "This is a list of category references in the form of keyedReference elements and keyedReferenceGroup

+ * structures.  The returned businessList contains businessInfo elements matching all of
the categories 
+ * passed (logical AND by default).   Specifying the appropriate findQualifiers can override
this behavior.
+ * 
+ * A given keyedReferenceGroup "X" (e.g., within a given categoryBag) matches a keyedReferenceGroup
"Y" in the registry if 
+ * and only if the tModelKey assigned to the keyedReferenceGroup X matches the tModelKey
assigned to the keyedReferenceGroup 
+ * Y and the set of keyedReferences in "X" are a subset of the set of keyedReferences in
"Y."  The order of individual 
+ * keyedReferences within a keyedReferenceGroup is not important. Matching rules for the
individual contained keyedReference 
+ * elements are the same as above."
+ * 
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class FindBusinessByCategoryGroupQuery {
+	
+	private static final String ENTITY_NAME_CHILD = "BusinessCategoryBag";
+	
+	private static FindEntityByCategoryGroupQuery findQuery;
+	
+	static {
+		findQuery = new FindEntityByCategoryGroupQuery(BusinessEntityQuery.ENTITY_NAME, 
+													   BusinessEntityQuery.ENTITY_ALIAS, 
+													   BusinessEntityQuery.KEY_NAME, 
+													   BusinessEntityQuery.ENTITY_FIELD, 
+													   ENTITY_NAME_CHILD);
+	}
+	
+	public static List<?> select(EntityManager em, FindQualifiers fq, CategoryBag categoryBag,
List<?> keysIn) {
+		return findQuery.select(em, fq, categoryBag, keysIn);
+	}
+}

Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBusinessByCategoryGroupQuery.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByCategoryGroupQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByCategoryGroupQuery.java?rev=730483&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByCategoryGroupQuery.java
(added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByCategoryGroupQuery.java
Wed Dec 31 13:17:11 2008
@@ -0,0 +1,315 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.juddi.query;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.persistence.EntityManager;
+import javax.xml.bind.JAXBElement;
+
+import org.apache.juddi.config.Constants;
+import org.apache.juddi.model.BusinessEntity;
+import org.apache.juddi.query.util.DynamicQuery;
+import org.apache.juddi.query.util.FindQualifiers;
+import org.apache.juddi.query.util.KeyedRefGroupTModelComparator;
+import org.apache.log4j.Logger;
+import org.uddi.api_v3.CategoryBag;
+import org.uddi.api_v3.KeyedReference;
+import org.uddi.api_v3.KeyedReferenceGroup;
+
+/**
+ * Returns the list of "entity" keys possessing the keyedReferenceGroups in the passed category
bag.
+ * Output is restricted by list of "entity" keys passed in.  If null, all entities are searched.
+ * Output is produced by building the appropriate JPA query based on input and find qualifiers.
+ * 
+ * NOTES:
+ * 1) Category groups are grouped with a logical AND by default.
+ * 2) Concerning when the categories are AND'd together - the only way this can be done with
a single query was to create a self-join for 
+ *    each category.  If there are a lot of categories, the performance could suffer.
+ *    TODO:  Test performance with multiple AND'd categories.  If too slow, look to process
this query in multiple steps.
+ * 3) The "orLikeKeys" qualifier complicates matters.  The "like" keys are OR'd together
and these groups of "like" keys are AND'd together.
+ *    As with "andAllKeys", self-joins are created but only one for each group of "like"
keys.  If none of the keyedReferences passed are alike then this
+ *    will reduce to an "andAllKeys" query.  If all are alike, then this will query will
exhibit the behavior of OR'ing all keys.
+ * 
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class FindEntityByCategoryGroupQuery extends EntityQuery {
+	
+	private Logger log = Logger.getLogger(FindEntityByCategoryGroupQuery.class);
+
+	private static final String ENTITY_KEYEDREFERENCEGROUP = "KeyedReferenceGroup";
+	private static final String ALIAS_KEYEDREFERENCEGROUP = "krg";
+	private static final String FIELD_CATEGORYBAG = "categoryBag";
+
+	private static final String ENTITY_KEYEDREFERENCE = "KeyedReference";
+	private static final String ALIAS_KEYEDREFERENCE = buildAlias(ENTITY_KEYEDREFERENCE);
+	private static final String FIELD_KEYEDREFERENCEGROUP = "keyedReferenceGroup";
+	
+	private String entityName;
+	private String entityAlias;
+	private String keyName;
+	private String entityField;
+	private String entityNameChild;
+	private String entityAliasChild;
+	private String selectSQL;
+
+	public FindEntityByCategoryGroupQuery(String entityName, String entityAlias, String keyName,
String entityField, String entityNameChild) {
+		this.entityName = entityName;
+		this.entityAlias = entityAlias;
+		this.keyName = keyName;
+		this.entityField = entityField;
+		this.entityNameChild = entityNameChild;
+		this.entityAliasChild = buildAlias(entityNameChild);
+		
+		StringBuffer sql = new StringBuffer(200);
+		sql.append("select distinct " + entityAlias + "." + keyName + " from " 
+				   + entityName + " " + entityAlias + " , " 
+				   + entityNameChild + " " + entityAliasChild + " , "
+				   + ENTITY_KEYEDREFERENCEGROUP + " " + ALIAS_KEYEDREFERENCEGROUP + " ");
+		selectSQL = sql.toString();
+	}
+	
+	public String getEntityName() {
+		return entityName;
+	}
+
+	public String getEntityAlias() {
+		return entityAlias;
+	}
+
+	public String getKeyName() {
+		return keyName;
+	}
+
+	public String getEntityField() {
+		return entityField;
+	}
+
+	public String getEntityNameChild() {
+		return entityNameChild;
+	}
+	
+	public String getEntityAliasChild() {
+		return entityAliasChild;
+	}
+	
+	public String getSelectSQL() {
+		return selectSQL;
+	}
+	
+	public List<?> select(EntityManager em, FindQualifiers fq, CategoryBag categoryBag,
List<?> keysIn, DynamicQuery.Parameter... restrictions) {
+		// If keysIn is not null and empty, then search is over.
+		if ((keysIn != null) && (keysIn.size() == 0))
+			return keysIn;
+		
+		if (categoryBag == null)
+			return keysIn;
+		
+		List<JAXBElement<?>> categories = categoryBag.getContent();
+		if (categories == null || categories.size() == 0)
+			return keysIn;
+		
+		List<KeyedReferenceGroup> keyedRefGroups = new ArrayList<KeyedReferenceGroup>(0);
+		for (JAXBElement<?> elem : categories) {
+			if (elem.getValue() instanceof KeyedReferenceGroup)
+				keyedRefGroups.add((KeyedReferenceGroup)elem.getValue());
+		}
+		if (keyedRefGroups.size() == 0)
+			return keysIn;		
+		
+		
+		Collections.sort(keyedRefGroups, new KeyedRefGroupTModelComparator());
+		int count = 0;
+		String prevTModelKey = null;
+		Set<String> orResults = new HashSet<String>(0);
+		List<?> restrictionList = keysIn;
+		List<?> curResult = null;
+		for (KeyedReferenceGroup keyedRefGroup : keyedRefGroups) {
+			String curTModelKey = keyedRefGroup.getTModelKey();
+			
+			DynamicQuery dynamicQry = new DynamicQuery(selectSQL);
+			appendConditions(dynamicQry, fq, keyedRefGroup);
+			if (restrictions != null && restrictions.length > 0)
+				dynamicQry.AND().pad().appendGroupedAnd(restrictions);
+			
+
+			if (fq.isOrLikeKeys()) {
+				if (!curTModelKey.equals(prevTModelKey)) {
+					if (count != 0) {
+						restrictionList = new ArrayList<String>(orResults);
+						orResults.clear();
+					}
+				}
+			}
+			else if (!fq.isOrAllKeys()) {
+				if (count != 0)
+					restrictionList = curResult;
+			}
+
+			if (restrictionList != null && restrictionList.size() == 0)
+				break;
+			
+			curResult = getQueryResult(em, dynamicQry, restrictionList, entityAlias + "." + keyName);
+
+			if (fq.isOrAllKeys() || fq.isOrLikeKeys()) {
+				orResults.addAll((List<String>)curResult);
+			}
+			
+			prevTModelKey = curTModelKey;
+			count++;
+		}
+		
+		List<String> result = null;
+		if (fq.isOrAllKeys() || fq.isOrLikeKeys()) {
+			result = new ArrayList<String>(0);
+			result.addAll(orResults);
+		}
+		else
+			result = (List<String>)curResult;
+		
+		return result;
+		
+	}
+
+	/*
+	 * Appends the conditions to the query based on the keyedReferenceGroup.  According to the
specification, a keyedReference group matches if all
+	 * keyedReferences within the group are a subset of the target entity's group.  Thus, 
+	 */
+	public void appendConditions(DynamicQuery qry, FindQualifiers fq, KeyedReferenceGroup keyedRefGroup)
{
+		
+		// Append the necessary tables (two will always be added connecting the entity to its category
bag table and then the category table to the keyed reference group).
+		appendJoinTables(qry, fq, keyedRefGroup);
+
+		// First, appending the group's tmodel key as a condition
+		qry.AND().pad().appendGroupedAnd(new DynamicQuery.Parameter(ALIAS_KEYEDREFERENCEGROUP +
".tmodelKey", keyedRefGroup.getTModelKey(), DynamicQuery.PREDICATE_EQUALS));
+		
+		List<KeyedReference> keyedRefs = keyedRefGroup.getKeyedReference();
+		if (keyedRefs != null && keyedRefs.size() > 0) {
+		
+			qry.AND().pad().openParen().pad();
+	
+			String predicate = DynamicQuery.PREDICATE_EQUALS;
+			if (fq.isApproximateMatch()) {
+				predicate = DynamicQuery.PREDICATE_LIKE;
+			}
+			
+			int count = 0;
+			int tblCount = -1;
+			for(KeyedReference keyedRef : keyedRefs) {
+				String tmodelKey = keyedRef.getTModelKey();
+				String keyValue = keyedRef.getKeyValue();
+				String keyName = keyedRef.getKeyName();
+
+				if (fq.isApproximateMatch()) {
+					keyValue = keyValue.endsWith(DynamicQuery.WILDCARD)?keyValue:keyValue + DynamicQuery.WILDCARD;
+					keyName = keyName.endsWith(DynamicQuery.WILDCARD)?keyName:keyName + DynamicQuery.WILDCARD;
+				}
+
+				tblCount++;
+				String keyValueTerm = ALIAS_KEYEDREFERENCE + tblCount + ".keyValue";
+				String keyNameTerm = ALIAS_KEYEDREFERENCE + tblCount + ".keyName";
+				String tmodelKeyTerm = ALIAS_KEYEDREFERENCE + tblCount + ".tmodelKeyRef";
+				if (fq.isCaseInsensitiveMatch()) {
+					keyValueTerm = "upper(" + keyValueTerm + ")";
+					keyValue = keyValue.toUpperCase();
+					
+					keyNameTerm = "upper(" + keyNameTerm + ")";
+					keyName = keyName.toUpperCase();
+				}
+				
+				// According to specification, if the "general keyword" tmodel is used, then the keyName
must be part of the query.
+				if (Constants.GENERAL_KEYWORD_TMODEL.equalsIgnoreCase(tmodelKey)) {
+					qry.appendGroupedAnd(new DynamicQuery.Parameter(tmodelKeyTerm, tmodelKey, DynamicQuery.PREDICATE_EQUALS),
+										 new DynamicQuery.Parameter(keyValueTerm, keyValue, predicate),
+										 new DynamicQuery.Parameter(keyNameTerm, keyName, predicate));
+				}
+				else {
+					qry.appendGroupedAnd(new DynamicQuery.Parameter(tmodelKeyTerm, tmodelKey, DynamicQuery.PREDICATE_EQUALS),
+										 new DynamicQuery.Parameter(keyValueTerm, keyValue, predicate));
+					
+				}
+				
+				if (count + 1 < keyedRefs.size())
+					qry.AND().pad();
+				
+				count++;
+			}
+			qry.closeParen().pad();
+		}
+		
+	}
+
+	
+	
+	/*
+	 * Appends the necessary join table for the child entity and additional tables for when
keys are AND'd.  When "orLikeKeys" is used, 
+	 * we only need an extra table for each distinct tmodelKey.
+	 */
+	public void appendJoinTables(DynamicQuery qry, FindQualifiers fq, KeyedReferenceGroup keyedRefGroup)
{
+		
+		if (keyedRefGroup != null) {
+			
+			List<KeyedReference> keyedRefs = keyedRefGroup.getKeyedReference();
+			StringBuffer thetaJoins = new StringBuffer(200);
+			if (keyedRefs != null && keyedRefs.size() > 0) {
+				
+				int tblCount = 0;
+				int count = 0;
+				for(KeyedReference kr : keyedRefs) {
+					if (count != 0) {
+						tblCount++;
+						qry.comma().pad().append(ENTITY_KEYEDREFERENCE + " " + ALIAS_KEYEDREFERENCE + tblCount).pad();
+						thetaJoins.append(ALIAS_KEYEDREFERENCE + (tblCount - 1) + "." + FIELD_KEYEDREFERENCEGROUP
+ ".id = " + ALIAS_KEYEDREFERENCE + tblCount + "." + FIELD_KEYEDREFERENCEGROUP + ".id ");
+						thetaJoins.append(DynamicQuery.OPERATOR_AND + " ");
+	
+					}
+					else {
+						qry.comma().pad().append(ENTITY_KEYEDREFERENCE + " " + ALIAS_KEYEDREFERENCE + tblCount).pad();
+						thetaJoins.append(ALIAS_KEYEDREFERENCEGROUP + ".id = " + ALIAS_KEYEDREFERENCE + tblCount
+ "." + FIELD_KEYEDREFERENCEGROUP + ".id ");
+						thetaJoins.append(DynamicQuery.OPERATOR_AND + " ");
+					}
+					count++;
+				}
+			}
+			qry.WHERE().pad().openParen().pad();
+			
+			// Appending the middling entity-specific category table condition
+			qry.append(entityAlias + "." + keyName + " = " + entityAliasChild + "." + entityField
+ "." + KEY_NAME).pad();
+			qry.AND().pad();
+
+			// Now, appending the condition that attaches the keyed reference group table
+			qry.append(entityAliasChild + ".id = " + ALIAS_KEYEDREFERENCEGROUP + "." + FIELD_CATEGORYBAG
+ ".id").pad();
+
+			String thetaJoinsStr = thetaJoins.toString();
+			if (thetaJoinsStr != null && thetaJoinsStr.length() > 0)
+				qry.AND().pad();
+			
+			if (thetaJoinsStr.endsWith(DynamicQuery.OPERATOR_AND + " "))
+				thetaJoinsStr = thetaJoinsStr.substring(0, thetaJoinsStr.length() - (DynamicQuery.OPERATOR_AND
+ " ").length());
+			qry.append(thetaJoinsStr);
+
+			qry.closeParen().pad();
+		}
+	}
+
+}

Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByCategoryGroupQuery.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByCategoryQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByCategoryQuery.java?rev=730483&r1=730482&r2=730483&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByCategoryQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByCategoryQuery.java
Wed Dec 31 13:17:11 2008
@@ -37,7 +37,7 @@
  * Output is produced by building the appropriate JPA query based on input and find qualifiers.
  * 
  * NOTES:
- * 1) Identifiers are grouped with a logical AND by default.
+ * 1) Categories are grouped with a logical AND by default.
  * 2) Concerning when the categories are AND'd together - the only way this can be done with
a single query was to create a self-join for 
  *    each category.  If there are a lot of categories, the performance could suffer.
  *    TODO:  Test performance with multiple AND'd categories.  If too slow, look to process
this query in multiple steps.
@@ -212,13 +212,14 @@
 				
 			}
 			
-			if (count + 1 < keyedRefs.size())
+			if (count + 1 < keyedRefs.size()) {
 				if (fq.isOrAllKeys())
 					qry.OR().pad();
 				else if (fq.isOrLikeKeys()) {
 				}
 				else
 					qry.AND().pad();
+			}
 			
 			// The "orLikeKeys" will always leave an unclosed parenthesis.  This will close it.
 			if (fq.isOrLikeKeys() && (count + 1 == keyedRefs.size()))

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByIdentifierQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByIdentifierQuery.java?rev=730483&r1=730482&r2=730483&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByIdentifierQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByIdentifierQuery.java
Wed Dec 31 13:17:11 2008
@@ -198,13 +198,14 @@
 				
 			}
 			
-			if (count + 1 < keyedRefs.size())
+			if (count + 1 < keyedRefs.size()) {
 				if (fq.isAndAllKeys())
 					qry.AND().pad();
 				else if (fq.isOrLikeKeys()) {
 				}
 				else
 					qry.OR().pad();
+			}
 			
 			// The "orLikeKeys" will always leave an unclosed parenthesis.  This will close it.
 			if (fq.isOrLikeKeys() && (count + 1 == keyedRefs.size()))

Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindServiceByCategoryGroupQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindServiceByCategoryGroupQuery.java?rev=730483&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindServiceByCategoryGroupQuery.java
(added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindServiceByCategoryGroupQuery.java
Wed Dec 31 13:17:11 2008
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.juddi.query;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.apache.juddi.query.util.DynamicQuery;
+import org.apache.juddi.query.util.FindQualifiers;
+import org.uddi.api_v3.CategoryBag;
+
+/**
+ * Returns the list of service keys possessing the keyedReferenceGroups in the passed category
bag.
+ * Output is restricted by list of service keys passed in.  If null, all services are searched.
+ * Output is produced by building the appropriate JPA query based on input and find qualifiers.
+ * 
+ * From specification:
+ * "This is a list of category references.  The returned serviceList contains serviceInfo
structures matching all of the 
+ * categories passed (logical AND by default).   Specifying the appropriate findQualifiers
can override this behavior.
+ * 
+ * A given keyedReferenceGroup "X" (e.g., within a given categoryBag) matches a keyedReferenceGroup
"Y" in the registry if 
+ * and only if the tModelKey assigned to the keyedReferenceGroup X matches the tModelKey
assigned to the keyedReferenceGroup 
+ * Y and the set of keyedReferences in "X" are a subset of the set of keyedReferences in
"Y."  The order of individual 
+ * keyedReferences within a keyedReferenceGroup is not important. Matching rules for the
individual contained keyedReference 
+ * elements are the same as above."
+ * 
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class FindServiceByCategoryGroupQuery {
+	
+	private static final String ENTITY_NAME_CHILD = "ServiceCategoryBag";
+	
+	private static FindEntityByCategoryGroupQuery findQuery;
+	
+	static {
+		findQuery = new FindEntityByCategoryGroupQuery(BusinessServiceQuery.ENTITY_NAME, 
+													   BusinessServiceQuery.ENTITY_ALIAS, 
+													   BusinessServiceQuery.KEY_NAME, 
+													   BusinessServiceQuery.ENTITY_FIELD, 
+													   ENTITY_NAME_CHILD);
+	}
+	
+	public static List<?> select(EntityManager em, FindQualifiers fq, CategoryBag categoryBag,
String parentKey, List<?> keysIn) {
+		if (parentKey != null && parentKey.length() > 0) {
+			DynamicQuery.Parameter param = new DynamicQuery.Parameter(BusinessServiceQuery.ENTITY_ALIAS
+ "." + BusinessServiceQuery.KEY_NAME_PARENT, parentKey, DynamicQuery.PREDICATE_EQUALS); 
+			return findQuery.select(em, fq, categoryBag, keysIn, param);
+		}
+		else
+			return findQuery.select(em, fq, categoryBag, keysIn);
+	}
+}

Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindServiceByCategoryGroupQuery.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindTModelByCategoryGroupQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindTModelByCategoryGroupQuery.java?rev=730483&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindTModelByCategoryGroupQuery.java
(added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindTModelByCategoryGroupQuery.java
Wed Dec 31 13:17:11 2008
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.juddi.query;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.apache.juddi.query.util.FindQualifiers;
+import org.uddi.api_v3.CategoryBag;
+
+/**
+ * Returns the list of tmodel keys possessing the keyedReferenceGroups in the passed category
bag.
+ * Output is restricted by list of tmodel keys passed in.  If null, all tmodels are searched.
+ * Output is produced by building the appropriate JPA query based on input and find qualifiers.
+ * 
+ * From specification:
+ * "This is a list of category references.  The returned tModelList contains tModelInfo elements
whose associated tModels 
+ * match all of the categories passed (logical AND by default).   Specifying the appropriate
findQualifiers can override 
+ * this behavior.
+ * 
+ * A given keyedReferenceGroup "X" (e.g., within a given categoryBag) matches a keyedReferenceGroup
"Y" in the registry if 
+ * and only if the tModelKey assigned to the keyedReferenceGroup X matches the tModelKey
assigned to the keyedReferenceGroup 
+ * Y and the set of keyedReferences in "X" are a subset of the set of keyedReferences in
"Y."  The order of individual 
+ * keyedReferences within a keyedReferenceGroup is not important. Matching rules for the
individual contained keyedReference 
+ * elements are the same as above."
+ * 
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class FindTModelByCategoryGroupQuery {
+	
+	private static final String ENTITY_NAME_CHILD = "TmodelCategoryBag";
+	
+	private static FindEntityByCategoryGroupQuery findQuery;
+	
+	static {
+		findQuery = new FindEntityByCategoryGroupQuery(TModelQuery.ENTITY_NAME, 
+													   TModelQuery.ENTITY_ALIAS, 
+													   TModelQuery.KEY_NAME, 
+													   TModelQuery.ENTITY_FIELD, 
+													   ENTITY_NAME_CHILD);
+	}
+	
+	public static List<?> select(EntityManager em, FindQualifiers fq, CategoryBag categoryBag,
List<?> keysIn) {
+		return findQuery.select(em, fq, categoryBag, keysIn);
+	}
+}

Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindTModelByCategoryGroupQuery.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/util/KeyedRefGroupTModelComparator.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/util/KeyedRefGroupTModelComparator.java?rev=730483&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/util/KeyedRefGroupTModelComparator.java
(added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/util/KeyedRefGroupTModelComparator.java
Wed Dec 31 13:17:11 2008
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.juddi.query.util;
+
+import java.util.Comparator;
+import org.uddi.api_v3.KeyedReferenceGroup;
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class KeyedRefGroupTModelComparator implements Comparator<KeyedReferenceGroup>
{
+
+	public int compare(KeyedReferenceGroup krg1, KeyedReferenceGroup krg2) {
+		if (krg1 == null && krg2 == null)
+			return 0;
+		if (krg1 == null)
+			return -1;
+		if (krg2 == null)
+			return 1;
+		
+		if (krg1.getTModelKey() == null && krg2.getTModelKey() == null)
+			return 0;
+		if (krg1.getTModelKey() == null)
+			return -1;
+		if (krg2.getTModelKey() == null)
+			return 1;
+			
+		return krg1.getTModelKey().compareTo(krg2.getTModelKey());
+	}
+	
+}

Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/util/KeyedRefGroupTModelComparator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



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


Mime
View raw message