mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-16 17:55:15 +00:00
ScriptNode activeWorkflows getter. Workflow JS API constructors made public.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10386 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
18db34ffdb
commit
ffda0d4f49
@ -48,6 +48,7 @@ import org.alfresco.repo.thumbnail.ThumbnailDetails;
|
||||
import org.alfresco.repo.thumbnail.ThumbnailRegistry;
|
||||
import org.alfresco.repo.thumbnail.script.ScriptThumbnail;
|
||||
import org.alfresco.repo.version.VersionModel;
|
||||
import org.alfresco.repo.workflow.jscript.JscriptWorkflowInstance;
|
||||
import org.alfresco.scripts.ScriptException;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
@ -74,6 +75,8 @@ import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.version.Version;
|
||||
import org.alfresco.service.cmr.version.VersionHistory;
|
||||
import org.alfresco.service.cmr.version.VersionType;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowInstance;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
@ -133,7 +136,7 @@ public class ScriptNode implements Serializable, Scopeable
|
||||
/** The target associations from this node */
|
||||
private ScriptableQNameMap<String, Object> targetAssocs = null;
|
||||
|
||||
/** The source assoications to this node */
|
||||
/** The source associations to this node */
|
||||
private ScriptableQNameMap<String, Object> sourceAssocs = null;
|
||||
|
||||
/** The child associations for this node */
|
||||
@ -147,6 +150,9 @@ public class ScriptNode implements Serializable, Scopeable
|
||||
|
||||
/** The versions of this node */
|
||||
private Scriptable versions = null;
|
||||
|
||||
/** The active workflows acting on this node */
|
||||
private Scriptable activeWorkflows = null;
|
||||
|
||||
protected ServiceRegistry services = null;
|
||||
private NodeService nodeService = null;
|
||||
@ -2269,6 +2275,35 @@ public class ScriptNode implements Serializable, Scopeable
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Workflow methods
|
||||
|
||||
/**
|
||||
* Get active workflow instances this node belongs to
|
||||
*
|
||||
* @return the active workflow instances this node belongs to
|
||||
*/
|
||||
public Scriptable getActiveWorkflows()
|
||||
{
|
||||
if (this.activeWorkflows == null)
|
||||
{
|
||||
WorkflowService workflowService = this.services.getWorkflowService();
|
||||
|
||||
List<WorkflowInstance> workflowInstances = workflowService.getWorkflowsForContent(this.nodeRef, true);
|
||||
Object[] jsWorkflowInstances = new Object[workflowInstances.size()];
|
||||
int index = 0;
|
||||
for (WorkflowInstance workflowInstance : workflowInstances)
|
||||
{
|
||||
jsWorkflowInstances[index++] = new JscriptWorkflowInstance(workflowInstance, this.services, this.scope);
|
||||
}
|
||||
this.activeWorkflows = Context.getCurrentContext().newArray(this.scope, jsWorkflowInstances);
|
||||
}
|
||||
|
||||
return this.activeWorkflows;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helper methods
|
||||
@ -2380,6 +2415,7 @@ public class ScriptNode implements Serializable, Scopeable
|
||||
this.isContainer = null;
|
||||
this.parent = null;
|
||||
this.primaryParentAssoc = null;
|
||||
this.activeWorkflows = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ public class JscriptWorkflowDefinition implements Serializable
|
||||
* @param serviceRegistry reference to the Service Registry
|
||||
* @param scope the root scripting scope for this object
|
||||
*/
|
||||
JscriptWorkflowDefinition(final WorkflowDefinition cmrWorkflowDefinition,
|
||||
public JscriptWorkflowDefinition(final WorkflowDefinition cmrWorkflowDefinition,
|
||||
final ServiceRegistry serviceRegistry, final Scriptable scope)
|
||||
{
|
||||
this.id = cmrWorkflowDefinition.id;
|
||||
@ -101,7 +101,7 @@ public class JscriptWorkflowDefinition implements Serializable
|
||||
* @param serviceRegistry reference to the Service Registry
|
||||
* @param scope root scripting scope for this object
|
||||
*/
|
||||
JscriptWorkflowDefinition(final String id, final String name, final String version,
|
||||
public JscriptWorkflowDefinition(final String id, final String name, final String version,
|
||||
final String title, final String description, ServiceRegistry serviceRegistry,
|
||||
final Scriptable scope)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ public class JscriptWorkflowInstance implements Serializable
|
||||
* @param serviceRegistry Service Registry instance
|
||||
* @param scope the root scripting scope for this object
|
||||
*/
|
||||
JscriptWorkflowInstance(final String id, final String description, final Date startDate,
|
||||
public JscriptWorkflowInstance(final String id, final String description, final Date startDate,
|
||||
final ServiceRegistry serviceRegistry, final Scriptable scope)
|
||||
{
|
||||
this.id = id;
|
||||
@ -97,7 +97,7 @@ public class JscriptWorkflowInstance implements Serializable
|
||||
* @param serviceRegistry Service Registry instance
|
||||
* @param scope the root scripting scope for this object
|
||||
*/
|
||||
JscriptWorkflowInstance(final WorkflowInstance
|
||||
public JscriptWorkflowInstance(final WorkflowInstance
|
||||
cmrWorkflowInstance, final ServiceRegistry serviceRegistry, final Scriptable scope)
|
||||
{
|
||||
this.id = cmrWorkflowInstance.id;
|
||||
|
@ -73,7 +73,7 @@ public class JscriptWorkflowNode implements Serializable
|
||||
* @param scope root scripting scope for this object
|
||||
* @param serviceRegistry service registry object
|
||||
*/
|
||||
JscriptWorkflowNode(String name, String title, String description,
|
||||
public JscriptWorkflowNode(String name, String title, String description,
|
||||
boolean isTaskNode, ArrayList<JscriptWorkflowTransition> transitions,
|
||||
Scriptable scope, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
@ -96,7 +96,7 @@ public class JscriptWorkflowNode implements Serializable
|
||||
* @param scope root scripting scope for this newly instantiated object
|
||||
* @param serviceRegistry service registry object
|
||||
*/
|
||||
JscriptWorkflowNode(WorkflowNode workflowNode, Scriptable scope, ServiceRegistry serviceRegistry)
|
||||
public JscriptWorkflowNode(WorkflowNode workflowNode, Scriptable scope, ServiceRegistry serviceRegistry)
|
||||
{
|
||||
this.name = workflowNode.name;
|
||||
this.title = workflowNode.title;
|
||||
|
@ -77,7 +77,7 @@ public class JscriptWorkflowPath implements Serializable
|
||||
* @param serviceRegistry Service Registry object
|
||||
* @param scope the root scripting scope for this object
|
||||
*/
|
||||
JscriptWorkflowPath(final String id, final WorkflowNode node, final JscriptWorkflowInstance instance,
|
||||
public JscriptWorkflowPath(final String id, final WorkflowNode node, final JscriptWorkflowInstance instance,
|
||||
final ServiceRegistry serviceRegistry, final Scriptable scope)
|
||||
{
|
||||
this.id = id;
|
||||
@ -97,7 +97,7 @@ public class JscriptWorkflowPath implements Serializable
|
||||
* @param serviceRegistry Service Registry object
|
||||
* @param scope the root scripting scope for this object
|
||||
*/
|
||||
JscriptWorkflowPath(final WorkflowPath cmrWorkflowPath,
|
||||
public JscriptWorkflowPath(final WorkflowPath cmrWorkflowPath,
|
||||
final ServiceRegistry serviceRegistry, Scriptable scope)
|
||||
{
|
||||
this.id = cmrWorkflowPath.id;
|
||||
|
@ -77,7 +77,7 @@ public class JscriptWorkflowTask implements Serializable
|
||||
* @param description workflow task description
|
||||
* @param serviceRegistry Service Registry object
|
||||
*/
|
||||
JscriptWorkflowTask(final String id, final String name, final String title,
|
||||
public JscriptWorkflowTask(final String id, final String name, final String title,
|
||||
final String description, final ServiceRegistry serviceRegistry,
|
||||
final ScriptableQNameMap<String, Serializable> properties)
|
||||
{
|
||||
@ -96,7 +96,7 @@ public class JscriptWorkflowTask implements Serializable
|
||||
* @param cmrWorkflowTask an instance of WorkflowTask from CMR workflow object model
|
||||
* @param serviceRegistry Service Registry object
|
||||
*/
|
||||
JscriptWorkflowTask(final WorkflowTask cmrWorkflowTask,
|
||||
public JscriptWorkflowTask(final WorkflowTask cmrWorkflowTask,
|
||||
final ServiceRegistry serviceRegistry)
|
||||
{
|
||||
this.id = cmrWorkflowTask.id;
|
||||
|
@ -49,7 +49,7 @@ public class JscriptWorkflowTransition implements Serializable
|
||||
* @param title Workflow transition title
|
||||
* @param description Workflow transition description
|
||||
*/
|
||||
JscriptWorkflowTransition(String id, String title, String description)
|
||||
public JscriptWorkflowTransition(String id, String title, String description)
|
||||
{
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
@ -63,7 +63,7 @@ public class JscriptWorkflowTransition implements Serializable
|
||||
* @param transition CMR WorkflowTransition object from which
|
||||
* to create a new instance of this class
|
||||
*/
|
||||
JscriptWorkflowTransition(WorkflowTransition transition)
|
||||
public JscriptWorkflowTransition(WorkflowTransition transition)
|
||||
{
|
||||
this.id = transition.id;
|
||||
this.title = transition.title;
|
||||
|
Loading…
x
Reference in New Issue
Block a user