| author | Vikas Mishra | 2012-03-21 07:20:53 (EDT) |
|---|---|---|
| committer | Manik Kishore | 2012-06-19 07:22:31 (EDT) |
| commit | e6eed0d7d4f236e5e8b80b95afbc6f784c03ddb4 (patch) (side-by-side diff) | |
| tree | 1355a368a91e9f07dbc28089f188edbe498618a2 | |
| parent | 842ee2a6f82df8187c346d9dad720a076cac2ff2 (diff) | |
| download | org.eclipse.stardust.ui.web-e6eed0d7d4f236e5e8b80b95afbc6f784c03ddb4.zip org.eclipse.stardust.ui.web-e6eed0d7d4f236e5e8b80b95afbc6f784c03ddb4.tar.gz org.eclipse.stardust.ui.web-e6eed0d7d4f236e5e8b80b95afbc6f784c03ddb4.tar.bz2 | |
Jira-ID: CRNT-24233
if all source key descriptors contain either null or empty then do not call process search.
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@54739 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
| -rw-r--r-- | views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/search/RelatedProcessSearchHelper.java | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/search/RelatedProcessSearchHelper.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/search/RelatedProcessSearchHelper.java index 38e9b08..5adbd08 100644 --- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/search/RelatedProcessSearchHelper.java +++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/search/RelatedProcessSearchHelper.java @@ -52,6 +52,7 @@ import org.eclipse.stardust.ui.web.viewscommon.utils.ServiceFactoryUtils; +
/**
*
* @author Vikas.Mishra
@@ -249,25 +250,32 @@ public class RelatedProcessSearchHelper {
List<ProcessInstance> processInstances = null;
-
- //first check in cache
- if (resultCache.containsKey(matchAny))
- {
- processInstances = resultCache.get(matchAny);
- }
- else
- {
- ProcessInstanceQuery query = createQuery();
- processInstances = ServiceFactoryUtils.getQueryService().getAllProcessInstances(query);
- resultCache.put(matchAny, processInstances);
- }
- if (CollectionUtils.isNotEmpty(processInstances))
+
+ // to search Process(es)/Case(es),atleast one key descriptor must contain non empty value.
+ if (!isEmptyDescriptors(keyDescriptors.values(), sourceDescriptors))
{
- for (ProcessInstance processInstance : processInstances)
+ // first check in cache
+ if (resultCache.containsKey(matchAny))
+ {
+ processInstances = resultCache.get(matchAny);
+ }
+ else
{
- tablelList.add(new RelatedProcessTableEntry(processInstance));
+ ProcessInstanceQuery query = createQuery();
+ processInstances = ServiceFactoryUtils.getQueryService().getAllProcessInstances(query);
+ resultCache.put(matchAny, processInstances);
+ }
+
+
+ if (CollectionUtils.isNotEmpty(processInstances))
+ {
+ for (ProcessInstance processInstance : processInstances)
+ {
+ tablelList.add(new RelatedProcessTableEntry(processInstance));
+ }
}
}
+
}
}
catch (Exception e)
@@ -408,6 +416,27 @@ public class RelatedProcessSearchHelper return piQuery;
}
+ private boolean isEmptyDescriptors(final Collection<DataPath> datas, final Map<String, Object> sourceDescriptors)
+ {
+ for (DataPath path : datas)
+ {
+ if (sourceDescriptors.containsKey(path.getId()))
+ {
+ Object value = sourceDescriptors.get(path.getId());
+ if (null != value && !(value instanceof String))
+ {
+ return false;
+ }
+ else if (value instanceof String && StringUtils.isNotEmpty(value.toString()))
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+
/**
*
* @param query
|

