mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
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:
@@ -147,6 +147,12 @@
|
|||||||
<archive>false</archive>
|
<archive>false</archive>
|
||||||
</aspect>
|
</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 -->
|
<!-- details stored on archived nodes -->
|
||||||
<aspect name="sys:archived">
|
<aspect name="sys:archived">
|
||||||
<title>Archived</title>
|
<title>Archived</title>
|
||||||
|
@@ -1835,6 +1835,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
|||||||
// Create it - the path will be created, if necessary
|
// Create it - the path will be created, if necessary
|
||||||
|
|
||||||
NodeRef nodeRef = cifsHelper.createNode(deviceRootNodeRef, path, true);
|
NodeRef nodeRef = cifsHelper.createNode(deviceRootNodeRef, path, true);
|
||||||
|
nodeService.addAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT, null);
|
||||||
|
|
||||||
// Create the network file
|
// Create the network file
|
||||||
|
|
||||||
|
@@ -408,9 +408,11 @@ public class ContentNetworkFile extends NodeRefNetworkFile
|
|||||||
if (contentChanged)
|
if (contentChanged)
|
||||||
{
|
{
|
||||||
ContentData contentData = content.getContentData();
|
ContentData contentData = content.getContentData();
|
||||||
|
NodeRef contentNodeRef = getNodeRef();
|
||||||
|
nodeService.removeAspect(contentNodeRef, ContentModel.ASPECT_NO_CONTENT);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
nodeService.setProperty( getNodeRef(), ContentModel.PROP_CONTENT, contentData);
|
nodeService.setProperty( contentNodeRef, ContentModel.PROP_CONTENT, contentData);
|
||||||
}
|
}
|
||||||
catch (ContentQuotaException qe)
|
catch (ContentQuotaException qe)
|
||||||
{
|
{
|
||||||
|
@@ -45,6 +45,9 @@ public interface ContentModel
|
|||||||
// tag for temporary nodes
|
// tag for temporary nodes
|
||||||
static final QName ASPECT_TEMPORARY = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "temporary");
|
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
|
// tag for localized nodes
|
||||||
static final QName ASPECT_LOCALIZED = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "localized");
|
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");
|
static final QName PROP_LOCALE = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "locale");
|
||||||
|
@@ -35,6 +35,7 @@ import org.alfresco.repo.content.cleanup.EagerContentStoreCleaner;
|
|||||||
import org.alfresco.repo.content.filestore.FileContentStore;
|
import org.alfresco.repo.content.filestore.FileContentStore;
|
||||||
import org.alfresco.repo.content.transform.ContentTransformer;
|
import org.alfresco.repo.content.transform.ContentTransformer;
|
||||||
import org.alfresco.repo.content.transform.ContentTransformerRegistry;
|
import org.alfresco.repo.content.transform.ContentTransformerRegistry;
|
||||||
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
import org.alfresco.repo.policy.ClassPolicyDelegate;
|
import org.alfresco.repo.policy.ClassPolicyDelegate;
|
||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
@@ -175,7 +176,7 @@ public class ContentServiceImpl implements ContentService
|
|||||||
|
|
||||||
// Bind on update properties behaviour
|
// Bind on update properties behaviour
|
||||||
this.policyComponent.bindClassBehaviour(
|
this.policyComponent.bindClassBehaviour(
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
|
NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME,
|
||||||
this,
|
this,
|
||||||
new JavaBehaviour(this, "onUpdateProperties"));
|
new JavaBehaviour(this, "onUpdateProperties"));
|
||||||
|
|
||||||
@@ -197,6 +198,12 @@ public class ContentServiceImpl implements ContentService
|
|||||||
Map<QName, Serializable> before,
|
Map<QName, Serializable> before,
|
||||||
Map<QName, Serializable> after)
|
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
|
// Don't duplicate work when firing multiple policies
|
||||||
Set<QName> types = null;
|
Set<QName> types = null;
|
||||||
OnContentPropertyUpdatePolicy propertyPolicy = null; // Doesn't change for the node instance
|
OnContentPropertyUpdatePolicy propertyPolicy = null; // Doesn't change for the node instance
|
||||||
|
@@ -26,9 +26,6 @@ import org.alfresco.repo.content.ContentStore;
|
|||||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||||
import org.alfresco.repo.transaction.TransactionListenerAdapter;
|
import org.alfresco.repo.transaction.TransactionListenerAdapter;
|
||||||
import org.alfresco.repo.transaction.TransactionalResourceHelper;
|
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.alfresco.util.PropertyCheck;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -69,13 +66,11 @@ public class EagerContentStoreCleaner extends TransactionListenerAdapter
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Content URLs to delete once the transaction commits.
|
* Content URLs to delete once the transaction commits.
|
||||||
* @see #onContentPropertyUpdate(NodeRef, QName, ContentData, ContentData)
|
|
||||||
* @see #afterCommit()
|
* @see #afterCommit()
|
||||||
*/
|
*/
|
||||||
private static final String KEY_POST_COMMIT_DELETION_URLS = "ContentStoreCleaner.PostCommitDeletionUrls";
|
private static final String KEY_POST_COMMIT_DELETION_URLS = "ContentStoreCleaner.PostCommitDeletionUrls";
|
||||||
/**
|
/**
|
||||||
* Content URLs to delete if the transaction rolls b ack.
|
* Content URLs to delete if the transaction rolls back.
|
||||||
* @see #onContentPropertyUpdate(NodeRef, QName, ContentData, ContentData)
|
|
||||||
* @see #afterRollback()
|
* @see #afterRollback()
|
||||||
*/
|
*/
|
||||||
private static final String KEY_POST_ROLLBACK_DELETION_URLS = "ContentStoreCleaner.PostRollbackDeletionUrls";
|
private static final String KEY_POST_ROLLBACK_DELETION_URLS = "ContentStoreCleaner.PostRollbackDeletionUrls";
|
||||||
|
@@ -153,7 +153,7 @@ public class ContentData implements Serializable
|
|||||||
* Helper method to determine if the data represents any physical content or not.
|
* Helper method to determine if the data represents any physical content or not.
|
||||||
*
|
*
|
||||||
* @param contentData the content to check (may be <tt>null</tt>)
|
* @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)
|
public static boolean hasContent(ContentData contentData)
|
||||||
{
|
{
|
||||||
@@ -161,7 +161,7 @@ public class ContentData implements Serializable
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (contentData.contentUrl != null) && (contentData.size > 0L);
|
return contentData.contentUrl != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user