- pre-cursor to ALF-8832

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28371 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2011-06-13 16:05:41 +00:00
parent 33e06bb4f5
commit d9e98c1b16

View File

@@ -83,7 +83,7 @@ public class WorkflowObjectFactory
public boolean isGlobalId(String globalId) public boolean isGlobalId(String globalId)
{ {
return BPMEngineRegistry.isGlobalId(globalId, globalId); return BPMEngineRegistry.isGlobalId(globalId, engineId);
} }
/** /**
@@ -109,22 +109,20 @@ public class WorkflowObjectFactory
* @return * @return
*/ */
public WorkflowDefinition createDefinition(String defId, public WorkflowDefinition createDefinition(String defId,
String defName,int version, String defName, int version,
String defaultTitle, String defaultDescription, String defaultTitle, String defaultDescription,
WorkflowTaskDefinition startTaskDef) WorkflowTaskDefinition startTaskDef)
{ {
checkDomain(defName); checkDomain(defName);
String actualId = buildGlobalId(defId); String actualId = buildGlobalId(defId);
String actualName = getWorkflowDefinitionName(defName);
String actualVersion = Integer.toString(version); String actualVersion = Integer.toString(version);
String baseName= tenantService.getBaseName(defName); String displayId = getProcessKey(defName) + ".workflow";
String displayId = baseName + ".workflow";
String title = getLabel(displayId, TITLE_LABEL, defaultTitle); String title = getLabel(displayId, TITLE_LABEL, defaultTitle);
String description = getLabel(displayId, DESC_LABEL, defaultDescription, title); String description = getLabel(displayId, DESC_LABEL, defaultDescription, title);
return new WorkflowDefinition( return new WorkflowDefinition(
actualId, actualName, actualVersion, title, description, startTaskDef); actualId, buildGlobalId(defName), actualVersion, title, description, startTaskDef);
} }
public String getWorkflowDefinitionName(String defName) public String getWorkflowDefinitionName(String defName)
@@ -138,8 +136,8 @@ public class WorkflowObjectFactory
WorkflowDefinition definition, Map<String, Object> variables, WorkflowDefinition definition, Map<String, Object> variables,
boolean isActive, Date startDate, Date endDate) boolean isActive, Date startDate, Date endDate)
{ {
checkDomain(definition.getName());
String actualId = buildGlobalId(id); String actualId = buildGlobalId(id);
checkDomain(getLocalEngineId(definition.getName()));
String description = (String) getVariable(variables, WorkflowModel.PROP_WORKFLOW_DESCRIPTION); String description = (String) getVariable(variables, WorkflowModel.PROP_WORKFLOW_DESCRIPTION);
@@ -207,11 +205,10 @@ public class WorkflowObjectFactory
Map<QName, Serializable> properties) Map<QName, Serializable> properties)
{ {
String defName = path.getInstance().getDefinition().getName(); String defName = path.getInstance().getDefinition().getName();
String processKey = getLocalEngineId(defName); checkDomain(defName);
checkDomain(processKey);
String actualId = buildGlobalId(id); String actualId = buildGlobalId(id);
String displayId = processKey + ".task." + name;
String displayId = getProcessKey(defName) + ".task." + name;
TypeDefinition metadata = taskDef.getMetadata(); TypeDefinition metadata = taskDef.getMetadata();
String title = getLabel(displayId, TITLE_LABEL, defaultTitle, metadata.getTitle(), name); String title = getLabel(displayId, TITLE_LABEL, defaultTitle, metadata.getTitle(), name);
String description = getLabel(displayId, DESC_LABEL, defaultDescription, metadata.getDescription(), title); String description = getLabel(displayId, DESC_LABEL, defaultDescription, metadata.getDescription(), title);
@@ -227,25 +224,25 @@ public class WorkflowObjectFactory
return new WorkflowTimer(actualId, name, workflowPath, workflowTask, dueDate, error); return new WorkflowTimer(actualId, name, workflowPath, workflowTask, dueDate, error);
} }
public String getTaskTitle(TypeDefinition typeDefinition, String defName, String defaultTitle, String name) private String getProcessKey(String defName)
{ {
String processKey = defName; String processKey = defName;
if(isGlobalId(defName)) if (isGlobalId(defName))
{ {
processKey = getLocalEngineId(defName); processKey = getLocalEngineId(defName);
} }
String displayId = processKey + ".task." + name; return tenantService.getBaseName(processKey);
}
public String getTaskTitle(TypeDefinition typeDefinition, String defName, String defaultTitle, String name)
{
String displayId = getProcessKey(defName) + ".task." + name;
return getLabel(displayId, TITLE_LABEL, defaultTitle, typeDefinition.getTitle(), name); return getLabel(displayId, TITLE_LABEL, defaultTitle, typeDefinition.getTitle(), name);
} }
public String getTaskDescription(TypeDefinition typeDefinition, String defName, String defaultDescription, String title) public String getTaskDescription(TypeDefinition typeDefinition, String defName, String defaultDescription, String title)
{ {
String processKey = defName; String displayId = getProcessKey(defName) + ".task." + title;
if(isGlobalId(defName))
{
processKey = getLocalEngineId(defName);
}
String displayId = processKey + ".task." + title;
return getLabel(displayId, DESC_LABEL, defaultDescription, typeDefinition.getTitle(), title); return getLabel(displayId, DESC_LABEL, defaultDescription, typeDefinition.getTitle(), title);
} }
@@ -305,14 +302,18 @@ public class WorkflowObjectFactory
/** /**
* Throws exception if domain mismatch * Throws exception if domain mismatch
* @param definitionKey * @param defName
*/ */
private void checkDomain(String definitionKey) private void checkDomain(String defName)
{ {
if (tenantService.isEnabled()) if (tenantService.isEnabled())
{ {
String processKey = defName;
tenantService.checkDomain(definitionKey); if (isGlobalId(defName))
{
processKey = getLocalEngineId(defName);
}
tenantService.checkDomain(processKey);
} }
} }