|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.model.ml.MultilingualContentServiceImpl
public class MultilingualContentServiceImpl
Multilingual support implementation.
The basic structure supported is that of a hidden container of type cm:mlContainer containing one or more secondary children of type cm:mlDocument. One of these will have a matching locale and is referred to as the pivot translation. It is also possible to have several transient cm:emptyTranslation instances that live and die with the container until they get their own content.
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 cm:mlContainer instances.
Constructor Summary | |
---|---|
MultilingualContentServiceImpl()
|
Method Summary | |
---|---|
org.alfresco.service.cmr.repository.NodeRef |
addEmptyTranslation(org.alfresco.service.cmr.repository.NodeRef translationOfNodeRef,
java.lang.String name,
java.util.Locale locale)
Make a empty translation out of an existing pivot translation. |
void |
addTranslation(org.alfresco.service.cmr.repository.NodeRef newTranslationNodeRef,
org.alfresco.service.cmr.repository.NodeRef translationOfNodeRef,
java.util.Locale locale)
Make a translation out of an existing document. |
org.alfresco.service.cmr.repository.NodeRef |
copyTranslationContainer(org.alfresco.service.cmr.repository.NodeRef mlContainerNodeRef,
org.alfresco.service.cmr.repository.NodeRef newParentRef,
java.lang.String prefixName)
Copies the given cm:mlContainer. |
void |
deleteTranslationContainer(org.alfresco.service.cmr.repository.NodeRef mlContainerNodeRef)
Delete the given mlContainer and its translations. |
java.util.List |
getMissingTranslations(org.alfresco.service.cmr.repository.NodeRef localizedNodeRef,
boolean addThisNodeLocale)
Given a cm:mlDocument or cm:mlContainer this node returns each locale for which there isn't a translation. |
org.alfresco.service.cmr.repository.NodeRef |
getPivotTranslation(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Given any node, this returns the pivot translation. |
org.alfresco.service.cmr.repository.NodeRef |
getTranslationContainer(org.alfresco.service.cmr.repository.NodeRef translationNodeRef)
Convenience method for super user. |
org.alfresco.service.cmr.repository.NodeRef |
getTranslationForLocale(org.alfresco.service.cmr.repository.NodeRef translationNodeRef,
java.util.Locale locale)
Given a cm:mlDocument, this method attempts to find the best translation for the given locale. |
java.util.Map |
getTranslations(org.alfresco.service.cmr.repository.NodeRef translationOfNodeRef)
Gets the set of sibling translations associated with the given cm:mlDocument or cm:mlContainer. |
boolean |
isTranslation(org.alfresco.service.cmr.repository.NodeRef contentNodeRef)
Checks whether an existing document is part of a translation group. |
void |
makeTranslation(org.alfresco.service.cmr.repository.NodeRef contentNodeRef,
java.util.Locale locale)
Make an existing document into a translation by adding the cm:mlDocument aspect and creating a cm:mlContainer parent. |
void |
moveTranslationContainer(org.alfresco.service.cmr.repository.NodeRef mlContainerNodeRef,
org.alfresco.service.cmr.repository.NodeRef newParentRef)
Moves the location of the given cm:mlContainer. |
void |
setContentFilterLanguagesService(ContentFilterLanguagesService contentFilterLanguagesService)
|
void |
setFileFolderService(FileFolderService fileFolderService)
|
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
|
void |
setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
|
void |
setPolicyBehaviourFilter(BehaviourFilter policyBehaviourFilter)
|
void |
setVersionService(VersionService versionService)
|
void |
unmakeTranslation(org.alfresco.service.cmr.repository.NodeRef translationNodeRef)
Removes the node from any associated translations. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MultilingualContentServiceImpl()
Method Detail |
---|
public boolean isTranslation(org.alfresco.service.cmr.repository.NodeRef contentNodeRef)
isTranslation
in interface MultilingualContentService
contentNodeRef
- An existing cm:content
public void makeTranslation(org.alfresco.service.cmr.repository.NodeRef contentNodeRef, java.util.Locale locale)
makeTranslation
in interface MultilingualContentService
contentNodeRef
- An existing cm:contentContentModel.ASPECT_MULTILINGUAL_DOCUMENT
public void deleteTranslationContainer(org.alfresco.service.cmr.repository.NodeRef mlContainerNodeRef)
MultilingualContentService
deleteTranslationContainer
in interface MultilingualContentService
mlContainerNodeRef
- The cm:mlContainer to removepublic void unmakeTranslation(org.alfresco.service.cmr.repository.NodeRef translationNodeRef)
MultilingualContentService
unmakeTranslation
in interface MultilingualContentService
translationNodeRef
- an existing cm:mlDocumentpublic void addTranslation(org.alfresco.service.cmr.repository.NodeRef newTranslationNodeRef, org.alfresco.service.cmr.repository.NodeRef translationOfNodeRef, java.util.Locale locale)
addTranslation
in interface MultilingualContentService
newTranslationNodeRef
- An existing cm:contenttranslationOfNodeRef
- An existing cm:mlDocumentpublic org.alfresco.service.cmr.repository.NodeRef getTranslationContainer(org.alfresco.service.cmr.repository.NodeRef translationNodeRef)
getTranslationContainer
in interface MultilingualContentService
translationNodeRef
- An existing cm:mlDocument
public java.util.Map getTranslations(org.alfresco.service.cmr.repository.NodeRef translationOfNodeRef)
getTranslations
in interface MultilingualContentService
translationOfNodeRef
- An existing cm:mlDocument or cm:mlContainer
public org.alfresco.service.cmr.repository.NodeRef getTranslationForLocale(org.alfresco.service.cmr.repository.NodeRef translationNodeRef, java.util.Locale locale)
partial match
, then the
pivot translation
is used. If that also gives no results
then the translation itself is returned.
getTranslationForLocale
in interface MultilingualContentService
translationNodeRef
- the cm:mlDocumentlocale
- the target locale
MultilingualContentService.getTranslations(NodeRef)
,
I18NUtil.getNearestLocale(Locale, Set)
public java.util.List getMissingTranslations(org.alfresco.service.cmr.repository.NodeRef localizedNodeRef, boolean addThisNodeLocale)
getMissingTranslations
in interface MultilingualContentService
localizedNodeRef
- the cm:mlDocument or cm:mlContaineraddThisNodeLocale
- if true, add the locale of the given cm:mlDocument in the list.
public org.alfresco.service.cmr.repository.NodeRef getPivotTranslation(org.alfresco.service.cmr.repository.NodeRef nodeRef)
getPivotTranslation
in interface MultilingualContentService
nodeRef
- a cm:mlDocument translation or cm:mlContainer translation
container
public org.alfresco.service.cmr.repository.NodeRef addEmptyTranslation(org.alfresco.service.cmr.repository.NodeRef translationOfNodeRef, java.lang.String name, java.util.Locale locale)
Document.txt --> Document_fr.txtThe necessary translation structures will be created as necessary.
addEmptyTranslation
in interface MultilingualContentService
translationOfNodeRef
- An existing cm:mlDocumentname
- The name of the file to create, or null to use
the default naming convention.
public org.alfresco.service.cmr.repository.NodeRef copyTranslationContainer(org.alfresco.service.cmr.repository.NodeRef mlContainerNodeRef, org.alfresco.service.cmr.repository.NodeRef newParentRef, java.lang.String prefixName) throws java.lang.Exception
MultilingualContentService
This involves the copy of the cm:mlContainer node and the copy of its cm:mlDocument.
copyTranslationContainer
in interface MultilingualContentService
newParentRef
- The new parent of the copied cm:mlDocumentprefixName
- The prefix of the name of the copied translations. Can be null.
javax.transaction.SystemException
java.lang.Exception
FileNotFoundException
FileExistsException
public void moveTranslationContainer(org.alfresco.service.cmr.repository.NodeRef mlContainerNodeRef, org.alfresco.service.cmr.repository.NodeRef newParentRef) throws FileExistsException, FileNotFoundException
MultilingualContentService
This not involves changing the cm:mlContainer node but moves its cm:mlDocument.
moveTranslationContainer
in interface MultilingualContentService
newParentRef
- The new parent of the moved cm:mlDocument
FileExistsException
FileNotFoundException
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
public void setContentFilterLanguagesService(ContentFilterLanguagesService contentFilterLanguagesService)
public void setFileFolderService(FileFolderService fileFolderService)
public void setVersionService(VersionService versionService)
public void setPolicyBehaviourFilter(BehaviourFilter policyBehaviourFilter)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |