mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Implemented helper methods for retrieving translations
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4768 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -17,8 +17,10 @@
|
||||
package org.alfresco.repo.model.ml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
@@ -212,11 +214,16 @@ public class MultilingualContentServiceImplTest extends TestCase
|
||||
|
||||
// Now be sure that we can get the required information using the version service
|
||||
VersionHistory mlContainerVersionHistory = versionService.getVersionHistory(mlContainerNodeRef);
|
||||
Version mlContainerRootVersion = mlContainerVersionHistory.getRootVersion();
|
||||
NodeRef mlContainerRootVersionNodeRef = mlContainerRootVersion.getVersionedNodeRef();
|
||||
// Get the root version's children
|
||||
List<ChildAssociationRef> mlContainerRootVersionChildren = nodeService.getChildAssocs(mlContainerRootVersionNodeRef);
|
||||
// Check them
|
||||
// assertEquals("Incorrect number of child nodes for root version", 3, mlContainerRootVersionChildren.size());
|
||||
Collection<Version> mlContainerVersions = mlContainerVersionHistory.getAllVersions();
|
||||
// Loop through and get all the children of each version
|
||||
for (Version mlContainerVersion : mlContainerVersions)
|
||||
{
|
||||
NodeRef versionedMLContainerNodeRef = mlContainerVersion.getFrozenStateNodeRef();
|
||||
// Get all the children
|
||||
Map<Locale, NodeRef> translationsByLocale = multilingualContentService.getTranslations(
|
||||
versionedMLContainerNodeRef);
|
||||
// Count the children
|
||||
int count = translationsByLocale.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user