Merge V3.2 to HEAD

19453: Merged BRANCHES/DEV/BELARUS/V3.2-2010_03_17 to BRANCHES/V3.2: 
      19407: ALF-254: empty files (0 bytes) do not trigger content rules 
         - Some Javadoc cleanup added    
   19601: Follow-up fix for ALF-254: Empty files (0 bytes) do not trigger content rules 
      - CIFS uses 'sys:noContent' instead of 'sys:temporary'; the latter has other behaviour attached



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19639 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2010-03-29 13:27:36 +00:00
parent eaccdd978b
commit 28f113a0a3
7 changed files with 24 additions and 10 deletions

View File

@@ -147,6 +147,12 @@
<archive>false</archive>
</aspect>
<!-- aspect to tag nodes being formed and without any content yet -->
<aspect name="sys:noContent">
<title>NoContent</title>
<archive>false</archive>
</aspect>
<!-- details stored on archived nodes -->
<aspect name="sys:archived">
<title>Archived</title>

View File

@@ -1835,6 +1835,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
// Create it - the path will be created, if necessary
NodeRef nodeRef = cifsHelper.createNode(deviceRootNodeRef, path, true);
nodeService.addAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT, null);
// Create the network file

View File

@@ -408,9 +408,11 @@ public class ContentNetworkFile extends NodeRefNetworkFile
if (contentChanged)
{
ContentData contentData = content.getContentData();
NodeRef contentNodeRef = getNodeRef();
nodeService.removeAspect(contentNodeRef, ContentModel.ASPECT_NO_CONTENT);
try
{
nodeService.setProperty( getNodeRef(), ContentModel.PROP_CONTENT, contentData);
nodeService.setProperty( contentNodeRef, ContentModel.PROP_CONTENT, contentData);
}
catch (ContentQuotaException qe)
{

View File

@@ -45,6 +45,9 @@ public interface ContentModel
// tag for temporary nodes
static final QName ASPECT_TEMPORARY = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "temporary");
// tag for nodes being formed (CIFS)
static final QName ASPECT_NO_CONTENT = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "noContent");
// tag for localized nodes
static final QName ASPECT_LOCALIZED = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "localized");
static final QName PROP_LOCALE = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "locale");

View File

@@ -35,6 +35,7 @@ import org.alfresco.repo.content.cleanup.EagerContentStoreCleaner;
import org.alfresco.repo.content.filestore.FileContentStore;
import org.alfresco.repo.content.transform.ContentTransformer;
import org.alfresco.repo.content.transform.ContentTransformerRegistry;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.ClassPolicyDelegate;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
@@ -175,7 +176,7 @@ public class ContentServiceImpl implements ContentService
// Bind on update properties behaviour
this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME,
this,
new JavaBehaviour(this, "onUpdateProperties"));
@@ -197,6 +198,12 @@ public class ContentServiceImpl implements ContentService
Map<QName, Serializable> before,
Map<QName, Serializable> after)
{
// ALF-254: empty files (0 bytes) do not trigger content rules
if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT))
{
return;
}
// Don't duplicate work when firing multiple policies
Set<QName> types = null;
OnContentPropertyUpdatePolicy propertyPolicy = null; // Doesn't change for the node instance

View File

@@ -26,9 +26,6 @@ import org.alfresco.repo.content.ContentStore;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
import org.alfresco.repo.transaction.TransactionListenerAdapter;
import org.alfresco.repo.transaction.TransactionalResourceHelper;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.PropertyCheck;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -69,13 +66,11 @@ public class EagerContentStoreCleaner extends TransactionListenerAdapter
{
/**
* Content URLs to delete once the transaction commits.
* @see #onContentPropertyUpdate(NodeRef, QName, ContentData, ContentData)
* @see #afterCommit()
*/
private static final String KEY_POST_COMMIT_DELETION_URLS = "ContentStoreCleaner.PostCommitDeletionUrls";
/**
* Content URLs to delete if the transaction rolls back.
* @see #onContentPropertyUpdate(NodeRef, QName, ContentData, ContentData)
* @see #afterRollback()
*/
private static final String KEY_POST_ROLLBACK_DELETION_URLS = "ContentStoreCleaner.PostRollbackDeletionUrls";

View File

@@ -153,7 +153,7 @@ public class ContentData implements Serializable
* Helper method to determine if the data represents any physical content or not.
*
* @param contentData the content to check (may be <tt>null</tt>)
* @return <tt>true</tt> if the value is non-null and has a content URL of non-zero length
* @return <tt>true</tt> if the value is non-null
*/
public static boolean hasContent(ContentData contentData)
{
@@ -161,7 +161,7 @@ public class ContentData implements Serializable
{
return false;
}
return (contentData.contentUrl != null) && (contentData.size > 0L);
return contentData.contentUrl != null;
}
/**