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:
Derek Hulley
2007-09-10 14:30:55 +00:00
parent cd78bd51ba
commit b166891218
12 changed files with 268 additions and 577 deletions

View File

@@ -274,6 +274,9 @@
</property> </property>
<property name="contentStore"> <property name="contentStore">
<ref bean="auditFileContentStore"/> <ref bean="auditFileContentStore"/>
</property>
<property name="localSessionFactory">
<ref bean="&amp;sessionFactory"></ref> <!-- inject the actual factory, not a session -->
</property> </property>
</bean> </bean>

View File

@@ -1,458 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of Records Management Model -->
<!-- Note: the rma: namespace is defined further on in the document -->
<model name="rma:recordsmanagement" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Meta-data about the model -->
<description>Records Management Model</description>
<author>John Newton</author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
</imports>
<!-- Records Management Namespace -->
<namespaces>
<namespace uri="http://www.alfresco.org/model/record/1.0" prefix="rma"/>
</namespaces>
<aspects>
<!-- Definition of new Content Aspect: Record User-Specified Data -->
<!-- Please extend this for new records metadata -->
<aspect name="rma:userSpecifiedData">
<title>RM: User Specified Data</title>
<properties>
<property name="rma:privacyActSystem">
<title>Privacy Act System</title>
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
</property>
</properties>
</aspect>
<!-- Definition of new Content Aspect: FilePlan -->
<aspect name="rma:filePlan">
<title>RM: File Plan</title>
<properties>
<property name="rma:recordCategoryIdentifier">
<title>Record Category Identifier</title>
<type>d:text</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:dispositionAuthority">
<title>Disposition Authority</title>
<type>d:text</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:permanentRecordIndicator">
<title>Permanent Record Indicator</title>
<type>d:boolean</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:dispositionInstructions">
<title>Disposition Instructions</title>
<type>d:text</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:containsRecordFolders">
<title>Contains Records Folders</title>
<type>d:boolean</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:recordFolders">
<title>Name of Folders</title>
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:defaultMediaType">
<title>Default Media Format</title>
<type>d:category</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:defaultMarkingList">
<title>Default Marking List</title>
<type>d:category</type>
<mandatory enforced="false">false</mandatory>
<multiple>true</multiple>
</property>
<property name="rma:defaultOriginatingOrganization">
<title>Default Originating Org</title>
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
</property>
<!-- Vital Record Lifecycle State -->
<property name="rma:vitalRecordIndicator">
<title>Vital Record Indicator</title>
<type>d:boolean</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:vitalRecordReviewPeriod">
<title>Vital Record Review Period</title>
<type>d:category</type>
<mandatory enforced="false">true</mandatory>
</property>
<!-- Cut-off Lifecycle State -->
<property name="rma:processCutoff">
<title>Process Cutoff</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:eventTrigger">
<title>Event Trigger</title>
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:cutoffPeriod">
<title>Cutoff Period</title>
<type>d:category</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:cutoffOnObsolete">
<title>Cutoff When Obsolete</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:cutoffOnSuperseded">
<title>Cutoff When Superseded</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<!-- Hold Lifecycle State -->
<property name="rma:processHold">
<title>Process Hold</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:holdPeriod">
<title>Hold Period in Years</title>
<type>d:float</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:discretionaryHold">
<title>Discretionary Hold</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<!-- Transfer Lifecycle State -->
<property name="rma:processTransfer">
<title>Process Transfer</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:defaultTransferLocation">
<title>Transfer Location</title>
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:transferBlockSize">
<title>Transfer Blocksize in Years</title>
<type>d:float</type>
<mandatory enforced="false">false</mandatory>
</property>
<!-- Accession Lifecycle State -->
<property name="rma:processAccession">
<title>Process Accession</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:accessionPeriod">
<title>Time to Accession in Years</title>
<type>d:float</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:accessionLocation">
<title>Accession Location</title>
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:accessionBlockSize">
<title>Accession Blocksize in Years</title>
<type>d:float</type>
<mandatory enforced="false">false</mandatory>
</property>
<!-- Destruction Lifecycle State -->
<property name="rma:processDestruction">
<title>Process Destruction</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:destructionLocation"> <!-- hidden for now -->
<title>Destruction Location</title>
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
</property>
<!-- Miscellaneous Lifecycle Metadata -->
<property name="rma:filePlanNote">
<title>Note</title>
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:recordCounter">
<title>Record Counter</title>
<type>d:int</type>
<mandatory enforced="false">false</mandatory>
</property>
</properties>
<mandatory-aspects>
<aspect>rma:userSpecifiedData</aspect>
</mandatory-aspects>
</aspect>
<!-- Definition of Association Aspect: Superseded -->
<aspect name="rma:superseded">
<title>RM: Superseded</title>
<associations>
<association name="rma:superseding">
<title>Superceded By</title>
<source>
<role>rma:supersededBy</role>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>cm:content</class>
<role>rma:supersedes</role>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</aspect>
<!-- Definition of new Content Aspect: Record -->
<aspect name="rma:record">
<title>RM: Record</title>
<properties>
<property name="rma:recordIdentifier">
<title>Unique Record Identifier</title>
<type>d:text</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:subject">
<title>Subject</title>
<type>d:text</type>
</property>
<property name="rma:format">
<title>Format</title>
<type>d:text</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:mediaFormat">
<title>Media Format</title>
<type>d:category</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:dateFiled">
<title>Date Filed</title>
<type>d:datetime</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:publicationDate">
<title>Publication Date</title>
<type>d:datetime</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:dateReceived">
<title>Date Received</title>
<type>d:datetime</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:originator">
<title>Originator</title>
<type>d:text</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:originatingOrganization">
<title>Originating Organization</title>
<type>d:text</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:addressee">
<title>Addressee</title>
<type>d:text</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="rma:otherAddressees">
<title>Other Addressees</title>
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:supplementalMarkingList">
<title>Supplemental Marking List</title>
<type>d:category</type>
<mandatory enforced="false">false</mandatory>
<multiple>true</multiple>
</property>
<property name="rma:isObsolete">
<title>Obsolete</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:recordNote">
<title>Note</title>
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
</property>
</properties>
<mandatory-aspects>
<aspect>cm:auditable</aspect>
<aspect>cm:author</aspect>
<aspect>rma:userSpecifiedData</aspect>
<aspect>cm:referencing</aspect>
<aspect>rma:superseded</aspect>
</mandatory-aspects>
</aspect>
<!-- Definition of Disposition Aspect: Vital Record -->
<aspect name="rma:vitalrecord">
<title>RM: Vital Record</title>
<properties>
<property name="rma:isVitalRecord">
<title>Vital Record</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:prevReviewDate">
<title>Last Review Date</title>
<type>d:datetime</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:nextReviewDate">
<title>Next Review Date</title>
<type>d:datetime</type>
<mandatory enforced="false">false</mandatory>
</property>
</properties>
</aspect>
<!-- Definition of Disposition Aspect: Cutoffable -->
<aspect name="rma:cutoffable">
<title>RM: Cutoffable</title>
<properties>
<property name="rma:cutoffExecuted">
<title>Cutoff Executed</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:cutoffNow">
<title>Cutoff Now</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:cutoffDateTime">
<title>Cutoff Date</title>
<type>d:datetime</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:cutoffEvent">
<title>Cutoff Event</title>
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
</property>
</properties>
</aspect>
<!-- Definition of Disposition Aspect: Holdable -->
<aspect name="rma:holdable">
<title>RM: Holdable</title>
<properties>
<property name="rma:holdExecuted">
<title>Hold Executed</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:holdUntil">
<title>Hold Until</title>
<type>d:datetime</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:holdUntilEvent">
<title>Hold Until Event</title>
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:freeze">
<title>Freeze</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
</properties>
</aspect>
<!-- Definition of Disposition Aspect: Transferable -->
<aspect name="rma:transferable">
<title>RM: Transferable</title>
<properties>
<property name="rma:transferExecuted">
<title>Transfer Executed</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:transferDate">
<title>Transfer Date</title>
<type>d:datetime</type>
<mandatory enforced="false">false</mandatory>
</property>
</properties>
</aspect>
<!-- Definition of Disposition Aspect: Accessionable -->
<aspect name="rma:accessionable">
<title>RM: Accessionable</title>
<properties>
<property name="rma:accessionExecuted">
<title>Accession Executed</title>
<type>d:boolean</type>
<mandatory enforced="false">false</mandatory>
</property>
<property name="rma:accessionDate">
<title>Accession Date</title>
<type>d:datetime</type>
<mandatory enforced="false">false</mandatory>
</property>
</properties>
</aspect>
<!-- Definition of Disposition Aspect: Destroyable -->
<aspect name="rma:destroyable">
<title>RM: Destroyable</title>
<properties>
<property name="rma:destructionDate">
<title>Destruction Date</title>
<type>d:datetime</type>
<mandatory enforced="false">false</mandatory>
</property>
</properties>
<mandatory-aspects>
<!-- Needed to permanently destroy the attached object -->
<aspect>sys:temporary</aspect>
</mandatory-aspects>
</aspect>
</aspects>
</model>

