Alfresco sublime text snippets

A collection of sublime text snippets useful for coding Alfresco webscripts, scripts, forms and content models.

Download as .zip Download as .tar.gz View on GitHub

Alfresco Content Model

A collection of sublime text snippets useful for coding Alfresco Content Model


Main Triggers !

Trigger: model

Output:


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<model xmlns="http://www.alfresco.org/model/dictionary/1.0" name="$1:model">
  <description>$TM_FILENAME</description>
  <author>$TM_FULLNAME : $TM_EMAIL</author>
  <published>$TM_YEAR</published>
  <version>1.0</version>
  
  <imports>
    <import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0" />
    <import prefix="cm" uri="http://www.alfresco.org/model/content/1.0" />
    <import prefix="sys" uri="http://www.alfresco.org/model/system/1.0" />
  </imports>

  <namespaces>
    <namespace prefix="$1" uri="http://www.org/v3.1/module/$2/model/1.0" />
  </namespaces>
  
  <constraints>
    <constraint name="$1:x-list" type="LIST">
      <parameter name="allowedValues">
        <list>
          <value>1</value>
          <value>2</value>
          <value>3</value>
        </list>
      </parameter>
    </constraint>
  </constraints>

  <types>
    <type name="$1:name">
      <title>Title</title>
      <parent>cm:content</parent>
      <properties>
        <property name="$1:date">
          <title>Date</title>
          <type>d:date</type>
        </property>
        <property name="$1:list">
          <title>List</title>
          <type>d:text</type>
          <constraints>
            <constraint ref="$1:x-list" />
          </constraints>
        </property>
        <property name="$1:text">
          <title>Text</title>
          <type>d:text</type>
        </property>       
      </properties>
      <mandatory-aspects>
        <aspect>cm:auditable</aspect>
        <aspect>cm:author</aspect>
      </mandatory-aspects>
    </type>
  </types>
  
  <aspects>
    <aspect name="$1:x-aspect">
      
    </aspect>
  </aspects>
</model>  
    
  
          

Trigger: association

Output:


<association name="$1:$2">
   <title>Title</title>
   <source>
      <mandatory>false</mandatory>
      <many>true</many>
   </source>
   <target>
      <class>cm:person</class>
      <mandatory>false</mandatory>
      <many>false</many>
   </target>
</association>
          

Trigger: associations

Output:


<associations>
  
</associations>
          

Trigger: child association

Output:


<child-association name="$1:$2">
   <source>
    <mandatory>false</mandatory>
    <many>false</many>
   </source>
   <target>
    <class>cm:folder</class>
    <mandatory enforced="true">true</mandatory>
    <many>false</many>
   </target>
   <duplicate>false</duplicate>
</child-association>
          

Trigger: constraint List

Output:


<constraint name="$1:$2" type="LIST">
  <parameter name="allowedValues">
    <list>
      <value>1</value>
      <value>2</value>
      <value>3</value>
    </list>
  </parameter>
</constraint>
          

Trigger: constraints MINMAX

Output:


<constraint name="$1:$2" type="MINMAX">
 <parameter name="minValue">
    <value>0</value>
 </parameter>
 <parameter name="maxValue">
    <value>100</value>
 </parameter>
</constraint>
          

Trigger: constraints

Output:


<constraints>
  
</constraints>
          

Trigger: description

Output:


<description>description</description>
<author>Author</author>
<published>Date</published>
<version>1.0</version>
          

Trigger: imports

Output:


<imports>
  <import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0" />
  <import prefix="cm" uri="http://www.alfresco.org/model/content/1.0" />
  <import prefix="sys" uri="http://www.alfresco.org/model/system/1.0" />
</imports>
          

Trigger: multiple

Output:


<multiple>true</multiple>
          

Trigger: namespaces

Output:


<namespaces>
  <namespace prefix="$1" uri="http://www.org/v3.1/module/$2/model/1.0" />
</namespaces>
          

Trigger: propertyDate

Output:


<property name="$1:date">
  <title>Date</title>
  <type>d:date</type>
</property>
          

Trigger: propertyInt

Output:


<property name="$1:int">
  <title>Int</title>
  <type>d:int</type>  
</property>
          

Trigger: propertyList

Output:


<property name="$1:list">
  <title>List</title>
  <type>d:text</type>
  <constraints>
    <constraint ref="$1:x-list" />
  </constraints>
</property>
          

Trigger: propertyText

Output:


<property name="$1:text">
  <title>Text</title>
  <type>d:text</type>
</property>
          

Trigger: types

Output:


<types>
  <type name="$1:name">
    <title>Title</title>
    <parent>sys:base</parent>
    <properties>
      <property name="$1:date">
        <title>Date</title>
        <type>d:date</type>
      </property>
      <property name="$1:list">
        <title>List</title>
        <type>d:text</type>
        <constraints>
          <constraint ref="$1:x-list" />
        </constraints>
      </property>
      <property name="$1:text">
        <title>Text</title>
        <type>d:text</type>
      </property>       
    </properties>
    <mandatory-aspects>
      <aspect>cm:auditable</aspect>
      <aspect>cm:author</aspect>
    </mandatory-aspects>
  </type>
</types>
          

Author

GitHub: odtorres