- 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); WorkflowDefinition workflowDef = this.workflowService.getDefinitionByName(wrapper.name);
UIListItem item = new UIListItem(); UIListItem item = new UIListItem();
item.setValue(workflowDef.getName()); item.setValue(workflowDef.getName());
item.setLabel(workflowDef.getTitle()); String label = workflowDef.getTitle();
item.setDescription(workflowDef.getDescription()); String desc = workflowDef.getDescription();
item.setImage(WebResources.IMAGE_WORKFLOW_32); if (desc != null && desc.length() > 0)
{
label = label + "(" + desc + ")";
}
item.setLabel(label);
items.add(item); items.add(item);
// add first workflow as default selection // add first workflow as default selection
if (workflowSelectedValue == null) if (workflowSelectedValue == null)
{ {

View File

@@ -654,25 +654,28 @@ public class ManageTaskDialog extends BaseDialogBean
if (this.workflowPackage.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM)) if (this.workflowPackage.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
{ {
final NodeRef stagingNodeRef = (NodeRef) if (this.nodeService.exists(this.workflowPackage))
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))
{ {
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()) if (LOGGER.isDebugEnabled())
LOGGER.debug("got difference " + d); LOGGER.debug("comparing " + packageAvmPath + " with " + stagingAvmPath);
if (d.getDifferenceCode() == AVMDifference.NEWER || for (AVMDifference d : this.avmSyncService.compare(-1, packageAvmPath,
d.getDifferenceCode() == AVMDifference.CONFLICT) -1, stagingAvmPath,
null))
{ {
this.addAVMNode(new AVMNode(this.avmService.lookup(d.getSourceVersion(), if (LOGGER.isDebugEnabled())
d.getSourcePath(), LOGGER.debug("got difference " + d);
true))); 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"); Utils.outputAttribute(out, getAttributes().get("itemStyleClass"), "class");
out.write("><div style='padding:2px'>"); out.write("><div style='padding:2px'>");
out.write(item.getLabel()); out.write(item.getLabel());
out.write("</div><div style='padding:2px'>"); out.write("</div>");
if (description != null) if (description != null)
{ {
out.write("<div style='padding:2px'>");
out.write(description); out.write(description);
out.write("</div>");
} }
out.write("</div></td>"); out.write("</td>");
if (activeSelect) if (activeSelect)
{ {

View File

@@ -55,6 +55,7 @@ import org.apache.commons.logging.LogFactory;
public class UIWorkflowHistory extends SelfRenderingComponent public class UIWorkflowHistory extends SelfRenderingComponent
{ {
protected WorkflowInstance value = null; protected WorkflowInstance value = null;
protected Boolean completedMode = null;
private static final Log logger = LogFactory.getLog(UIWorkflowHistory.class); 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 // standard component attributes are restored by the super class
super.restoreState(context, values[0]); super.restoreState(context, values[0]);
this.value = (WorkflowInstance)values[1]; this.value = (WorkflowInstance)values[1];
this.completedMode = (Boolean)values[2];
} }
@Override @Override
public Object saveState(FacesContext context) public Object saveState(FacesContext context)
{ {
Object values[] = new Object[8]; Object values[] = new Object[3];
// standard component attributes are saved by the super class // standard component attributes are saved by the super class
values[0] = super.saveState(context); values[0] = super.saveState(context);
values[1] = this.value; values[1] = this.value;
values[2] = this.completedMode;
return values; return values;
} }
@@ -113,6 +116,7 @@ public class UIWorkflowHistory extends SelfRenderingComponent
logger.debug("Retrieving workflow history for workflow instance: " + wi); logger.debug("Retrieving workflow history for workflow instance: " + wi);
WorkflowTaskQuery query = new WorkflowTaskQuery(); WorkflowTaskQuery query = new WorkflowTaskQuery();
query.setActive(!getCompletedMode());
query.setProcessId(wi.id); query.setProcessId(wi.id);
query.setTaskState(WorkflowTaskState.COMPLETED); query.setTaskState(WorkflowTaskState.COMPLETED);
query.setOrderBy(new WorkflowTaskQuery.OrderBy[] { query.setOrderBy(new WorkflowTaskQuery.OrderBy[] {
@@ -253,4 +257,34 @@ public class UIWorkflowHistory extends SelfRenderingComponent
{ {
this.value = value; 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 public class WorkflowHistoryTag extends HtmlComponentTag
{ {
private String value;
private String completedMode;
/** /**
* @see javax.faces.webapp.UIComponentTag#getComponentType() * @see javax.faces.webapp.UIComponentTag#getComponentType()
*/ */
@@ -59,6 +62,7 @@ public class WorkflowHistoryTag extends HtmlComponentTag
super.setProperties(component); super.setProperties(component);
setStringProperty(component, "value", this.value); setStringProperty(component, "value", this.value);
setBooleanProperty(component, "completedMode", this.completedMode);
} }
/** /**
@@ -68,6 +72,7 @@ public class WorkflowHistoryTag extends HtmlComponentTag
{ {
super.release(); super.release();
this.value = null; this.value = null;
this.completedMode = null;
} }
/** /**
@@ -80,6 +85,13 @@ public class WorkflowHistoryTag extends HtmlComponentTag
this.value = value; 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;
}
} }

View File

@@ -1957,6 +1957,12 @@
<required>false</required> <required>false</required>
<rtexprvalue>true</rtexprvalue> <rtexprvalue>true</rtexprvalue>
</attribute> </attribute>
<attribute>
<name>completedMode</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag> </tag>
<tag> <tag>

View File

@@ -88,7 +88,7 @@
<h:panelGroup rendered="#{DialogManager.bean.workflowListSize != 0}"> <h:panelGroup rendered="#{DialogManager.bean.workflowListSize != 0}">
<h:outputText value="#{msg.submit_workflow_selection}" /> <h:outputText value="#{msg.submit_workflow_selection}" />
<h:panelGrid columns="2" cellpadding="2" cellpadding="2"> <h:panelGrid columns="2" cellpadding="2" cellpadding="2">
<a:selectList id="workflow-list" multiSelect="false" styleClass="selectListTable" itemStyleClass="selectListItem" <a:selectList id="workflow-list" multiSelect="false" styleClass="noBrColumn" itemStyle="padding-top: 3px;"
value="#{DialogManager.bean.workflowSelectedValue}"> value="#{DialogManager.bean.workflowSelectedValue}">
<a:listItems value="#{DialogManager.bean.workflowList}" /> <a:listItems value="#{DialogManager.bean.workflowList}" />
</a:selectList> </a:selectList>
@@ -106,7 +106,7 @@
</h:panelGroup> </h:panelGroup>
</h:panelGrid> </h:panelGrid>
<h:panelGrid columns="1" cellpadding="2" style="padding-top:10px;padding-bottom:4px;" <h:panelGrid columns="1" cellpadding="2" style="padding-top:6px;padding-bottom:4px;"
width="100%" rowClasses="wizardSectionHeading"> width="100%" rowClasses="wizardSectionHeading">
<h:outputText value="&nbsp;#{msg.content_launch}" escape="false" /> <h:outputText value="&nbsp;#{msg.content_launch}" escape="false" />
</h:panelGrid> </h:panelGrid>

View File

@@ -107,4 +107,11 @@
<r:workflowSummary id="workflow-summary" value="#{DialogManager.bean.workflowInstance}" styleClass="workflowSummary" /> <r:workflowSummary id="workflow-summary" value="#{DialogManager.bean.workflowInstance}" styleClass="workflowSummary" />
<f:verbatim><div style="padding-left:9px;padding-top:8px;padding-bottom:4px"></f:verbatim>
<a:panel id="pending-submission-panel" label="#{msg.workflow_history}" progressive="true"
expanded="false" styleClass="mainSubTitle">
<r:workflowHistory id="workflow-history" value="#{DialogManager.bean.workflowInstance}"
styleClass="workflowHistoryList" completedMode="true" />
</a:panel>
<f:verbatim></div></f:verbatim>
</a:panel> </a:panel>