Bootstrap rule and it's script.

cancel
Showing results for 
Search instead for 
Did you mean: 
fedorow
Senior Member II

Bootstrap rule and it's script.

I have a problem with bootstraping rule by module SDK 4.5. The rule have referance to the script. I bootstrap the script and the rule in one module. The script imports sucsessfuly, but rule geting empty refferance instead refferance to this script. The rule became wrong and can't be edited in UI. But if the script already present in the Data Dictionary/Scripts folder, then bootstrap makes a proper refferance in the rule.

bootstrap-context.xml

    <!-- Import smart folder templates and javascripts -->
    <bean id="customSpacesBootstrap" parent="spacesStoreImporter" >
        <property name="useExistingStore">
            <value>true</value>
        </property>
        <property name="bootstrapViews">
            <list>
                ...
                <props>
                    <prop key='uuidBinding'>UPDATE_EXISTING</prop>
                    <prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.scripts.childname}</prop>
                    <prop key="location">alfresco/module/${project.artifactId}/bootstrap/import-scripts.xml</prop>
                </props>
            </list>
        </property>
    </bean>
    
    <!-- Import rule to manage files -->
    <bean id="MyModule.bootstrap" 
        class="org.alfresco.repo.module.ImporterModuleComponent"
        parent="module.baseComponent">
            
        <property name="moduleId" value="${project.artifactId}" />
        <property name="name" value="${project.name}" />
        <property name="description" value="My Modules initial data requirements" />
        <property name="sinceVersion" value="1.0-SNAPSHOT" />
        <property name="appliesFromVersion" value="1.0-SNAPSHOT" />
        
        <property name="importer" ref="spacesBootstrap"/>
        <property name="bootstrapViews">
            <list>
                <props>
                    <prop key='uuidBinding'>UPDATE_EXISTING</prop>
                    <prop key="path">/${spaces.company_home.childname}/${spaces.sites.childname}/cm:products</prop>
                    <prop key="location">alfresco/module/${project.artifactId}/bootstrap/documentLibrary.xml</prop>
                </props>
                <props>
                    <prop key='uuidBinding'>UPDATE_EXISTING</prop>
                    <prop key="path">/${spaces.company_home.childname}/${spaces.sites.childname}/cm:products/cm:documentLibrary/rule:ruleFolder</prop>
                    <prop key="location">alfresco/module/${project.artifactId}/bootstrap/rule.xml</prop>
                </props>
            </list>
        </property>
    </bean>

The documentLibrary.xml just add rule:rules aspect

The rule.xml file have refferance to the script imported by the import-scripts.xml in the first bean.

<view:value view:datatype="d:category">/app:company_home/app:dictionary/app:scripts/update-doc-file.js</view:value>

It works only if update-doc-file.js script already in the /Scripts folder. Is it posible to manage the bootstrap order?

 

How to import rule and script in one module?