mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.1 to HEAD
6349: Build fix after ReadPermissions was added to the permission model 6350: CIFS file rename fixes 6352: Management of avmsubmittedaspect, particularly as applies to newly created directories 6353: Added assemble to ignore property pattern 6354: Deployment project build stuff 6355: Fix for AR-1245 (Do not authenticate in a read only TX as it could create a person object) 6356: Office 2003 Add-Ins - Fixes to installers to support Vista 6357: Office Add-In web scripts - Updated to support the new Office 2007 extensions (.docx, .xlsx, .pptx) 6358: Fix for AR-1392 - Audit string lengths 6359: Remove unwanted rule model from repo Fix issue with update rules on spaces causing documents to be deleted in CIFS 6360: Office 2003 Add-In Installers, Vista fixes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6723 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -394,7 +394,7 @@ public class AlfrescoAuthenticator extends CifsAuthenticator
|
||||
{
|
||||
// Start a transaction
|
||||
|
||||
sess.beginReadTransaction( m_transactionService);
|
||||
sess.beginWriteTransaction( m_transactionService);
|
||||
|
||||
// Default logon status to disallow
|
||||
|
||||
|
@@ -553,10 +553,15 @@ public class CifsHelper
|
||||
|
||||
try
|
||||
{
|
||||
// remove the tempory aspects from the nodes, this will be reapplied if the new name dictates it
|
||||
nodeService.removeAspect(tempNodeRef, ContentModel.ASPECT_TEMPORARY);
|
||||
|
||||
// rename temp file to the new name
|
||||
fileFolderService.rename(tempNodeRef, newName);
|
||||
|
||||
// rename new file to old name
|
||||
fileFolderService.rename(nodeToMoveRef, tempName);
|
||||
this.nodeService.addAspect(nodeToMoveRef, ContentModel.ASPECT_TEMPORARY, null);
|
||||
}
|
||||
catch (org.alfresco.service.cmr.model.FileNotFoundException e)
|
||||
{
|
||||
@@ -617,6 +622,36 @@ public class CifsHelper
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a node
|
||||
*
|
||||
* @param nodeToRenameRef Node to be renamed
|
||||
* @param newName New name for the node
|
||||
* @throws FileExistsException
|
||||
*/
|
||||
public void rename(NodeRef nodeToRenameRef, String newName) throws FileExistsException
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check if the new file name is a temporary file name
|
||||
if ( newName.endsWith(".tmp") || newName.endsWith(".temp"))
|
||||
nodeService.addAspect(nodeToRenameRef, ContentModel.ASPECT_TEMPORARY, null);
|
||||
|
||||
fileFolderService.rename(nodeToRenameRef, newName);
|
||||
}
|
||||
catch (org.alfresco.service.cmr.model.FileExistsException e)
|
||||
{
|
||||
throw new FileExistsException(newName);
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Rename failed: \n" +
|
||||
" node to rename: " + nodeToRenameRef + "\n" +
|
||||
" new name: " + newName,
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the file name for a node
|
||||
*
|
||||
|
@@ -1213,9 +1213,9 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
|
||||
// Check for delete access
|
||||
|
||||
if ( params.hasAccessMode(AccessMode.NTDelete) &&
|
||||
permissionService.hasPermission(nodeRef, PermissionService.DELETE) == AccessStatus.DENIED)
|
||||
throw new AccessDeniedException("No delete access to " + params.getFullPath());
|
||||
// if ( params.hasAccessMode(AccessMode.NTDelete) &&
|
||||
// permissionService.hasPermission(nodeRef, PermissionService.DELETE) == AccessStatus.DENIED)
|
||||
// throw new AccessDeniedException("No delete access to " + params.getFullPath());
|
||||
|
||||
// Check if the file has a lock
|
||||
|
||||
@@ -1899,6 +1899,14 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
NodeRef targetFolderRef = getNodeForPath(tree, splitPaths[0]);
|
||||
String name = splitPaths[1];
|
||||
|
||||
// Check if this is a rename within the same folder
|
||||
|
||||
String[] oldPaths = FileName.splitPath( oldName);
|
||||
|
||||
boolean sameFolder = false;
|
||||
if ( splitPaths[0].equalsIgnoreCase( oldPaths[0]))
|
||||
sameFolder = true;
|
||||
|
||||
// Update the state table
|
||||
|
||||
boolean relinked = false;
|
||||
@@ -1961,9 +1969,30 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
|
||||
if (!relinked)
|
||||
{
|
||||
// Move the file/folder
|
||||
// Move or rename the file/folder
|
||||
|
||||
cifsHelper.move(nodeToMoveRef, targetFolderRef, name);
|
||||
if ( sameFolder == true)
|
||||
{
|
||||
// Rename the file/folder
|
||||
|
||||
cifsHelper.rename(nodeToMoveRef, name);
|
||||
|
||||
// DEBUG
|
||||
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("Renamed file: from: " + oldName + " to: " + newName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Move the file/folder
|
||||
|
||||
cifsHelper.move(nodeToMoveRef, targetFolderRef, name);
|
||||
|
||||
// DEBUG
|
||||
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("Moved file: from: " + oldName + " to: " + newName);
|
||||
}
|
||||
|
||||
// Check if we renamed a file, if so then cache the rename details for a short period
|
||||
// in case another file renamed to the old name. MS Word uses renames to move a new
|
||||
@@ -2009,7 +2038,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
// DEBUG
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Moved node: " + " from: " + oldName + " to: " + newName);
|
||||
logger.debug("Moved node: from: " + oldName + " to: " + newName);
|
||||
}
|
||||
catch (org.alfresco.repo.security.permissions.AccessDeniedException ex)
|
||||
{
|
||||
@@ -2042,7 +2071,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
|
||||
// Convert to a general I/O exception
|
||||
|
||||
throw new IOException("Rename file " + oldName);
|
||||
throw new AccessDeniedException("Rename file " + oldName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -34,9 +34,11 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.audit.AuditComponentImpl;
|
||||
import org.alfresco.repo.audit.AuditConfiguration;
|
||||
import org.alfresco.repo.audit.AuditDAO;
|
||||
import org.alfresco.repo.audit.AuditState;
|
||||
@@ -52,8 +54,12 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.datatype.Duration;
|
||||
import org.alfresco.util.EqualsHelper;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.mapping.Column;
|
||||
import org.springframework.orm.hibernate3.HibernateCallback;
|
||||
import org.springframework.orm.hibernate3.LocalSessionFactoryBean;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
/**
|
||||
@@ -63,6 +69,11 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
*/
|
||||
public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO, TransactionalDao
|
||||
{
|
||||
/**
|
||||
* Logging
|
||||
*/
|
||||
private static Log s_logger = LogFactory.getLog(HibernateAuditDAO.class);
|
||||
|
||||
public static final String QUERY_LAST_AUDIT_DATE = "audit.GetLatestAuditDate";
|
||||
|
||||
public static final String QUERY_LAST_AUDIT_CONFIG = "audit.GetLatestAuditConfig";
|
||||
@@ -78,13 +89,13 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
public static final String QUERY_AUDIT_APP_SOURCE_MET = "method";
|
||||
|
||||
public static final String QUERY_AUDIT_TRAIL = "audit.GetAuditTrailForNode";
|
||||
|
||||
|
||||
public static final String QUERY_AUDIT_PROTOCOL = "protocol";
|
||||
|
||||
|
||||
public static final String QUERY_AUDIT_STORE_ID = "store_id";
|
||||
|
||||
|
||||
public static final String QUERY_AUDIT_NODE_ID = "node_id";
|
||||
|
||||
|
||||
public static final String QUERY_AUDIT_NODE_REF = "nodeRef";
|
||||
|
||||
/** a uuid identifying this unique instance */
|
||||
@@ -97,9 +108,11 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
private ThreadLocal<Long> auditConfigImplId = new ThreadLocal<Long>();
|
||||
|
||||
private ThreadLocal<Long> auditDateImplId = new ThreadLocal<Long>();
|
||||
|
||||
|
||||
private ThreadLocal<HashMap<SourceKey, Long>> sourceIds = new ThreadLocal<HashMap<SourceKey, Long>>();
|
||||
|
||||
private LocalSessionFactoryBean localSessionFactory;
|
||||
|
||||
public HibernateAuditDAO()
|
||||
{
|
||||
super();
|
||||
@@ -116,13 +129,18 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
this.contentStore = contentStore;
|
||||
}
|
||||
|
||||
public void setLocalSessionFactory(LocalSessionFactoryBean localSessionFactory)
|
||||
{
|
||||
this.localSessionFactory = localSessionFactory;
|
||||
}
|
||||
|
||||
public void audit(AuditState auditInfo)
|
||||
{
|
||||
if(auditInfo.getUserIdentifier() == null)
|
||||
if (auditInfo.getUserIdentifier() == null)
|
||||
{
|
||||
auditInfo.setUserIdentifier(AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
if(AuthenticationUtil.getCurrentUserName() == null)
|
||||
if (AuthenticationUtil.getCurrentUserName() == null)
|
||||
{
|
||||
AuthenticationUtil.setSystemUserAsCurrentUser();
|
||||
try
|
||||
@@ -131,7 +149,7 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
}
|
||||
finally
|
||||
{
|
||||
AuthenticationUtil.clearCurrentSecurityContext();
|
||||
AuthenticationUtil.clearCurrentSecurityContext();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -139,7 +157,7 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
audit0(auditInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void audit0(AuditState auditInfo)
|
||||
{
|
||||
// Find/Build the configuraton entry
|
||||
@@ -163,25 +181,25 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
|
||||
if (args != null)
|
||||
{
|
||||
int length;
|
||||
switch (args.length)
|
||||
{
|
||||
default:
|
||||
case 5:
|
||||
auditFact.setArg5(getStringOrNull(args[4]));
|
||||
auditFact.setArg5(getStringOrNull(args[4], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg5")));
|
||||
case 4:
|
||||
auditFact.setArg4(getStringOrNull(args[3]));
|
||||
auditFact.setArg4(getStringOrNull(args[3], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg4")));
|
||||
case 3:
|
||||
auditFact.setArg3(getStringOrNull(args[2]));
|
||||
auditFact.setArg3(getStringOrNull(args[2], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg3")));
|
||||
case 2:
|
||||
auditFact.setArg2(getStringOrNull(args[1]));
|
||||
auditFact.setArg2(getStringOrNull(args[1], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg2")));
|
||||
case 1:
|
||||
auditFact.setArg1(getStringOrNull(args[0]));
|
||||
auditFact.setArg1(getStringOrNull(args[0], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg1")));
|
||||
case 0:
|
||||
}
|
||||
}
|
||||
|
||||
auditFact.setClientInetAddress(auditInfo.getClientAddress() == null ? null : auditInfo.getClientAddress()
|
||||
.toString());
|
||||
auditFact.setClientInetAddress(auditInfo.getClientAddress() == null ? null : auditInfo.getClientAddress().toString());
|
||||
auditFact.setDate(auditInfo.getDate());
|
||||
auditFact.setException(auditInfo.getThrowable() == null ? null : auditInfo.getThrowable().getMessage());
|
||||
auditFact.setFail(auditInfo.isFail());
|
||||
@@ -206,7 +224,23 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
|
||||
}
|
||||
|
||||
private String getStringOrNull(Object o)
|
||||
private int getColumnLength(String entityName, String propertyName)
|
||||
{
|
||||
int length = -1;
|
||||
Iterator it = localSessionFactory.getConfiguration().getClassMapping(entityName).getProperty(propertyName).getValue().getColumnIterator();
|
||||
if (it.hasNext())
|
||||
{
|
||||
Column col = (Column) it.next();
|
||||
length = col.getLength();
|
||||
}
|
||||
if (s_logger.isDebugEnabled())
|
||||
{
|
||||
s_logger.debug(entityName + " "+propertyName+ " is of length " + length);
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
private String getStringOrNull(Object o, int size)
|
||||
{
|
||||
if (o == null)
|
||||
{
|
||||
@@ -216,11 +250,21 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
{
|
||||
try
|
||||
{
|
||||
return o.toString();
|
||||
String answer = o.toString();
|
||||
if((size > -1) && (answer.length() > size))
|
||||
{
|
||||
answer = answer.substring(0, size);
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
catch(Throwable t)
|
||||
catch (Throwable t)
|
||||
{
|
||||
return "Throwable in toString implementation for "+o.getClass() + " was "+t.getMessage();
|
||||
String answer = "Throwable in toString implementation for " + o.getClass() + " was " + t.getMessage();
|
||||
if((size > -1) && (answer.length() > size))
|
||||
{
|
||||
answer = answer.substring(0, size);
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,28 +272,26 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
private AuditSource getAuditSource(AuditState auditInfo)
|
||||
{
|
||||
AuditSource auditSourceImpl;
|
||||
|
||||
|
||||
SourceKey sourceKey = new SourceKey(auditInfo.getAuditApplication(), auditInfo.getAuditService(), auditInfo.getAuditMethod());
|
||||
if(sourceIds.get() == null)
|
||||
if (sourceIds.get() == null)
|
||||
{
|
||||
sourceIds.set(new HashMap<SourceKey, Long>());
|
||||
}
|
||||
Long id = sourceIds.get().get(sourceKey);
|
||||
if(id != null)
|
||||
if (id != null)
|
||||
{
|
||||
auditSourceImpl = (AuditSource) getSession().get(AuditSourceImpl.class, id.longValue());
|
||||
if(auditSourceImpl != null)
|
||||
if (auditSourceImpl != null)
|
||||
{
|
||||
return auditSourceImpl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((auditInfo.getAuditService() != null)
|
||||
&& (auditInfo.getAuditService().length() > 0) && (auditInfo.getAuditMethod() != null)
|
||||
&& (auditInfo.getAuditMethod().length() > 0))
|
||||
&& (auditInfo.getAuditService().length() > 0) && (auditInfo.getAuditMethod() != null) && (auditInfo.getAuditMethod().length() > 0))
|
||||
{
|
||||
auditSourceImpl = AuditSourceImpl.getApplicationSource(getSession(), auditInfo.getAuditApplication(),
|
||||
auditInfo.getAuditService(), auditInfo.getAuditMethod());
|
||||
auditSourceImpl = AuditSourceImpl.getApplicationSource(getSession(), auditInfo.getAuditApplication(), auditInfo.getAuditService(), auditInfo.getAuditMethod());
|
||||
if (auditSourceImpl == null)
|
||||
{
|
||||
auditSourceImpl = new AuditSourceImpl();
|
||||
@@ -350,8 +392,7 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(
|
||||
"Failed to read and validate current audit configuration against the last", e);
|
||||
throw new AlfrescoRuntimeException("Failed to read and validate current audit configuration against the last", e);
|
||||
}
|
||||
if (currentValue != lastValue)
|
||||
{
|
||||
@@ -368,8 +409,7 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
}
|
||||
else
|
||||
{
|
||||
auditConfig = (AuditConfig) getSession()
|
||||
.get(AuditConfigImpl.class, auditConfigImplId.get().longValue());
|
||||
auditConfig = (AuditConfig) getSession().get(AuditConfigImpl.class, auditConfigImplId.get().longValue());
|
||||
if (auditConfig == null)
|
||||
{
|
||||
auditConfig = createNewAuditConfigImpl(auditInfo);
|
||||
@@ -472,8 +512,7 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
}
|
||||
SourceKey other = (SourceKey) o;
|
||||
return EqualsHelper.nullSafeEquals(this.application, other.application)
|
||||
&& EqualsHelper.nullSafeEquals(this.service, other.service)
|
||||
&& EqualsHelper.nullSafeEquals(this.method, other.method);
|
||||
&& EqualsHelper.nullSafeEquals(this.service, other.service) && EqualsHelper.nullSafeEquals(this.method, other.method);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -494,20 +533,19 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
|
||||
|
||||
public List<AuditInfo> getAuditTrail(NodeRef nodeRef)
|
||||
{
|
||||
if(nodeRef == null)
|
||||
if (nodeRef == null)
|
||||
{
|
||||
return Collections.<AuditInfo>emptyList();
|
||||
return Collections.<AuditInfo> emptyList();
|
||||
}
|
||||
List<? extends AuditFact> internalTrail = AuditFactImpl.getAuditTrail(getSession(), nodeRef);
|
||||
|
||||
|
||||
ArrayList<AuditInfo> answer = new ArrayList<AuditInfo>(internalTrail.size());
|
||||
for(AuditFact auditFact : internalTrail)
|
||||
for (AuditFact auditFact : internalTrail)
|
||||
{
|
||||
AuditInfo info = new AuditInfoImpl(auditFact);
|
||||
answer.add(info);
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ import java.util.List;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
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.avmsync.AVMDifference;
|
||||
@@ -46,64 +47,82 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
*/
|
||||
public class AVMClearSubmittedHandler extends JBPMSpringActionHandler
|
||||
{
|
||||
private static final long serialVersionUID = 4113360751217684995L;
|
||||
private static final long serialVersionUID = 4113360751217684995L;
|
||||
|
||||
/**
|
||||
* The AVMService instance.
|
||||
*/
|
||||
private AVMService fAVMService;
|
||||
/**
|
||||
* The AVMService instance.
|
||||
*/
|
||||
private AVMService avmService;
|
||||
|
||||
/**
|
||||
* The AVMSyncService instance.
|
||||
*/
|
||||
private AVMSyncService fAVMSyncService;
|
||||
/**
|
||||
* The AVMSyncService instance.
|
||||
*/
|
||||
private AVMSyncService avmSyncService;
|
||||
|
||||
/**
|
||||
* The AVMSubmittedAspect instance.
|
||||
*/
|
||||
private AVMSubmittedAspect fAVMSubmittedAspect;
|
||||
/**
|
||||
* The AVMSubmittedAspect instance.
|
||||
*/
|
||||
private AVMSubmittedAspect avmSubmittedAspect;
|
||||
|
||||
/**
|
||||
* Initialize service references.
|
||||
* @param factory The BeanFactory to get references from.
|
||||
*/
|
||||
@Override
|
||||
protected void initialiseHandler(BeanFactory factory)
|
||||
{
|
||||
this.avmService = (AVMService)factory.getBean(ServiceRegistry.AVM_SERVICE.getLocalName());
|
||||
this.avmSyncService = (AVMSyncService)factory.getBean(ServiceRegistry.AVM_SYNC_SERVICE.getLocalName());
|
||||
this.avmSubmittedAspect = (AVMSubmittedAspect)factory.getBean("AVMSubmittedAspect");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize service references.
|
||||
* @param factory The BeanFactory to get references from.
|
||||
*/
|
||||
@Override
|
||||
protected void initialiseHandler(BeanFactory factory)
|
||||
{
|
||||
fAVMService = (AVMService)factory.getBean("AVMService");
|
||||
fAVMSyncService = (AVMSyncService)factory.getBean("AVMSyncService");
|
||||
fAVMSubmittedAspect = (AVMSubmittedAspect)factory.getBean("AVMSubmittedAspect");
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the actual work.
|
||||
* @param executionContext The context to get stuff from.
|
||||
*/
|
||||
public void execute(ExecutionContext executionContext) throws Exception
|
||||
{
|
||||
// TODO: Allow submit parameters to be passed into this action handler
|
||||
// rather than pulling directly from execution context
|
||||
/**
|
||||
* Do the actual work.
|
||||
* @param executionContext The context to get stuff from.
|
||||
*/
|
||||
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
|
||||
|
||||
// NOTE: Submitted items can only be marked as "submitted" if we know where they came from
|
||||
String from = (String)executionContext.getContextInstance().getVariable("wcmwf_fromPath");
|
||||
if (from != null && from.length() > 0)
|
||||
{
|
||||
// retrieve list of changes in submitted package
|
||||
NodeRef pkg = ((JBPMNode)executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef();
|
||||
Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg);
|
||||
AVMNodeDescriptor pkgDesc = fAVMService.lookup(pkgPath.getFirst(), pkgPath.getSecond());
|
||||
String targetPath = pkgDesc.getIndirection();
|
||||
List<AVMDifference> diffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, targetPath, null);
|
||||
// NOTE: Submitted items can only be marked as "submitted" if we know where they came from
|
||||
String from = (String)executionContext.getContextInstance().getVariable("wcmwf_fromPath");
|
||||
if (from == null || from.length() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// retrieve list of changes in submitted package
|
||||
NodeRef pkg = ((JBPMNode)executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef();
|
||||
Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg);
|
||||
AVMNodeDescriptor pkgDesc = this.avmService.lookup(pkgPath.getFirst(), pkgPath.getSecond());
|
||||
String targetPath = pkgDesc.getIndirection();
|
||||
final List<AVMDifference> diffs = this.avmSyncService.compare(pkgPath.getFirst(),
|
||||
pkgPath.getSecond(),
|
||||
-1,
|
||||
targetPath,
|
||||
null);
|
||||
|
||||
// for each change, mark original as submitted
|
||||
for (AVMDifference diff : diffs)
|
||||
{
|
||||
String submittedPath = from + diff.getSourcePath().substring(pkgPath.getSecond().length());
|
||||
fAVMSubmittedAspect.clearSubmitted(-1, submittedPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for each change, mark original as submitted
|
||||
for (final AVMDifference diff : diffs)
|
||||
{
|
||||
final String submittedPath = from + diff.getSourcePath().substring(pkgPath.getSecond().length());
|
||||
this.clearSubmitted(this.avmService.lookup(-1, submittedPath, true));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively clear the submitted aspect.
|
||||
*/
|
||||
private void clearSubmitted(final AVMNodeDescriptor d)
|
||||
{
|
||||
this.avmSubmittedAspect.clearSubmitted(d.getVersionID(), d.getPath());
|
||||
if (d.isDirectory())
|
||||
{
|
||||
for (final AVMNodeDescriptor c : this.avmService.getDirectoryListingArray(d, true))
|
||||
{
|
||||
this.clearSubmitted(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,8 @@
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing" */
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
package org.alfresco.repo.avm.wf;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -44,8 +45,9 @@ import org.alfresco.util.Pair;
|
||||
import org.jbpm.graph.exe.ExecutionContext;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
|
||||
public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
||||
Serializable
|
||||
public class AVMSubmitPackageHandler
|
||||
extends JBPMSpringActionHandler
|
||||
implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 4113360751217684995L;
|
||||
|
||||
@@ -116,8 +118,9 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
||||
final List<AVMDifference> stagingDiffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, targetPath, null);
|
||||
for (final AVMDifference diff : stagingDiffs)
|
||||
{
|
||||
fAVMSubmittedAspect.clearSubmitted(diff.getSourceVersion(), diff.getSourcePath());
|
||||
recursivelyRemoveLocks(webProject, diff.getSourceVersion(), diff.getSourcePath());
|
||||
this.recursivelyRemoveLocksAndSubmittedAspect(webProject,
|
||||
diff.getSourceVersion(),
|
||||
diff.getSourcePath());
|
||||
}
|
||||
|
||||
// Allow AVMSubmitTransactionListener to inspect the staging diffs
|
||||
@@ -150,8 +153,9 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
||||
* Recursively remove locks from a path. Walking child folders looking for files
|
||||
* to remove locks from.
|
||||
*/
|
||||
private void recursivelyRemoveLocks(String webProject, int version, String path)
|
||||
private void recursivelyRemoveLocksAndSubmittedAspect(final String webProject, final int version, final String path)
|
||||
{
|
||||
fAVMSubmittedAspect.clearSubmitted(version, path);
|
||||
AVMNodeDescriptor desc = fAVMService.lookup(version, path, true);
|
||||
if (desc.isFile() || desc.isDeletedFile())
|
||||
{
|
||||
@@ -159,10 +163,9 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
|
||||
}
|
||||
else
|
||||
{
|
||||
Map<String, AVMNodeDescriptor> list = fAVMService.getDirectoryListing(version, path, true);
|
||||
for (AVMNodeDescriptor child : list.values())
|
||||
for (final AVMNodeDescriptor child : fAVMService.getDirectoryListingArray(version, path, true))
|
||||
{
|
||||
recursivelyRemoveLocks(webProject, version, child.getPath());
|
||||
this.recursivelyRemoveLocksAndSubmittedAspect(webProject, version, child.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,9 +27,11 @@ package org.alfresco.repo.rule;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.action.CommonResourceAbstractBase;
|
||||
import org.alfresco.repo.rule.ruletrigger.RuleTrigger;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.rule.Rule;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
import org.alfresco.service.cmr.rule.RuleType;
|
||||
@@ -52,6 +54,11 @@ public class RuleTypeImpl extends CommonResourceAbstractBase implements RuleType
|
||||
* The rule service
|
||||
*/
|
||||
private RuleService ruleService;
|
||||
|
||||
/**
|
||||
* The node service
|
||||
*/
|
||||
private NodeService nodeService;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -78,6 +85,16 @@ public class RuleTypeImpl extends CommonResourceAbstractBase implements RuleType
|
||||
{
|
||||
this.ruleService = ruleService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the node service
|
||||
*
|
||||
* @param nodeService the node service
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rule type initialise method
|
||||
@@ -108,7 +125,9 @@ public class RuleTypeImpl extends CommonResourceAbstractBase implements RuleType
|
||||
*/
|
||||
public void triggerRuleType(NodeRef nodeRef, NodeRef actionedUponNodeRef, boolean executeRuleImmediately)
|
||||
{
|
||||
if (this.ruleService.isEnabled() == true)
|
||||
if (this.ruleService.isEnabled() == true &&
|
||||
this.nodeService.exists(actionedUponNodeRef) == true &&
|
||||
this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_TEMPORARY) == false)
|
||||
{
|
||||
if (this.ruleService.hasRules(nodeRef) == true)
|
||||
{
|
||||
|
@@ -868,7 +868,7 @@ public class NTLMAuthenticationComponentImpl extends AbstractAuthenticationCompo
|
||||
|
||||
// Wrap the service calls in a transaction
|
||||
|
||||
tx = m_transactionService.getUserTransaction( true);
|
||||
tx = m_transactionService.getUserTransaction( false);
|
||||
tx.begin();
|
||||
|
||||
// Map the passthru username to an Alfresco person
|
||||
|
@@ -64,7 +64,7 @@ public class PermissionModelTest extends AbstractPermissionTest
|
||||
Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(new SimplePermissionReference(QName.createQName("cm", "cmobject",
|
||||
namespacePrefixResolver), "Contributor"));
|
||||
|
||||
assertEquals(14, grantees.size());
|
||||
assertEquals(16, grantees.size());
|
||||
}
|
||||
|
||||
public void testIncludePermissionGroups3()
|
||||
@@ -72,7 +72,7 @@ public class PermissionModelTest extends AbstractPermissionTest
|
||||
Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(new SimplePermissionReference(QName.createQName("cm", "cmobject",
|
||||
namespacePrefixResolver), "Editor"));
|
||||
|
||||
assertEquals(17, grantees.size());
|
||||
assertEquals(19, grantees.size());
|
||||
}
|
||||
|
||||
public void testIncludePermissionGroups4()
|
||||
@@ -80,7 +80,7 @@ public class PermissionModelTest extends AbstractPermissionTest
|
||||
Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(new SimplePermissionReference(QName.createQName("cm", "cmobject",
|
||||
namespacePrefixResolver), "Collaborator"));
|
||||
|
||||
assertEquals(24, grantees.size());
|
||||
assertEquals(26, grantees.size());
|
||||
}
|
||||
|
||||
public void testIncludePermissionGroups5()
|
||||
|
Reference in New Issue
Block a user