아래 코드를 자바서비스 만들기로 작성한다.
------------------------------------------------------------------
/*
* 입력된 yyyyMMdd에서 특정 addDay 날짜 만큼 더하거나 빼서 리턴 한다.
*/
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
String yyyyMMdd = IDataUtil.getString( pipelineCursor, "yyyyMMdd" );
String addDay = IDataUtil.getString( pipelineCursor, "addDay" );
pipelineCursor.destroy();
int iDay = 0;
if(addDay != null && addDay.length() >0)
iDay = Integer.parseInt(addDay);
Calendar cal=Calendar.getInstance ( );
int nYear = Integer.parseInt(yyyyMMdd.substring(0,4));
int nMonth = Integer.parseInt(yyyyMMdd.substring(4,6)) - 1;
int nDay = Integer.parseInt(yyyyMMdd.substring(6,8));
if(yyyyMMdd != null && yyyyMMdd.trim().length() >= 8){
cal.set(nYear, nMonth, nDay);
}else{
return;
}
StringBuffer sbDate=new StringBuffer ( );
cal.add ( Calendar.DAY_OF_MONTH, iDay );
nYear = cal.get ( Calendar.YEAR );
nMonth = cal.get ( Calendar.MONTH ) + 1;
nDay = cal.get ( Calendar.DAY_OF_MONTH );
sbDate.append ( nYear );
if ( nMonth < 10 )
sbDate.append ( "0" );
sbDate.append ( nMonth );
if ( nDay < 10 )
sbDate.append ( "0" );
sbDate.append ( nDay );
sbDate.append ( "Z" );
// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
IDataUtil.put( pipelineCursor_1, "outDate", sbDate.toString() );
pipelineCursor_1.destroy();
import java.util.*;
import java.text.*;
input
yyyyMMdd
addDay
output
outDate