summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Mishra2012-03-13 08:07:30 (EDT)
committerManik Kishore2012-06-19 07:20:58 (EDT)
commitac0119bdf9c21fde25c61bbb27a185fb23e171e5 (patch)
tree925dcadef244f2f52400eb889804fda5a9926e76
parent6b6a1ddff2835cb06e739554e82b7f0894640cf8 (diff)
downloadorg.eclipse.stardust.ui.web-ac0119bdf9c21fde25c61bbb27a185fb23e171e5.zip
org.eclipse.stardust.ui.web-ac0119bdf9c21fde25c61bbb27a185fb23e171e5.tar.gz
org.eclipse.stardust.ui.web-ac0119bdf9c21fde25c61bbb27a185fb23e171e5.tar.bz2
Jira-ID: CRNT-24123
added validation check before open create case or attach to case. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@54503 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/casemanagement/AttachToCaseDialogBean.java26
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/casemanagement/CreateCaseDialogBean.java17
2 files changed, 40 insertions, 3 deletions
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/casemanagement/AttachToCaseDialogBean.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/casemanagement/AttachToCaseDialogBean.java
index 33985b0..9f02290 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/casemanagement/AttachToCaseDialogBean.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/casemanagement/AttachToCaseDialogBean.java
@@ -17,19 +17,20 @@ import org.eclipse.stardust.common.StringUtils;
import org.eclipse.stardust.engine.api.runtime.ProcessInstance;
import org.eclipse.stardust.engine.api.runtime.ProcessInstanceState;
import org.eclipse.stardust.ui.web.common.dialogs.ConfirmationDialog;
-import org.eclipse.stardust.ui.web.common.dialogs.ConfirmationDialogHandler;
import org.eclipse.stardust.ui.web.common.dialogs.ConfirmationDialog.DialogActionType;
import org.eclipse.stardust.ui.web.common.dialogs.ConfirmationDialog.DialogContentType;
import org.eclipse.stardust.ui.web.common.dialogs.ConfirmationDialog.DialogStyle;
+import org.eclipse.stardust.ui.web.common.dialogs.ConfirmationDialogHandler;
+import org.eclipse.stardust.ui.web.common.message.MessageDialog;
import org.eclipse.stardust.ui.web.common.util.FacesUtils;
import org.eclipse.stardust.ui.web.viewscommon.core.ResourcePaths;
import org.eclipse.stardust.ui.web.viewscommon.messages.MessagesViewsCommonBean;
import org.eclipse.stardust.ui.web.viewscommon.utils.AuthorizationUtils;
import org.eclipse.stardust.ui.web.viewscommon.utils.CommonDescriptorUtils;
import org.eclipse.stardust.ui.web.viewscommon.utils.ExceptionHandler;
+import org.eclipse.stardust.ui.web.viewscommon.utils.ExceptionHandler.MessageDisplayMode;
import org.eclipse.stardust.ui.web.viewscommon.utils.ProcessInstanceUtils;
import org.eclipse.stardust.ui.web.viewscommon.utils.ServiceFactoryUtils;
-import org.eclipse.stardust.ui.web.viewscommon.utils.ExceptionHandler.MessageDisplayMode;
import org.eclipse.stardust.ui.web.viewscommon.views.search.RelatedProcessSearchBean;
import org.eclipse.stardust.ui.web.viewscommon.views.search.RelatedProcessTableEntry;
@@ -67,7 +68,28 @@ public class AttachToCaseDialogBean extends RelatedProcessSearchBean implements
public void openPopup()
{
resolveScope();
+ if (Scope.Process.equals(scope))
+ {
+ List<ProcessInstance> pis = getSourceProcessInstances();
+ List<Long> oids = CollectionUtils.newArrayList();
+ for (ProcessInstance pi : pis)
+ {
+ oids.add(pi.getOID());
+ }
+ pis = ProcessInstanceUtils.getProcessInstances(oids);
+ if (ProcessInstanceUtils.isRootProcessInstances(pis))
+ {
+ setSourceProcessInstances(pis);
+ }
+ else
+ {
+ MessageDialog.addErrorMessage(COMMON_MESSAGE_BEAN
+ .getString("views.attachToCase.nonRootProcessSelectedToCreateCase"));
+ return;
+ }
+ }
+
getRelatedProcessSearchHelper().setSearchCases(Scope.Case.equals(scope) ? false : true);
if ((Scope.Case.equals(scope) && hasManageCasePermission()) || Scope.Process.equals(scope))
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/casemanagement/CreateCaseDialogBean.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/casemanagement/CreateCaseDialogBean.java
index 811d46f..5684c04 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/casemanagement/CreateCaseDialogBean.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/casemanagement/CreateCaseDialogBean.java
@@ -12,11 +12,13 @@ package org.eclipse.stardust.ui.web.viewscommon.views.casemanagement;
import java.util.List;
+import org.eclipse.stardust.common.CollectionUtils;
import org.eclipse.stardust.common.StringUtils;
import org.eclipse.stardust.engine.api.dto.ContextKind;
import org.eclipse.stardust.engine.api.dto.ProcessInstanceAttributes;
import org.eclipse.stardust.engine.api.runtime.ProcessInstance;
import org.eclipse.stardust.ui.web.common.PopupUIComponentBean;
+import org.eclipse.stardust.ui.web.common.message.MessageDialog;
import org.eclipse.stardust.ui.web.common.util.FacesUtils;
import org.eclipse.stardust.ui.web.viewscommon.beans.SessionContext;
import org.eclipse.stardust.ui.web.viewscommon.messages.MessagesViewsCommonBean;
@@ -38,7 +40,7 @@ public class CreateCaseDialogBean extends PopupUIComponentBean
private static final long serialVersionUID = 1L;
private static final String BEAN_NAME = "createCaseDialogBean";
-
+ private final MessagesViewsCommonBean COMMON_MESSAGE_BEAN = MessagesViewsCommonBean.getInstance();
private String caseName;
private String note;
private String description;
@@ -79,6 +81,19 @@ public class CreateCaseDialogBean extends PopupUIComponentBean
@Override
public void openPopup()
{
+
+ List<Long> oids = CollectionUtils.newArrayList();
+ for (ProcessInstance pi : sourceProcessInstances)
+ {
+ oids.add(pi.getOID());
+ }
+ sourceProcessInstances = ProcessInstanceUtils.getProcessInstances(oids);
+ if (!ProcessInstanceUtils.isRootProcessInstances(sourceProcessInstances))
+ {
+ MessageDialog.addErrorMessage(COMMON_MESSAGE_BEAN.getString("views.attachToCase.selectOnlyProcess.message"));
+ return;
+ }
+
initialize();
super.openPopup();
}