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:
Ariel Backenroth
2007-06-20 19:07:49 +00:00
parent cdf7889c7c
commit f7dfae61e2
3 changed files with 9 additions and 18 deletions

View File

@@ -19,7 +19,8 @@
* and Open Source Software ("FLOSS") applications as described in Alfresco's * and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing * FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here: * the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" */ * http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.web.forms; package org.alfresco.web.forms;
import java.io.*; import java.io.*;
@@ -176,7 +177,7 @@ public class FormInstanceDataImpl
public List<Rendition> getRenditions() public List<Rendition> getRenditions()
{ {
final AVMService avmService = this.getServiceRegistry().getAVMService(); final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService();
final PropertyValue pv = final PropertyValue pv =
avmService.getNodeProperty(-1, this.getPath(), WCMAppModel.PROP_RENDITIONS); avmService.getNodeProperty(-1, this.getPath(), WCMAppModel.PROP_RENDITIONS);
final Collection<Serializable> renditionPaths = (pv == null final Collection<Serializable> renditionPaths = (pv == null

View File

@@ -178,7 +178,7 @@ public class RenderingEngineTemplateImpl
public String getOutputPathForRendition(final FormInstanceData formInstanceData, final String currentAVMPath) public String getOutputPathForRendition(final FormInstanceData formInstanceData, final String currentAVMPath)
{ {
final ServiceRegistry sr = this.getServiceRegistry(); final ServiceRegistry sr = this.getServiceRegistry();
final AVMService avmService = this.getAVMService(); final AVMService avmService = sr.getAVMLockingAwareService();
final String formInstanceDataAVMPath = formInstanceData.getPath(); final String formInstanceDataAVMPath = formInstanceData.getPath();
@@ -252,7 +252,7 @@ public class RenderingEngineTemplateImpl
SAXException, SAXException,
RenderingEngine.RenderingException RenderingEngine.RenderingException
{ {
final AVMService avmService = this.getAVMService(); final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService();
final boolean isRegenerate = avmService.lookup(-1, renditionAvmPath) != null; final boolean isRegenerate = avmService.lookup(-1, renditionAvmPath) != null;
if (!isRegenerate) if (!isRegenerate)
{ {
@@ -329,7 +329,7 @@ public class RenderingEngineTemplateImpl
new PropertyValue(DataTypeDefinition.TEXT, new PropertyValue(DataTypeDefinition.TEXT,
AVMUtil.getStoreRelativePath(formInstanceData.getPath()))); AVMUtil.getStoreRelativePath(formInstanceData.getPath())));
final AVMService avmService = this.getAVMService(); final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService();
avmService.setNodeProperties(rendition.getPath(), props); avmService.setNodeProperties(rendition.getPath(), props);
} }
@@ -554,11 +554,6 @@ public class RenderingEngineTemplateImpl
return new FormDataFunctions((AVMRemote)wac.getBean("avmRemote")); return new FormDataFunctions((AVMRemote)wac.getBean("avmRemote"));
} }
private AVMService getAVMService()
{
return this.getServiceRegistry().getAVMService();
}
private ServiceRegistry getServiceRegistry() private ServiceRegistry getServiceRegistry()
{ {
final FacesContext fc = FacesContext.getCurrentInstance(); final FacesContext fc = FacesContext.getCurrentInstance();

View File

@@ -103,7 +103,7 @@ public class RenditionImpl
public FormInstanceData getPrimaryFormInstanceData() public FormInstanceData getPrimaryFormInstanceData()
throws FileNotFoundException throws FileNotFoundException
{ {
final AVMService avmService = this.getAVMService(); final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService();
final String fidAVMStoreRelativePath = (String) final String fidAVMStoreRelativePath = (String)
avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
@@ -123,7 +123,7 @@ public class RenditionImpl
{ {
if (this.renderingEngineTemplate == null) if (this.renderingEngineTemplate == null)
{ {
final AVMService avmService = this.getAVMService(); final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService();
PropertyValue pv = PropertyValue pv =
avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
@@ -187,7 +187,7 @@ public class RenditionImpl
public OutputStream getOutputStream() public OutputStream getOutputStream()
{ {
final AVMService avmService = this.getAVMService(); final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService();
final Pair<Integer, String> p = AVMNodeConverter.ToAVMVersionPath(this.nodeRef); final Pair<Integer, String> p = AVMNodeConverter.ToAVMVersionPath(this.nodeRef);
return (avmService.lookup(p.getFirst(), p.getSecond()) == null return (avmService.lookup(p.getFirst(), p.getSecond()) == null
? avmService.createFile(AVMNodeConverter.SplitBase(p.getSecond())[0], ? avmService.createFile(AVMNodeConverter.SplitBase(p.getSecond())[0],
@@ -212,11 +212,6 @@ public class RenditionImpl
this.getRenderingEngineTemplate().render(formInstanceData, this); this.getRenderingEngineTemplate().render(formInstanceData, this);
} }
private AVMService getAVMService()
{
return this.getServiceRegistry().getAVMService();
}
private ServiceRegistry getServiceRegistry() private ServiceRegistry getServiceRegistry()
{ {
final FacesContext fc = FacesContext.getCurrentInstance(); final FacesContext fc = FacesContext.getCurrentInstance();