Skip to main content

Class Structure

Annotations

Processor classes should include the following annotations in order to be properly recognized by Spring.

Designate the processor class as a bean which will then be recognized by core configuration: @Service

Explicitly set the scope of the class requiring Spring to create a new object instance every time bean is requested from the Spring container: @Scope("prototype")
This allows for better isolation and allows for init and tear-down separation.

All tasks should extend the AbstractTask class: AbstractTask
This class will provide some access to the IJobTask interface as well as some i18n functions and fields for UI form support.


Methods

getFormFields()

Create a list of form fields to capture user data for your task.

validateFormFields()

Server side form validation. Verify and notify form data entered by the user.

process()

Main method which will be called on each Repository Document processed by the job.

init()

Initialize your processor. This method will be called before process() to set up the processor for all documents in the queue.

close()

When all documents have been processed the migration manager will call the close method on the processor.


Initialize and Teardown

Proper utilization of the init and close methods is crucial for process performance. Use the init method to set your configuration, create re-usable clients, and set up caches or other ephemeral data structures that will be used while processing. The close method should be used to make sure nothing is left open and can also be used to perform any ancillary operations that need to be executed after that last document is processed.


i18N

Simflofy leverages Spring for internationalization. There are some base methods available through the AbstractTask class to help pull in the proper labels for the locale.

Make sure your Processor constructor sets a message source that matches the location of your properties file for internationalization.

public SampleTask() {
ResourceBundleMessageSource bundleMessageSource = new ResourceBundleMessageSource();
bundleMessageSource.setBasename("i18/sample-task");
bundleMessageSource.setDefaultEncoding("UTF-8");
this.setMessageSource(bundleMessageSource);
setMessageBase("sampleTask");
setName("sampleTask");
}

getTaskMessage(String label)

This will look for messages prepended with “task”. ie “task.taskName”

getGenMessage(String label)

This will look for messages prepended with “general”. These labels have multiple references throughout the product.

getMessage(String label)

Get the label based on the current message base. Uses whatever message base is set in the constructor. ie

Use task messages to show labels in config.

epf.addCheckEP(TEST_CHECK_BOX, getTaskMessage("testMessage"), getTaskMessage("testMessageDescription"));

Once the constructor has the setMessageBase method applied, the method above will return the value for the property keyed as seen below.

sample-task_en.properties
#Show additional i18n config
task.testMessage=Check?
task.testMessageDescription=This does not actually do anything. Go nuts.