summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntje Fuhrmann2013-02-21 05:55:31 (EST)
committer Sven Rottstock2013-03-11 04:54:51 (EDT)
commitc66d713305c73222fc5a7453edd62faf2308fdbd (patch)
treeb51ca036216731a0b6f8787ffc2607b645abc35e
parented5d35fbc9523f680ab33e0387f0a4bc69a8d6ce (diff)
downloadorg.eclipse.stardust.engine-c66d713305c73222fc5a7453edd62faf2308fdbd.zip
org.eclipse.stardust.engine-c66d713305c73222fc5a7453edd62faf2308fdbd.tar.gz
org.eclipse.stardust.engine-c66d713305c73222fc5a7453edd62faf2308fdbd.tar.bz2
Jira-ID: CRNT-28057
Console does not support Department operations in multi model environments. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/engine@63151 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/cli/console/ModifyDepartmentCommand.java39
1 files changed, 31 insertions, 8 deletions
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/cli/console/ModifyDepartmentCommand.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/cli/console/ModifyDepartmentCommand.java
index cd120a7..7c6f245 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/cli/console/ModifyDepartmentCommand.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/cli/console/ModifyDepartmentCommand.java
@@ -13,14 +13,19 @@ package org.eclipse.stardust.engine.cli.console;
import java.util.List;
import java.util.Map;
+import javax.xml.namespace.QName;
+
import org.eclipse.stardust.common.error.PublicException;
import org.eclipse.stardust.common.utils.console.Options;
+import org.eclipse.stardust.engine.api.dto.DeployedModelDescriptionDetails;
import org.eclipse.stardust.engine.api.ejb2.ServiceFactoryLocator;
+import org.eclipse.stardust.engine.api.model.Model;
import org.eclipse.stardust.engine.api.model.Organization;
import org.eclipse.stardust.engine.api.model.Participant;
-import org.eclipse.stardust.engine.api.runtime.DeployedModel;
+import org.eclipse.stardust.engine.api.query.DeployedModelQuery;
+import org.eclipse.stardust.engine.api.runtime.Models;
+import org.eclipse.stardust.engine.api.runtime.QueryService;
import org.eclipse.stardust.engine.api.runtime.ServiceFactory;
-import org.eclipse.stardust.engine.api.runtime.WorkflowService;
import org.eclipse.stardust.engine.cli.common.DepartmentClientUtils;
@@ -95,16 +100,34 @@ public abstract class ModifyDepartmentCommand extends DepartmentCommand
ServiceFactory serviceFactory = ServiceFactoryLocator.get(config.getUserName(),
config.getPassWord());
- WorkflowService workflowService = serviceFactory.getWorkflowService();
+ QueryService queryService = serviceFactory.getQueryService();
- DeployedModel model = workflowService.getModel();
- Participant participant = model.getParticipant(participantId);
+ String namespace = null;
+ if (participantId.startsWith("{"))
+ {
+ QName qname = QName.valueOf(participantId);
+ namespace = qname.getNamespaceURI();
+ participantId = qname.getLocalPart();
+ }
+ Model model = null;
+ DeployedModelQuery query = namespace != null ? DeployedModelQuery
+ .findActiveForId(namespace) : DeployedModelQuery.findActive();
+ Models models = queryService.getModels(query);
+ if (!models.isEmpty())
+ {
+ DeployedModelDescriptionDetails details = (DeployedModelDescriptionDetails) models
+ .get(0);
+ model = queryService.getModel(details.getModelOID());
+ }
+
+ Participant participant = model != null
+ ? model.getParticipant(participantId)
+ : null;
if (participant == null)
{
- throw new PublicException("Organisation: " + participantId + " no found");
+ throw new PublicException("Organisation: '" + participantId + "' not found.");
}
-
-
+
DepartmentClientUtils dh = DepartmentClientUtils.getInstance(globalOptions);
List<Organization> organizationHierarchy = dh.getOrganizationHierarchy(participant,
true);