View File

@@ -59,6 +59,9 @@
<property name="ruleService"> <property name="ruleService">
<ref bean="ruleService"/> <ref bean="ruleService"/>
</property> </property>
<property name="nodeService">
<ref bean="NodeService"/>
</property>
</bean> </bean>
<bean id="inbound" class="org.alfresco.repo.rule.RuleTypeImpl" parent="rule-type-base"> <bean id="inbound" class="org.alfresco.repo.rule.RuleTypeImpl" parent="rule-type-base">

View File

@@ -394,7 +394,7 @@ public class AlfrescoAuthenticator extends CifsAuthenticator
{ {
// Start a transaction // Start a transaction
sess.beginReadTransaction( m_transactionService); sess.beginWriteTransaction( m_transactionService);
// Default logon status to disallow // Default logon status to disallow

View File

@@ -553,10 +553,15 @@ public class CifsHelper
try 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 // rename temp file to the new name
fileFolderService.rename(tempNodeRef, newName); fileFolderService.rename(tempNodeRef, newName);
// rename new file to old name // rename new file to old name
fileFolderService.rename(nodeToMoveRef, tempName); fileFolderService.rename(nodeToMoveRef, tempName);
this.nodeService.addAspect(nodeToMoveRef, ContentModel.ASPECT_TEMPORARY, null);
} }
catch (org.alfresco.service.cmr.model.FileNotFoundException e) 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 * Return the file name for a node
* *

