cancel
Showing results for 
Search instead for 
Did you mean: 

Use of assocTypeQName parameter in NodeService

partha
Champ in-the-making
Champ in-the-making
Hi,
     In the following method of NodeService, the parameter "assocTypeQName" means what and what are all the possible values for that

    NodeService.createAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)

   Thanks.
6 REPLIES 6

rivarola
Champ on-the-rise
Champ on-the-rise
Hello,

the assocTypeQName is the QName of an association described in an Alfresco model.
For instance a valid value is :
org.alfresco.model.ContentModel.ASSOC_REFERENCES

partha
Champ in-the-making
Champ in-the-making
Thanks rivarola. I just want to know what this QName means - org.alfresco.model.ContentModel.ASSOC_REFERENCES.
Actually i want to createAssociation between two Nodes using NodeService. SO i want to know what are all the possible QName values i can use.
Thanks.

lvs
Champ in-the-making
Champ in-the-making
Hi,

I think that you can use any name of an association.

For example :


      <aspect name="cm:referencing">
         <title>Referencing</title>
         <associations>
            <association name="cm:references">
               <source>
                  <role>cm:referencedBy</role>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:content</class>
                  <role>cm:references</role>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>
      </aspect>

org.alfresco.model.ContentModel.ASSOC_REFERENCES  = {http://www.alfresco.org/model/content/1.0}references. It is the qualified name of this association. So you can use the qualified name of any of the existing alfresco associations or of any any of the association you possibly created in your content model.
I hope this helped,
Regards
Laura

partha
Champ in-the-making
Champ in-the-making
Thanks Laura.
    I have my own custom association in my content model. SO i used that to create association between two nodes and both nodes created in Alfresco i can see that, it does not gave any error i think association also given between those two nodes. I just want to know how i can check whether association can be given or not through my java Program.
If i retrieve the properties of the Two nodes its listing the corresponding properties of it only… Association means if i list the properties of source node that i used while giving association should list all the properties of itself and the properties of the associated node as well right. Please confirm me.

But its not listing like that. I need some more information on this.
Thanks.

lvs
Champ in-the-making
Champ in-the-making
Hi partha,

To check in your java program if you can create an association or not, I don't know if you can use the dictionary service or the association definition to rertrieve information about the target and the source types. Anyway, the create association will throw an exception (InvalidTypeException for examle)
I think if you want the property sheet to show the properties from the node and its associated node, I am not sure you can do this by custmoisation and I think you'll need to developp your own component to do that.

I hope it helps
Regards
Laura

partha
Champ in-the-making
Champ in-the-making
Thanks Laura.

I think my question to you was wrong. Actually i created association between two Nodes using my custom java program and i want to know How i can check whether those two nodes got associated or not through my program.

   Also i want to know if i list the properties of the source node, then will it list the properties of the associated node or not?
Actually my requirement is also the same. i.e.,If i list the properties of the source node then it should list the props of the associated node as well through my java program.Is there any option available for that?

     I am using this code PropertyIterator propIterator = sourceNode.getProperties(); to get the properties of the source node and i am iterating it to get each properties seperately. In this way its not listing the props of the associated node, it lists only the source node props.

Any how thanks again for your information and help.

Regards,
Partha.