Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Configuring the OC AutoNumber Event

Natalie Reiman edited this page Aug 8, 2018 · 2 revisions

Setup the AutoNumber Bean

Add the following AutoNumber bean to your project-bean-config.xml.

<bean id="AutoNumber" class="com.tsgrp.opencontent.core.event.events.AutoNumberEvent" init-method="init">
	<property name="ocPolicyComponent" ref="ocPolicyComponent" />
	<property name="priority" value="1" />
	<property name="enabled" value="true" />
	<property name="eventType" value="BEFORE_CREATE" />
	<property name="eventFilters">
		<list value-type="com.tsgrp.opencontent.core.event.OCEventFilter">
		        <ref bean="objectTypeDoc" />
		</list>
	</property>
	<property name="autoNumberFormat" value="${app_department~deptLabelMap}-${objectType~docTypeMap}-${AutoNumber}" />
</bean>

Note: The autoNumberFormat is used to name the new object being uploaded.

  • You can change the values of the tokens and the String they are separated by.
  • Each token value must be a valid property found on the new file's OCO, and the separator String must be the same b/w each token.
  • Optionally, you can include a lookup map if you want to replace the value that comes back from a property. Other Examples:
<property name="autoNumberFormat" value="${objectName}-${departmentName}-${mimeType}-${AutoNumber}" />
<property name="autoNumberFormat" value="${objectName} and ${objectType} and ${AutoNumber}" />
<property name="autoNumberFormat" value="${objectName~objNameMap}_${objectType}_${AutoNumber}" />

(Optional) Add the Lookup Maps

Add an entry to the ProjectPicklists bean for each lookup map you included in the autoNumberFormat.

<entry key="deptLabelMap" value="Government Administration,GA;Information Technology,IT;Human Resource,HR;Safety,SA;Environmental,EN;Internal Audit,IA;Ethics &amp; Compliance,EC" />
<entry key="docTypeMap" value="Claims Document,CLD;Controlled Document,COD;Policy,PO" />

Setup a Filter on Object Types

Add an objectTypeFilter bean to your project-bean-config.xml. This bean determines the object types that will not be auto numbered.

<bean id="objectTypeDoc" class="com.tsgrp.opencontent.core.event.filters.ObjectTypeFilter">
        <property name="invert" value="true" />
	<property name="objectTypes">
		<list value-type="java.lang.String">
			<value>Document</value>
			<value>AutoNumber</value>
		</list>
	</property>
</bean>

Create the AutoNumber OTC.

Type

  • Label: AutoNumber
  • ocName: AutoNumber

Properties

  • Label: Number
  • ocName: Number
  • Data Type: integer

Create a New Form for AutoNumber

  • Include the Name and Number properties from your new AutoNumber OTC.

Create a Contentless Object of type AutoNumber.

  • Set up the action createContentlessObject to use your new Auto Number Form.
  • Create the new contentless object. Set the name value to be something easy like "Num", and set the number value to be 1.

Upload some docs and see it work!

  • The new docs file names should include the tokens and the auto number.
Clone this wiki locally