date value modifier

Date Value Modifier

Version: 17.07

Supported Since: 17.07

What is a Date Value Modifier?

Date Value Modifier processing element can be used to increment or decrement the value of a given input date string. The input can be set as a message context scope variable, message property, message transport header or users can directly provide the relevant date string as a property to the processing element configuration. If you are using a scope variable or a message property to provide the input date it can be a java.util.Date type or java.lang.String type. In the processing element configuration you can define the segment of the date to be modified and number of units that it needs to be modified. Also you can define where the resultant modified date should be assigned to, ie: to a scope variable, message property or a message header, and the name of the parameter which will hold the result.

Out Ports

date value modifier outports

Next

The processing element will modify given date by the defined number of units and then assign it to a variable/property/header and then it will be forwarded to this out port

On Exception

The message will be sent to this outport if any exception occurred while modifying the provided date

Parameters

Input Type

Using this property you need to define how will you provide the date. From the dropdown menu you will be able to select on of the following options.

* HEADER * PROPERTY * CONTENT * VARIABLE

Date String

If you select "CONTENT" from the "Input Type" dropdown you need to provide the date string needs to be used as the input date

Variable Name

If you select "VARIABLE" from the "Input Type" dropdown you need to provide name of the scope variable which needs to be used as the input date

Variable Type

If you select "VARIABLE" from the "Input Type" dropdown you need to provide type of the scope variable by selecting from dropdown menu, ie: whether it is going to be a "STRING" or a "DATE"

Header Name

If you select "HEADER" from the "Input Type" dropdown you need to provide name of the transport header which needs to be used as the input date

Property Name

If you select "PROPERTY" from the "Input Type" dropdown you need to provide name of the message property which needs to be used as the input date

Property Type

If you select "PROPERTY" from the "Input Type" dropdown you need to provide type of the message property by selecting from dropdown menu, ie: whether it is going to be a "STRING" or a "DATE"

Original Date Pattern

If you are providing a date string then it is required to provide the pattern of the provided date string. From the dropdown list you should select on the following date patterns supported by org.apache.commons.lang3.time.FastDateFormat

* yyyy-MM-dd’T’HH:mm:ss * yyyy-MM-dd’T’HH:mm:ssZZ * yyyy-MM-dd * yyyy-MM-ddZZ * 'T’HH:mm:ss * 'T’HH:mm:ssZZ * HH:mm:ss * HH:mm:ssZZ * EEE, dd MMM yyyy HH:mm:ss Z

Property to be Modified

Using this property you can define the segment of the date that needs to be modified. Following are the segments that are facilitated to be modified for given the date.

* YEAR * MONTH * DAY * HOUR * MINUTES * SECONDS * MILLISECONDS * TIME ZONE OFFSET

Increment/ Decrement

By marking the checkbox to be trye you will be able to mark the modify operation as an increment operation.

Number of Units

From this property you will be able to define the number of units that the required date segment needs to be incremented/decremented.

Output Type

Using this property you need to define how you needs to assign the transformed date string. From the dropdown menu you will be able to select one of the following options.

* HEADER * PROPERTY * VARIABLE

Transformed Variable Type

If you select "VARIABLE" or "PROPERTY" from the "Output Type" dropdown you need to provide type of the scope variable/message property by selecting from dropdown menu, ie: whether it is going to be a "STRING" or a "DATE"

Variable Name to Assign Transformed Date

If you select "VARIABLE" from the "Output Type" dropdown you need to provide name of the scope variable which needs to be used to assign the modified date

Header Name to Assign Transformed Date

If you select "HEADER" from the "Output Type" dropdown you need to provide name of the transport header which needs to be used to assign the modified date

Property Name to Assign Transformed Date

If you select "PROPERTY" from the "Output Type" dropdown you need to provide name of the message property which needs to be used to assign the modified date

Sample Use Case

The following simple use case describes how you can receive a HTTP message which contains a transport header with a timestamp value and how you can modify it as you prefer and use in your custom logic. In this case modified date will be assigned to a message context scope variable.

date val modifier flow

In the above flow, through HTTP Ingress Connector element messages will be received to the flow. Each message will have a transport header "timestamp" that contains a date value formatted into "yyyy-MM-dd’T’HH:mm:ss". From that date Date Value Modifier processing element will modify inorder to increment the day value from four units and assign it to a scope variable of name "updatedDate".

Following images depicts configuration of the processing element.

date update input 01
date update input 02
date update output

After modification, modified date will be assigned to a scope variable as depicted in the following image.

date update result

After modification, in this simple message flow, the message will be forwarded to the backend server through a HTTP Egress Connector.

In this topic
In this topic
Contact Us