How to create rules, folder etc ... using amp file

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

How to create rules, folder etc ... using amp file

Hi,

I'm trying to do an automatic deployment of alfresco i've already achieve to do it with my amp files using script but i don't see how to do it with my rule ?

- I've a JS file to put un the script folder

- and i need to add a rule on a folder using this script on share

Is there an API or something else to do that on share ?

Thanks

5 Replies
krutik_jayswal
Senior Member II

Re: Automatic deployment

Question is no fully clear.Please rephrase it.

aliiiiii
Member II

Re: Automatic deployment

Ok sorry Smiley Happy

so i need to do a ready to use install of alfresco architecture (with custom models, folders to add, and rule on a folder)

- just launch script

- i don't want to set anything using share

my script already deploy custom models, create folders etc ... but i don't see how to "push" my js script file in "Data Dictionary/scripts/" folder and use it on another folder this is my question hope it's clear now

i find a way using SDK but i need to switch my rule from js to java that was not planned i hope there is another option ...

thanks

krutik_jayswal
Senior Member II

Re: Automatic deployment

You can bootstrap the content , in your case the file which you would like to put in data dictionary, Refer below link for more details on that.

Bootstrap content | Alfresco Documentation 

I am not sure regarding rule, whether they can be applied using bootstrap or not.You can check on that.If it doesn't support than, I guess you can use patch in alfresco.

aliiiiii
Member II

Re: Automatic deployment

Yes it's exactly what i want to do thanks Smiley Happy and it seems that it works for rules just need to acp export my folder with rule on it, I try to do what i want and i explain that step by step

aliiiiii
Member II

Re: How to create rules, folder etc ... using amp file

i have finally achieve to do what i want, an amp file to : create a new model / put a js file in the data dictionnary/scripts folder / create a folder with this rule set on it with alfresco 5.2

  • First as i didn't find a way to export space i've installed a module who can import/export space in acp format : Import/Export ACP,ZIP from Share | Alfresco Add-ons - Alfresco Customizations 
  • I create my js file in the scripts folder, create a folder and set on it the rule i just copy
  • After that i've used the export module on the scripts folder where my js file was (i've removed all other scripts because i don't need to export them ...) same for my folder with my rule on it each time i've obtained an acp files (who contains an xml and eventually few files depends what kind of stuff you export) - if you check "included selected space" you will have the folder + the content so for the rule uncheck it (we only want the file) and for the folder check it
  • I was not able to directly bootstrap the acp (but several tutorials were using acp directly) so i unzip the acp and put the xml in my ide project
  • I've needed to look inside each xml and correct the path of the files to reflect the path of my module
  • I've updated the bootstrap-context.xml and add the bean(s) I need in my case 1 bean for the model and 1 bean for the rule & the folder

and that's it, compile it, you will have your amp file put it in amps folder in alfresco restart and enjoy ... or not if alfresco crash : in that case go in tomcat/logs/catalina.out (if you're using tomcat of course) and see the stacktrace, in my case i had as first error "Context initialization failed" then "org.alfresco.error.AlfrescoRuntimeException: Bootstrap failed" then a new error with the real problem like impossible to find this file etc ... with that you can correct the issue

bootstrap-context.xml :

//Here is my bean model

<bean id="org.alfresco.tutorial.customcontentmodelrepo.dictionaryBootstrap"
parent="dictionaryModelBootstrap"
depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/module/custom-repo/model/tourte.xml</value>
</list>
</property>
</bean>

//Here is my bean for the rule and the folder

     <bean id='custom_script_repo' class='org.alfresco.repo.module.ImporterModuleComponent' parent='module.baseComponent'>
     <property name='moduleId' value='${project.artifactId}' />
     <property name='name' value='org.alfresco.module.yourmodule.bootstrapSpaces' />
     <property name='description' value='Initial data requirements' />
     <property name='sinceVersion' value='${project.version}' />
     <property name='appliesFromVersion' value='${project.version}' />
     <property name='importer' ref='spacesBootstrap'/>
     <property name='bootstrapViews'>
     <list>
                 <props>
         <prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.scripts.childname}</prop>
         <prop key="location">alfresco/module/custom-script-repo/bootstrap/docx2pdf.xml</prop>
         </props>
         <props>
         <prop key="path">/${spaces.company_home.childname}</prop>
         <prop key="location">alfresco/module/custom-script-repo/bootstrap/tourtefolder.xml</prop>
         </props>
     </list>
</property>
    </bean>
</beans>