cancel
Showing results for 
Search instead for 
Did you mean: 

Complex properties

daniel_pereza
Champ in-the-making
Champ in-the-making
Hi,

I need to map this XML to a type in Alfresco:

<doc>
  <title>Title</title>
  <authors>
    <author>
      <name>Author 1</name>
      <email>author1@email.com</email>
    </author>
    <author>
      <name>Author 2</name>
      <email>author2@email.com</email>
    </author>
  </authors>
</doc>

As you can see, my property "author" is multiple, and contains two other properties, "name" and "email". However, I don't see any examples that create a property that contains other properties.

In case complex properties of this kind are not possible, how should I model this? Should authors be separate documents, linked to the original document through associations?

Many thanks for your insights.
6 REPLIES 6

derek
Star Contributor
Star Contributor
Hi,

Alfresco does not support complex properties.  However, you can declare a multivalued property of type d:any and throw whatever you want into there; it's not a great solution and you'll have to make sure that the data structures have a decent toString method.

You could make use of the person object (where user details are stored) and link your document to those via associations, but it really depends on how you intend to query/retrieve this information on how you might store it.

Regards

daniel_pereza
Champ in-the-making
Champ in-the-making
If I created a "person" type, is there a way to easily create new "person" objects from the properties page of the original document? Or would I have to create a new content of type "person", and then go to the properties page of the original document and associate them?

Thanks for your suggestions anyway.

derek
Star Contributor
Star Contributor
org.alfresco.service.cmr.security.PersonService.getPerson(String userName);
I was thinking that you could associate your document with the "Person" object that represents the logged-in user.

daniel_pereza
Champ in-the-making
Champ in-the-making
Well, the XML I posted is a simplification of my situation. My "author" has other business-specific attributes, so I think the "person" object wouldn't be a good fit…

derek
Star Contributor
Star Contributor
OK.  So you'll need a model for author nodes and hang them off some well-known location, associating them with the content.  You'd probably have an aspect that you apply to documents that has a mandatory 1 or many association to an author type.

daniel_pereza
Champ in-the-making
Champ in-the-making
That's probably the way to go, many thanks.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.