Merged V2.2 to HEAD

8041: Merged V2.1 to V2.2
      7736: Fix for broken "make versionable" action after webdav fixes
      7755: Fix AR-1962: File is not truncated when opened for overwrite when using the older CIFS open file request
      7971: Fix for AR-1964 (IE7 character encoding)
      7973: Fixes transient submit failures when submitting deleted directories with no ancestors
      7989: ACT-858: AVM Issuer
      7994: WebDav document url now available in Template/Script APIs as per AR-1917
      8002: AR-1978: Added support for SPNEGO to the CIFS passthru authenticator


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8462 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-03-07 12:40:18 +00:00
parent 5e890e6656
commit c6c115b627
4 changed files with 116 additions and 13 deletions

View File

@@ -87,9 +87,9 @@ public class Issuer
public Object execute()
{
IssuerID issuerID = fIDDAO.get(fName);
if (issuerID == null)
Long id = fIssuerDAO.getIssuerValue(fName);
if (issuerID == null || id == null || id >= issuerID.getNext())
{
Long id = fIssuerDAO.getIssuerValue(fName);
if (id == null)
{
id = 0L;
@@ -98,8 +98,15 @@ public class Issuer
{
id = id + 1L;
}
issuerID = new IssuerIDImpl(fName, id);
fIDDAO.save(issuerID);
if (issuerID == null)
{
issuerID = new IssuerIDImpl(fName, id);
fIDDAO.save(issuerID);
}
else
{
issuerID.setNext(id);
}
}
return null;
}
@@ -123,11 +130,46 @@ public class Issuer
{
if (fNext >= fLast)
{
IssuerID isID = fIDDAO.get(fName);
fNext = isID.getNext();
fLast = fNext + BLOCK_SIZE;
isID.setNext(fLast);
BlockGetter getter = new BlockGetter();
Thread thread = new Thread(getter);
thread.start();
try
{
thread.join();
}
catch (InterruptedException e)
{
// Do nothing.
}
fNext = getter.fNext;
fLast = getter.fLast;
}
return fNext++;
}
private class BlockGetter implements Runnable
{
public long fNext;
public long fLast;
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
public void run()
{
fTxnService.getRetryingTransactionHelper().doInTransaction(
new RetryingTransactionCallback<Object>()
{
public Object execute()
{
IssuerID isID = fIDDAO.get(fName);
fNext = isID.getNext();
fLast = fNext + BLOCK_SIZE;
isID.setNext(fLast);
return null;
}
});
}
}
}

View File

@@ -24,8 +24,6 @@
*/
package org.alfresco.repo.jscript;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.text.MessageFormat;
@@ -53,7 +51,6 @@ import org.alfresco.service.cmr.model.FileNotFoundException;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentIOException;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter;
@@ -81,7 +78,6 @@ import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
import org.mozilla.javascript.UniqueTag;
import org.mozilla.javascript.Wrapper;
import org.springframework.util.FileCopyUtils;
/**
* Node class implementation, specific for use by ScriptService as part of the object model.
@@ -834,6 +830,40 @@ public class ScriptNode implements Serializable, Scopeable
}
}
public String jsGet_downloadUrl()
{
return getDownloadUrl();
}
/**
* @return The WebDav cm:name based path to the content for the default content property
* (@see ContentModel.PROP_CONTENT)
*/
public String getWebdavUrl()
{
try
{
List<FileInfo> paths = this.services.getFileFolderService().getNamePath(null, getNodeRef());
// build up the webdav url
StringBuilder path = new StringBuilder(128);
path.append("/webdav");
// build up the path skipping the first path as it is the root folder
for (int i=1; i<paths.size(); i++)
{
path.append("/")
.append(URLEncoder.encode(paths.get(i).getName()));
}
return path.toString();
}
catch (FileNotFoundException nodeErr)
{
// cannot build path if file no longer exists
return "";
}
}
/**
* @return The mimetype encoding for content attached to the node from the default content property
* (@see ContentModel.PROP_CONTENT)

View File

@@ -431,6 +431,35 @@ public abstract class BaseContentNode implements TemplateContent
}
}
/**
* @return The WebDav cm:name based path to the content for the default content property
* (@see ContentModel.PROP_CONTENT)
*/
public String getWebdavUrl()
{
try
{
List<FileInfo> paths = this.services.getFileFolderService().getNamePath(null, getNodeRef());
// build up the webdav url
StringBuilder path = new StringBuilder(128);
path.append("/webdav");
// build up the path skipping the first path as it is the root folder
for (int i=1; i<paths.size(); i++)
{
path.append("/")
.append(URLEncoder.encode(paths.get(i).getName()));
}
return path.toString();
}
catch (FileNotFoundException nodeErr)
{
// cannot build path if file no longer exists
return "";
}
}
/**
* @return The mimetype encoding for content attached to the node from the default content property
* (@see ContentModel.PROP_CONTENT)

View File

@@ -11,6 +11,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.StaleObjectStateException;
import org.hibernate.StaleStateException;
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.LockAcquisitionException;
import org.springframework.aop.framework.ReflectiveMethodInvocation;
import org.springframework.dao.ConcurrencyFailureException;
@@ -124,7 +125,8 @@ public class RetryingTransactionAdvice implements MethodInterceptor
t instanceof DeadlockLoserDataAccessException ||
t instanceof StaleObjectStateException ||
t instanceof LockAcquisitionException ||
t instanceof StaleStateException)
t instanceof StaleStateException ||
t instanceof ConstraintViolationException)
{
shouldRetry = true;
try