cancel
Showing results for 
Search instead for 
Did you mean: 

Relationship between aspects and properties

theorbix
Confirmed Champ
Confirmed Champ
Hello,

Can someone explain the difference - and the relationships - between Aspects and Properties?

I understand that both are used to customize the metadata associated to content in the Alfresco repository.

So, let's say that I want to classify all my documents, in a given Space, with two additional metadata "fields"… like "Customer ID" and "Customer Name".

Both metadata should be visible in the Web Client, so users will be able to enter the value of the fields as required.

To do this, is it required to create a new Aspect with two Properties?
6 REPLIES 6

alarocca
Champ in-the-making
Champ in-the-making
Correct. This is the right way to apply custom fields to different content types (orders, offers, etc.).

Without a CustomerRelated aspect you should add the same fields to each content type. And this should be avoided like the plague  :lol:

theorbix
Confirmed Champ
Confirmed Champ
Ok, cool.

Now, two other related questions:

1) Is it possible - for instance in a JavaScript - to define a Property (and store values in it) without having defined an Aspect that "owns" the property?

2) Is it possible to define new custom Aspects (and hence new cstom Properties) via API, or the only way to do this is to manually edit the customModel.xml and web-client-config-custom.xml files?

3) How do you control and define the list of "content types"?

I know these questions may seem a bit silly, but I'm a newbie…

kevinr
Star Contributor
Star Contributor
1) You don't need to "define" ad-hoc properties, you can add values with any QName you like to a node. It is best to define the properties you want in models as they you can add constraints and they can be displayed in the web-client etc. I would only use ad-hoc properties for storing hidden data etc.

2) You need to manually edit the files yes. We have recently added the ability (in 2.2 dev code) to change models and config without restarting the server.

3) The same model and config files as 2).

Thanks,

Kevin

theorbix
Confirmed Champ
Confirmed Champ
1) You don't need to "define" ad-hoc properties, you can add values with any QName you like to a node. It is best to define the properties you want in models as they you can add constraints and they can be displayed in the web-client etc. I would only use ad-hoc properties for storing hidden data etc.

Ok, thanks.

So if I understand well, up to version 2.1 Properties can be added dynamically to any node (document or folder) by using Java or JavaScript, while Aspects and Content Types must be defined by editing configuration files.

Another question (but I guess that I already know the answer)… can a certain Property name be repeated in two different aspects?

The scenario is:

Aspect "CustomerOrder" has properties called "OrderDate" and "OrderNumber".

Aspect "SupplierOrder should have properties with identical names.

Can this be done, or it is necessary to use different names ("CustOrderDate", "CustOrderNumber", "SuppOrderDate", "SuppOrderNumber")?

rdanner
Champ in-the-making
Champ in-the-making
It is entirely possible for two aspects to have the same property name if they have different name spaces.

rdanner
Champ in-the-making
Champ in-the-making
1) You don't need to "define" ad-hoc properties, you can add values with any QName you like to a node. It is best to define the properties you want in models as they you can add constraints and they can be displayed in the web-client etc. I would only use ad-hoc properties for storing hidden data etc.

Kevin, I know that you CAN do this but would you want to? Isn't this akin to black metadata (where sneaky programmers stick data in a file after the end of file marker)?  When would this be a good practice?