Timestamp Utility Service
The Timestamp Utility service creates, formats, and performs arithmetic operations on timestamp values in a business process.
The following table provides an overview of the Timestamp Utility service:
Category | Description |
---|---|
System name | TimestampUtilService |
Graphical Process Modeler (GPM) category | All Services |
Description | Enables you to create, format, and perform arithmetic
operations on timestamp values in a business process. The following
options are available with the Timestamp Utility service:
|
Preconfigured? | Yes |
Requires third-party files? | No |
Platform availability | All supported Sterling B2B Integrator platforms |
Related services | No |
Application requirements | No |
Initiates business processes? | No |
Invocation | Runs as part of a business process. |
Restrictions | No |
How the Timestamp Utility Service Works
The Timestamp Utility service enables you to use and manipulate timestamps as part of a business process. One example of how this service could be used would be to calculate the expiration time for incoming documents. If a document had to be acted upon within a two-hour time frame, you could use the service to get the timestamp for when the document arrives, and then calculate the time (two hours later), when an error should be generated if no action has been taken on that document. You could also use the service to generate a timestamp when errors occur in a business process, and use the timestamp as part of the information delivered in an e-mail message about the error, or send the information to a report.
The Timestamp Utility service calculates the time difference using the UNIX time stamp. The time difference is the number of seconds between the particular date and time and the UNIX epoch time.
Business Process Examples
The following figure shows process data that uses the Timestamp Utility service to format a timestamp:
<process name="default">
<sequence name="Main">
<sequence name="SetTimeAdd">
<operation name="Timestamp Utility">
<participant name="TimestampUtilService"/>
<output message="TimestampUtilServiceTypeInputMessage">
<assign to="action">add</assign>
<assign to="baseTime">2016-06-16 16:30:00</assign>
<assign to="baseTimeFormat">yyyy-MM-dd HH:mm:ss</assign>
<assign to="format">yyyy-MM-dd HH:mm:ss</assign>
<assign to="offsetTime">1800</assign>
<assign to="scale">sec</assign>
<assign to="." from="*"/>
</output>
<input message="inmsg">
<assign to="/ProcessData/calculated" from="*" append="true"/>
</input>
</operation>
</sequence>
<sequence name="NowTimeAdd">
<operation name="Timestamp Utility">
<participant name="TimestampUtilService"/>
<output message="TimestampUtilServiceTypeInputMessage">
<assign to="action">add</assign>
<assign to="baseTime">now</assign>
<assign to="format">yyyy-MM-dd HH:mm:ss</assign>
<assign to="offsetTime">1800</assign>
<assign to="scale">sec</assign>
<assign to="." from="*"/>
</output>
<input message="inmsg">
<assign to="/ProcessData/calculated" from="*" append="true"/>
</input>
</operation>
</sequence>
</sequence>
</process>
For examples of timestamp format patterns and results, see http://www.oracle.com/technetwork/java/index.html and see the information about the SimpleDateFormat class.
Implementing the Timestamp Utility Service
- Create a Timestamp Utility service configuration. See Creating a Service Configuration.
- Configure the Timestamp Utility service. See Configuring the Timestamp Utility Service.
- Use the Timestamp Utility in a business process.
Configuring the Timestamp Utility Service
The following table describes the fields used to configure the Timestamp Utility service in the GPM:
Field | Description |
---|---|
Config | Name of the service configuration. |
action | Action the service should perform. Optional. Valid values are:
|
baseTime | String to use as the base time. Optional. Default time expression is
milliseconds; used if no scale is supplied (see scale parameter,
below). '"now"' is a valid value for the base time. Restriction:
|
baseTimeFormat | String to use as the base time format. Optional. For example, yyyy-MM-dd
HH:mm:ss Note: If the baseTimeFormat is not used, a UNIX
ctime
can be use as the
baseTime. |
format | String that describes how to format the parameter. Optional. See http://www.oracle.com/technetwork/java/index.html for information about using SimpleDateFormat values. |
offsetTime | Amount to add or subtract from the baseTime. Used with action parameters add and diff only. Optional. Default time expression is milliseconds; used if no scale is supplied (see scale parameter, below). |
scale | How the parameter value is expressed in time scales. Optional. Valid values are:
If not set, the baseTime and offsetTime parameters are expressed in milliseconds. |
Parameters Passed from Business Process to Service
The parameters passed from the business process to the Timestamp Utility service is shown in the following table:
Parameters | Description |
---|---|
Config | Name of the service configuration. |
action | Action the service should perform. Optional. Valid values are:
|
baseTime | String to use as the base time. Optional. Default time expression is milliseconds; used if no scale is supplied (see scale parameter, below). |
baseTimeFormat | String to use as the base time format. Optional. For example, yyyy-MM-dd HH:mm:ss |
format | String that describes how to format the parameter. Optional. See http://www.oracle.com/technetwork/java/index.html for information about using SimpleDateFormat values. |
offsetTime | Amount to add or subtract from the baseTime. Used with action parameters add and diff only. Optional. Default time expression is milliseconds; used if no scale is supplied (see scale parameter, below). |
scale | How the parameter value is expressed in time scales. Optional. Valid values are:
If not set, the baseTime and offsetTime parameters are expressed in milliseconds. |