Dark Star1
Dark Star1

Reputation: 7403

Is it possible to create a constraint based on another defined type in Alfresco?

I can find anything that would suggest this is possible or otherwise I have the following declared models. The product:

<type name="syn:produit">
        <title>Produit</title>
        <parent>cm:cmobject</parent>

        <properties>
                        <!-- properties defined -->
        </properties>
    </type>     

product order:

        <type name="syn:produitCommande">
            <title></title>
            <parent>cm:object</parent>
            <properties>
                    <propert name="productType">
                    </property>
            </properties>
    </type>

I would like to constraint the productType of the syn:produitCommande to a list of syn:produit. Is it possible to do this OOTB (I think no is the answer to that), I have seen example codes of dynamic constraints but a lot of "That's a bad idea" warnings that goes with the code. I need advice on how to proceed with resolving this issue with possible code examples. (Not entirely understood the text on how to build the custom constraint yet.)

Upvotes: 0

Views: 140

Answers (2)

mitpatoliya
mitpatoliya

Reputation: 2037

It really is bad idea.

There will be various problems as with each type fix set of properties attached so you cannot configure this thing though model for sure.

I think you have a requirement where you don't want to fix the type of document on creation. you want to provide the option to user to allow change type of document after it is created right?In that case you can create all your custom content types in model and there is one action called change type in alfresco share which you can configure to showup all your custom content types.In that way even after creating the content you will be able to change its content type.

Upvotes: 0

Tahir Malik
Tahir Malik

Reputation: 6643

Fist to answer your question, there is No XML config where you can configure that.

A DB example from the forum is here

I probably wouldn't make a custom constraint if it's only for UI usage.

My approach would be to make a custom form control (in share) which loads a search (through Ajax in json format) from the Repository.

Upvotes: 1

Related Questions