mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. List of available workflows for WCM wizards now come from configured list
- added new wcm specific client config file: web-client-config-wcm.xml - only the workflows as defined in the WCM client config file are now shown in the various wizards - the upside is that workflows not compatible with AVM objects are no longer shown - the downside is that when new workflows are deployed in the system they must be added to the config file git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4725 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
<value>classpath:alfresco/web-client-config-wizards.xml</value>
|
<value>classpath:alfresco/web-client-config-wizards.xml</value>
|
||||||
<value>classpath:alfresco/web-client-config-properties.xml</value>
|
<value>classpath:alfresco/web-client-config-properties.xml</value>
|
||||||
<value>classpath:alfresco/web-client-config-navigation.xml</value>
|
<value>classpath:alfresco/web-client-config-navigation.xml</value>
|
||||||
|
<value>classpath:alfresco/web-client-config-wcm.xml</value>
|
||||||
<value>classpath:alfresco/web-client-config-actions.xml</value>
|
<value>classpath:alfresco/web-client-config-actions.xml</value>
|
||||||
<value>classpath:alfresco/web-client-config-forum-actions.xml</value>
|
<value>classpath:alfresco/web-client-config-forum-actions.xml</value>
|
||||||
<value>classpath:alfresco/web-client-config-wcm-actions.xml</value>
|
<value>classpath:alfresco/web-client-config-wcm-actions.xml</value>
|
||||||
|
15
config/alfresco/web-client-config-wcm.xml
Normal file
15
config/alfresco/web-client-config-wcm.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<alfresco-config>
|
||||||
|
|
||||||
|
<config>
|
||||||
|
|
||||||
|
<wcm>
|
||||||
|
<!-- Comma separated list of the workflows to display in the Create Web Form and
|
||||||
|
Create Web Project wizards. The Name identifers of the workflows should be specified. -->
|
||||||
|
<workflows>
|
||||||
|
wcmwf:submit
|
||||||
|
</workflows>
|
||||||
|
</wcm>
|
||||||
|
|
||||||
|
</config>
|
||||||
|
|
||||||
|
</alfresco-config>
|
@@ -23,10 +23,13 @@ import java.io.ObjectInputStream;
|
|||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
|
import org.alfresco.config.ConfigElement;
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.WCMAppModel;
|
import org.alfresco.model.WCMAppModel;
|
||||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
@@ -42,12 +45,16 @@ import org.alfresco.service.cmr.repository.ContentService;
|
|||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowPath;
|
import org.alfresco.service.cmr.workflow.WorkflowPath;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.bean.repository.Repository;
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
import org.alfresco.web.bean.workflow.WorkflowUtil;
|
import org.alfresco.web.bean.workflow.WorkflowUtil;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AVM Specific workflow related helper methods.
|
* AVM Specific workflow related helper methods.
|
||||||
@@ -57,11 +64,16 @@ import org.alfresco.web.bean.workflow.WorkflowUtil;
|
|||||||
*/
|
*/
|
||||||
public class AVMWorkflowUtil extends WorkflowUtil
|
public class AVMWorkflowUtil extends WorkflowUtil
|
||||||
{
|
{
|
||||||
|
private static final Log logger = LogFactory.getLog(AVMWorkflowUtil.class);
|
||||||
|
|
||||||
// Common workflow definitions
|
// Common workflow definitions
|
||||||
private static final String WCM_WORKFLOW_MODEL_1_0_URI = "http://www.alfresco.org/model/wcmworkflow/1.0";
|
private static final String WCM_WORKFLOW_MODEL_1_0_URI = "http://www.alfresco.org/model/wcmworkflow/1.0";
|
||||||
public static final QName PROP_FROM_PATH = QName.createQName(WCM_WORKFLOW_MODEL_1_0_URI, "fromPath");
|
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_LABEL = QName.createQName(WCM_WORKFLOW_MODEL_1_0_URI, "label");
|
||||||
|
|
||||||
|
// cached configured lists
|
||||||
|
private static List<WorkflowDefinition> configuredWorkflowDefs = null;
|
||||||
|
|
||||||
public static NodeRef createWorkflowPackage(final List<String> srcPaths,
|
public static NodeRef createWorkflowPackage(final List<String> srcPaths,
|
||||||
final String storeId,
|
final String storeId,
|
||||||
final WorkflowPath path,
|
final WorkflowPath path,
|
||||||
@@ -156,4 +168,50 @@ public class AVMWorkflowUtil extends WorkflowUtil
|
|||||||
throw new AlfrescoRuntimeException("Unable to deserialize workflow default parameters: " + classErr.getMessage());
|
throw new AlfrescoRuntimeException("Unable to deserialize workflow default parameters: " + classErr.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the list of WorkflowDefinition objects as configured in the wcm/workflows client config.
|
||||||
|
*/
|
||||||
|
public static List<WorkflowDefinition> getConfiguredWorkflows()
|
||||||
|
{
|
||||||
|
if (configuredWorkflowDefs == null)
|
||||||
|
{
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
List<WorkflowDefinition> defs = Collections.<WorkflowDefinition>emptyList();
|
||||||
|
ConfigElement config = Application.getConfigService(fc).getGlobalConfig().getConfigElement("wcm");
|
||||||
|
if (config != null)
|
||||||
|
{
|
||||||
|
ConfigElement workflowConfig = config.getChild("workflows");
|
||||||
|
if (workflowConfig != null)
|
||||||
|
{
|
||||||
|
WorkflowService service = Repository.getServiceRegistry(fc).getWorkflowService();
|
||||||
|
StringTokenizer t = new StringTokenizer(workflowConfig.getValue().trim(), ", ");
|
||||||
|
defs = new ArrayList<WorkflowDefinition>(t.countTokens());
|
||||||
|
while (t.hasMoreTokens())
|
||||||
|
{
|
||||||
|
String wfName = t.nextToken();
|
||||||
|
WorkflowDefinition def = service.getDefinitionByName("jbpm$" + wfName);
|
||||||
|
if (def != null)
|
||||||
|
{
|
||||||
|
defs.add(def);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.warn("WARNING: Cannot find WCM workflow def for configured definition name: " + wfName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.warn("WARNING: Unable to find WCM 'workflows' config element definition.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.warn("WARNING: Unable to find 'wcm' config element definition.");
|
||||||
|
}
|
||||||
|
configuredWorkflowDefs = defs;
|
||||||
|
}
|
||||||
|
return configuredWorkflowDefs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,19 +19,26 @@ package org.alfresco.web.bean.wcm;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
import javax.faces.event.ActionEvent;
|
import javax.faces.event.ActionEvent;
|
||||||
import javax.faces.event.ValueChangeEvent;
|
import javax.faces.event.ValueChangeEvent;
|
||||||
import javax.faces.model.DataModel;
|
import javax.faces.model.DataModel;
|
||||||
import javax.faces.model.ListDataModel;
|
import javax.faces.model.ListDataModel;
|
||||||
import javax.faces.model.SelectItem;
|
import javax.faces.model.SelectItem;
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.model.WCMAppModel;
|
import org.alfresco.model.WCMAppModel;
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.alfresco.service.cmr.model.FileInfo;
|
|
||||||
import org.alfresco.service.cmr.model.FileExistsException;
|
import org.alfresco.service.cmr.model.FileExistsException;
|
||||||
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
import org.alfresco.service.cmr.repository.ContentService;
|
import org.alfresco.service.cmr.repository.ContentService;
|
||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||||
@@ -44,15 +51,22 @@ import org.alfresco.web.bean.FileUploadBean;
|
|||||||
import org.alfresco.web.bean.wizard.BaseWizardBean;
|
import org.alfresco.web.bean.wizard.BaseWizardBean;
|
||||||
import org.alfresco.web.data.IDataContainer;
|
import org.alfresco.web.data.IDataContainer;
|
||||||
import org.alfresco.web.data.QuickSort;
|
import org.alfresco.web.data.QuickSort;
|
||||||
import org.alfresco.web.forms.*;
|
import org.alfresco.web.forms.FormsService;
|
||||||
|
import org.alfresco.web.forms.RenderingEngine;
|
||||||
|
import org.alfresco.web.forms.RenderingEngineTemplate;
|
||||||
|
import org.alfresco.web.forms.RenderingEngineTemplateImpl;
|
||||||
|
import org.alfresco.web.forms.XMLUtil;
|
||||||
import org.alfresco.web.forms.xforms.SchemaUtil;
|
import org.alfresco.web.forms.xforms.SchemaUtil;
|
||||||
import org.alfresco.web.ui.common.component.UIListItem;
|
|
||||||
import org.alfresco.web.ui.common.Utils;
|
import org.alfresco.web.ui.common.Utils;
|
||||||
|
import org.alfresco.web.ui.common.component.UIListItem;
|
||||||
import org.alfresco.web.ui.wcm.WebResources;
|
import org.alfresco.web.ui.wcm.WebResources;
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.xerces.xs.*;
|
import org.apache.xerces.xs.XSConstants;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.xerces.xs.XSElementDeclaration;
|
||||||
|
import org.apache.xerces.xs.XSModel;
|
||||||
|
import org.apache.xerces.xs.XSNamedMap;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -989,9 +1003,8 @@ public class CreateFormWizard
|
|||||||
{
|
{
|
||||||
if (this.defaultWorkflowChoices == null)
|
if (this.defaultWorkflowChoices == null)
|
||||||
{
|
{
|
||||||
// TODO: add list of workflows from config
|
// get list of workflows from config definitions
|
||||||
// @see org.alfresco.web.wcm.FormDetailsDialog#getWorkflowList()
|
final List<WorkflowDefinition> workflowDefs = AVMWorkflowUtil.getConfiguredWorkflows();
|
||||||
final List<WorkflowDefinition> workflowDefs = this.workflowService.getDefinitions();
|
|
||||||
this.defaultWorkflowChoices = new ArrayList<UIListItem>(workflowDefs.size() + 1);
|
this.defaultWorkflowChoices = new ArrayList<UIListItem>(workflowDefs.size() + 1);
|
||||||
|
|
||||||
for (WorkflowDefinition workflowDef : workflowDefs)
|
for (WorkflowDefinition workflowDef : workflowDefs)
|
||||||
|
@@ -643,9 +643,8 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
|||||||
*/
|
*/
|
||||||
public List<UIListItem> getWorkflowList()
|
public List<UIListItem> getWorkflowList()
|
||||||
{
|
{
|
||||||
// TODO: add list of workflows from config
|
// get list of workflows from config definitions
|
||||||
// @see org.alfresco.web.wcm.FormDetailsDialog#getWorkflowList()
|
List<WorkflowDefinition> workflowDefs = AVMWorkflowUtil.getConfiguredWorkflows();
|
||||||
List<WorkflowDefinition> workflowDefs = this.workflowService.getDefinitions();
|
|
||||||
List<UIListItem> items = new ArrayList<UIListItem>(workflowDefs.size());
|
List<UIListItem> items = new ArrayList<UIListItem>(workflowDefs.size());
|
||||||
for (WorkflowDefinition workflowDef : workflowDefs)
|
for (WorkflowDefinition workflowDef : workflowDefs)
|
||||||
{
|
{
|
||||||
|
@@ -188,9 +188,8 @@ public class FormDetailsDialog extends BaseDialogBean
|
|||||||
*/
|
*/
|
||||||
public List<UIListItem> getWorkflowList()
|
public List<UIListItem> getWorkflowList()
|
||||||
{
|
{
|
||||||
// TODO: add list of workflows from config
|
// get list of workflows from config definitions
|
||||||
// @see org.alfresco.web.wcm.CreateWebsiteWizard#getWorkflowList()
|
List<WorkflowDefinition> workflowDefs = AVMWorkflowUtil.getConfiguredWorkflows();
|
||||||
List<WorkflowDefinition> workflowDefs = this.workflowService.getDefinitions();
|
|
||||||
List<UIListItem> items = new ArrayList<UIListItem>(workflowDefs.size());
|
List<UIListItem> items = new ArrayList<UIListItem>(workflowDefs.size());
|
||||||
for (WorkflowDefinition workflowDef : workflowDefs)
|
for (WorkflowDefinition workflowDef : workflowDefs)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user