Advanced AMP Development

Document created by resplin Employee on Jun 6, 2015
Version 1Show Document
  • View in full screen mode

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com






AMP file structure



  /
  |
  |- /config
  |
  |- /lib
  |
  |- /licenses
  |
  |- /web
    |
    |- /jsp
    |
    |- /css
    |
    |- /images
    |
    |- /scripts
  |
  |- module.properties
  |
  |- file-mapping.properties



Structure config directory



  /config
  |
  |- /alfresco
    |
    |- /module
       |
       |- /moduleid
          |- module-context.xml
          |
          |- /boostrap
          |  |-script-import.xml
          |  |-groups-import.xml
          |  |-content-template-import.xml
          |  |-space-to-import.xml
          |  |-/space-to-import
          |
          |- /context
          |  |-bootstrap-context.xml
          |  |-action-context.xml
          |  |-others-context.xml
          |
          |- /messages
          |
          |- /model
          |  |-modulenameModel.xml
          |
          |- /script
          |  |-somescript.js
          |
          |- /template
          |  |-sometemplate.ftl
          |
          |- /ui
          |  |-web-client-custom.xml
          |
          |- /workflow
             |-workflowmodulename_workflowModel.xml
             |-workflowmodulename_processdefinition.xml
             |-workflowmodulename-messages.properties

/alfresco/module/moduleid

For alfresco to pickup your module resources these have to be placed
(these usually were placed in the <shared>/alfresco/extension directory)
in the webapps/alfresco/WEB-INF/classes/alfresco/module/<moduleid> subdirectory
as you can see in this snippet from WEB-INF/classes/alfresco/module-context.xml



   <import resource='classpath*:alfresco/module/*/module-context.xml'/>
   <import resource='classpath*:alfresco/module/*/module-uninstall-context.xml'/>

contents of module-context.xml



<beans>
  <moduleid>/context/bootstrap-context.xml' />
  <moduleid>/context/action-context.xml' />
  <moduleid>/context/scheduled-action-context.xml' />

  <moduleid>.ConfigBootstrap' class='org.alfresco.web.config.WebClientConfigBootstrap' init-method='init'>
    <property name='configs'>
     <list>
       <value>classpath:alfresco/module/<moduleid>/ui/web-client-xml</value>
     </list>
    </property>
  </bean>
</beans>

Using bootstrap


When installing a Module into the Alfresco system you probably want to import
some stuff like spaces, templates, scripts etc.
For this purpose you can use the boostrap mechanism.

The first line in module-context.xml:



    <moduleid>/context/bootstrap-context.xml' />

points to

bootstrap-context.xml



<beans>
  <moduleid>.dictionaryBootstrap' parent='dictionaryModelBootstrap' depends-on='dictionaryBootstrap'>
    <property name='models'>
      <list>
        <value>alfresco/module/<moduleid>/model/modulenameModel.xml</value>
      </list>
    </property>
  </bean>

  <moduleid>.bootstrapSpaces' class='org.alfresco.repo.module.ImporterModuleComponent'
                                        parent='module.baseComponent'>
    <moduleid>' />
    <moduleid>.bootstrapSpaces' />
    <property name='description' value='Initial data requirements' />
    <property name='sinceVersion' value='1.0' />
    <property name='appliesFromVersion' value='1.0' />
    <property name='importer' ref='spacesBootstrap'/>
    <property name='bootstrapViews'>
      <list>
        <props>
          <prop key='path'>/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname}</prop>
          <prop key='location'>alfresco/module/<moduleid>/bootstrap/content-template-import.xml</prop>
        </props>
        <props>
          <prop key='path'>/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.scripts.childname}</prop>
          <prop key='location'>alfresco/module/<moduleid>/bootstrap/script-import.xml</prop>
        </props>
        <props>
          <prop key='path'>/${spaces.company_home.childname}</prop>
          <prop key='location'>alfresco/module/<moduleid>/bootstrap/space-to-import.xml</prop>
        </props>
      </list>
    </property>
  </bean>

  <moduleid>.bootstrapGroups' class='org.alfresco.repo.module.ImporterModuleComponent'
                                        parent='module.baseComponent'>
    <moduleid>' />
    <moduleid>.bootstrapGroups' />
    <property name='description' value='Initial data requirements' />
    <property name='sinceVersion' value='1.1' />
    <property name='appliesFromVersion' value='1.1' />
    <property name='importer' ref='userBootstrap'/>
    <property name='bootstrapViews'>
      <list>
        <props>
          <prop key='path'>/${alfresco_user_store.system_container.childname}/sys:authorities</prop>
          <prop key='location'>alfresco/module/<moduleid>/bootstrap/import_groups.xml</prop>
        </props>
      </list>
    </property>
  </bean>

  <moduleid>.workflowBootstrap' parent='workflowDeployer'>
    <property name='workflowDefinitions'>
      <list>
        <props>
          <prop key='engineId'>jbpm</prop>
          <prop key='location'>alfresco/module/<moduleid>/workflow/workflowmodulename_processdefinition.xml</prop>
          <prop key='mimetype'>text/xml</prop>
          <prop key='redeploy'>true</prop>
        </props>
      </list>
    </property>
    <property name='models'>
      <list>
        <value>alfresco/module/<moduleid>/workflow/workflowmodulename_workflowModel.xml</value>
      </list>
    </property>
    <property name='labels'>
      <list>
        <value>alfresco/module/<moduleid>/workflow/workflowmodulename</value>
      </list>
    </property>
  </bean>

</beans>


AMP

Attachments

    Outcomes