public static final void first(IData pipeline) throws ServiceException { // --- <<IS-START(first)>> --- // @subtype unknown // @sigtype java 3.5 // [o] field:0:optional $key // [o] object:0:optional $value IDataCursor cursor = pipeline.getCursor(); try { if (cursor.first()) { String key = cursor.getKey(); Object value = cursor.getValue(); IDataUtil.put(cursor, "$key", key); IDataUtil.put(cursor, "$value", value); } } finally { cursor.destroy(); } // --- <<IS-END>> --- }
public static final void getCurrentDateString(IData pipeline) throws ServiceException { // --- <<IS-START(getCurrentDateString)>> --- // @subtype unknown // @sigtype java 3.5 // [i] field:0:required pattern // [i] field:0:optional timezone // [i] field:0:optional locale // [o] field:0:required value IDataCursor idcPipeline = pipeline.getCursor(); try { String inPattern = ""; if (idcPipeline.first("pattern")) { inPattern = (String) idcPipeline.getValue(); } else { throw new ServiceException("Input parameter 'pattern' was not found."); } IData output = Service.doInvoke("pub.date", "getCurrentDateString", pipeline); IDataCursor outCur = output.getCursor(); String stDate = IDataUtil.getString(outCur, "value"); IDataUtil.remove(outCur, "value"); outCur.destroy(); if (inPattern.endsWith("Z")) { Matcher matcher = specialTimezonePattern.matcher(stDate); if (matcher.find()) { stDate = matcher.replaceAll(":" + matcher.group(1)); } } idcPipeline.insertAfter("value", stDate); } catch (Exception e) { throw new ServiceException(e.getMessage()); } idcPipeline.destroy(); // --- <<IS-END>> --- }