mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V4.1-BUG-FIX to HEAD
40605: ALF-15273: Merged PATCHES/V4.0.1 to V4.1-BUG-FIX 40132: ALF-15376: Activiti schema updates fail when hibernate.default_schema is set with ORA-00942. - Corrected schema case to uppercase when database is Oracle. 40235: ALF-15367: Reverse merged the following revisions because the fix is deemed not robust enough. 40132: ALF-15376: Activiti schema updates fail when hibernate.default_schema is set with ORA-00942. - Corrected schema case to uppercase when database is Oracle. 40041: ALF-15376: Merged V4.1-BUG-FIX to PATCHES/V4.0.1 39969: Merged DEV/BELARUS-V4.1-BUG-FIX-2012_07_09 to V4.1-BUG-FIX: ALF-15273 : Activiti schema updates fail when hibernate.default_schema is set with ORA-00942. The Activiti database is now correctly initialized with the correct "hibernate.default_schema" 40470: ALF-15376: how to debug the creation of Activiti tables (ACT_) when upgrading to 4.X - added more logging to Activiti schema creation 40471: ALF-15376: Activiti schema updates fail when hibernate.default_schema is set with ORA-00942 - Ignore hibernate.default_schema and determine default schema from the Connection DatabaseMetaData - Provided the Activiti schema initializer with the default schema information - Provided countAppliedPatches() with default schema information 40501: ALF-15376: Improved webapp logging.properties to use a console handler so that it doesn't suppress absolutely everything and we can selectively turn on logging! 40608: Fix for ALF-4274 - JSF - Paste action does not work when browse.jsp is overrided 40611: GERMAN: Translation updates based on EN r40604 40612: SPANISH: Translation updates based on EN r40604 40613: FRENCH: Translation updates based on EN r40604 40614: ITALIAN: Translation updates based on EN r40604 40615: JAPANESE: Translation updates based on EN r40604 40616: DUTCH: Translation updates based on EN r40604 40617: CHINESE: Translation updates based on EN r40604 40629: ALF-15321: upgrade Activiti to fix logging 40632: Fix for ALF-15487 Search not working for queries containing 3-digit versions Fix for ALF-15356 SOLR doesn't support searching by cm:name of file with underscore and dots 40655: Fix for ALF-14752 - Collapse Links part at the WCM details page lead to error. 40662: Eclipse classpath fixes 40663: Merged DEV to V4.1-BUG-FIX 40661: ALF-15318 (part 2): It's possible to log in by disabled user (NTLM with SSO in a clustered env) The onValidateFailed() methods were moved to BaseSSOAuthenticationFilter to response with a 401 for a disabled user. 40665: ALF-15448: Merged V3.4-BUG-FIX (3.4.11) to V4.1-BUG-FIX (4.1.1) 40664: ALF-15578 CLONE 3.4.11: LibreOffice 3.6 startup on Mac fails 40685: Merged PATCHES/V4.0.2 to V4.1-BUG-FIX 39274: Merged DEV to V4.0.2 (4.0.2.4) << Unable to merge code as supplied as it introduced a change to a public API, which would break alfresco.log if the RM AMP was installed See RM-452 >> 39166: ALF-15583 / ALF-14584: autoVersionOnUpdateProps=true does not increment the version label after checkout/checkin 'VersionableAspectTest' has been modified in accordance with concept: several modifications of node in a single transaction are interpreted as a single version. Each operation in the test which should provide a new version have been made atomic 39089: ALF-15583 / ALF-14584: autoVersionOnUpdateProps=true does not increment the version label after checkout/checkin Check of lock has been corrected since 'cm:lockable' aspect doesn't indicate lock state: - 'LockService' service has been extended with 'isLocked(NodRef)' method which returns 'true' if document is locked and current user is not an owner of the lock; - new 'VersionableAspectTest' has been added to test the use-case described in the issue and to test whether 'VersionableAspect' changes version label of a locked document 39369: ALF-15583 / ALF-14584 autoVersionOnUpdateProps=true does not increment the version label after checkout/checkin - Test failures: A READ_ONLY lock was being set because we are adding a versionable aspect. This resulted in an Exception when attempting to update the version. Change made to the isLocked method (now called isLockedOrReadOnly) to reflect that a node is locked even for the owner and the lock type is not a WRITE lock. 39939: ALF-15584 / ALF-15001: Gracefully handle stale NodeRefs in query results in DMDiscoveryServicePort - SOLR makes this more likely to occur 40455: ALF-15585 / ALF-15383: Long-running Feed Cleaner - Part 1: Limit problems caused by missing indexes - Remove all count calls - Remove logic requiring calls to SiteService to list all sites - Added in an ID range limit to act as a hard-stop to entry growth (set to 1M) - TODO: use JobLockService 40461: ALF-15585 / ALF-15383: Long running Feed Cleaner - Part 2: Added JobLockService usage to ensure only one instance runs at a time 40463: ALF-15585 / ALF-15383: Long running Feed Cleaner - A bit more trace and debug 40526: ALF-15586: Fixed ALF-15540: CMIS: Synchronized block in service interceptor 40574: ALF-15585 / ALF-15383: Long running Feed Cleaner - Fix MySQL variant of activities-common-SqlMap 40579: ALF-15585: Fix fallout from rev 40455: ALF-15383: Long-running Feed Cleaner - MySQL dialect was duplicating ALL SQL statements - Split 'large' SQL selects into activities-select-SqlMap.xml containing 7 statements that are all overridden for MySQL - Fixed split in common file between different types of statements 40588: ALF-15587 / ALF-15385: Merged V3.4-BUG-FIX to PATCHES/V4.0.2 (Lost revision) 28830: ALF-7622 Refactored JScriptWorkflowTask. Now when setProperties() is called it properly updates the WorkflowTask properties via the WorflowService.updateTask() method. 40687: Merged V3.4-BUG-FIX to V4.1-BUG-FIX 40599: ALF-15567: Merged PATCHES/V3.4.10 to V3.4-BUG-FIX 40511: ALF-12008: Merged DEV to PATCHES/V3.4.10 Due to Windows Explorer's URL concatenation behaviour, we must present links as shortcuts to the real URL, rather than direct hrefs. This is at least consistent with the way the CIFS server handles links. See org.alfresco.filesys.repo.ContentDiskDriver.openFile(). 40518: ALF-12008: Fixed compilation error git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@40691 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -22,7 +22,7 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ApplicationModel;
|
||||
import org.alfresco.model.ContentModel;
|
||||
@@ -30,16 +30,19 @@ import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
|
||||
import org.alfresco.repo.jscript.ScriptNode;
|
||||
import org.alfresco.repo.jscript.ScriptableHashMap;
|
||||
import org.alfresco.repo.jscript.ScriptableQNameMap;
|
||||
import org.alfresco.repo.workflow.WorkflowModel;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTaskState;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTransition;
|
||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||
import org.alfresco.service.namespace.NamespacePrefixResolverProvider;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.mozilla.javascript.Context;
|
||||
import org.mozilla.javascript.Scriptable;
|
||||
@@ -54,154 +57,37 @@ public class JscriptWorkflowTask extends BaseScopableProcessorExtension implemen
|
||||
{
|
||||
static final long serialVersionUID = -8285971359421912313L;
|
||||
|
||||
/** Unique ID for workflow task */
|
||||
private final String id;
|
||||
|
||||
/** Name for workflow task */
|
||||
private final String name;
|
||||
|
||||
/** Title for workflow task */
|
||||
private final String title;
|
||||
|
||||
/** Description of workflow task */
|
||||
private final String description;
|
||||
|
||||
/** Properties (key/value pairs) for this Workflow Task */
|
||||
private ScriptableQNameMap<String, Serializable> properties;
|
||||
|
||||
/** Whether task is complete or not - 'true':complete, 'false':in-progress */
|
||||
private boolean complete = false;
|
||||
|
||||
/** Whether task is pooled or not */
|
||||
private boolean pooled = false;
|
||||
|
||||
/** Service Registry object */
|
||||
private ServiceRegistry serviceRegistry;
|
||||
|
||||
/** Available transitions * */
|
||||
private ScriptableHashMap<String, String> transitions;
|
||||
|
||||
/** Package resources * */
|
||||
private Scriptable packageResources;
|
||||
|
||||
/**
|
||||
* Creates a new instance of a workflow task (instance of a workflow task definition)
|
||||
*
|
||||
* @param id
|
||||
* workflow task ID
|
||||
* @param name
|
||||
* workflow task name
|
||||
* @param title
|
||||
* workflow task title
|
||||
* @param description
|
||||
* workflow task description
|
||||
* @param serviceRegistry
|
||||
* Service Registry object
|
||||
* @param properties
|
||||
* @param transitions
|
||||
* @param packageResources
|
||||
*/
|
||||
public JscriptWorkflowTask(final String id, final String name, final String title, final String description, final ServiceRegistry serviceRegistry,
|
||||
final ScriptableQNameMap<String, Serializable> properties, final ScriptableHashMap<String, String> transitions, Scriptable packageResources,
|
||||
Scriptable scope)
|
||||
{
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
this.properties = properties;
|
||||
this.transitions = transitions;
|
||||
this.packageResources = packageResources;
|
||||
this.setScope(scope);
|
||||
}
|
||||
private final ServiceRegistry serviceRegistry;
|
||||
private final NodeService nodeService;
|
||||
private final WorkflowService workflowService;
|
||||
private final DictionaryService dictionaryService;
|
||||
private MutableAuthenticationService authenticationService;
|
||||
private final DefaultNamespaceProvider namespaceProvider;
|
||||
|
||||
private WorkflowTask task;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of a workflow task from a WorkflowTask from the CMR workflow object model
|
||||
*
|
||||
* @param cmrWorkflowTask
|
||||
* @param task
|
||||
* an instance of WorkflowTask from CMR workflow object model
|
||||
* @param serviceRegistry
|
||||
* Service Registry object
|
||||
*/
|
||||
public JscriptWorkflowTask(final WorkflowTask cmrWorkflowTask, final ServiceRegistry serviceRegistry, Scriptable scope)
|
||||
public JscriptWorkflowTask(WorkflowTask task,
|
||||
ServiceRegistry serviceRegistry,
|
||||
Scriptable scope)
|
||||
{
|
||||
this.id = cmrWorkflowTask.getId();
|
||||
this.name = cmrWorkflowTask.getName();
|
||||
this.title = cmrWorkflowTask.getTitle();
|
||||
this.description = cmrWorkflowTask.getDescription();
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
this.namespaceProvider = new DefaultNamespaceProvider(serviceRegistry.getNamespaceService());
|
||||
this.workflowService = serviceRegistry.getWorkflowService();
|
||||
this.nodeService = serviceRegistry.getNodeService();
|
||||
this.dictionaryService = serviceRegistry.getDictionaryService();
|
||||
this.authenticationService = serviceRegistry.getAuthenticationService();
|
||||
this.task = task;
|
||||
this.setScope(scope);
|
||||
|
||||
// instantiate ScriptableQNameMap<String, Serializable> properties
|
||||
// from WorkflowTasks's Map<QName, Serializable> properties
|
||||
this.properties = new ScriptableQNameMap<String, Serializable>(new NamespacePrefixResolverProvider()
|
||||
{
|
||||
private static final long serialVersionUID = 4218645978524914678L;
|
||||
|
||||
public NamespacePrefixResolver getNamespacePrefixResolver()
|
||||
{
|
||||
return serviceRegistry.getNamespaceService();
|
||||
}
|
||||
});
|
||||
|
||||
Set<QName> keys = cmrWorkflowTask.getProperties().keySet();
|
||||
for (QName key : keys)
|
||||
{
|
||||
Serializable value = cmrWorkflowTask.getProperties().get(key);
|
||||
this.properties.put(key.toString(), value);
|
||||
}
|
||||
|
||||
transitions = new ScriptableHashMap<String, String>();
|
||||
for (WorkflowTransition transition : cmrWorkflowTask.getPath().getNode().getTransitions())
|
||||
{
|
||||
transitions.put(transition.getId(), transition.getTitle());
|
||||
}
|
||||
|
||||
// build package context .... should be centralised... YUK
|
||||
// Needs to match org.alfresco.repo.template.Workflow.WorkflowTaskItem.getPackageResources
|
||||
|
||||
List<NodeRef> contents = serviceRegistry.getWorkflowService().getPackageContents(cmrWorkflowTask.getId());
|
||||
List<NodeRef> resources = new ArrayList<NodeRef>(contents.size());
|
||||
|
||||
NodeService nodeService = serviceRegistry.getNodeService();
|
||||
DictionaryService ddService = serviceRegistry.getDictionaryService();
|
||||
|
||||
for (NodeRef nodeRef : contents)
|
||||
{
|
||||
if (nodeRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
|
||||
{
|
||||
resources.add(nodeRef);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nodeService.exists(nodeRef))
|
||||
{
|
||||
// find it's type so we can see if it's a node we are interested in
|
||||
QName type = nodeService.getType(nodeRef);
|
||||
|
||||
// make sure the type is defined in the data dictionary
|
||||
if (ddService.getType(type) != null)
|
||||
{
|
||||
// look for content nodes or links to content
|
||||
// NOTE: folders within workflow packages are ignored for now
|
||||
if (ddService.isSubClass(type, ContentModel.TYPE_CONTENT) || ApplicationModel.TYPE_FILELINK.equals(type))
|
||||
{
|
||||
resources.add(nodeRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object[] answer = new Object[resources.size()];
|
||||
for (int i = 0; i < resources.size(); i++)
|
||||
{
|
||||
// create our Node representation from the NodeRef
|
||||
answer[i] = new ScriptNode(resources.get(i), serviceRegistry, getScope());
|
||||
}
|
||||
packageResources = Context.getCurrentContext().newArray(getScope(), answer);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,7 +97,7 @@ public class JscriptWorkflowTask extends BaseScopableProcessorExtension implemen
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
return task.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,7 +107,7 @@ public class JscriptWorkflowTask extends BaseScopableProcessorExtension implemen
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
return task.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,7 +117,7 @@ public class JscriptWorkflowTask extends BaseScopableProcessorExtension implemen
|
||||
*/
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
return task.getTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,7 +127,7 @@ public class JscriptWorkflowTask extends BaseScopableProcessorExtension implemen
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
return task.getDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,20 +137,26 @@ public class JscriptWorkflowTask extends BaseScopableProcessorExtension implemen
|
||||
*/
|
||||
public Scriptable getProperties()
|
||||
{
|
||||
// instantiate ScriptableQNameMap<String, Serializable> properties
|
||||
// from WorkflowTasks's Map<QName, Serializable> properties
|
||||
ScriptableQNameMap<String, Serializable> properties = new ScriptableQNameMap<String, Serializable>(namespaceProvider);
|
||||
properties.putAll(task.getProperties());
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>properties</code> property
|
||||
* Sets the properties on the underlying {@link WorkflowTask}.
|
||||
*
|
||||
* @param properties
|
||||
* the properties to set
|
||||
*/
|
||||
public void setProperties(ScriptableQNameMap<String, Serializable> properties)
|
||||
{
|
||||
this.properties = properties;
|
||||
|
||||
Map<QName, Serializable> qNameProps = properties.getMapOfQNames();
|
||||
this.task = workflowService.updateTask(task.getId(), qNameProps, null, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the task is complete 'true':complete, 'false':in-progress
|
||||
*
|
||||
@@ -272,7 +164,7 @@ public class JscriptWorkflowTask extends BaseScopableProcessorExtension implemen
|
||||
*/
|
||||
public boolean isComplete()
|
||||
{
|
||||
return complete;
|
||||
return task.getState().equals(WorkflowTaskState.COMPLETED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,15 +174,13 @@ public class JscriptWorkflowTask extends BaseScopableProcessorExtension implemen
|
||||
*/
|
||||
public boolean isPooled()
|
||||
{
|
||||
if(properties != null) {
|
||||
Collection<?> actors = (Collection<?>) properties.get(WorkflowModel.ASSOC_POOLED_ACTORS);
|
||||
return actors != null && !actors.isEmpty();
|
||||
}
|
||||
return false;
|
||||
String authority = authenticationService.getCurrentUserName();
|
||||
return workflowService.isTaskClaimable(task, authority);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated pooled state cannot be altered.
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public void setPooled(boolean pooled)
|
||||
@@ -306,7 +196,7 @@ public class JscriptWorkflowTask extends BaseScopableProcessorExtension implemen
|
||||
*/
|
||||
public void endTask(String transitionId)
|
||||
{
|
||||
serviceRegistry.getWorkflowService().endTask(this.id, transitionId);
|
||||
workflowService.endTask(task.getId(), transitionId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,6 +206,11 @@ public class JscriptWorkflowTask extends BaseScopableProcessorExtension implemen
|
||||
*/
|
||||
public ScriptableHashMap<String, String> getTransitions()
|
||||
{
|
||||
ScriptableHashMap<String, String> transitions = new ScriptableHashMap<String, String>();
|
||||
for (WorkflowTransition transition : task.getPath().getNode().getTransitions())
|
||||
{
|
||||
transitions.put(transition.getId(), transition.getTitle());
|
||||
}
|
||||
return transitions;
|
||||
}
|
||||
|
||||
@@ -326,7 +221,64 @@ public class JscriptWorkflowTask extends BaseScopableProcessorExtension implemen
|
||||
*/
|
||||
public Scriptable getPackageResources()
|
||||
{
|
||||
return packageResources;
|
||||
List<NodeRef> contents = workflowService.getPackageContents(task.getId());
|
||||
List<ScriptNode> resources = new ArrayList<ScriptNode>(contents.size());
|
||||
|
||||
Collection<QName> allowedTypes = getAllowedPackageResourceTypes();
|
||||
for (NodeRef node : contents)
|
||||
{
|
||||
if (isAvmResource(node, allowedTypes))
|
||||
{
|
||||
ScriptNode scriptNode = new ScriptNode(node, serviceRegistry, getScope());
|
||||
resources.add(scriptNode);
|
||||
}
|
||||
}
|
||||
return Context.getCurrentContext().newArray(getScope(), resources.toArray());
|
||||
}
|
||||
|
||||
private Collection<QName> getAllowedPackageResourceTypes()
|
||||
{
|
||||
// look for content nodes or links to content
|
||||
// NOTE: folders within workflow packages are ignored for now
|
||||
Collection<QName> allowedTypes = dictionaryService.getSubTypes(ContentModel.TYPE_CONTENT, true);
|
||||
allowedTypes.addAll(dictionaryService.getSubTypes(ApplicationModel.TYPE_FILELINK, true));
|
||||
return allowedTypes;
|
||||
}
|
||||
|
||||
private boolean isAvmResource(NodeRef node, Collection<QName> allowedTypes)
|
||||
{
|
||||
if(isAvmNode(node))
|
||||
return true;
|
||||
if (nodeService.exists(node))
|
||||
{
|
||||
//Check if the node is one of the allowedTypes.
|
||||
return allowedTypes.contains(nodeService.getType(node));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isAvmNode(NodeRef node)
|
||||
{
|
||||
return StoreRef.PROTOCOL_AVM.equals(node.getStoreRef().getProtocol());
|
||||
}
|
||||
|
||||
private static class DefaultNamespaceProvider implements NamespacePrefixResolverProvider
|
||||
{
|
||||
private static final long serialVersionUID = -7015209142379905617L;
|
||||
private final NamespaceService namespaceService;
|
||||
|
||||
public DefaultNamespaceProvider(NamespaceService namespaceService)
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public NamespacePrefixResolver getNamespacePrefixResolver()
|
||||
{
|
||||
return namespaceService;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user