Subversion Repositories XServices

Rev

Rev 68 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68 Rev 69
Line 43... Line 43...
43
    }
43
    }
44
)
44
)
45
public interface DateService {
45
public interface DateService {
Line 46... Line 46...
46
	
46
	
47
	public static final String SERVICE_NAME = "DateService";
47
	public static final String SERVICE_NAME = "DateService";
48
	public static final String OPERATION_GETDATE = "getDate";
48
	final String OPERATION_GETDATE = "getDate";
49
	public static final String OPERATION_GETTIMESTAMP = "getTimestamp";
49
	final String OPERATION_GETTIMESTAMP = "getTimestamp";
50
	public static final String OPERATION_GETINTIMEZONE = "getInTimezone";
50
	final String OPERATION_GETINTIMEZONE = "getInTimezone";
51
	public static final String OPERATION_FORMATDATE = "formatDate";
51
	final String OPERATION_FORMATDATE = "formatDate";
52
	public static final String OPERATION_FORMATDATEADVANCED = "formatDateAdvanced";	
52
	final String OPERATION_FORMATDATEADVANCED = "formatDateAdvanced";	
53
	public static final String OPERATION_PARSEDATE = "parseDate";
53
	final String OPERATION_PARSEDATE = "parseDate";
54
	public static final String OPERATION_PARSEDATEADVANCED = "parseDateAdvanced";
54
	final String OPERATION_PARSEDATEADVANCED = "parseDateAdvanced";
55
	public static final String OPERATION_DATETIMEDIFF = "dateTimeDiff";
55
	final String OPERATION_DATETIMEDIFF = "dateTimeDiff";
56
	public static final String OPERATION_DATETIMEDIFF2 = "dateTimeDiff2";
56
	final String OPERATION_DATETIMEDIFF2 = "dateTimeDiff2";
57
	public static final String OPERATION_DATEADD = "dateAdd";
57
	final String OPERATION_DATEADD = "dateAdd";
58
	
58
	
59
	public static final String PARAM_TIMEZONE = "timezone";
59
	final String PARAM_TIMEZONE = "timezone";
60
	public static final String PARAM_DATETIME = "datetime";
60
	final String PARAM_DATETIME = "datetime";
61
	public static final String PARAM_FORMAT = "format";
61
	final String PARAM_FORMAT = "format";
Line 62... Line 62...
62
	public static final String PARAM_UNIT = "unit";
62
	final String PARAM_UNIT = "unit";
63
	
63
	
64
	/**
64
	/**
65
	 * Get current date and time.
65
	 * Get current date and time.
Line 95... Line 95...
95
	public abstract GregorianCalendar getInTimezone(
95
	public abstract GregorianCalendar getInTimezone(
96
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal,
96
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal,
97
			@WebParam(name=PARAM_TIMEZONE) @XmlElement(required=true) String timezone) throws XServicesFault;
97
			@WebParam(name=PARAM_TIMEZONE) @XmlElement(required=true) String timezone) throws XServicesFault;
Line 98... Line 98...
98
	
98
	
-
 
99
	/**
99
	/**
100
	 * Formats a date with pre-defined patterns.
100
	 * @param cal
101
	 * 
-
 
102
	 * @param cal date time to be formatted
101
	 * @param format
103
	 * @param format Pattern to be used for date formating
102
	 * @return formatted date/time string
104
	 * @return formatted date/time string
103
	 * @throws XServicesFault
105
	 * @throws XServicesFault
104
	 */
106
	 */
105
	@WebMethod(operationName=OPERATION_FORMATDATE)
107
	@WebMethod(operationName=OPERATION_FORMATDATE)
106
	public abstract String formatDate(
108
	public abstract String formatDate(
107
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal,
109
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal,
Line -... Line 110...
-
 
110
			@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) DateFormatType format) throws XServicesFault;
-
 
111
	
-
 
112
	/**
-
 
113
	 * Formats a date with a free form pattern.
-
 
114
	 * Uses SimpleDateFormat patterns
-
 
115
	 * The following pattern letters are defined (all other characters from 'A' to 'Z' and from 'a' to 'z' are reserved):
-
 
116
 
-
 
117
    Letter	Date or Time Component	Presentation	Examples
-
 
118
    G	Era designator	Text	AD
-
 
119
    y	Year	Year	1996; 96
-
 
120
    M	Month in year	Month	July; Jul; 07
-
 
121
    w	Week in year	Number	27
-
 
122
    W	Week in month	Number	2
-
 
123
    D	Day in year	Number	189
-
 
124
    d	Day in month	Number	10
-
 
125
    F	Day of week in month	Number	2
-
 
126
    E	Day in week	Text	Tuesday; Tue
-
 
127
    a	Am/pm marker	Text	PM
-
 
128
    H	Hour in day (0-23)	Number	0
-
 
129
    k	Hour in day (1-24)	Number	24
-
 
130
    K	Hour in am/pm (0-11)	Number	0
-
 
131
    h	Hour in am/pm (1-12)	Number	12
-
 
132
    m	Minute in hour	Number	30
-
 
133
    s	Second in minute	Number	55
-
 
134
    S	Millisecond	Number	978
-
 
135
    z	Time zone	General time zone	Pacific Standard Time; PST; GMT-08:00
-
 
136
    Z	Time zone	RFC 822 time zone	-0800
-
 
137
	 * @param cal Date time to be formatted
-
 
138
	 * @param format Format string
-
 
139
	 * @return Date time formatted according to format string
108
			@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) DateFormatType format) throws XServicesFault;
140
	 * @throws XServicesFault
109
	
141
	 */
110
	@WebMethod(operationName=OPERATION_FORMATDATEADVANCED)
142
	@WebMethod(operationName=OPERATION_FORMATDATEADVANCED)
111
	public abstract String formatDateAdvanced(
143
	public abstract String formatDateAdvanced(
Line 122... Line 154...
122
	public abstract GregorianCalendar parseDateAdvanced(
154
	public abstract GregorianCalendar parseDateAdvanced(
123
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) String s,
155
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) String s,
124
			@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) String format,
156
			@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) String format,
125
			@WebParam(name=PARAM_TIMEZONE) String timezone) throws XServicesFault;
157
			@WebParam(name=PARAM_TIMEZONE) String timezone) throws XServicesFault;