View File

@@ -1213,9 +1213,9 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
// Check for delete access // Check for delete access
if ( params.hasAccessMode(AccessMode.NTDelete) && // if ( params.hasAccessMode(AccessMode.NTDelete) &&
permissionService.hasPermission(nodeRef, PermissionService.DELETE) == AccessStatus.DENIED) // permissionService.hasPermission(nodeRef, PermissionService.DELETE) == AccessStatus.DENIED)
throw new AccessDeniedException("No delete access to " + params.getFullPath()); // throw new AccessDeniedException("No delete access to " + params.getFullPath());
// Check if the file has a lock // Check if the file has a lock
@@ -1899,6 +1899,14 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
NodeRef targetFolderRef = getNodeForPath(tree, splitPaths[0]); NodeRef targetFolderRef = getNodeForPath(tree, splitPaths[0]);
String name = splitPaths[1]; 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 // Update the state table
boolean relinked = false; boolean relinked = false;
@@ -1960,11 +1968,32 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
// Move the file/folder, if not relinked to previous version history // Move the file/folder, if not relinked to previous version history
if (!relinked) if (!relinked)
{
// Move or rename the file/folder
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 // Move the file/folder
cifsHelper.move(nodeToMoveRef, targetFolderRef, name); 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 // 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 // in case another file renamed to the old name. MS Word uses renames to move a new
// version of a document into place so we need to reconnect the version history. // version of a document into place so we need to reconnect the version history.
@@ -2009,7 +2038,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
// DEBUG // DEBUG
if (logger.isDebugEnabled()) 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) 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 // Convert to a general I/O exception
throw new IOException("Rename file " + oldName); throw new AccessDeniedException("Rename file " + oldName);
} }
} }

