cancel
Showing results for 
Search instead for 
Did you mean: 

Override constraints of bpm model

sversh71
Champ in-the-making
Champ in-the-making
Hello!

We have out of the box model "bpm:businessprocessmodel" and some constraints inside it.

        <constraint name="bpm:allowedStatus" type="LIST">
            <parameter name="allowedValues">
                <!–  TODO: Determine if status values can be mapped to human-readable strings –>
                <list>
                    <value>Not Yet Started</value>
                    <value>In Progress</value>
                    <value>On Hold</value>
                    <value>Cancelled</value>
                    <value>Completed</value>
                </list>
            </parameter>
        </constraint>
I'm working on solution for non english speaking users, so does anybody know how to override this constraint with localized values?
I know that it isn't possible to localize constraints with .properties file. So I need at least rewrite built-in values with my own.
Any ideas?
4 REPLIES 4

sversh71
Champ in-the-making
Champ in-the-making
Solved.
If someone interesting I can explain

jayjayecl
Confirmed Champ
Confirmed Champ
I'm pretty sure this problem has been raised many times and that no (good) solution was found.
Sharing your solution would definitely help many future users.

Thx

sversh71
Champ in-the-making
Champ in-the-making
I don't think that my solution is good. It is suitable only for single language environment. I used the standard way to overwrite out of the box model with custom model.
In this case I do the following:
1. create context file or use an existing and copy there dictionaryBootstrap bean description from core-services-context.xml
Replace link to standard bpmModel.xml with custom bpmModel.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

    <!– Overwrite the existing models –>
    <bean id="dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="resourceBundles">
        <property name="models">
            <list>
                <!– System models  –>
                <value>alfresco/model/dictionaryModel.xml</value>
                <value>alfresco/model/systemModel.xml</value>
                <value>org/alfresco/repo/security/authentication/userModel.xml</value>

                <!– Content models –>
                <value>alfresco/model/contentModel.xml</value>
                <!– <value>alfresco/model/bpmModel.xml</value> –>
                <value>alfresco/extension/model/bpmModel.xml</value>
                <value>alfresco/model/wcmModel.xml</value>
                <value>alfresco/model/forumModel.xml</value>
                <value>alfresco/model/imapModel.xml</value>

                <!– Content models –>
                <value>alfresco/model/applicationModel.xml</value>
                <value>alfresco/model/wcmAppModel.xml</value>

                <!– Implementation models –>
                <value>org/alfresco/repo/action/actionModel.xml</value>
                <value>org/alfresco/repo/rule/ruleModel.xml</value>
               
                <!–  Version models –>
                <value>org/alfresco/repo/version/version_model.xml</value> <!– deprecated –>
                <value>org/alfresco/repo/version/version2_model.xml</value>               

                <!– Email model –>
                <value>alfresco/model/emailServerModel.xml</value>
               
                <!– Calendar model –>
                <value>alfresco/model/calendarModel.xml</value>

                <!– Blog Integration model –>
                <value>alfresco/model/blogIntegrationModel.xml</value>

                <!– Links model –>
                <value>alfresco/model/linksModel.xml</value>

                <!– Deprecated types –>
                <value>alfresco/model/deprecated/deprecated_contentModel.xml</value>
            </list>
        </property>
        <property name="labels">
            <list>
                <value>alfresco/model/dataTypeAnalyzers</value>
                <value>alfresco/messages/system-model</value>
                <value>alfresco/messages/dictionary-model</value>
                <value>alfresco/messages/content-model</value>
                <value>alfresco/messages/bpm-messages</value>
                <value>alfresco/messages/application-model</value>
                <value>alfresco/messages/forum-model</value>
            </list>
        </property>
    </bean>

</beans>

2. Copy alfresco/model/bpmModel.xml to alfresco/extension/model/bpmModel.xml and change english language constraints values to localized.

        …….
        <constraint name="bpm:allowedStatus" type="LIST">
            <parameter name="allowedValues">
                <!–  TODO: Determine if status values can be mapped to human-readable strings –>
                <list>
                    <!–
                    <value>Not Yet Started</value>
                    <value>In Progress</value>
                    <value>On Hold</value>
                    <value>Cancelled</value>
                    <value>Completed</value>
                     –>
                    <value>localized value 1</value>
                    <value>localized value 2</value>
                    <value>localized value 3</value>
                    <value>localized value 4</value>
                    <value>localized value 5</value>
                </list>
            </parameter>
        </constraint>
        …….
        <type name="bpm:task">
            <parent>cm:content</parent>
            <properties>
                ………..
                <property name="bpm:status">
                    <type>d:text</type>
                    <mandatory>true</mandatory>
                    <!– <default>Not Yet Started</default> –>
                    <default>localized value 1</default>
                    <constraints>
                        <constraint ref="bpm:allowedStatus" />
                    </constraints>
                </property>
            ……
            </properties>
……


That's all. If this solution has any potential weakness, please tell me

Tanks

jayjayecl
Confirmed Champ
Confirmed Champ
All Right, I did not understand it was suitable for only one language.

The potential weakness is when you'll want to upgrade your Alfresco platform.

I had to get to to the same result, and I prefered to create a new customStatus property in my workflowModel.xml instead of overriding the existing one.

regards,