mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.1 to HEAD
6383: ML contributions 6400: AR-1625 Empty translations track pivot translation git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6406 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -35,7 +35,6 @@ import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.policy.JavaBehaviour;
|
||||
import org.alfresco.repo.policy.PolicyComponent;
|
||||
import org.alfresco.repo.policy.PolicyScope;
|
||||
import org.alfresco.repo.version.VersionServicePolicies;
|
||||
import org.alfresco.service.cmr.ml.MultilingualContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
@@ -54,22 +53,10 @@ import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
*/
|
||||
public class MultilingualDocumentAspect implements
|
||||
CopyServicePolicies.OnCopyNodePolicy,
|
||||
CopyServicePolicies.OnCopyCompletePolicy,
|
||||
NodeServicePolicies.BeforeDeleteNodePolicy,
|
||||
NodeServicePolicies.OnUpdatePropertiesPolicy,
|
||||
VersionServicePolicies.OnCreateVersionPolicy
|
||||
NodeServicePolicies.OnUpdatePropertiesPolicy
|
||||
{
|
||||
|
||||
/**
|
||||
* List of properties to set persistent when a version of the mlDocument is created
|
||||
*/
|
||||
public static final QName[] PROPERTIES_TO_VERSION = {
|
||||
ContentModel.PROP_AUTHOR,
|
||||
ContentModel.PROP_LOCALE,
|
||||
ContentModel.PROP_TITLE,
|
||||
ContentModel.PROP_DESCRIPTION,
|
||||
};
|
||||
|
||||
// Dependencies
|
||||
private PolicyComponent policyComponent;
|
||||
private MultilingualContentService multilingualContentService;
|
||||
@@ -88,11 +75,6 @@ public class MultilingualDocumentAspect implements
|
||||
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
||||
new JavaBehaviour(this, "onCopyNode"));
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyComplete"),
|
||||
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
||||
new JavaBehaviour(this, "onCopyComplete"));
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"),
|
||||
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
||||
@@ -103,11 +85,6 @@ public class MultilingualDocumentAspect implements
|
||||
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
||||
new JavaBehaviour(this, "onUpdateProperties"));
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateVersion"),
|
||||
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
||||
new JavaBehaviour(this, "onCreateVersion"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,16 +122,6 @@ public class MultilingualDocumentAspect implements
|
||||
copyDetails.removeAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* The copy of <b>mlDocument</b> don't keep the 'locale' property.
|
||||
*
|
||||
* @see org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy#onCopyComplete(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, boolean, java.util.Map)
|
||||
*/
|
||||
public void onCopyComplete(QName classRef, NodeRef sourceNodeRef, NodeRef destinationRef, boolean copyToNewNode, Map<NodeRef, NodeRef> copyMap)
|
||||
{
|
||||
nodeService.removeProperty(destinationRef, ContentModel.PROP_LOCALE);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is not an empty translation, then ensure that the node is properly
|
||||
* unhooked from the translation mechanism first.
|
||||
@@ -191,10 +158,10 @@ public class MultilingualDocumentAspect implements
|
||||
|
||||
// the after local property type can be either Locale or String
|
||||
Serializable objLocaleAfter = after.get(ContentModel.PROP_LOCALE);
|
||||
|
||||
if (objLocaleAfter instanceof Locale )
|
||||
{
|
||||
localeAfter = (Locale) objLocaleAfter;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -242,19 +209,4 @@ public class MultilingualDocumentAspect implements
|
||||
|
||||
// else no action to perform
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist some specific properties in the version store
|
||||
*
|
||||
* @see org.alfresco.repo.model.ml.MultilingualDocumentAspect.PROPERTIES_TO_VERSION
|
||||
* @see org.alfresco.repo.version.VersionServicePolicies.OnCreateVersionPolicy#onCreateVersion(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, java.util.Map, org.alfresco.repo.policy.PolicyScope)
|
||||
*/
|
||||
public void onCreateVersion(QName classRef, NodeRef versionableNode, Map<String, Serializable> versionProperties, PolicyScope nodeDetails)
|
||||
{
|
||||
for(QName prop : PROPERTIES_TO_VERSION)
|
||||
{
|
||||
nodeDetails.addProperty(prop, nodeService.getProperty(versionableNode, prop));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user