Merging from EC-MC: Checkpoint before refactor

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5744 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-05-22 05:03:16 +00:00
parent 2d461f5dd9
commit d818c54e99
22 changed files with 644 additions and 416 deletions

View File

@@ -245,6 +245,42 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
return mlContainerNodeRef;
}
/** @inheritDoc */
public boolean isTranslation(NodeRef contentNodeRef)
{
if (!nodeService.hasAspect(contentNodeRef, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
{
// It doesn't have the aspect, so it isn't a translation
if (logger.isDebugEnabled())
{
logger.debug("Document is not multilingual: " + contentNodeRef);
}
return false;
}
// Is there a ML container
List<ChildAssociationRef> parentAssocRefs = nodeService.getParentAssocs(
contentNodeRef,
ContentModel.ASSOC_MULTILINGUAL_CHILD,
RegexQNamePattern.MATCH_ALL);
if (parentAssocRefs.size() > 0)
{
// It has the parent required
if (logger.isDebugEnabled())
{
logger.debug("Document has ML container parent: " + contentNodeRef);
}
return true;
}
else
{
if (logger.isDebugEnabled())
{
logger.debug("Document has no ML container parent: " + contentNodeRef);
}
return false;
}
}
/** @inheritDoc */
public NodeRef makeTranslation(NodeRef contentNodeRef, Locale locale)
{
@@ -505,7 +541,11 @@ 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)
{
// any node used as reference
@@ -542,8 +582,11 @@ public class MultilingualContentServiceImpl implements MultilingualContentServic
// set it empty
nodeService.addAspect(newTranslationNodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION, null);
// Initially, the file should be temporary. This will be changed as soon as some content is added.
nodeService.addAspect(newTranslationNodeRef, ContentModel.ASPECT_TEMPORARY, null);
// get the extension and set the ContentData property with an null URL.
// TODO: Mimetype must be correct, i.e. taken from the original
String extension = "";
int dotIdx;
if((dotIdx = name.lastIndexOf(".")) > -1 )