PPM provides various attribute transformations of the type Time stamp transformation.
The time stamp transformations available in the PPM system convert source system time stamp values in any format to the valid internal PPM format with the proper PPM target data type. The following table provides you with an overview of available time stamp transformations:
Transformation |
PPM target data type |
---|---|
timestamp |
TIME |
timestamp_epoch |
TIME |
timeofday |
TIMEOFDAY |
timeofday_epoch |
TIMEOFDAY |
day |
DAY |
day_epoch |
DAY |
SAGDateTime |
TIME |
timestamp, timeofday, day time stamp transformations
The standards for the configuration of time stamp transformations are specified in the eventmapping.dtd document type definition:
...
<!ELEMENT transformation EMPTY>
<!ATTLIST transformation
type NMTOKEN "timestamp"
format CDATA #REQUIRED
>
...
In the type XML attribute, you specify which of the available time stamp transformations is to be used. The timestamp attribute transformation is the default. The format XML attribute specifies the time stamp format in the source system attribute.
Data in the format attribute corresponds to the Java time stamp format:
Symbol |
Description |
Data type |
Example |
---|---|---|---|
G |
Epoch identifier |
Text |
AD |
y |
Year |
Figure |
2003 |
MM |
Calendar month |
Figure |
09 |
MMM |
Calendar month |
Text |
Sep |
MMMM |
Calendar month |
Text |
September |
d |
Calendar day |
Figure |
26 |
h |
Hour, American notation (1-12) |
Figure |
12 |
H |
Hour (0-23) |
Figure |
14 |
m |
Minute |
Figure |
42 |
s |
Second |
Figure |
57 |
S |
Millisecond |
Figure |
978 |
E |
Day of the week |
Text |
Thursday |
F |
Recurrence of weekday in month |
Figure |
2 |
D |
Day of the year |
Figure |
189 |
w |
Calendar week |
Figure |
27 |
W |
Week of the month |
Figure |
2 (2. week of the month) |
a |
Time of day identifier |
Text |
PM |
k |
Hour (1-24) |
Figure |
24 |
K |
Hour, American notation (0-11) |
Figure |
7 |
z |
Time zone |
Text |
GMT |
´ |
Escape character for text |
Characters |
'Example text' |
´´ |
Simple apostrophe |
Characters |
'Example' 'Text' |
Example 1
The value 2002-12-24 (<Year>-<Month>-<Day>) for a source system attribute is transformed into PPM format using the format string yyyy-MM-dd:
...
<transformation type="timestamp" format="yyyy-MM-dd"/>
...
Example 2
Consolidated source system attribute values:
...
<attribute ppmattributetype="AT_END_TIME">
<eventattributetype>ERF_DAT</eventattributetype>
<eventattributetype>ERF_ZEIT</eventattributetype>
<transformation format="yyyyMMddHHmmss"/>
</attribute>
...
In the ERF_DAT source system attribute, the creation date is present in the format yyyyMMdd and in the ERF_ZEIT source system attribute the creation time is present in the format HHmmss. Extract from the XML output file:
<event>
...
<attribute type='ERF_DAT'>20011230</attribute>
...
</event>
<event>
...
<attribute type='ERF_ZEIT'>120730</attribute>
<attribute type='ERF_DAT'>20011101</attribute>
...
</event>
For the first system event, the AT_END_TIME attribute is not created, as the ERF_ZEIT attribute is not present.
For the second system event, both attributes are present. The attribute values are joined in the specified sequence to give 20011101120730, then evaluated using the specified format yyyyMMddHHmmss and transformed into the PPM-compatible time stamp 01.11.2001 12:07:30.
Example 3
In the ERF_STD attribute only the hour is recorded in which the system event was created. The creation time is always thirty minutes after the hour.
...
<attribute ppmattributetype="AT_END_TIME">
<eventattributetype>ERF_DAT</eventattributetype>
<value>::</value>
<eventattributetype>ERF_STD</eventattributetype>
<value>30</value>
<transformation format="yyyyMMdd::HHmm"/>
</attribute>
...
Associated system event from output file:
...
<event>
...
<attribute type='ERF_STD'>12</attribute>
<attribute type='ERF_DAT'>20011001</attribute>
...
</event>
...
The attribute values and constant strings are combined in the specified sequence into the string 20011001::1230 and transformed using the format yyyyMMdd::hhmm to give the PPM compatible time stamp 01.10.2001 12:30:00, which is written to the PPM attribute AT_END_TIME.
timestamp_epoch, timeofday_epoch, and day_epoch time stamp transformations
The timestamp_epoch time stamp transformation transforms an integer value indicating the seconds or milliseconds that have passed since January 1, 1970 into the internal PPM format. In the format XML attribute, you specify whether the integer value indicates the number of seconds (SECOND) or milliseconds (MILLISECOND) that have passed since 01.01.1970 0:00:00 GMT. The system's current time zone is taken into account in the calculation.
Use the attribute transformations timeofday_epoch and day_epoch the same way.
Example (timestamp_epoch)
In the WORK_ITEM-END_TIME source system attribute, the number of seconds since January 1, 1970 is indicated.
...
<attribute type="WORK_ITEM-END_TIME">1221482578</attribute>
...
Use the following mapping rule to assign this attribute value to the value of the PPM AT_END_TIME attribute:
...
<attribute ppmattributetype="AT_END_TIME">
<eventattributetype>
WORK_ITEM-END_TIME
</eventattributetype>
<transformation type="timestamp_epoch"
format="SECOND"/>
</attribute>
...
SAGDateTime attribute transformation
The SAGDateTime time format is used in so-called EDA events. So far, event attributes of the SAGDateTime time have been imported as text attributes because the existing time stamp transformations cannot easily process the date format.
YYYY-MM-DDThh:mm:ss.sssTZD
Examples of times in this format:
2011-04-28T08:15:59.001Z
2011-04-28T08:15:59.001+06:00
Transformator class
The SAGDateTime transformation contains a function for transforming times in SAGDateTime format to the PPM-specific time format.
The class can be used in attribute mapping during the PPM XML and process import. A mapping must be defined and could look like this.
<attribute ppmattributetype="AT_TIMESTAMP_PPM">
<eventattributetype>TIMESTAMP_SAGDATETIME</eventattributetype>
<transformation type="SAGDateTime" format="yyyy-MM-dd'T'HH:mm:ss.SSSZ"/>
</attribute>
Applying this rule leads to the contents of the event attribute TIMESTAMP_SAGDATETIME being written to the PPM attribute AT_TIMESTAMP_PPM in a PPM-compatible format. Milliseconds will be ignored.
Applying the above rule to the event attribute
<attribute type="TIMESTAMP_SAGDATETIME">2013-07-15T06:02:33.650Z</attribute>
would result in the following PPM attribute when used in the UTC time zone:
<attribute type="AT_TIMESTAMP_PPM">15.07.2013 06:02:33</attribute>
You have two options for specifying the mapping rule.
If it is known that the time in the event attribute is exact to the millisecond you can specify the expected format in the format attribute of the transformation (yyyy-MM-dd'T'HH:mm:ss.SSSZ for times to the millisecond, yyyy-MM-dd'T'HH:mm:ssZ for times to the second). Using a transformation for a time to the millisecond for a time to the second, and vice versa will result in an error.
If you do not specify a format both time formats (dd'T'HH:mm:ss.SSSZ und yyyy-MM-dd'T'HH:mm:ssZ) are applied consecutively during the transformation. If one of the formats is recognized the corresponding value will be written to the PPM attribute.