Merged V1.4 to HEAD

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@3925 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@3965 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3966 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-09-29 07:45:33 +00:00
parent d4c5c3562a
commit cba5171884
23 changed files with 386 additions and 197 deletions

View File

@@ -5,6 +5,7 @@ import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.workflow.WorkflowInstance;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean;
@@ -18,7 +19,7 @@ import org.apache.commons.logging.LogFactory;
*/
public class CancelWorkflowDialog extends BaseDialogBean
{
protected String workflowInstanceId;
protected WorkflowInstance workflowInstance;
protected WorkflowService workflowService;
private static final Log logger = LogFactory.getLog(CancelWorkflowDialog.class);
@@ -32,11 +33,17 @@ public class CancelWorkflowDialog extends BaseDialogBean
super.init(parameters);
// make sure the workflow instance id has been passed
this.workflowInstanceId = this.parameters.get("workflow-instance-id");
if (this.workflowInstanceId == null || this.workflowInstanceId.length() == 0)
String workflowInstanceId = this.parameters.get("workflow-instance-id");
if (workflowInstanceId == null || workflowInstanceId.length() == 0)
{
throw new IllegalArgumentException("Cancel workflow dialog called without workflow instance id");
}
this.workflowInstance = workflowService.getWorkflowById(workflowInstanceId);
if (this.workflowInstance == null)
{
throw new IllegalArgumentException("Failed to find workflow instance for id: " + workflowInstanceId);
}
}
@Override
@@ -44,13 +51,13 @@ public class CancelWorkflowDialog extends BaseDialogBean
throws Exception
{
if (logger.isDebugEnabled())
logger.debug("Cancelling workflow with id: " + this.workflowInstanceId);
logger.debug("Cancelling workflow with id: " + this.workflowInstance.id);
// cancel the workflow
this.workflowService.cancelWorkflow(this.workflowInstanceId);
this.workflowService.cancelWorkflow(this.workflowInstance.id);
if (logger.isDebugEnabled())
logger.debug("Cancelled workflow with id: " + this.workflowInstanceId);
logger.debug("Cancelled workflow with id: " + this.workflowInstance.id);
return outcome;
}
@@ -67,9 +74,21 @@ public class CancelWorkflowDialog extends BaseDialogBean
return false;
}
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "no");
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "yes");
}
// ------------------------------------------------------------------------------
// Bean Getters and Setters
/**
* Returns the confirmation to display to the user before deleting the content.
*
@@ -80,8 +99,13 @@ public class CancelWorkflowDialog extends BaseDialogBean
String confirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
"cancel_workflow_confirm");
return MessageFormat.format(confirmMsg,
new Object[] {this.parameters.get("workflow-instance-name")});
String workflowLabel = this.workflowInstance.definition.title;
if (this.workflowInstance.description != null && this.workflowInstance.description.length() > 0)
{
workflowLabel = workflowLabel + " (" + this.workflowInstance.description + ")";
}
return MessageFormat.format(confirmMsg, new Object[] {workflowLabel});
}
/**

View File

@@ -15,10 +15,6 @@ import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.namespace.NamespaceService;

View File

@@ -233,9 +233,31 @@ public class StartWorkflowWizard extends BaseWizardBean
return this.nextButtonDisabled;
}
@Override
public String getContainerTitle()
{
String wizTitle = null;
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
String stepName = Application.getWizardManager().getCurrentStepName();
if ("choose-workflow".equals(stepName) == false && this.selectedWorkflow != null)
{
String titlePattern = bundle.getString("start_named_workflow_wizard");
WorkflowDefinition workflowDef = this.workflows.get(this.selectedWorkflow);
wizTitle = MessageFormat.format(titlePattern, new Object[] {workflowDef.title});
}
else
{
wizTitle = bundle.getString("start_workflow_wizard");
}
return wizTitle;
}
// ------------------------------------------------------------------------------
// Event Handlers
/**
* Prepares the dialog to allow the user to add an item to the workflow package
*

View File

@@ -260,7 +260,6 @@ public class WorkflowBean
// add the workflow instance id and name this taks belongs to
node.getProperties().put("workflowInstanceId", task.path.instance.id);
node.getProperties().put("workflowInstanceName", task.path.instance.definition.title);
}
return node;