cancel
Showing results for 
Search instead for 
Did you mean: 

Create multilingual content

theaterofthough
Champ in-the-making
Champ in-the-making
Hello,

I'm trying to create some multilingual content using the webservices. In order to do that I try to follow what's the MultiLingualContentServiceImpl is doing using the RepositoryWebService.

I'm blocked when trying to create a mlContainer.

I send a message to the update operation of the RepositoryWebService.
When the message contains a "create" for the mlContainer with some properties (a locale and a name), 2 add aspects (versionable and localized), 1 AddChild (add a mlTranslation child to the mlContainer) I get an IllegalArgumentException "The pivot translation must be an existing translation".

When I try to workaround the problem sending a message containing a "create" for the mlContainer without properties,), 2 add aspects (versionable and localized), 1 AddChild (link to an mlTranslation) and an "update" for the mlContainer (setting a locale and a name) I get an AlfrescoRuntimeException "failed to execute transaction level behaviour public abstract void org.alfresco.repo.node.NodeServicePolicies$OnAddAspectPolicy".

Are there any samples to create multilingual content using webservices or any ideas how to proceed?

Thank you.
3 REPLIES 3

bopeep36
Champ in-the-making
Champ in-the-making
Anyone figure out how to do this?  The multilingualcontentservice doesn't seem to be exposed via any apis.  I'm thinking I might just make a "translated" association and try to use that instead due to the lack of information on ml support.

bopeep36
Champ in-the-making
Champ in-the-making
The only way I found to create a mlDocument aspect correctly is to use the MultilingualContentService makeTranslation call (which I had to expose via webscript).  Make sure you aren't manually adding any ml aspects or it won't work.

dcmg
Champ in-the-making
Champ in-the-making
TheaterOfThought
Can you post some code snipets of what you are trying to do?
Im trying to do the same but Im got this error:

org.alfresco.repo.node.integrity.IntegrityException: 11040027 Found 1 integrity violations:
The association child multiplicity has been violated:
   Source Node: workspace://SpacesStore/3c1670d5-6001-4f31-931b-fb3729a1f135
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}mlContainer], name={http://www.alfresco.org/model/content/1.0}mlChild, target class={http://www.alfresco.org/model/content/1.0}mlDocument, source role=null, target role=null]
   Required child Multiplicity: 1..*
   Actual child Multiplicity: 0

this is my code to create the mlContainer, I know that something is wrong.

        ParentReference parentReference = new ParentReference(this.spacesStore, idPadre, null, Constants.ASSOC_CONTAINS, Constants.ASSOC_CONTAINS);
     
        String qname = Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, "mlContainer");
       
        CMLCreate create = new CMLCreate("1", parentReference, "2", Constants.ASSOC_CHILDREN, qname, qname, null);
        CML cml = new CML();
        cml.setCreate(new CMLCreate[]{create});
        UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);
       
        CMLAddAspect aspect = new CMLAddAspect();
        aspect.setAspect(Constants.ASPECT_VERSIONABLE);
        aspect.setWhere(new Predicate(new Reference[]{results[0].getDestination()},   this.spacesStore, null));
       
       cml = new CML();
        cml.setAddAspect(new CMLAddAspect[]{aspect});
        results = WebServiceFactory.getRepositoryService().update(cml);

can anyone help on this?