Line -... Line 158...
-
 
158
	
-
 
159
	/**
-
 
160
	 * Calculate elapsed time between two dates.
-
 
161
	 * @param fromCal First date.
-
 
162
	 * @param toCal Second date.
-
 
163
	 * @return Elapsed time in milliseconds
-
 
164
	 * @throws XServicesFault
126
	
165
	 */
127
	@WebMethod(operationName=OPERATION_DATETIMEDIFF)
166
	@WebMethod(operationName=OPERATION_DATETIMEDIFF)
128
	public abstract BigInteger dateTimeDiff(
167
	public abstract BigInteger dateTimeDiff(
129
			@WebParam(name="fromDateTime") @XmlElement(required=true) GregorianCalendar fromCal,
168
			@WebParam(name="fromDateTime") @XmlElement(required=true) GregorianCalendar fromCal,
Line 145... Line 184...
145
			@WebParam(name="fromDateTime") @XmlElement(required=true) GregorianCalendar fromCal,
184
			@WebParam(name="fromDateTime") @XmlElement(required=true) GregorianCalendar fromCal,
146
			@WebParam(name="toDateTime") @XmlElement(required=true) GregorianCalendar toCal,
185
			@WebParam(name="toDateTime") @XmlElement(required=true) GregorianCalendar toCal,
147
			@WebParam(name="PARAM_UNIT") DateTimeUnits unit) throws XServicesFault;
186
			@WebParam(name="PARAM_UNIT") DateTimeUnits unit) throws XServicesFault;
Line 148... Line 187...
148
	
187
	
149
	/**
188
	/**
150
	 * Add or substract a time span from a date.
189
	 * Add or subtract a time span from a date.
151
	 * 
190
	 * 
152
	 * @param cal
191
	 * @param cal The initial date.
-
 
192
	 * @param value The amount to add.
153
	 * @param unit 
193
	 * @param unit The unit the amount is defined in.
154
	 * @return New date and time.
194
	 * @return New date and time.
-
 
195
	 * @throws XServicesFault
155
	 * @throws XServicesFault
196
	 * 
156
	 */
197
	 */
157
	@WebMethod(operationName=OPERATION_DATEADD)
198
	@WebMethod(operationName=OPERATION_DATEADD)
158
	@WSDLDocumentation(value="Add or substract a time span from a date.")
199
	@WSDLDocumentation(value="Add or substract a time span from a date.")
159
	public abstract GregorianCalendar dateAdd(
200
	public abstract GregorianCalendar dateAdd(