Hi dear members,
For using blaze, we have to declared some variable in the publishableCanonical in Object / java.util.Date format.
When we received an Idoc from SAP, on the Handler we defined a mapping service to map Data from the Idoc to the publishableDocument.
The string that we have from the IDoc structure is like : yyyyMMddhhmmss
I tried to understand the build-in service :
pub.date:dateTimeFormat , but the output is a String
So I created a Java Service to make a new transformer in order to map the String field from Idoc to the Date field of the canonical:
IDataCursor pipelineCursor = pipeline.getCursor();
String Input = IDataUtil.getString( pipelineCursor, “DateInput”);
pipelineCursor.destroy();
SimpleDateFormat df = new SimpleDateFormat (“yyyyMMddhhmmss”);
java.util.Date d= df.parse(Input);
IDataCursor pipelineCursorOut = pipeline.getCursor();
IDataUtil.put( pipelineCursorOut, “DateOutput”, d);
pipelineCursorOut.destroy();
I’m not very good in JAVA, and I’m not sure if it’s working, because when I try to save it in Developper I got the error :
unreported exception java.text.ParseException; must be caught or declared to be thrown
java.util.Date d= df.parse(Input);
^
1 error
To you have an idea, or maybe a better practices ?
Many Thanks,
Vincent