First cut of pending submission UI

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5735 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2007-05-21 15:15:48 +00:00
parent 4eb57cdf86
commit 6419aef81e
12 changed files with 679 additions and 2 deletions

View File

@@ -1106,6 +1106,70 @@ public class AVMBrowseBean implements IContextListener
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "wizard:createWebContent");
}
/**
* Event handler that transitions a 'submitpending' task to effectively
* bypass the lauch date and immediately submit the items.
*
* @param event The event
*/
public void promotePendingSubmission(ActionEvent event)
{
UIActionLink link = (UIActionLink)event.getComponent();
Map<String, String> params = link.getParameterMap();
String taskId = params.get("taskId");
UserTransaction tx = null;
try
{
FacesContext context = FacesContext.getCurrentInstance();
tx = Repository.getUserTransaction(context, false);
tx.begin();
// transition the task
this.workflowService.endTask(taskId, "launch");
// commit the transaction
tx.commit();
}
catch (Throwable err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
}
/**
* Event handler that cancels a pending submission.
*
* @param event The event
*/
public void cancelPendingSubmission(ActionEvent event)
{
UIActionLink link = (UIActionLink)event.getComponent();
Map<String, String> params = link.getParameterMap();
String workflowId = params.get("workflowInstanceId");
UserTransaction tx = null;
try
{
FacesContext context = FacesContext.getCurrentInstance();
tx = Repository.getUserTransaction(context, false);
tx.begin();
// cancel the workflow
this.workflowService.cancelWorkflow(workflowId);
// commit the transaction
tx.commit();
}
catch (Throwable err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
}
// ------------------------------------------------------------------------------
// Private helpers

View File

@@ -83,6 +83,7 @@ public class AVMWorkflowUtil extends WorkflowUtil
public static final QName PROP_FROM_PATH = QName.createQName(WCM_WORKFLOW_MODEL_1_0_URI, "fromPath");
public static final QName PROP_LABEL = QName.createQName(WCM_WORKFLOW_MODEL_1_0_URI, "label");
public static final QName PROP_LAUNCH_DATE = QName.createQName(WCM_WORKFLOW_MODEL_1_0_URI, "launchDate");
public static final QName ASSOC_WEBPROJECT = QName.createQName(WCM_WORKFLOW_MODEL_1_0_URI, "webproject");
// cached configured lists
private static List<WorkflowDefinition> configuredWorkflowDefs = null;

View File

@@ -326,9 +326,12 @@ public class SubmitDialog extends BaseDialogBean
// add submission parameters
params.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, getComment());
params.put(AVMWorkflowUtil.PROP_LABEL, getLabel());
params.put(AVMWorkflowUtil.PROP_FROM_PATH, AVMUtil.buildStoreRootPath(this.avmBrowseBean.getSandbox()));
params.put(AVMWorkflowUtil.PROP_FROM_PATH,
AVMUtil.buildStoreRootPath(this.avmBrowseBean.getSandbox()));
params.put(AVMWorkflowUtil.PROP_LAUNCH_DATE, this.launchDate);
params.put(AVMWorkflowUtil.ASSOC_WEBPROJECT,
this.avmBrowseBean.getWebsite().getNodeRef());
// update start task with submit parameters
this.workflowService.updateTask(startTask.id, params, null, null);