mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Mergeing form EC-MC: Completed. Removed intwined aspect deletion behaviour
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5745 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -862,16 +862,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Folder -->
|
|
||||||
<bean id="folderType" class="org.alfresco.repo.model.filefolder.FolderType" init-method="init">
|
|
||||||
<property name="policyComponent">
|
|
||||||
<ref bean="policyComponent" />
|
|
||||||
</property>
|
|
||||||
<property name="nodeService">
|
|
||||||
<ref bean="nodeService" />
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- Referenceable -->
|
<!-- Referenceable -->
|
||||||
<bean id="referenceableAspect" class="org.alfresco.repo.node.ReferenceableAspect" init-method="init">
|
<bean id="referenceableAspect" class="org.alfresco.repo.node.ReferenceableAspect" init-method="init">
|
||||||
<property name="policyComponent">
|
<property name="policyComponent">
|
||||||
|
@@ -16,6 +16,15 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="mlTranslationInterceptor" class="org.alfresco.repo.node.MLTranslationInterceptor">
|
||||||
|
<property name="directNodeService">
|
||||||
|
<ref bean="mlAwareNodeService" />
|
||||||
|
</property>
|
||||||
|
<property name="directMultilingualContentService">
|
||||||
|
<ref bean="multilingualContentService" />
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="nodeService" class="org.springframework.aop.framework.ProxyFactoryBean" >
|
<bean id="nodeService" class="org.springframework.aop.framework.ProxyFactoryBean" >
|
||||||
<property name="targetName">
|
<property name="targetName">
|
||||||
<value>mlAwareNodeService</value>
|
<value>mlAwareNodeService</value>
|
||||||
|
@@ -69,6 +69,10 @@
|
|||||||
<idref local="AuditMethodInterceptor"/>
|
<idref local="AuditMethodInterceptor"/>
|
||||||
<idref local="exceptionTranslator"/>
|
<idref local="exceptionTranslator"/>
|
||||||
<idref bean="NodeService_security"/>
|
<idref bean="NodeService_security"/>
|
||||||
|
<!-- Bug prevents use.
|
||||||
|
Also, the interception of this sort will lead to issues with other clients
|
||||||
|
<idref bean="mlTranslationInterceptor"/>
|
||||||
|
-->
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
@@ -539,6 +539,7 @@
|
|||||||
org.alfresco.service.cmr.ml.MultilingualContentService.getPivotTranslation=ACL_NODE.0.sys:base.Read
|
org.alfresco.service.cmr.ml.MultilingualContentService.getPivotTranslation=ACL_NODE.0.sys:base.Read
|
||||||
org.alfresco.service.cmr.ml.MultilingualContentService.isTranslation=ACL_NODE.0.sys:base.Read
|
org.alfresco.service.cmr.ml.MultilingualContentService.isTranslation=ACL_NODE.0.sys:base.Read
|
||||||
org.alfresco.service.cmr.ml.MultilingualContentService.makeTranslation=ACL_NODE.0.sys:base.Write
|
org.alfresco.service.cmr.ml.MultilingualContentService.makeTranslation=ACL_NODE.0.sys:base.Write
|
||||||
|
org.alfresco.service.cmr.ml.MultilingualContentService.unmakeTranslation=ACL_NODE.0.sys:base.Write
|
||||||
org.alfresco.service.cmr.ml.MultilingualContentService.addTranslation=ACL_NODE.0.sys:base.Read,ACL_NODE.1.sys:base.Write
|
org.alfresco.service.cmr.ml.MultilingualContentService.addTranslation=ACL_NODE.0.sys:base.Read,ACL_NODE.1.sys:base.Write
|
||||||
org.alfresco.service.cmr.ml.MultilingualContentService.addEmptyTranslation=ACL_NODE.0.sys:base.Read
|
org.alfresco.service.cmr.ml.MultilingualContentService.addEmptyTranslation=ACL_NODE.0.sys:base.Read
|
||||||
org.alfresco.service.cmr.ml.MultilingualContentService.createEdition=ACL_NODE.0.sys:base.Write
|
org.alfresco.service.cmr.ml.MultilingualContentService.createEdition=ACL_NODE.0.sys:base.Write
|
||||||
|
@@ -1,119 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
* As a special exception to the terms and conditions of version 2.0 of
|
|
||||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
|
||||||
* 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"
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.model.filefolder;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
|
||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class containing behaviour for the folder type.
|
|
||||||
*
|
|
||||||
* {@link ContentModel#TYPE_FOLDER folder type}
|
|
||||||
*
|
|
||||||
* @author yanipig
|
|
||||||
*/
|
|
||||||
public class FolderType implements
|
|
||||||
NodeServicePolicies.BeforeDeleteNodePolicy
|
|
||||||
{
|
|
||||||
|
|
||||||
// Dependencies
|
|
||||||
private PolicyComponent policyComponent;
|
|
||||||
private NodeService nodeService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialise the Folder type
|
|
||||||
*
|
|
||||||
* Ensures that the {@link ContentModel#TYPE_FOLDER} folder type
|
|
||||||
*/
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
this.policyComponent.bindClassBehaviour(
|
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"),
|
|
||||||
ContentModel.TYPE_FOLDER,
|
|
||||||
new JavaBehaviour(this, "beforeDeleteNode"));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param policyComponent the policy component to register behaviour with
|
|
||||||
*/
|
|
||||||
public void setPolicyComponent(PolicyComponent policyComponent)
|
|
||||||
{
|
|
||||||
this.policyComponent = policyComponent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param nodeService the Node Service to set
|
|
||||||
*/
|
|
||||||
public void setNodeService(NodeService nodeService)
|
|
||||||
{
|
|
||||||
this.nodeService = nodeService;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Since the multilingual document don't keep their <b>mlDocument</b> aspect, the <b>mlEmptyTranslation<b>
|
|
||||||
* can't be archived and the deletion of a container doesn't call the right policies, the deletion of a
|
|
||||||
* folder must explicitly remove this aspect.
|
|
||||||
*
|
|
||||||
* @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
|
|
||||||
*/
|
|
||||||
public void beforeDeleteNode(NodeRef nodeRef)
|
|
||||||
{
|
|
||||||
List<ChildAssociationRef> childAssociations = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
|
||||||
|
|
||||||
for(ChildAssociationRef childAssoc : childAssociations)
|
|
||||||
{
|
|
||||||
NodeRef child = childAssoc.getChildRef();
|
|
||||||
|
|
||||||
if(nodeService.exists(child))
|
|
||||||
{
|
|
||||||
// Remove the mlDocument aspect of each multilingual node contained in the folder.
|
|
||||||
// The policies of this aspect perform the right logic.
|
|
||||||
if(nodeService.hasAspect(child, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
|
|
||||||
{
|
|
||||||
nodeService.removeAspect(child, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
|
|
||||||
}
|
|
||||||
// Recurse the process if needed
|
|
||||||
else if(nodeService.getType(child).equals(ContentModel.TYPE_FOLDER))
|
|
||||||
{
|
|
||||||
beforeDeleteNode(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,114 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
* As a special exception to the terms and conditions of version 2.0 of
|
|
||||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
|
||||||
* 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"
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.model.filefolder;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
|
||||||
import org.alfresco.repo.model.ml.tools.AbstractMultilingualTestCases;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Multilingual container type test cases
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.cmr.ml.MLContainerType
|
|
||||||
*
|
|
||||||
* @author yanipig
|
|
||||||
*/
|
|
||||||
public class FolderTypeTest extends AbstractMultilingualTestCases {
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public void testRemoveSpace() throws Exception
|
|
||||||
{
|
|
||||||
NodeRef pivot = createContent();
|
|
||||||
NodeRef trans2 = createContent();
|
|
||||||
NodeRef trans3 = createContent();
|
|
||||||
NodeRef empty;
|
|
||||||
|
|
||||||
NodeRef mlContainer = multilingualContentService.makeTranslation(pivot, Locale.FRENCH);
|
|
||||||
multilingualContentService.addTranslation(trans2, pivot, Locale.GERMAN);
|
|
||||||
multilingualContentService.addTranslation(trans3, pivot, Locale.ITALIAN);;
|
|
||||||
empty = multilingualContentService.addEmptyTranslation(pivot, "Empty_" + System.currentTimeMillis(), Locale.ENGLISH);
|
|
||||||
|
|
||||||
|
|
||||||
NodeRef space = fileFolderService.create(
|
|
||||||
nodeService.getPrimaryParent(pivot).getParentRef(),
|
|
||||||
"folder_" + System.currentTimeMillis(),
|
|
||||||
ContentModel.TYPE_FOLDER).getNodeRef();
|
|
||||||
|
|
||||||
nodeService.moveNode(pivot, space, ContentModel.ASSOC_CONTAINS, this.nodeService.getPrimaryParent(pivot).getQName());
|
|
||||||
nodeService.moveNode(trans2, space, ContentModel.ASSOC_CONTAINS, this.nodeService.getPrimaryParent(trans2).getQName());
|
|
||||||
nodeService.moveNode(trans3, space, ContentModel.ASSOC_CONTAINS, this.nodeService.getPrimaryParent(trans3).getQName());
|
|
||||||
nodeService.moveNode(empty, space, ContentModel.ASSOC_CONTAINS, this.nodeService.getPrimaryParent(empty).getQName());
|
|
||||||
|
|
||||||
// Ensure that the nodes are correctly moved
|
|
||||||
assertEquals("Move nodes failed", 4, nodeService.getChildAssocs(space).size());
|
|
||||||
|
|
||||||
// 1. Delete space
|
|
||||||
|
|
||||||
nodeService.deleteNode(space);
|
|
||||||
|
|
||||||
// Ensute that the space is deleted
|
|
||||||
assertFalse("The deletion of the space failed", nodeService.exists(space));
|
|
||||||
|
|
||||||
// Ensure that the nodes are archived
|
|
||||||
assertTrue("The space " + space + " must be archived", nodeService.exists(nodeArchiveService.getArchivedNode(trans2)));
|
|
||||||
assertTrue("The node " + pivot + " must be archived", nodeService.exists(nodeArchiveService.getArchivedNode(pivot)));
|
|
||||||
assertTrue("The node " + trans2 + " must be archived", nodeService.exists(nodeArchiveService.getArchivedNode(trans2)));
|
|
||||||
assertTrue("The node " + trans3 + " must be archived", nodeService.exists(nodeArchiveService.getArchivedNode(trans3)));
|
|
||||||
|
|
||||||
// Ensure that the mlContainer is deleted and not archived
|
|
||||||
assertFalse("The mlContainer " + mlContainer + " must be deleted", nodeService.exists(mlContainer));
|
|
||||||
assertFalse("The mlContainer " + mlContainer + " can't be archived", nodeService.exists(nodeArchiveService.getArchivedNode(mlContainer)));
|
|
||||||
|
|
||||||
// 2. Restore space
|
|
||||||
nodeArchiveService.restoreArchivedNode(nodeArchiveService.getArchivedNode(space));
|
|
||||||
|
|
||||||
// Ensure that the nodes are restaured
|
|
||||||
assertFalse("The space " + space + "must be restored", nodeService.exists(nodeArchiveService.getArchivedNode(space)));
|
|
||||||
assertFalse("The node " + pivot + "must be restored", nodeService.exists(nodeArchiveService.getArchivedNode(pivot)));
|
|
||||||
assertFalse("The node " + trans2 + "must be restored", nodeService.exists(nodeArchiveService.getArchivedNode(trans2)));
|
|
||||||
assertFalse("The node " + trans3 + "must be restored", nodeService.exists(nodeArchiveService.getArchivedNode(trans3)));
|
|
||||||
|
|
||||||
// Ensure that the mlContainer is not restored
|
|
||||||
assertFalse("The mlContainer " + mlContainer + " must be deleted and can't be restored", nodeService.exists(mlContainer));
|
|
||||||
|
|
||||||
// 3. Delete space and remove it from the arhives
|
|
||||||
|
|
||||||
nodeService.deleteNode(space);
|
|
||||||
nodeService.deleteNode(nodeArchiveService.getArchivedNode(space));
|
|
||||||
|
|
||||||
assertFalse("The space " + space + "can't be archived", nodeService.exists(nodeArchiveService.getArchivedNode(space)));
|
|
||||||
assertFalse("The node " + pivot + "can't be archived", nodeService.exists(nodeArchiveService.getArchivedNode(pivot)));
|
|
||||||
assertFalse("The node " + trans2 + "can't be archived", nodeService.exists(nodeArchiveService.getArchivedNode(trans2)));
|
|
||||||
assertFalse("The node " + trans3 + "can't be archived", nodeService.exists(nodeArchiveService.getArchivedNode(trans3)));
|
|
||||||
|
|
||||||
assertFalse("The space " + space + "must be deleted", nodeService.exists(space));
|
|
||||||
assertFalse("The node " + pivot + "must be deleted", nodeService.exists(pivot));
|
|
||||||
assertFalse("The node " + trans2 + "must be deleted", nodeService.exists(trans2));
|
|
||||||
assertFalse("The node " + trans3 + "must be deleted", nodeService.exists(trans3));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -220,8 +220,15 @@ public class MLTranslationInterceptor implements MethodInterceptor
|
|||||||
}
|
}
|
||||||
// Convert the set back to a list
|
// Convert the set back to a list
|
||||||
List<FileInfo> orderedResults = new ArrayList<FileInfo>(fileInfos.size());
|
List<FileInfo> orderedResults = new ArrayList<FileInfo>(fileInfos.size());
|
||||||
|
Set<FileInfo> alreadyPresent = new HashSet<FileInfo>(fileInfos.size() * 2 + 1);
|
||||||
for (FileInfo info : fileInfos)
|
for (FileInfo info : fileInfos)
|
||||||
{
|
{
|
||||||
|
if (alreadyPresent.contains(info))
|
||||||
|
{
|
||||||
|
// We've done this one
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
alreadyPresent.add(info);
|
||||||
orderedResults.add(translatedFileInfos.get(info));
|
orderedResults.add(translatedFileInfos.get(info));
|
||||||
}
|
}
|
||||||
ret = orderedResults;
|
ret = orderedResults;
|
||||||
|
@@ -28,11 +28,9 @@ package org.alfresco.repo.model.ml;
|
|||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.content.ContentServicePolicies;
|
import org.alfresco.repo.content.ContentServicePolicies;
|
||||||
import org.alfresco.repo.copy.CopyServicePolicies;
|
import org.alfresco.repo.copy.CopyServicePolicies;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
|
||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
import org.alfresco.repo.policy.PolicyScope;
|
import org.alfresco.repo.policy.PolicyScope;
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
|
||||||
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.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
@@ -50,8 +48,6 @@ import org.alfresco.service.namespace.QName;
|
|||||||
*/
|
*/
|
||||||
public class EmptyTranslationAspect implements
|
public class EmptyTranslationAspect implements
|
||||||
CopyServicePolicies.OnCopyNodePolicy,
|
CopyServicePolicies.OnCopyNodePolicy,
|
||||||
// NodeServicePolicies.BeforeDeleteNodePolicy,
|
|
||||||
// NodeServicePolicies.OnRemoveAspectPolicy,
|
|
||||||
ContentServicePolicies.OnContentUpdatePolicy
|
ContentServicePolicies.OnContentUpdatePolicy
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -77,16 +73,6 @@ public class EmptyTranslationAspect implements
|
|||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onContentUpdate"),
|
QName.createQName(NamespaceService.ALFRESCO_URI, "onContentUpdate"),
|
||||||
ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION,
|
ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION,
|
||||||
new JavaBehaviour(this, "onContentUpdate"));
|
new JavaBehaviour(this, "onContentUpdate"));
|
||||||
//
|
|
||||||
// this.policyComponent.bindClassBehaviour(
|
|
||||||
// QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"),
|
|
||||||
// ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION,
|
|
||||||
// new JavaBehaviour(this, "beforeDeleteNode"));
|
|
||||||
//
|
|
||||||
// this.policyComponent.bindClassBehaviour(
|
|
||||||
// QName.createQName(NamespaceService.ALFRESCO_URI, "onRemoveAspect"),
|
|
||||||
// ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION,
|
|
||||||
// new JavaBehaviour(this, "onRemoveAspect"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,32 +115,4 @@ public class EmptyTranslationAspect implements
|
|||||||
nodeService.removeAspect(nodeRef, ContentModel.ASPECT_TEMPORARY);
|
nodeService.removeAspect(nodeRef, ContentModel.ASPECT_TEMPORARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * If a <b>cm:mlEmptyTranslation<b> is deleted, it can't be archived.
|
|
||||||
// *
|
|
||||||
// * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
|
|
||||||
// */
|
|
||||||
// public void beforeDeleteNode(NodeRef nodeRef)
|
|
||||||
// {
|
|
||||||
// // add TEMPORARY ASPECT to force the deleteNode
|
|
||||||
// nodeService.addAspect(nodeRef, ContentModel.ASPECT_TEMPORARY, null);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * If the aspect <b>cm:mlEmptyTranslation<b> is removed <b>and the content url property is null</b>, the node can be deleted.
|
|
||||||
// * The other time the aspect is removed is when new content is added, in which case the node must be kept.
|
|
||||||
// *
|
|
||||||
// * @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) *
|
|
||||||
// */
|
|
||||||
// public void onRemoveAspect(NodeRef nodeRef, QName aspectTypeQName)
|
|
||||||
// {
|
|
||||||
// // Delete the node if the content is empty.
|
|
||||||
// // Keep the node if it has content
|
|
||||||
// ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT);
|
|
||||||
// if(contentData.getContentUrl() == null)
|
|
||||||
// {
|
|
||||||
// nodeService.deleteNode(nodeRef);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,6 @@ import org.alfresco.service.namespace.QName;
|
|||||||
* @author yanipig
|
* @author yanipig
|
||||||
*/
|
*/
|
||||||
public class MLContainerType implements
|
public class MLContainerType implements
|
||||||
NodeServicePolicies.BeforeDeleteNodePolicy,
|
|
||||||
NodeServicePolicies.OnUpdatePropertiesPolicy
|
NodeServicePolicies.OnUpdatePropertiesPolicy
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -76,11 +75,6 @@ public class MLContainerType implements
|
|||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
|
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
|
||||||
ContentModel.TYPE_MULTILINGUAL_CONTAINER,
|
ContentModel.TYPE_MULTILINGUAL_CONTAINER,
|
||||||
new JavaBehaviour(this, "onUpdateProperties"));
|
new JavaBehaviour(this, "onUpdateProperties"));
|
||||||
|
|
||||||
this.policyComponent.bindClassBehaviour(
|
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"),
|
|
||||||
ContentModel.TYPE_MULTILINGUAL_CONTAINER,
|
|
||||||
new JavaBehaviour(this, "beforeDeleteNode"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,27 +102,6 @@ public class MLContainerType implements
|
|||||||
this.nodeService = nodeService;
|
this.nodeService = nodeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If a <b>cm:mlContainer<b> is deleted, it can't be archived.
|
|
||||||
*
|
|
||||||
* @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
|
|
||||||
*/
|
|
||||||
public void beforeDeleteNode(NodeRef nodeRef)
|
|
||||||
{
|
|
||||||
Map<Locale, NodeRef> translations = multilingualContentService.getTranslations(nodeRef);
|
|
||||||
|
|
||||||
// add the DELETION_RUNNING property
|
|
||||||
nodeService.setProperty(nodeRef, PROP_NAME_DELETION_RUNNING, Boolean.TRUE);
|
|
||||||
|
|
||||||
for(Map.Entry<Locale, NodeRef> entry : translations.entrySet())
|
|
||||||
{
|
|
||||||
nodeService.removeAspect(entry.getValue(), ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove the DELETION_RUNNING property
|
|
||||||
nodeService.removeProperty(nodeRef, PROP_NAME_DELETION_RUNNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The property <b>locale</b> of a <b>cm:mlContainer</b> represents the locale of the pivot translation.
|
* The property <b>locale</b> of a <b>cm:mlContainer</b> represents the locale of the pivot translation.
|
||||||
*
|
*
|
||||||
@@ -139,6 +112,10 @@ public class MLContainerType implements
|
|||||||
*/
|
*/
|
||||||
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
|
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* TODO: Move into MultilingualContentService
|
||||||
|
*/
|
||||||
|
|
||||||
Locale localeAfter = (Locale) after.get(ContentModel.PROP_LOCALE);
|
Locale localeAfter = (Locale) after.get(ContentModel.PROP_LOCALE);
|
||||||
Locale localeBefore = (Locale) before.get(ContentModel.PROP_LOCALE);
|
Locale localeBefore = (Locale) before.get(ContentModel.PROP_LOCALE);
|
||||||
|
|
||||||
|
@@ -52,12 +52,26 @@ import org.alfresco.service.cmr.version.VersionService;
|
|||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
|
import org.alfresco.util.EqualsHelper;
|
||||||
import org.alfresco.util.PropertyMap;
|
import org.alfresco.util.PropertyMap;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multilingual support implementation
|
* Multilingual support implementation.
|
||||||
|
* <p>
|
||||||
|
* The basic structure supported is that of a hidden container of type
|
||||||
|
* <b>cm:mlContainer</b> containing one or more secondary children of
|
||||||
|
* type <b>cm:mlDocument</b>. One of these will have a matching locale
|
||||||
|
* and is referred to as the <i>pivot translation</i>. It is also possible
|
||||||
|
* to have several transient <b>cm:emptyTranslation</b> instances that
|
||||||
|
* live and die with the container until they get their own content.
|
||||||
|
* <p>
|
||||||
|
* It is not possible to guarantee that there is always a pivot translation
|
||||||
|
* available in the set of sibling translations. The strategy is to hide
|
||||||
|
* all translations when there isn't a pivot translation available. A
|
||||||
|
* background task should be cleaning up the empty or invalid <b>cm:mlContainer</b>
|
||||||
|
* instances.
|
||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
* @author Philippe Dubois
|
* @author Philippe Dubois
|
||||||
@@ -245,6 +259,21 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
|
|||||||
return mlContainerNodeRef;
|
return mlContainerNodeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isPivotTranslation(NodeRef contentNodeRef)
|
||||||
|
{
|
||||||
|
Locale locale = (Locale) nodeService.getProperty(contentNodeRef, ContentModel.PROP_LOCALE);
|
||||||
|
// Get the container
|
||||||
|
NodeRef containerNodeRef = getOrCreateMLContainer(contentNodeRef, false);
|
||||||
|
Locale containerLocale = (Locale) nodeService.getProperty(containerNodeRef, ContentModel.PROP_LOCALE);
|
||||||
|
boolean isPivot = EqualsHelper.nullSafeEquals(locale, containerLocale);
|
||||||
|
// Done
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Node " + (isPivot ? "is" : "is not") + " pivot: " + contentNodeRef);
|
||||||
|
}
|
||||||
|
return isPivot;
|
||||||
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
public boolean isTranslation(NodeRef contentNodeRef)
|
public boolean isTranslation(NodeRef contentNodeRef)
|
||||||
{
|
{
|
||||||
@@ -257,17 +286,13 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Is there a ML container
|
// Are there any associated translations
|
||||||
List<ChildAssociationRef> parentAssocRefs = nodeService.getParentAssocs(
|
Map<Locale, NodeRef> translations = getTranslations(contentNodeRef);
|
||||||
contentNodeRef,
|
if (translations.size() > 0)
|
||||||
ContentModel.ASSOC_MULTILINGUAL_CHILD,
|
|
||||||
RegexQNamePattern.MATCH_ALL);
|
|
||||||
if (parentAssocRefs.size() > 0)
|
|
||||||
{
|
{
|
||||||
// It has the parent required
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Document has ML container parent: " + contentNodeRef);
|
logger.debug("Document is a translation: " + contentNodeRef);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -275,7 +300,7 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
|
|||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Document has no ML container parent: " + contentNodeRef);
|
logger.debug("Document is not a translation: " + contentNodeRef);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -296,6 +321,52 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
|
|||||||
return mlContainerNodeRef;
|
return mlContainerNodeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @inheritDoc */
|
||||||
|
public void unmakeTranslation(NodeRef translationNodeRef)
|
||||||
|
{
|
||||||
|
boolean isPivot = isPivotTranslation(translationNodeRef);
|
||||||
|
|
||||||
|
if (isPivot)
|
||||||
|
{
|
||||||
|
// Get the container
|
||||||
|
NodeRef containerNodeRef = getOrCreateMLContainer(translationNodeRef, false);
|
||||||
|
// Get all translation child associations
|
||||||
|
List<ChildAssociationRef> mlChildAssocs = nodeService.getChildAssocs(
|
||||||
|
containerNodeRef,
|
||||||
|
ContentModel.ASSOC_MULTILINGUAL_CHILD,
|
||||||
|
RegexQNamePattern.MATCH_ALL);
|
||||||
|
for (ChildAssociationRef mlChildAssoc : mlChildAssocs)
|
||||||
|
{
|
||||||
|
NodeRef mlChildNodeRef = mlChildAssoc.getChildRef();
|
||||||
|
// Delete empty translations
|
||||||
|
if (nodeService.hasAspect(mlChildNodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
|
||||||
|
{
|
||||||
|
nodeService.deleteNode(mlChildNodeRef);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nodeService.removeAspect(mlChildNodeRef, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Now delete the container
|
||||||
|
nodeService.deleteNode(containerNodeRef);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (nodeService.hasAspect(translationNodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
|
||||||
|
{
|
||||||
|
nodeService.deleteNode(translationNodeRef);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get the container and break the association to it
|
||||||
|
NodeRef containerNodeRef = getOrCreateMLContainer(translationNodeRef, false);
|
||||||
|
nodeService.removeChild(containerNodeRef, translationNodeRef);
|
||||||
|
nodeService.removeAspect(translationNodeRef, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
public NodeRef addTranslation(NodeRef newTranslationNodeRef, NodeRef translationOfNodeRef, Locale locale)
|
public NodeRef addTranslation(NodeRef newTranslationNodeRef, NodeRef translationOfNodeRef, Locale locale)
|
||||||
{
|
{
|
||||||
@@ -443,8 +514,6 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
|
|||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
public NodeRef getTranslationForLocale(NodeRef translationNodeRef, Locale locale)
|
public NodeRef getTranslationForLocale(NodeRef translationNodeRef, Locale locale)
|
||||||
{
|
{
|
||||||
// Get the container
|
|
||||||
getOrCreateMLContainer(translationNodeRef, false);
|
|
||||||
// Get all the translations
|
// Get all the translations
|
||||||
Map<Locale, NodeRef> nodeRefsByLocale = getTranslations(translationNodeRef);
|
Map<Locale, NodeRef> nodeRefsByLocale = getTranslations(translationNodeRef);
|
||||||
// Get the closest matching locale
|
// Get the closest matching locale
|
||||||
@@ -529,8 +598,7 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
|
|||||||
else if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(nodeService.getType(nodeRef)))
|
else if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(nodeService.getType(nodeRef)))
|
||||||
{
|
{
|
||||||
Locale containerLocale = (Locale) nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE);
|
Locale containerLocale = (Locale) nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE);
|
||||||
|
return getTranslationForLocale(nodeRef, containerLocale);
|
||||||
return getTranslationForLocale(getTranslations(nodeRef).get(containerLocale), containerLocale);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -542,9 +610,6 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*
|
|
||||||
* TODO: This logic merely creates a file with a specific aspect and is designed to support
|
|
||||||
* specific use-case in the UI. Examine if the logic should be here or in the UI.
|
|
||||||
*/
|
*/
|
||||||
public NodeRef addEmptyTranslation(NodeRef translationOfNodeRef, String name, Locale locale)
|
public NodeRef addEmptyTranslation(NodeRef translationOfNodeRef, String name, Locale locale)
|
||||||
{
|
{
|
||||||
|
@@ -55,8 +55,6 @@ public class MultilingualDocumentAspect implements
|
|||||||
CopyServicePolicies.OnCopyNodePolicy,
|
CopyServicePolicies.OnCopyNodePolicy,
|
||||||
CopyServicePolicies.OnCopyCompletePolicy,
|
CopyServicePolicies.OnCopyCompletePolicy,
|
||||||
NodeServicePolicies.BeforeDeleteNodePolicy,
|
NodeServicePolicies.BeforeDeleteNodePolicy,
|
||||||
NodeServicePolicies.BeforeRemoveAspectPolicy,
|
|
||||||
NodeServicePolicies.OnRemoveAspectPolicy,
|
|
||||||
NodeServicePolicies.OnUpdatePropertiesPolicy
|
NodeServicePolicies.OnUpdatePropertiesPolicy
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -80,31 +78,20 @@ public class MultilingualDocumentAspect implements
|
|||||||
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
||||||
new JavaBehaviour(this, "onCopyNode"));
|
new JavaBehaviour(this, "onCopyNode"));
|
||||||
|
|
||||||
this.policyComponent.bindClassBehaviour(
|
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"),
|
|
||||||
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
|
||||||
new JavaBehaviour(this, "beforeDeleteNode"));
|
|
||||||
|
|
||||||
this.policyComponent.bindClassBehaviour(
|
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRemoveAspect"),
|
|
||||||
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
|
||||||
new JavaBehaviour(this, "beforeRemoveAspect"));
|
|
||||||
|
|
||||||
this.policyComponent.bindClassBehaviour(
|
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
|
|
||||||
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
|
||||||
new JavaBehaviour(this, "onUpdateProperties"));
|
|
||||||
|
|
||||||
this.policyComponent.bindClassBehaviour(
|
this.policyComponent.bindClassBehaviour(
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyComplete"),
|
QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyComplete"),
|
||||||
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
||||||
new JavaBehaviour(this, "onCopyComplete"));
|
new JavaBehaviour(this, "onCopyComplete"));
|
||||||
|
|
||||||
this.policyComponent.bindClassBehaviour(
|
this.policyComponent.bindClassBehaviour(
|
||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onRemoveAspect"),
|
QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"),
|
||||||
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
||||||
new JavaBehaviour(this, "onRemoveAspect"));
|
new JavaBehaviour(this, "beforeDeleteNode"));
|
||||||
|
|
||||||
|
this.policyComponent.bindClassBehaviour(
|
||||||
|
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
|
||||||
|
ContentModel.ASPECT_MULTILINGUAL_DOCUMENT,
|
||||||
|
new JavaBehaviour(this, "onUpdateProperties"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,72 +140,19 @@ public class MultilingualDocumentAspect implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the node is multilingual and it is the pivot translation, then deletion is not allowed unless the
|
* If this is not an empty translation, then ensure that the node is properly
|
||||||
|
* unhooked from the translation mechanism first.
|
||||||
*/
|
*/
|
||||||
public void beforeDeleteNode(NodeRef nodeRef)
|
public void beforeDeleteNode(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
// checkRemoveParentMLContainer(nodeRef);
|
|
||||||
// Remove the aspect
|
|
||||||
nodeService.removeAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When a pivot translation is deleted, it's <b>cm:mlContainer is deleted too.</b>
|
|
||||||
*
|
|
||||||
* <i>Note: When the pivot translation and the mlContainer are deleted, the mlDocument apsect is removed from
|
|
||||||
* the other translations. It will be better to don't allow the deletion of the pivot if other translation is
|
|
||||||
* available at the client side level.</i>
|
|
||||||
*
|
|
||||||
* @see org.alfresco.repo.node.NodeServicePolicies.BeforeRemoveAspectPolicy#beforeRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
|
|
||||||
*/
|
|
||||||
public void beforeRemoveAspect(NodeRef nodeRef, QName aspectTypeQName)
|
|
||||||
{
|
|
||||||
checkRemoveParentMLContainer(nodeRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkRemoveParentMLContainer(NodeRef nodeRef)
|
|
||||||
{
|
|
||||||
// Avoid nodes that are no longer translations
|
|
||||||
if (!multilingualContentService.isTranslation(nodeRef))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeRef mlContainer = multilingualContentService.getTranslationContainer(nodeRef);
|
|
||||||
|
|
||||||
// nothing to do if the mlContainer is in a deletion process
|
|
||||||
Boolean inDeleteProcess = (Boolean) nodeService.getProperty(mlContainer, MLContainerType.PROP_NAME_DELETION_RUNNING);
|
|
||||||
if(inDeleteProcess != null && inDeleteProcess == true)
|
|
||||||
{
|
|
||||||
// TODO: Is this still called? Can we get rid of the DELETION_RUNNING property?
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Locale mlContainerLocale = (Locale) nodeService.getProperty(mlContainer, ContentModel.PROP_LOCALE);
|
|
||||||
Locale nodeRefLocale = (Locale) nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE);
|
|
||||||
|
|
||||||
nodeService.removeChild(mlContainer, nodeRef);
|
|
||||||
|
|
||||||
// if last translation or if nodeRef is pivot translation
|
|
||||||
if (multilingualContentService.getTranslations(mlContainer).size() == 0
|
|
||||||
|| mlContainerLocale.equals(nodeRefLocale))
|
|
||||||
{
|
|
||||||
// delete the mlContainer
|
|
||||||
nodeService.deleteNode(mlContainer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the document's locale and the <b>cm:mlEmptyTranslation</b> aspect,
|
|
||||||
* if present.
|
|
||||||
*/
|
|
||||||
public void onRemoveAspect(NodeRef nodeRef, QName aspectTypeQName)
|
|
||||||
{
|
|
||||||
nodeService.removeProperty(nodeRef, ContentModel.PROP_LOCALE);
|
|
||||||
// Remove the empty translation aspect if it is present
|
|
||||||
if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
|
if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
|
||||||
{
|
{
|
||||||
nodeService.removeAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION);
|
// We just let it get deleted
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// First unhook it
|
||||||
|
multilingualContentService.unmakeTranslation(nodeRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,6 +166,10 @@ public class MultilingualDocumentAspect implements
|
|||||||
*/
|
*/
|
||||||
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
|
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* TODO: Move this into MultilingualContentService#setTranslationLocale
|
||||||
|
*/
|
||||||
|
|
||||||
Locale localeBefore = (Locale) before.get(ContentModel.PROP_LOCALE);
|
Locale localeBefore = (Locale) before.get(ContentModel.PROP_LOCALE);
|
||||||
Locale localeAfter;
|
Locale localeAfter;
|
||||||
|
|
||||||
|
@@ -27,14 +27,12 @@ package org.alfresco.repo.model.ml;
|
|||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.alfresco.repo.model.filefolder.FolderTypeTest;
|
|
||||||
import org.alfresco.repo.model.ml.tools.ContentFilterLanguagesMapTest;
|
import org.alfresco.repo.model.ml.tools.ContentFilterLanguagesMapTest;
|
||||||
import org.alfresco.repo.model.ml.tools.EmptyTranslationAspectTest;
|
import org.alfresco.repo.model.ml.tools.EmptyTranslationAspectTest;
|
||||||
import org.alfresco.repo.model.ml.tools.MLContainerTypeTest;
|
import org.alfresco.repo.model.ml.tools.MLContainerTypeTest;
|
||||||
import org.alfresco.repo.model.ml.tools.MultilingualContentServiceImplTest;
|
import org.alfresco.repo.model.ml.tools.MultilingualContentServiceImplTest;
|
||||||
import org.alfresco.repo.model.ml.tools.MultilingualDocumentAspectTest;
|
import org.alfresco.repo.model.ml.tools.MultilingualDocumentAspectTest;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multilingual test suite
|
* Multilingual test suite
|
||||||
*
|
*
|
||||||
@@ -56,7 +54,6 @@ public class MultilingualTestSuite extends TestSuite
|
|||||||
suite.addTestSuite(MultilingualContentServiceImplTest.class);
|
suite.addTestSuite(MultilingualContentServiceImplTest.class);
|
||||||
suite.addTestSuite(MultilingualDocumentAspectTest.class);
|
suite.addTestSuite(MultilingualDocumentAspectTest.class);
|
||||||
suite.addTestSuite(MLContainerTypeTest.class);
|
suite.addTestSuite(MLContainerTypeTest.class);
|
||||||
suite.addTestSuite(FolderTypeTest.class);
|
|
||||||
|
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
@@ -169,50 +169,4 @@ public class EmptyTranslationAspectTest extends AbstractMultilingualTestCases {
|
|||||||
fileFolderService.getReader(empty).getContentString(),
|
fileFolderService.getReader(empty).getContentString(),
|
||||||
fileFolderService.getReader(pivot).getContentString());
|
fileFolderService.getReader(pivot).getContentString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRemoveAspect() throws Exception
|
|
||||||
{
|
|
||||||
NodeRef pivot = createContent();
|
|
||||||
NodeRef empty = null;
|
|
||||||
|
|
||||||
multilingualContentService.makeTranslation(pivot, Locale.FRENCH);
|
|
||||||
|
|
||||||
// 1. remove mlEmptyTranslation aspect with empty content
|
|
||||||
empty = multilingualContentService.addEmptyTranslation(pivot, "empty_" + System.currentTimeMillis(), Locale.CHINESE);
|
|
||||||
nodeService.removeAspect(empty, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION);
|
|
||||||
|
|
||||||
// Ensure that the empty translation is deleted
|
|
||||||
assertFalse("After removed the " + ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION + " of an empty translation with no content the node must be deleted",
|
|
||||||
nodeService.exists(empty));
|
|
||||||
assertFalse("After removed the " + ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION + " of an empty translation with no content the node must be deleted and can't be archived",
|
|
||||||
nodeService.exists(nodeArchiveService.getArchivedNode(empty)));
|
|
||||||
|
|
||||||
// 2. remove mlDocument aspect with empty content
|
|
||||||
empty = multilingualContentService.addEmptyTranslation(pivot, "empty_" + System.currentTimeMillis(), Locale.CHINESE);
|
|
||||||
nodeService.removeAspect(empty, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
|
|
||||||
|
|
||||||
// Ensure that the empty translation is deleted
|
|
||||||
assertFalse("After removed the " + ContentModel.ASPECT_MULTILINGUAL_DOCUMENT + " of an empty translation with no content the node must be deleted",
|
|
||||||
nodeService.exists(empty));
|
|
||||||
assertFalse("After removed the " + ContentModel.ASPECT_MULTILINGUAL_DOCUMENT + " of an empty translation with no content the node must be deleted and can't be archived",
|
|
||||||
nodeService.exists(nodeArchiveService.getArchivedNode(empty)));
|
|
||||||
|
|
||||||
// 3. remove mlEmptyTranslation aspect with not empty content
|
|
||||||
empty = multilingualContentService.addEmptyTranslation(pivot, "empty_" + System.currentTimeMillis(), Locale.CHINESE);
|
|
||||||
ContentWriter writer = contentService.getWriter(empty, ContentModel.PROP_CONTENT, true);
|
|
||||||
writer.setMimetype("text/plain");
|
|
||||||
writer.putContent("ANY_CONTENT");
|
|
||||||
nodeService.removeAspect(empty, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION);
|
|
||||||
|
|
||||||
// Ensure that the empty translation is NOT deleted
|
|
||||||
assertTrue("After removed the " + ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION + " of an empty translation with content the node must NOT be deleted",
|
|
||||||
nodeService.exists(empty));
|
|
||||||
// Ensure that the mlEmptyTranslation aspect is removed
|
|
||||||
assertFalse("After removed the " + ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION + " of an empty translation with content this aspect must be removed",
|
|
||||||
nodeService.hasAspect(empty, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION));
|
|
||||||
// Ensure that the mlEmptyDocument in NOT removed
|
|
||||||
assertTrue("After removed the " + ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION + " of an empty translation with content the " + ContentModel.ASPECT_MULTILINGUAL_DOCUMENT + " aspect must be keeped",
|
|
||||||
nodeService.hasAspect(empty, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -39,30 +39,8 @@ import org.alfresco.service.namespace.QName;
|
|||||||
*
|
*
|
||||||
* @author yanipig
|
* @author yanipig
|
||||||
*/
|
*/
|
||||||
public class MLContainerTypeTest extends AbstractMultilingualTestCases {
|
public class MLContainerTypeTest extends AbstractMultilingualTestCases
|
||||||
|
{
|
||||||
|
|
||||||
public void testDeleteNode() throws Exception
|
|
||||||
{
|
|
||||||
NodeRef pivot = createContent();
|
|
||||||
NodeRef empty;
|
|
||||||
|
|
||||||
NodeRef mlContainer = multilingualContentService.makeTranslation(pivot, Locale.FRENCH);
|
|
||||||
empty = multilingualContentService.addEmptyTranslation(pivot, "Empty_" + System.currentTimeMillis(), Locale.ENGLISH);
|
|
||||||
|
|
||||||
nodeService.deleteNode(mlContainer);
|
|
||||||
|
|
||||||
// Ensure that the mlContainer is deleted
|
|
||||||
assertFalse("The mlContainer must be deleted", nodeService.exists(mlContainer));
|
|
||||||
// Ensure that the empty translation is deleted
|
|
||||||
assertFalse("The mlEmptyTranslation must be deleted", nodeService.exists(empty));
|
|
||||||
// Ensure that the non-empty document is not deleted
|
|
||||||
assertTrue("The mlDocument must not be deleted", nodeService.exists(pivot));
|
|
||||||
// Ensure that the mlDocument property of the non-empty document is removed
|
|
||||||
assertFalse("The " + ContentModel.ASPECT_MULTILINGUAL_DOCUMENT + " aspect of the mlDocument must be removed",
|
|
||||||
nodeService.hasAspect(pivot, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT));
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void testEditLocale() throws Exception
|
public void testEditLocale() throws Exception
|
||||||
{
|
{
|
||||||
|
@@ -87,8 +87,11 @@ public class MultilingualDocumentAspectTest extends AbstractMultilingualTestCase
|
|||||||
assertEquals("The restored node would not be restaured to the mlContainer", 2, multilingualContentService.getTranslations(mlContainer).size());
|
assertEquals("The restored node would not be restaured to the mlContainer", 2, multilingualContentService.getTranslations(mlContainer).size());
|
||||||
// Ensure that the restored node doesn't keep the mlDocument aspect
|
// Ensure that the restored node doesn't keep the mlDocument aspect
|
||||||
assertFalse("The restored node can't keep the multilingual aspect", nodeService.hasAspect(restoredNode, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT));
|
assertFalse("The restored node can't keep the multilingual aspect", nodeService.hasAspect(restoredNode, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT));
|
||||||
// Ensure that the restored node doesn't keep the locale property
|
// DH: The locale is stored on an aspect that is independent of the ML model.
|
||||||
assertNull("The restaured node can't keep the locale property", nodeService.getProperty(restoredNode, ContentModel.PROP_LOCALE));
|
// It is therefore not possible to remove the locale just because the node
|
||||||
|
// is being unhooked from the ML structures
|
||||||
|
// // Ensure that the restored node doesn't keep the locale property
|
||||||
|
// assertNull("The restaured node can't keep the locale property", nodeService.getProperty(restoredNode, ContentModel.PROP_LOCALE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDeletePivot() throws Exception
|
public void testDeletePivot() throws Exception
|
||||||
@@ -109,8 +112,10 @@ public class MultilingualDocumentAspectTest extends AbstractMultilingualTestCase
|
|||||||
assertTrue("The last translation would not be removed", nodeService.exists(trans1));
|
assertTrue("The last translation would not be removed", nodeService.exists(trans1));
|
||||||
// Ensure that trans1 has no mlDocument aspect
|
// Ensure that trans1 has no mlDocument aspect
|
||||||
assertFalse("The last translation can't keep the multilingual aspect", nodeService.hasAspect(trans1, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT));
|
assertFalse("The last translation can't keep the multilingual aspect", nodeService.hasAspect(trans1, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT));
|
||||||
// Ensure that trans1 has no locale propety
|
// DH: Here too, the sys:locale property must be left alone as it is independent of the
|
||||||
assertNull("The last translation can't keep the locale property", nodeService.getProperty(trans1, ContentModel.PROP_LOCALE));
|
// ML model
|
||||||
|
// // Ensure that trans1 has no locale propety
|
||||||
|
// assertNull("The last translation can't keep the locale property", nodeService.getProperty(trans1, ContentModel.PROP_LOCALE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDeleteLastNode() throws Exception
|
public void testDeleteLastNode() throws Exception
|
||||||
|
171
source/java/org/alfresco/repo/node/MLTranslationInterceptor.java
Normal file
171
source/java/org/alfresco/repo/node/MLTranslationInterceptor.java
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* 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"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.node;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.alfresco.i18n.I18NUtil;
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.service.cmr.ml.MultilingualContentService;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.aopalliance.intercept.MethodInterceptor;
|
||||||
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interceptor to
|
||||||
|
* - filter the multilingual nodes to display the documents in the prefered language of teh user
|
||||||
|
*
|
||||||
|
* @author yanipig
|
||||||
|
*/
|
||||||
|
public class MLTranslationInterceptor implements MethodInterceptor
|
||||||
|
{
|
||||||
|
private static Log logger = LogFactory.getLog(MLTranslationInterceptor.class);
|
||||||
|
|
||||||
|
private NodeService directNodeService;
|
||||||
|
|
||||||
|
private MultilingualContentService directMultilingualContentService;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public Object invoke(MethodInvocation invocation) throws Throwable
|
||||||
|
{
|
||||||
|
Object ret = null;
|
||||||
|
String methodName = invocation.getMethod().getName();
|
||||||
|
|
||||||
|
// intercept the methods getChildAssocs and getChildByNames to apply filter.
|
||||||
|
if (methodName.equals("getChildAssocs") || methodName.equals("getChildByName"))
|
||||||
|
{
|
||||||
|
ret = invocation.proceed();
|
||||||
|
|
||||||
|
NodeRef parent = (NodeRef) invocation.getArguments()[0];
|
||||||
|
|
||||||
|
// all the association returned by the method
|
||||||
|
List<ChildAssociationRef> allChildAssoc = (List<ChildAssociationRef>) ret;
|
||||||
|
|
||||||
|
// get the user content filter language
|
||||||
|
Locale filterLocale = I18NUtil.getContentLocaleOrNull();
|
||||||
|
|
||||||
|
if(filterLocale != null
|
||||||
|
&& directNodeService.getType(parent).equals(ContentModel.TYPE_FOLDER)
|
||||||
|
&& ret != null
|
||||||
|
&& !allChildAssoc.isEmpty()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
// the list of Association to return
|
||||||
|
List<ChildAssociationRef> toReturn = new ArrayList();
|
||||||
|
// the ml containers found in the folder
|
||||||
|
List<NodeRef> mlContainers = new ArrayList();
|
||||||
|
|
||||||
|
// construct the list of ML Container
|
||||||
|
for (ChildAssociationRef assoc : allChildAssoc)
|
||||||
|
{
|
||||||
|
NodeRef child = assoc.getChildRef();
|
||||||
|
|
||||||
|
QName type = directNodeService.getType(child);
|
||||||
|
|
||||||
|
if(type.equals(ContentModel.TYPE_CONTENT) &&
|
||||||
|
directNodeService.hasAspect(child, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
|
||||||
|
{
|
||||||
|
NodeRef container = directMultilingualContentService.getTranslationContainer(child);
|
||||||
|
|
||||||
|
if (!mlContainers.contains(container))
|
||||||
|
{
|
||||||
|
mlContainers.add(container);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// no specific treatment for folder and non-multilingual document
|
||||||
|
toReturn.add(assoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// for each mlContainer found, choose the unique document to return
|
||||||
|
for(NodeRef container : mlContainers)
|
||||||
|
{
|
||||||
|
// get each translation language
|
||||||
|
Set<Locale> locales = directMultilingualContentService.getTranslations(container).keySet();
|
||||||
|
|
||||||
|
if(locales != null && locales.size() > 0)
|
||||||
|
{
|
||||||
|
Locale matchedLocal = I18NUtil.getNearestLocale(filterLocale, locales);
|
||||||
|
|
||||||
|
NodeRef matchedTranslation = null;
|
||||||
|
|
||||||
|
// if the filter language is not found
|
||||||
|
if(matchedLocal == null)
|
||||||
|
{
|
||||||
|
// get the pivot translation
|
||||||
|
matchedTranslation = directMultilingualContentService.getPivotTranslation(container);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// get the matched translation
|
||||||
|
matchedTranslation = directMultilingualContentService.getTranslations(container).get(matchedLocal);
|
||||||
|
}
|
||||||
|
|
||||||
|
toReturn.add(new ChildAssociationRef(null, null, null, matchedTranslation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = toReturn;
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Filter has found " +
|
||||||
|
allChildAssoc.size() + " entries, " +
|
||||||
|
mlContainers.size() + " different ML Container " +
|
||||||
|
"and returns " + toReturn.size() + " nodes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = invocation.proceed();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDirectMultilingualContentService(
|
||||||
|
MultilingualContentService multilingualContentService)
|
||||||
|
{
|
||||||
|
this.directMultilingualContentService = multilingualContentService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDirectNodeService(NodeService nodeService)
|
||||||
|
{
|
||||||
|
this.directNodeService = nodeService;
|
||||||
|
}
|
||||||
|
}
|
@@ -600,10 +600,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
public void removeAspect(NodeRef nodeRef, QName aspectTypeQName)
|
public void removeAspect(NodeRef nodeRef, QName aspectTypeQName)
|
||||||
throws InvalidNodeRefException, InvalidAspectException
|
throws InvalidNodeRefException, InvalidAspectException
|
||||||
{
|
{
|
||||||
// Invoke policy behaviours
|
|
||||||
invokeBeforeUpdateNode(nodeRef);
|
|
||||||
invokeBeforeRemoveAspect(nodeRef, aspectTypeQName);
|
|
||||||
|
|
||||||
// get the aspect
|
// get the aspect
|
||||||
AspectDefinition aspectDef = dictionaryService.getAspect(aspectTypeQName);
|
AspectDefinition aspectDef = dictionaryService.getAspect(aspectTypeQName);
|
||||||
if (aspectDef == null)
|
if (aspectDef == null)
|
||||||
@@ -612,12 +608,21 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
}
|
}
|
||||||
// get the node
|
// get the node
|
||||||
Node node = getNodeNotNull(nodeRef);
|
Node node = getNodeNotNull(nodeRef);
|
||||||
|
Set<QName> nodeAspects = node.getAspects();
|
||||||
|
|
||||||
|
if (!nodeAspects.contains(aspectTypeQName))
|
||||||
|
{
|
||||||
|
// The aspect isn't present so just leave it
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Invoke policy behaviours
|
||||||
|
invokeBeforeUpdateNode(nodeRef);
|
||||||
|
invokeBeforeRemoveAspect(nodeRef, aspectTypeQName);
|
||||||
|
|
||||||
// remove the aspect, if present
|
// remove the aspect, if present
|
||||||
boolean removed = node.getAspects().remove(aspectTypeQName);
|
node.getAspects().remove(aspectTypeQName);
|
||||||
// if the aspect was present, remove the associated properties and associations
|
|
||||||
if (removed)
|
|
||||||
{
|
|
||||||
Map<QName, PropertyValue> nodeProperties = node.getProperties();
|
Map<QName, PropertyValue> nodeProperties = node.getProperties();
|
||||||
Map<QName,PropertyDefinition> propertyDefs = aspectDef.getProperties();
|
Map<QName,PropertyDefinition> propertyDefs = aspectDef.getProperties();
|
||||||
for (QName propertyName : propertyDefs.keySet())
|
for (QName propertyName : propertyDefs.keySet())
|
||||||
@@ -662,7 +667,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
// update the node status
|
// update the node status
|
||||||
nodeDaoService.recordChangeId(nodeRef);
|
nodeDaoService.recordChangeId(nodeRef);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a check on the set of node aspects
|
* Performs a check on the set of node aspects
|
||||||
|
@@ -73,6 +73,15 @@ public interface MultilingualContentService
|
|||||||
@Auditable(key = Auditable.Key.ARG_0, parameters = {"contentNodeRef", "locale"})
|
@Auditable(key = Auditable.Key.ARG_0, parameters = {"contentNodeRef", "locale"})
|
||||||
NodeRef makeTranslation(NodeRef contentNodeRef, Locale locale);
|
NodeRef makeTranslation(NodeRef contentNodeRef, Locale locale);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the node from any associated translations. If the translation is the
|
||||||
|
* pivot translation, then the entire set of translations will be unhooked.
|
||||||
|
*
|
||||||
|
* @param translationNodeRef an existing <b>cm:mlDocument</b>
|
||||||
|
*/
|
||||||
|
@Auditable(key = Auditable.Key.ARG_0, parameters = {"translationNodeRef"})
|
||||||
|
void unmakeTranslation(NodeRef translationNodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a translation out of an existing document. The necessary translation structures will be created
|
* Make a translation out of an existing document. The necessary translation structures will be created
|
||||||
* as necessary.
|
* as necessary.
|
||||||
|
Reference in New Issue
Block a user