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">
|
||||
<ref bean="indexingAVMService"/>
|
||||
</property>
|
||||
<property name="avmLockingService">
|
||||
<ref bean="AVMLockingService"/>
|
||||
</property>
|
||||
<property name="publicAction">
|
||||
<value>false</value>
|
||||
</property>
|
||||
|
@ -4,16 +4,20 @@
|
||||
package org.alfresco.repo.avm.actions;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
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.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@ -36,11 +40,21 @@ public class AVMUndoSandboxListAction extends ActionExecuterAbstractBase
|
||||
* The AVM Service reference.
|
||||
*/
|
||||
private AVMService fAVMService;
|
||||
|
||||
/**
|
||||
* The AVM Locking Service reference.
|
||||
*/
|
||||
private AVMLockingService fAVMLockingService;
|
||||
|
||||
public void setAvmService(AVMService service)
|
||||
{
|
||||
fAVMService = service;
|
||||
}
|
||||
|
||||
public void setAvmLockingService(AVMLockingService service)
|
||||
{
|
||||
fAVMLockingService = service;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @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);
|
||||
if (parent.isLayeredDirectory())
|
||||
{
|
||||
if (fgLogger.isDebugEnabled())
|
||||
fgLogger.debug("reverting " + parentChild[1] + " in " + parentChild[0]);
|
||||
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.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.avm.AVMDAOs;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.workflow.jbpm.JBPMNode;
|
||||
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.AVMService;
|
||||
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
||||
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.jbpm.graph.exe.ExecutionContext;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
@ -59,6 +64,11 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
||||
*/
|
||||
private AVMSubmittedAspect fAVMSubmittedAspect;
|
||||
|
||||
/**
|
||||
* The AVMLockingService instance.
|
||||
*/
|
||||
private AVMLockingService fAVMLockingService;
|
||||
|
||||
/**
|
||||
* The AVMSubmitTransactionListener instance
|
||||
* (for JMX notification of virtualization server after commit/rollback).
|
||||
@ -73,8 +83,9 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
||||
@Override
|
||||
protected void initialiseHandler(BeanFactory factory)
|
||||
{
|
||||
fAVMService = (AVMService)factory.getBean("AVMService");
|
||||
fAVMSyncService = (AVMSyncService)factory.getBean("AVMSyncService");
|
||||
fAVMService = (AVMService)factory.getBean(ServiceRegistry.AVM_SERVICE.getLocalName());
|
||||
fAVMSyncService = (AVMSyncService)factory.getBean(ServiceRegistry.AVM_SYNC_SERVICE.getLocalName());
|
||||
fAVMLockingService = (AVMLockingService)factory.getBean(ServiceRegistry.AVM_LOCKING_SERVICE.getLocalName());
|
||||
fAVMSubmittedAspect = (AVMSubmittedAspect)factory.getBean("AVMSubmittedAspect");
|
||||
fAVMSubmitTransactionListener = (AVMSubmitTransactionListener) factory.getBean("AVMSubmitTransactionListener");
|
||||
|
||||
@ -85,23 +96,28 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
||||
* Do the actual work.
|
||||
* @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
|
||||
// rather than pulling directly from execution context
|
||||
|
||||
NodeRef pkg = ((JBPMNode)executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef();
|
||||
Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg);
|
||||
final NodeRef pkg = ((JBPMNode)executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef();
|
||||
final Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg);
|
||||
|
||||
// submit the package changes
|
||||
String description = (String)executionContext.getContextInstance().getVariable("bpm_workflowDescription");
|
||||
String tag = (String)executionContext.getContextInstance().getVariable("wcmwf_label");
|
||||
AVMNodeDescriptor pkgDesc = fAVMService.lookup(pkgPath.getFirst(), pkgPath.getSecond());
|
||||
String targetPath = pkgDesc.getIndirection();
|
||||
List<AVMDifference> stagingDiffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, targetPath, null);
|
||||
for (AVMDifference diff : stagingDiffs)
|
||||
final String description = (String)executionContext.getContextInstance().getVariable("bpm_workflowDescription");
|
||||
final String tag = (String)executionContext.getContextInstance().getVariable("wcmwf_label");
|
||||
final AVMNodeDescriptor pkgDesc = fAVMService.lookup(pkgPath.getFirst(), pkgPath.getSecond());
|
||||
final String targetPath = pkgDesc.getIndirection();
|
||||
final Map<QName, PropertyValue> dnsProperties = this.fAVMService.queryStorePropertyKey(targetPath.split(":")[0], QName.createQName(null, ".dns%"));
|
||||
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());
|
||||
this.fAVMLockingService.removeLock(webProject, diff.getSourcePath().substring(diff.getSourcePath().indexOf(":") + 1));
|
||||
}
|
||||
|
||||
// Allow AVMSubmitTransactionListener to inspect the staging diffs
|
||||
@ -113,7 +129,6 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
||||
|
||||
AlfrescoTransactionSupport.bindResource("staging_diffs", stagingDiffs);
|
||||
|
||||
|
||||
fAVMSyncService.update(stagingDiffs, null, false, false, true, true, tag, description);
|
||||
|
||||
// flatten source folder where changes were submitted from
|
||||
|
@ -323,6 +323,15 @@ public class ServiceDescriptorRegistry
|
||||
{
|
||||
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.
|
||||
|
@ -107,6 +107,7 @@ public interface ServiceRegistry
|
||||
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 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 CROSS_REPO_COPY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CrossRepositoryCopyService");
|
||||
static final QName ATTRIBUTE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AttributeService");
|
||||
@ -301,6 +302,13 @@ public interface ServiceRegistry
|
||||
*/
|
||||
@NotAuditable
|
||||
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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user