CIRCA Multilingual changes (Philippe Dubois)

- Web Client support for changing content filter language
 - I18NUtil support for contentLocale
 - MLPropertyInterceptor handling of properties inbound and outbound
TODO:
 - Is new Locale("") valid?
 - Some more tests to ensure property interceptor is working
 - Move interceptor into .sample config file


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5003 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-02-01 16:11:40 +00:00
parent a046d9be3f
commit fcddd9a468
5 changed files with 189 additions and 15 deletions

View File

@@ -46,6 +46,7 @@ import org.apache.commons.logging.LogFactory;
* Multilingual support implementation
*
* @author Derek Hulley
* @author Philippe Dubois
*/
public class MultilingualContentServiceImpl implements MultilingualContentService
{
@@ -216,6 +217,13 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
// The aspect is present, so just ensure that the locale is correct
nodeService.setProperty(contentNodeRef, ContentModel.PROP_LOCALE, locale);
}
//get all the languages already there
Map<Locale, NodeRef> existingLanguages = this.getTranslations(mlContainerNodeRef);
if (existingLanguages.containsKey(locale))
{
throw new AlfrescoRuntimeException("Duplicate locale in document pool:" + locale.toString());
}
// Do we make use of an existing container?
if (mlContainerNodeRef == null)
{
@@ -288,8 +296,9 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
}
/** @inheritDoc */
public void createEdition(NodeRef mlContainerNodeRef, NodeRef translationNodeRef)
public void createEdition( NodeRef translationNodeRef)
{
NodeRef mlContainerNodeRef = getOrCreateMLContainer(translationNodeRef, false);
// Ensure that the translation given is one of the children
getOrCreateMLContainer(translationNodeRef, false);
// Get all the container's children

View File

@@ -31,7 +31,6 @@ import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -49,6 +48,7 @@ import org.springframework.context.ApplicationContext;
* @see org.alfresco.repo.ml.MultilingualContentServiceImpl
*
* @author Derek Hulley
* @author Philippe Dubois
*/
public class MultilingualContentServiceImplTest extends TestCase
{
@@ -203,7 +203,7 @@ public class MultilingualContentServiceImplTest extends TestCase
Version japaneseVersionPreEdition = versionService.getCurrentVersion(japaneseContentNodeRef);
// Create the edition, keeping the Chinese translation as the basis
multilingualContentService.createEdition(mlContainerNodeRef, chineseContentNodeRef);
multilingualContentService.createEdition(chineseContentNodeRef);
// Check the container child count
assertEquals("Incorrect number of child nodes", 1, nodeService.getChildAssocs(mlContainerNodeRef).size());