View File

@@ -34,9 +34,11 @@ import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.audit.AuditComponentImpl;
import org.alfresco.repo.audit.AuditConfiguration; import org.alfresco.repo.audit.AuditConfiguration;
import org.alfresco.repo.audit.AuditDAO; import org.alfresco.repo.audit.AuditDAO;
import org.alfresco.repo.audit.AuditState; 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.service.cmr.repository.datatype.Duration;
import org.alfresco.util.EqualsHelper; import org.alfresco.util.EqualsHelper;
import org.alfresco.util.GUID; import org.alfresco.util.GUID;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.mapping.Column;
import org.springframework.orm.hibernate3.HibernateCallback; import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.LocalSessionFactoryBean;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport; 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 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_DATE = "audit.GetLatestAuditDate";
public static final String QUERY_LAST_AUDIT_CONFIG = "audit.GetLatestAuditConfig"; public static final String QUERY_LAST_AUDIT_CONFIG = "audit.GetLatestAuditConfig";
@@ -100,6 +111,8 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
private ThreadLocal<HashMap<SourceKey, Long>> sourceIds = new ThreadLocal<HashMap<SourceKey, Long>>(); private ThreadLocal<HashMap<SourceKey, Long>> sourceIds = new ThreadLocal<HashMap<SourceKey, Long>>();
private LocalSessionFactoryBean localSessionFactory;
public HibernateAuditDAO() public HibernateAuditDAO()
{ {
super(); super();
@@ -116,6 +129,11 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
this.contentStore = contentStore; this.contentStore = contentStore;
} }
public void setLocalSessionFactory(LocalSessionFactoryBean localSessionFactory)
{
this.localSessionFactory = localSessionFactory;
}
public void audit(AuditState auditInfo) public void audit(AuditState auditInfo)
{ {
if (auditInfo.getUserIdentifier() == null) if (auditInfo.getUserIdentifier() == null)
@@ -163,25 +181,25 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
if (args != null) if (args != null)
{ {
int length;
switch (args.length) switch (args.length)
{ {
default: default:
case 5: case 5:
auditFact.setArg5(getStringOrNull(args[4])); auditFact.setArg5(getStringOrNull(args[4], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg5")));
case 4: case 4:
auditFact.setArg4(getStringOrNull(args[3])); auditFact.setArg4(getStringOrNull(args[3], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg4")));
case 3: case 3:
auditFact.setArg3(getStringOrNull(args[2])); auditFact.setArg3(getStringOrNull(args[2], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg3")));
case 2: case 2:
auditFact.setArg2(getStringOrNull(args[1])); auditFact.setArg2(getStringOrNull(args[1], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg2")));
case 1: case 1:
auditFact.setArg1(getStringOrNull(args[0])); auditFact.setArg1(getStringOrNull(args[0], getColumnLength("org.alfresco.repo.audit.hibernate.AuditFactImpl", "arg1")));
case 0: case 0:
} }
} }
auditFact.setClientInetAddress(auditInfo.getClientAddress() == null ? null : auditInfo.getClientAddress() auditFact.setClientInetAddress(auditInfo.getClientAddress() == null ? null : auditInfo.getClientAddress().toString());
.toString());
auditFact.setDate(auditInfo.getDate()); auditFact.setDate(auditInfo.getDate());
auditFact.setException(auditInfo.getThrowable() == null ? null : auditInfo.getThrowable().getMessage()); auditFact.setException(auditInfo.getThrowable() == null ? null : auditInfo.getThrowable().getMessage());
auditFact.setFail(auditInfo.isFail()); 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) if (o == null)
{ {
@@ -216,11 +250,21 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
{ {
try 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;
} }
} }
} }
@@ -245,11 +289,9 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
} }
if ((auditInfo.getAuditService() != null) if ((auditInfo.getAuditService() != null)
&& (auditInfo.getAuditService().length() > 0) && (auditInfo.getAuditMethod() != null) && (auditInfo.getAuditService().length() > 0) && (auditInfo.getAuditMethod() != null) && (auditInfo.getAuditMethod().length() > 0))
&& (auditInfo.getAuditMethod().length() > 0))
{ {
auditSourceImpl = AuditSourceImpl.getApplicationSource(getSession(), auditInfo.getAuditApplication(), auditSourceImpl = AuditSourceImpl.getApplicationSource(getSession(), auditInfo.getAuditApplication(), auditInfo.getAuditService(), auditInfo.getAuditMethod());
auditInfo.getAuditService(), auditInfo.getAuditMethod());
if (auditSourceImpl == null) if (auditSourceImpl == null)
{ {
auditSourceImpl = new AuditSourceImpl(); auditSourceImpl = new AuditSourceImpl();
@@ -350,8 +392,7 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
} }
catch (IOException e) catch (IOException e)
{ {
throw new AlfrescoRuntimeException( throw new AlfrescoRuntimeException("Failed to read and validate current audit configuration against the last", e);
"Failed to read and validate current audit configuration against the last", e);
} }
if (currentValue != lastValue) if (currentValue != lastValue)
{ {
@@ -368,8 +409,7 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
} }
else else
{ {
auditConfig = (AuditConfig) getSession() auditConfig = (AuditConfig) getSession().get(AuditConfigImpl.class, auditConfigImplId.get().longValue());
.get(AuditConfigImpl.class, auditConfigImplId.get().longValue());
if (auditConfig == null) if (auditConfig == null)
{ {
auditConfig = createNewAuditConfigImpl(auditInfo); auditConfig = createNewAuditConfigImpl(auditInfo);
@@ -472,8 +512,7 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
} }
SourceKey other = (SourceKey) o; SourceKey other = (SourceKey) o;
return EqualsHelper.nullSafeEquals(this.application, other.application) return EqualsHelper.nullSafeEquals(this.application, other.application)
&& EqualsHelper.nullSafeEquals(this.service, other.service) && EqualsHelper.nullSafeEquals(this.service, other.service) && EqualsHelper.nullSafeEquals(this.method, other.method);
&& EqualsHelper.nullSafeEquals(this.method, other.method);
} }
@Override @Override
@@ -509,5 +548,4 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
return answer; return answer;
} }
} }

View File

@@ -29,6 +29,7 @@ import java.util.List;
import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.avm.AVMNodeConverter;
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.avmsync.AVMDifference; import org.alfresco.service.cmr.avmsync.AVMDifference;
@@ -51,19 +52,17 @@ public class AVMClearSubmittedHandler extends JBPMSpringActionHandler
/** /**
* The AVMService instance. * The AVMService instance.
*/ */
private AVMService fAVMService; private AVMService avmService;
/** /**
* The AVMSyncService instance. * The AVMSyncService instance.
*/ */
private AVMSyncService fAVMSyncService; private AVMSyncService avmSyncService;
/** /**
* The AVMSubmittedAspect instance. * The AVMSubmittedAspect instance.
*/ */
private AVMSubmittedAspect fAVMSubmittedAspect; private AVMSubmittedAspect avmSubmittedAspect;
/** /**
* Initialize service references. * Initialize service references.
@@ -72,38 +71,58 @@ public class AVMClearSubmittedHandler extends JBPMSpringActionHandler
@Override @Override
protected void initialiseHandler(BeanFactory factory) protected void initialiseHandler(BeanFactory factory)
{ {
fAVMService = (AVMService)factory.getBean("AVMService"); this.avmService = (AVMService)factory.getBean(ServiceRegistry.AVM_SERVICE.getLocalName());
fAVMSyncService = (AVMSyncService)factory.getBean("AVMSyncService"); this.avmSyncService = (AVMSyncService)factory.getBean(ServiceRegistry.AVM_SYNC_SERVICE.getLocalName());
fAVMSubmittedAspect = (AVMSubmittedAspect)factory.getBean("AVMSubmittedAspect"); this.avmSubmittedAspect = (AVMSubmittedAspect)factory.getBean("AVMSubmittedAspect");
} }
/** /**
* 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
// NOTE: Submitted items can only be marked as "submitted" if we know where they came from // NOTE: Submitted items can only be marked as "submitted" if we know where they came from
String from = (String)executionContext.getContextInstance().getVariable("wcmwf_fromPath"); String from = (String)executionContext.getContextInstance().getVariable("wcmwf_fromPath");
if (from != null && from.length() > 0) if (from == null || from.length() == 0)
{ {
return;
}
// retrieve list of changes in submitted package // retrieve list of changes in submitted package
NodeRef pkg = ((JBPMNode)executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef(); NodeRef pkg = ((JBPMNode)executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef();
Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg); Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg);
AVMNodeDescriptor pkgDesc = fAVMService.lookup(pkgPath.getFirst(), pkgPath.getSecond()); AVMNodeDescriptor pkgDesc = this.avmService.lookup(pkgPath.getFirst(), pkgPath.getSecond());
String targetPath = pkgDesc.getIndirection(); String targetPath = pkgDesc.getIndirection();
List<AVMDifference> diffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, targetPath, null); final List<AVMDifference> diffs = this.avmSyncService.compare(pkgPath.getFirst(),
pkgPath.getSecond(),
-1,
targetPath,
null);
// for each change, mark original as submitted // for each change, mark original as submitted
for (AVMDifference diff : diffs) for (final AVMDifference diff : diffs)
{ {
String submittedPath = from + diff.getSourcePath().substring(pkgPath.getSecond().length()); final String submittedPath = from + diff.getSourcePath().substring(pkgPath.getSecond().length());
fAVMSubmittedAspect.clearSubmitted(-1, submittedPath); 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);
}
}
}
} }

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.repo.avm.wf; package org.alfresco.repo.avm.wf;
import java.io.Serializable; import java.io.Serializable;
@@ -44,8 +45,9 @@ 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;
public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements public class AVMSubmitPackageHandler
Serializable extends JBPMSpringActionHandler
implements Serializable
{ {
private static final long serialVersionUID = 4113360751217684995L; 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); final List<AVMDifference> stagingDiffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, targetPath, null);
for (final AVMDifference diff : stagingDiffs) for (final AVMDifference diff : stagingDiffs)
{ {
fAVMSubmittedAspect.clearSubmitted(diff.getSourceVersion(), diff.getSourcePath()); this.recursivelyRemoveLocksAndSubmittedAspect(webProject,
recursivelyRemoveLocks(webProject, diff.getSourceVersion(), diff.getSourcePath()); diff.getSourceVersion(),
diff.getSourcePath());
} }
// Allow AVMSubmitTransactionListener to inspect the staging diffs // 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 * Recursively remove locks from a path. Walking child folders looking for files
* to remove locks from. * 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); AVMNodeDescriptor desc = fAVMService.lookup(version, path, true);
if (desc.isFile() || desc.isDeletedFile()) if (desc.isFile() || desc.isDeletedFile())
{ {
@@ -159,10 +163,9 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
} }
else else
{ {
Map<String, AVMNodeDescriptor> list = fAVMService.getDirectoryListing(version, path, true); for (final AVMNodeDescriptor child : fAVMService.getDirectoryListingArray(version, path, true))
for (AVMNodeDescriptor child : list.values())
{ {
recursivelyRemoveLocks(webProject, version, child.getPath()); this.recursivelyRemoveLocksAndSubmittedAspect(webProject, version, child.getPath());
} }
} }
} }

View File

@@ -27,9 +27,11 @@ package org.alfresco.repo.rule;
import java.util.List; import java.util.List;
import org.alfresco.i18n.I18NUtil; import org.alfresco.i18n.I18NUtil;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.CommonResourceAbstractBase; import org.alfresco.repo.action.CommonResourceAbstractBase;
import org.alfresco.repo.rule.ruletrigger.RuleTrigger; import org.alfresco.repo.rule.ruletrigger.RuleTrigger;
import org.alfresco.service.cmr.repository.NodeRef; 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.Rule;
import org.alfresco.service.cmr.rule.RuleService; import org.alfresco.service.cmr.rule.RuleService;
import org.alfresco.service.cmr.rule.RuleType; import org.alfresco.service.cmr.rule.RuleType;
@@ -53,6 +55,11 @@ public class RuleTypeImpl extends CommonResourceAbstractBase implements RuleType
*/ */
private RuleService ruleService; private RuleService ruleService;
/**
* The node service
*/
private NodeService nodeService;
/** /**
* Constructor * Constructor
* *
@@ -79,6 +86,16 @@ public class RuleTypeImpl extends CommonResourceAbstractBase implements RuleType
this.ruleService = ruleService; this.ruleService = ruleService;
} }
/**
* Set the node service
*
* @param nodeService the node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/** /**
* Rule type initialise method * Rule type initialise method
*/ */
@@ -108,7 +125,9 @@ public class RuleTypeImpl extends CommonResourceAbstractBase implements RuleType
*/ */
public void triggerRuleType(NodeRef nodeRef, NodeRef actionedUponNodeRef, boolean executeRuleImmediately) 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) if (this.ruleService.hasRules(nodeRef) == true)
{ {

View File

@@ -868,7 +868,7 @@ public class NTLMAuthenticationComponentImpl extends AbstractAuthenticationCompo
// Wrap the service calls in a transaction // Wrap the service calls in a transaction
tx = m_transactionService.getUserTransaction( true); tx = m_transactionService.getUserTransaction( false);
tx.begin(); tx.begin();
// Map the passthru username to an Alfresco person // Map the passthru username to an Alfresco person

View File

@@ -64,7 +64,7 @@ public class PermissionModelTest extends AbstractPermissionTest
Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(new SimplePermissionReference(QName.createQName("cm", "cmobject", Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(new SimplePermissionReference(QName.createQName("cm", "cmobject",
namespacePrefixResolver), "Contributor")); namespacePrefixResolver), "Contributor"));
assertEquals(14, grantees.size()); assertEquals(16, grantees.size());
} }
public void testIncludePermissionGroups3() public void testIncludePermissionGroups3()
@@ -72,7 +72,7 @@ public class PermissionModelTest extends AbstractPermissionTest
Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(new SimplePermissionReference(QName.createQName("cm", "cmobject", Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(new SimplePermissionReference(QName.createQName("cm", "cmobject",
namespacePrefixResolver), "Editor")); namespacePrefixResolver), "Editor"));
assertEquals(17, grantees.size()); assertEquals(19, grantees.size());
} }
public void testIncludePermissionGroups4() public void testIncludePermissionGroups4()
@@ -80,7 +80,7 @@ public class PermissionModelTest extends AbstractPermissionTest
Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(new SimplePermissionReference(QName.createQName("cm", "cmobject", Set<PermissionReference> grantees = permissionModelDAO.getGranteePermissions(new SimplePermissionReference(QName.createQName("cm", "cmobject",
namespacePrefixResolver), "Collaborator")); namespacePrefixResolver), "Collaborator"));
assertEquals(24, grantees.size()); assertEquals(26, grantees.size());
} }
public void testIncludePermissionGroups5() public void testIncludePermissionGroups5()