mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-16 17:55:15 +00:00
more locking related ui work
- unlocking files on submit - unlocking file on revert - adding AVMLockingAwareService to serviceregistry - locking renditions (using the lockingawareservice) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6040 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
5120da0dc6
commit
daffc0a235
@ -488,6 +488,9 @@
|
|||||||
<property name="avmService">
|
<property name="avmService">
|
||||||
<ref bean="indexingAVMService"/>
|
<ref bean="indexingAVMService"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="avmLockingService">
|
||||||
|
<ref bean="AVMLockingService"/>
|
||||||
|
</property>
|
||||||
<property name="publicAction">
|
<property name="publicAction">
|
||||||
<value>false</value>
|
<value>false</value>
|
||||||
</property>
|
</property>
|
||||||
|
@ -4,16 +4,20 @@
|
|||||||
package org.alfresco.repo.avm.actions;
|
package org.alfresco.repo.avm.actions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
||||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
||||||
|
import org.alfresco.repo.domain.PropertyValue;
|
||||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
import org.alfresco.service.cmr.action.Action;
|
import org.alfresco.service.cmr.action.Action;
|
||||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
|
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
||||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
@ -37,11 +41,21 @@ public class AVMUndoSandboxListAction extends ActionExecuterAbstractBase
|
|||||||
*/
|
*/
|
||||||
private AVMService fAVMService;
|
private AVMService fAVMService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The AVM Locking Service reference.
|
||||||
|
*/
|
||||||
|
private AVMLockingService fAVMLockingService;
|
||||||
|
|
||||||
public void setAvmService(AVMService service)
|
public void setAvmService(AVMService service)
|
||||||
{
|
{
|
||||||
fAVMService = service;
|
fAVMService = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAvmLockingService(AVMLockingService service)
|
||||||
|
{
|
||||||
|
fAVMLockingService = service;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||||
*/
|
*/
|
||||||
@ -65,8 +79,26 @@ public class AVMUndoSandboxListAction extends ActionExecuterAbstractBase
|
|||||||
AVMNodeDescriptor parent = fAVMService.lookup(-1, parentChild[0], true);
|
AVMNodeDescriptor parent = fAVMService.lookup(-1, parentChild[0], true);
|
||||||
if (parent.isLayeredDirectory())
|
if (parent.isLayeredDirectory())
|
||||||
{
|
{
|
||||||
|
if (fgLogger.isDebugEnabled())
|
||||||
|
fgLogger.debug("reverting " + parentChild[1] + " in " + parentChild[0]);
|
||||||
fAVMService.makeTransparent(parentChild[0], parentChild[1]);
|
fAVMService.makeTransparent(parentChild[0], parentChild[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Map<QName, PropertyValue> dnsProperties = fAVMService.queryStorePropertyKey(item.getSecond().split(":")[0], QName.createQName(null, ".dns%"));
|
||||||
|
String webProject = dnsProperties.keySet().iterator().next().getLocalName();
|
||||||
|
webProject = webProject.substring(webProject.lastIndexOf('.') + 1, webProject.length());
|
||||||
|
String path = item.getSecond().substring(item.getSecond().indexOf(":") + 1);
|
||||||
|
if (fgLogger.isDebugEnabled())
|
||||||
|
fgLogger.debug("unlocking file " + path + " in web project " + webProject);
|
||||||
|
|
||||||
|
if (fAVMLockingService.getLock(webProject, path) != null)
|
||||||
|
{
|
||||||
|
fAVMLockingService.removeLock(webProject, path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fgLogger.warn("expected file " + path + " in " + webProject + " to be locked");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,17 +24,22 @@ package org.alfresco.repo.avm.wf;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.repo.avm.AVMDAOs;
|
import org.alfresco.repo.avm.AVMDAOs;
|
||||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
|
import org.alfresco.repo.domain.PropertyValue;
|
||||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||||
import org.alfresco.repo.workflow.jbpm.JBPMNode;
|
import org.alfresco.repo.workflow.jbpm.JBPMNode;
|
||||||
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
|
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
|
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
||||||
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
||||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
import org.jbpm.graph.exe.ExecutionContext;
|
import org.jbpm.graph.exe.ExecutionContext;
|
||||||
import org.springframework.beans.factory.BeanFactory;
|
import org.springframework.beans.factory.BeanFactory;
|
||||||
@ -59,6 +64,11 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
|||||||
*/
|
*/
|
||||||
private AVMSubmittedAspect fAVMSubmittedAspect;
|
private AVMSubmittedAspect fAVMSubmittedAspect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The AVMLockingService instance.
|
||||||
|
*/
|
||||||
|
private AVMLockingService fAVMLockingService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The AVMSubmitTransactionListener instance
|
* The AVMSubmitTransactionListener instance
|
||||||
* (for JMX notification of virtualization server after commit/rollback).
|
* (for JMX notification of virtualization server after commit/rollback).
|
||||||
@ -73,8 +83,9 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
|||||||
@Override
|
@Override
|
||||||
protected void initialiseHandler(BeanFactory factory)
|
protected void initialiseHandler(BeanFactory factory)
|
||||||
{
|
{
|
||||||
fAVMService = (AVMService)factory.getBean("AVMService");
|
fAVMService = (AVMService)factory.getBean(ServiceRegistry.AVM_SERVICE.getLocalName());
|
||||||
fAVMSyncService = (AVMSyncService)factory.getBean("AVMSyncService");
|
fAVMSyncService = (AVMSyncService)factory.getBean(ServiceRegistry.AVM_SYNC_SERVICE.getLocalName());
|
||||||
|
fAVMLockingService = (AVMLockingService)factory.getBean(ServiceRegistry.AVM_LOCKING_SERVICE.getLocalName());
|
||||||
fAVMSubmittedAspect = (AVMSubmittedAspect)factory.getBean("AVMSubmittedAspect");
|
fAVMSubmittedAspect = (AVMSubmittedAspect)factory.getBean("AVMSubmittedAspect");
|
||||||
fAVMSubmitTransactionListener = (AVMSubmitTransactionListener) factory.getBean("AVMSubmitTransactionListener");
|
fAVMSubmitTransactionListener = (AVMSubmitTransactionListener) factory.getBean("AVMSubmitTransactionListener");
|
||||||
|
|
||||||
@ -85,23 +96,28 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
|||||||
* Do the actual work.
|
* Do the actual work.
|
||||||
* @param executionContext The context to get stuff from.
|
* @param executionContext The context to get stuff from.
|
||||||
*/
|
*/
|
||||||
public void execute(ExecutionContext executionContext) throws Exception
|
public void execute(final ExecutionContext executionContext)
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
// TODO: Allow submit parameters to be passed into this action handler
|
// TODO: Allow submit parameters to be passed into this action handler
|
||||||
// rather than pulling directly from execution context
|
// rather than pulling directly from execution context
|
||||||
|
|
||||||
NodeRef pkg = ((JBPMNode)executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef();
|
final NodeRef pkg = ((JBPMNode)executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef();
|
||||||
Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg);
|
final Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg);
|
||||||
|
|
||||||
// submit the package changes
|
// submit the package changes
|
||||||
String description = (String)executionContext.getContextInstance().getVariable("bpm_workflowDescription");
|
final String description = (String)executionContext.getContextInstance().getVariable("bpm_workflowDescription");
|
||||||
String tag = (String)executionContext.getContextInstance().getVariable("wcmwf_label");
|
final String tag = (String)executionContext.getContextInstance().getVariable("wcmwf_label");
|
||||||
AVMNodeDescriptor pkgDesc = fAVMService.lookup(pkgPath.getFirst(), pkgPath.getSecond());
|
final AVMNodeDescriptor pkgDesc = fAVMService.lookup(pkgPath.getFirst(), pkgPath.getSecond());
|
||||||
String targetPath = pkgDesc.getIndirection();
|
final String targetPath = pkgDesc.getIndirection();
|
||||||
List<AVMDifference> stagingDiffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, targetPath, null);
|
final Map<QName, PropertyValue> dnsProperties = this.fAVMService.queryStorePropertyKey(targetPath.split(":")[0], QName.createQName(null, ".dns%"));
|
||||||
for (AVMDifference diff : stagingDiffs)
|
String webProject = dnsProperties.keySet().iterator().next().getLocalName();
|
||||||
|
webProject = webProject.substring(webProject.lastIndexOf('.') + 1, webProject.length());
|
||||||
|
final List<AVMDifference> stagingDiffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, targetPath, null);
|
||||||
|
for (final AVMDifference diff : stagingDiffs)
|
||||||
{
|
{
|
||||||
fAVMSubmittedAspect.clearSubmitted(diff.getSourceVersion(), diff.getSourcePath());
|
fAVMSubmittedAspect.clearSubmitted(diff.getSourceVersion(), diff.getSourcePath());
|
||||||
|
this.fAVMLockingService.removeLock(webProject, diff.getSourcePath().substring(diff.getSourcePath().indexOf(":") + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow AVMSubmitTransactionListener to inspect the staging diffs
|
// Allow AVMSubmitTransactionListener to inspect the staging diffs
|
||||||
@ -113,7 +129,6 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
|||||||
|
|
||||||
AlfrescoTransactionSupport.bindResource("staging_diffs", stagingDiffs);
|
AlfrescoTransactionSupport.bindResource("staging_diffs", stagingDiffs);
|
||||||
|
|
||||||
|
|
||||||
fAVMSyncService.update(stagingDiffs, null, false, false, true, true, tag, description);
|
fAVMSyncService.update(stagingDiffs, null, false, false, true, true, tag, description);
|
||||||
|
|
||||||
// flatten source folder where changes were submitted from
|
// flatten source folder where changes were submitted from
|
||||||
|
@ -324,6 +324,15 @@ public class ServiceDescriptorRegistry
|
|||||||
return (AVMService)getService(AVM_SERVICE);
|
return (AVMService)getService(AVM_SERVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the AVMService.
|
||||||
|
* @return The AVMService or null if there is none.
|
||||||
|
*/
|
||||||
|
public AVMService getAVMLockingAwareService()
|
||||||
|
{
|
||||||
|
return (AVMService)getService(AVM_LOCKING_AWARE_SERVICE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the AVM Sync Service.
|
* Get the AVM Sync Service.
|
||||||
* @return The AVM Sync Service.
|
* @return The AVM Sync Service.
|
||||||
|
@ -107,6 +107,7 @@ public interface ServiceRegistry
|
|||||||
static final QName OWNABLE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "OwnableService");
|
static final QName OWNABLE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "OwnableService");
|
||||||
static final QName PERSON_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "PersonService");
|
static final QName PERSON_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "PersonService");
|
||||||
static final QName AVM_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMService");
|
static final QName AVM_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMService");
|
||||||
|
static final QName AVM_LOCKING_AWARE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMLockingAwareService");
|
||||||
static final QName AVM_SYNC_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMSyncService");
|
static final QName AVM_SYNC_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMSyncService");
|
||||||
static final QName CROSS_REPO_COPY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CrossRepositoryCopyService");
|
static final QName CROSS_REPO_COPY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CrossRepositoryCopyService");
|
||||||
static final QName ATTRIBUTE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AttributeService");
|
static final QName ATTRIBUTE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AttributeService");
|
||||||
@ -302,6 +303,13 @@ public interface ServiceRegistry
|
|||||||
@NotAuditable
|
@NotAuditable
|
||||||
AVMService getAVMService();
|
AVMService getAVMService();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the AVMLockingAwareService.
|
||||||
|
* @return The AVM locking aware service (or null if one is not provided);
|
||||||
|
*/
|
||||||
|
@NotAuditable
|
||||||
|
AVMService getAVMLockingAwareService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the AVM Sync Service.
|
* Get the AVM Sync Service.
|
||||||
* @return The AVM Sync Service.
|
* @return The AVM Sync Service.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user