cancel
Showing results for 
Search instead for 
Did you mean: 

Best practices using Alfresco Web Service Client

developer_resea
Champ in-the-making
Champ in-the-making
Hello,

     I'm trying to integrate a web application with alfresco using 'alfresco-web-service-client-3.3.jar', I have reviewed the examples that there is in the web and these work fine but there are some aspects that I have not clear yet:

1. There is various parts of the code to makes use of constants defined in 'org.alfresco.webservice.util.Constants', reviewed the code of this class can be observed:
   
    …
    public static final String ASSOC_CHILDREN;
    public static final String TYPE_CMOBJECT;
    public static final String PROP_NAME;
    public static final String TYPE_CONTENT;
    public static final String PROP_CONTENT;
    …
    …

     My doubt is: How I can know the values that take these constants after of deploy alfresco?

2. For create a node creates an instance of the 'org.alfresco.webservice.types.CMLCreate' class that has an attribute id, according the wiki (http://wiki.alfresco.com/wiki/CML) this field must be an String and apparently is optional (0..1). In the examples of the web I see that uses arbitrary values for this field, so I have the following questions: What considerations should be taken on notice about the values that should be allocated to this field? Do you have any implication, the value assigned, for actions subsequent of integration with alfresco repository or backup and restore? Is it recommendable to have a mechanism of generation, stored in a database, for the values in this field?

     These are the questions I have of what I've reviewed so far, I hope someone can help me clarify them.

Thanks in advance,
3 REPLIES 3

patil
Champ on-the-rise
Champ on-the-rise
To answer your first question, alfresco uses the ContentModelling concept store the data.
You can explore content modelling in alfresco to ge the answer.


Thanks,
Patil
ECM Consulatant
Bangalore

jcustovic
Champ in-the-making
Champ in-the-making
The ID that you are mentioning is not the actual ID and will not be stored on alfresco. It is ment to link other CML commnad to that item in a single request. Lets just say you want to add aspect with CMLCreate… You need some kind of ID to link it to because it is not yet created on alfresco (and if you didn't have that ID you would need to create the document in one request, get the nodeRef and issue another request for adding aspect) so thats where that ID is useful. For example:
      

CML cml = new CML();

CMLCreate create = new CMLCreate("1", parent, null, Constants.ASSOC_CONTAINS, null, documentTypeQName, properties);
CMLAddAspect aspect = new CMLAddAspect(aspectName, aspectProperties, null, "1");

CMLCreate create2 = new CMLCreate("2", parent, null, Constants.ASSOC_CONTAINS, null, documentTypeQName2, properties2);
CMLAddAspect aspect2 = new CMLAddAspect(aspectName2, aspectProperties2, null, "2");

cml.setAddAspect(new CMLAddAspect[] {aspect, aspect2});
cml.setCreate(new CMLCreate[] { create, create2 });

UpdateResult[] results = getRepositoryService().update(cml);

developer_resea
Champ in-the-making
Champ in-the-making
To answer your first question, alfresco uses the ContentModelling concept store the data.
You can explore content modelling in alfresco to ge the answer.

Hello Patil,

     Thanks for you answer, I guess you mean to 'contentModel.xml' in "ALFRESCO_HOME\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\model" but still not clear to me what values that take at run time the constants in the 'org.alfresco.webservice.util.Constants' class, my doubt is if its value will "".

Thanks and regards,