cancel
Showing results for 
Search instead for 
Did you mean: 

Content Type vs Aspect

lascaux
Champ on-the-rise
Champ on-the-rise
Hi,

I need some support for my needs.

I need to create a new document type to be able to manage a bunch of properties.

I've got 2 possibilities for that :
- create a new content type (what I already did)
- create a new aspect for the content type "cm:content"

Now, here are my needs :
I would like my document added to some workspace structure to be set as the previously defined content type / aspect (in order to set the properties values during the creation of a new document).
I also need my document to be versionable
and I also need to be able to make check in/out on the document.

What is the best solution to achieve this ?
- a new content type + defining the aspects for this content type ?
- a new aspect which inheritate from the others ?

How to make a rule which define that each new document added in my workspace structure will be set as the defined type (with the new properties) ?

Thanks a lot for help !

Sylvain
10 REPLIES 10

davidc
Star Contributor
Star Contributor
I would define your aspect as an independent aspect in your own model.

Then, I would use rules to:

- specialise the type (to the sub-type of content you've defined)
- add your custom aspect
- add the versionable aspect

lascaux
Champ on-the-rise
Champ on-the-rise
Hi David,

thanks for your reply.

I would define your aspect as an independent aspect in your own model.

Do you mean that I should not use a new content type but only a new aspect ?
Or Do I need to create a new content type with no properties and only defined the properties within the new aspect ?

(I am sorry, I am not yet very familiar with Aspect and Content Type)

Then, I would use rules to:

- specialise the type (to the sub-type of content you've defined)
- add your custom aspect
- add the versionable aspect

I think I got this point 🙂
Just need to know if I also need a custom content type + a custom aspect … or only a custom aspect …

Best regards,

Sylvain

davidc
Star Contributor
Star Contributor
It seems you only require a custom aspect.

lascaux
Champ on-the-rise
Champ on-the-rise
It seems you only require a custom aspect.

Ok thanks,

In order to create a custom aspect to my document,
I think I just have to do the same than creating a content-type (using the custom-model-context.xml + customModel.xml) …

Sylvain

davidc
Star Contributor
Star Contributor
That's correct.

lascaux
Champ on-the-rise
Champ on-the-rise
That's correct.

this is working perfectly …
but now, I've got a new requirement 🙂

I though I could implement them easily but I am not sure after few unsuccessfull test :

specifying 2 aspects with the same properties but:
- in aspect 1, some properties are not mandatory
- in aspect 2, they are mandatory
- when a document is moved from one workspace to the other one, aspect 2 is applied and then properties set in aspect 1 are copied ?

is it something possible ?

Sylvain

davidc
Star Contributor
Star Contributor
Execute a javascript action via rule.

With javascript you can copy property values.

http://wiki.alfresco.com/wiki/JavaScript_API

lascaux
Champ on-the-rise
Champ on-the-rise
Execute a javascript action via rule.

With javascript you can copy property values.

http://wiki.alfresco.com/wiki/JavaScript_API

Thanks again …
is it possible to specify the 2 aspects like that (in a different way) :
     <aspect name="ns:asp1">
        <title>aspect 1</title>
        <properties>
            <property name="ns:attr1">
                <type>d:text</type>
                <mandatory>true</mandatory>
            </property>
            <property name="ns:attr2">
                <type>d:text</type>
                <mandatory>false</mandatory>
            </property>
        </properties>
      </aspect>
     
      <aspect name="ns:asp2">
              <title>aspect 2</title>
              <properties>
                 <property name="ns:attr1">
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                  </property>
                  <property name="ns:attr2">
                      <type>d:text</type>
                      <mandatory>true</mandatory>
              </property>
              </properties>
       </aspect>

or should I specify different property names (for now it is failing compiling the model because the attribute name is already used in ns:asp1)

Sylvain

davidc
Star Contributor
Star Contributor
Property names must be unique within a model.