- Added workflow history to completed task dialog (allows user to see what happened through completed workflows)

- Fixed errors emitted from completed WCM workflows
- Toned down the appearance of workflow selection in the submit dialog

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5774 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2007-05-24 13:47:29 +00:00
parent 156ff56ed9
commit 20efff09d1
8 changed files with 95 additions and 26 deletions

View File

@@ -575,10 +575,15 @@ public class SubmitDialog extends BaseDialogBean
WorkflowDefinition workflowDef = this.workflowService.getDefinitionByName(wrapper.name);
UIListItem item = new UIListItem();
item.setValue(workflowDef.getName());
item.setLabel(workflowDef.getTitle());
item.setDescription(workflowDef.getDescription());
item.setImage(WebResources.IMAGE_WORKFLOW_32);
String label = workflowDef.getTitle();
String desc = workflowDef.getDescription();
if (desc != null && desc.length() > 0)
{
label = label + "(" + desc + ")";
}
item.setLabel(label);
items.add(item);
// add first workflow as default selection
if (workflowSelectedValue == null)
{

View File

@@ -654,25 +654,28 @@ public class ManageTaskDialog extends BaseDialogBean
if (this.workflowPackage.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
{
final NodeRef stagingNodeRef = (NodeRef)
this.nodeService.getProperty(this.workflowPackage,
WCMModel.PROP_AVM_DIR_INDIRECTION);
final String stagingAvmPath = AVMNodeConverter.ToAVMVersionPath(stagingNodeRef).getSecond();
final String packageAvmPath = AVMNodeConverter.ToAVMVersionPath(this.workflowPackage).getSecond();
if (LOGGER.isDebugEnabled())
LOGGER.debug("comparing " + packageAvmPath + " with " + stagingAvmPath);
for (AVMDifference d : this.avmSyncService.compare(-1, packageAvmPath,
-1, stagingAvmPath,
null))
if (this.nodeService.exists(this.workflowPackage))
{
final NodeRef stagingNodeRef = (NodeRef)
this.nodeService.getProperty(this.workflowPackage,
WCMModel.PROP_AVM_DIR_INDIRECTION);
final String stagingAvmPath = AVMNodeConverter.ToAVMVersionPath(stagingNodeRef).getSecond();
final String packageAvmPath = AVMNodeConverter.ToAVMVersionPath(this.workflowPackage).getSecond();
if (LOGGER.isDebugEnabled())
LOGGER.debug("got difference " + d);
if (d.getDifferenceCode() == AVMDifference.NEWER ||
d.getDifferenceCode() == AVMDifference.CONFLICT)
LOGGER.debug("comparing " + packageAvmPath + " with " + stagingAvmPath);
for (AVMDifference d : this.avmSyncService.compare(-1, packageAvmPath,
-1, stagingAvmPath,
null))
{
this.addAVMNode(new AVMNode(this.avmService.lookup(d.getSourceVersion(),
d.getSourcePath(),
true)));
if (LOGGER.isDebugEnabled())
LOGGER.debug("got difference " + d);
if (d.getDifferenceCode() == AVMDifference.NEWER ||
d.getDifferenceCode() == AVMDifference.CONFLICT)
{
this.addAVMNode(new AVMNode(this.avmService.lookup(d.getSourceVersion(),
d.getSourcePath(),
true)));
}
}
}
}

View File

@@ -400,12 +400,14 @@ public class UISelectList extends UIInput implements NamingContainer
Utils.outputAttribute(out, getAttributes().get("itemStyleClass"), "class");
out.write("><div style='padding:2px'>");
out.write(item.getLabel());
out.write("</div><div style='padding:2px'>");
out.write("</div>");
if (description != null)
{
out.write("<div style='padding:2px'>");
out.write(description);
out.write("</div>");
}
out.write("</div></td>");
out.write("</td>");
if (activeSelect)
{

View File

@@ -55,6 +55,7 @@ import org.apache.commons.logging.LogFactory;
public class UIWorkflowHistory extends SelfRenderingComponent
{
protected WorkflowInstance value = null;
protected Boolean completedMode = null;
private static final Log logger = LogFactory.getLog(UIWorkflowHistory.class);
@@ -84,15 +85,17 @@ public class UIWorkflowHistory extends SelfRenderingComponent
// standard component attributes are restored by the super class
super.restoreState(context, values[0]);
this.value = (WorkflowInstance)values[1];
this.completedMode = (Boolean)values[2];
}
@Override
public Object saveState(FacesContext context)
{
Object values[] = new Object[8];
Object values[] = new Object[3];
// standard component attributes are saved by the super class
values[0] = super.saveState(context);
values[1] = this.value;
values[2] = this.completedMode;
return values;
}
@@ -113,6 +116,7 @@ public class UIWorkflowHistory extends SelfRenderingComponent
logger.debug("Retrieving workflow history for workflow instance: " + wi);
WorkflowTaskQuery query = new WorkflowTaskQuery();
query.setActive(!getCompletedMode());
query.setProcessId(wi.id);
query.setTaskState(WorkflowTaskState.COMPLETED);
query.setOrderBy(new WorkflowTaskQuery.OrderBy[] {
@@ -253,4 +257,34 @@ public class UIWorkflowHistory extends SelfRenderingComponent
{
this.value = value;
}
/**
* @return Returns whether the history is for a completed workflow instance
*/
public boolean getCompletedMode()
{
if (this.completedMode == null)
{
ValueBinding vb = getValueBinding("completedMode");
if (vb != null)
{
this.completedMode = (Boolean)vb.getValue(getFacesContext());
}
}
if (this.completedMode == null)
{
this.completedMode = Boolean.FALSE;
}
return this.completedMode;
}
/**
* @param completedMode Sets whether the history is for a completed workflow instance
*/
public void setCompletedMode(boolean completedMode)
{
this.completedMode = Boolean.valueOf(completedMode);
}
}

View File

@@ -35,6 +35,9 @@ import org.alfresco.web.ui.common.tag.HtmlComponentTag;
*/
public class WorkflowHistoryTag extends HtmlComponentTag
{
private String value;
private String completedMode;
/**
* @see javax.faces.webapp.UIComponentTag#getComponentType()
*/
@@ -59,6 +62,7 @@ public class WorkflowHistoryTag extends HtmlComponentTag
super.setProperties(component);
setStringProperty(component, "value", this.value);
setBooleanProperty(component, "completedMode", this.completedMode);
}
/**
@@ -68,6 +72,7 @@ public class WorkflowHistoryTag extends HtmlComponentTag
{
super.release();
this.value = null;
this.completedMode = null;
}
/**
@@ -80,6 +85,13 @@ public class WorkflowHistoryTag extends HtmlComponentTag
this.value = value;
}
/** the value (binding to the workflow instance) */
private String value;
/**
* Sets whether the component is showing history for a completed workflow
*
* @param completedMode
*/
public void setCompletedMode(String completedMode)
{
this.completedMode = completedMode;
}
}