/alfresco-jscript-extensions

Alfresco repository module with helpful javascript root object extensions which are helpful in much scenarios

Primary LanguageJavaApache License 2.0Apache-2.0

alfresco-jscript-extensions

Alfresco (Master) Build Status Alfresco repository module with helpful javascript root object extensions which are helpful in much scenarios for Alfresco 5.1 and higher.

Important: Alfresco 4.2 - 5.0 is not supported anymore.

Maven usage

Alfresco SDK 2.x

Add the dependencies to the Alfresco repository POM files of your WAR projects.

<dependencies>
  ...
  <dependency>
    <groupId>de.jgoldhammer</groupId>
    <artifactId>alfresco-jscript-extension</artifactId>
    <version>1.7</version>
    <type>amp</type>
  </dependency>
  ...
</dependencies>

<overlays>
  ...
  <overlay>
    <groupId>de.jgoldhammer</groupId>
    <artifactId>alfresco-jscript-extension</artifactId>
    <version>1.7</version>
    <type>amp</type>
  </overlay>
  ...
</overlays>

Alfresco SDK 3.x

Add the dependencies to the Alfresco repository POM files of your WAR projects.

<platformModules>
	<moduleDependency>
		<groupId>de.jgoldhammer</groupId>
        	<artifactId>alfresco-jscript-extension</artifactId>
        	<version>1.7</version>
        	<type>amp</type>
    	</moduleDependency>
</platformModules>

Alfresco SDK 4.x

Including the AMP artifact into an All-in-One project created from the archetype provided by Alfresco SDK 4, the following dependency must be added to the *-platform-docker sub-module of the generated project:

<dependency>
	<groupId>de.jgoldhammer</groupId>
	<artifactId>alfresco-jscript-extension</artifactId>
	<version>1.8.0</version>
</dependency>

Functionality

The extension provides some root objects for java serivces in the alfresco api. The root objects provides easier access via js-console or javascript based webscripts.

Following root objects are provided:

  • attributes

    • get attributes by key
    • create attributes
    • remove attributes
    • example: tbd
  • auth

    • to change the authentication to another user during the javascript execution
    • to get the current executing authenticated user
    • example: tbd
  • batch

  • database

  • downloads

  • favorites

  • fileWriter

  • policies

    • to temporarly disable or enable policy behavours during javascript extecution
    • policy behaviours can be enabled or disabled on a specific node or a certain aspect/type
    • example: https://gist.github.com/jgoldhammer/6941414
  • jobs

  • permissions

  • repoAdmin

    • uses the repo admin interpreter from the repo admin console
    • write your commands and get back the result in the js-console
    • example 1: print(repoAdmin.exec('help')) - show the help
    • example 2: print(reopAdmin.exec('show models')); - show all additional datamodels
  • rules

  • tenantAdmin

    • uses the repo admin interpreter from the repo admin console
    • write your commands and get back the result in the js-console
    • example 1: print(tenantAdmin.exec('help')) - show the help
    • example 2: print(tenantAdmin.exec('show tenants')); - show all tenants (if you create one before!)
  • trans

    • create a new transaction
    • start, commit and rollback (database) transactions during the javascript execution
    • example: tbd
  • workflowAdmin

    • uses the workflowinterpreter from the workflow console
    • write your commands and get back the result in the js-console
    • example 1: print(workflowAdmin.exec('help')) - show the help
    • example 2: print(workflowAdmin.exec('show definitions')); - show all workflow definitions

Build

To build the module and its AMP / JAR files, run the following command from the base project directory:

mvn install

Release

  • Change the version number in pom.xml

  • push the release to sonatype nexus with following command

    .deploy.sh

License

The project is using Apache 2.0 license - see See LICENSE.md

Original authors:

  • Jens Goldhammer, fme AG