Subversion Repositories XServices

Rev

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

Rev 71 Rev 83
Line 15... Line 15...
15
 */
15
 */
Line 16... Line 16...
16
 
16
 
Line 17... Line 17...
17
package net.brutex.xservices.ws;
17
package net.brutex.xservices.ws;
-
 
18
 
18
 
19
import java.math.BigInteger;
-
 
20
import java.util.Date;
Line 19... Line 21...
19
import java.math.BigInteger;
21
import java.util.GregorianCalendar;
20
import java.util.GregorianCalendar;
22
import java.util.List;
21
 
23
 
22
import javax.jws.WebMethod;
24
import javax.jws.WebMethod;
-
 
25
import javax.jws.WebParam;
Line 23... Line 26...
23
import javax.jws.WebParam;
26
import javax.jws.WebService;
-
 
27
import javax.xml.bind.annotation.XmlElement;
-
 
28
import javax.xml.datatype.XMLGregorianCalendar;
24
import javax.jws.WebService;
29
 
-
 
30
import net.brutex.xservices.types.DateFormatType;
25
import javax.xml.bind.annotation.XmlElement;
31
import net.brutex.xservices.types.DateInfoExtendedType;
Line -... Line 32...
-
 
32
import net.brutex.xservices.types.DateInfoType;
26
 
33
import net.brutex.xservices.types.DateTimeUnits;
27
import net.brutex.xservices.types.DateFormatType;
34
import net.brutex.xservices.types.TimeZoneType;
Line 28... Line 35...
28
import net.brutex.xservices.types.DateTimeUnits;
35
import net.brutex.xservices.util.BrutexNamespaces;
29
import net.brutex.xservices.util.BrutexNamespaces;
36
 
Line 43... Line 50...
43
    }
50
    }
44
)
51
)
45
public interface DateService {
52
public interface DateService {
Line 46... Line 53...
46
	
53
	
-
 
54
	public static final String SERVICE_NAME = "DateService";
47
	public static final String SERVICE_NAME = "DateService";
55
	
-
 
56
	final String OPERATION_GETDATE = "getDate";
48
	final String OPERATION_GETDATE = "getDate";
57
	final String OPERATION_GETDATEEXTENDED = "getDateExtended";
49
	final String OPERATION_GETTIMESTAMP = "getTimestamp";
58
	final String OPERATION_GETTIMESTAMP = "getTimestamp";
50
	final String OPERATION_GETTIMESTAMP2 = "getTimestamp2";
59
	final String OPERATION_GETTIMESTAMP2 = "getTimestamp2";
51
	final String OPERATION_GETINTIMEZONE = "getInTimezone";
60
	final String OPERATION_GETINTIMEZONE = "getInTimezone";
52
	final String OPERATION_FORMATDATE = "formatDate";
61
	final String OPERATION_FORMATDATE = "formatDate";
53
	final String OPERATION_FORMATDATEADVANCED = "formatDateAdvanced";	
62
	final String OPERATION_FORMATDATEADVANCED = "formatDateAdvanced";	
54
	final String OPERATION_PARSEDATE = "parseDate";
63
	final String OPERATION_PARSEDATE = "parseDate";
55
	final String OPERATION_PARSEDATEADVANCED = "parseDateAdvanced";
64
	final String OPERATION_PARSEDATEADVANCED = "parseDateAdvanced";
56
	final String OPERATION_DATETIMEDIFF = "dateTimeDiff";
65
	final String OPERATION_DATETIMEDIFF = "dateTimeDiff";
57
	final String OPERATION_DATETIMEDIFF2 = "dateTimeDiff2";
66
	final String OPERATION_DATETIMEDIFF2 = "dateTimeDiff2";
58
	final String OPERATION_DATEADD = "dateAdd";
-
 
-
 
67
	final String OPERATION_DATEADD = "dateAdd";
59
	
68
	final String OPERATION_GETTIMEZONES = "getTimezones";
60
	final String PARAM_TIMEZONE = "timezone";
69
	final String PARAM_TIMEZONE = "timezone";
61
	final String PARAM_DATETIME = "datetime";
70
	final String PARAM_DATETIME = "datetime";
62
	final String PARAM_FORMAT = "format";
71
	final String PARAM_FORMAT = "format";
Line 63... Line 72...
63
	final String PARAM_UNIT = "unit";
72
	final String PARAM_UNIT = "unit";
64
	
73
	
65
	/**
74
	/**
66
	 * Get current date and time.
-
 
67
	 * 
75
	 * Get current date and time.
68
	 * @param timezone Optional timezone. Defaults to server timezone.
76
	 * 
69
	 * @return Current date and time.
77
	 * @return Current date and time.
70
	 * @throws XServicesFault 
78
	 * @throws XServicesFault 
71
	 */
79
	 */
72
	@WebMethod(operationName=OPERATION_GETDATE)
80
	@WebMethod(operationName=OPERATION_GETDATE)
-
 
81
	@WSDLDocumentation(value="Get current date and time.")
-
 
82
	public abstract DateInfoType getDate() 
-
 
83
			throws XServicesFault;
-
 
84
	
-
 
85
	/**
-
 
86
	 * Get current date and time (extended version).
-
 
87
	 * 
-
 
88
	 * @return Current date and time.
-
 
89
	 * @throws XServicesFault 
73
	@WSDLDocumentation(value="Get current date and time.")
90
	 */
-
 
91
	@WebMethod(operationName=OPERATION_GETDATEEXTENDED)
-
 
92
	@WSDLDocumentation(value="Get current date and time in different formats.")
Line 74... Line 93...
74
	public abstract GregorianCalendar getDate(
93
	public abstract DateInfoExtendedType getDateExtended() 
75
			@WebParam(name=PARAM_TIMEZONE) String timezone) throws XServicesFault;
94
			throws XServicesFault;
76
	
95
	
77
	/**
96
	/**
Line 100... Line 119...
100
	 * @param timezone time zone
119
	 * @param timezone time zone
101
	 * @return date time
120
	 * @return date time
102
	 * @throws XServicesFault
121
	 * @throws XServicesFault
103
	 */
122
	 */
104
	@WebMethod(operationName=OPERATION_GETINTIMEZONE)
123
	@WebMethod(operationName=OPERATION_GETINTIMEZONE)
105
	public abstract GregorianCalendar getInTimezone(
124
	public abstract String getInTimezone(
106
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal,
125
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) Date cal,
107
			@WebParam(name=PARAM_TIMEZONE) @XmlElement(required=true) String timezone) throws XServicesFault;
126
			@WebParam(name=PARAM_TIMEZONE) @XmlElement(required=true) String timezone) throws XServicesFault;
Line 108... Line 127...
108
	
127
	
109
	/**
128
	/**
110
	 * Formats a date with pre-defined patterns.
129
	 * Formats a date with pre-defined patterns.
111
	 * 
130
	 * 
112
	 * @param cal date time to be formatted
131
	 * @param cal date time to be formatted in ISO8601
113
	 * @param format Pattern to be used for date formating
132
	 * @param format Pattern to be used for date formating
114
	 * @return formatted date/time string
133
	 * @return formatted date/time string
115
	 * @throws XServicesFault
134
	 * @throws XServicesFault
116
	 */
135
	 */
117
	@WebMethod(operationName=OPERATION_FORMATDATE)
136
	@WebMethod(operationName=OPERATION_FORMATDATE)
118
	public abstract String formatDate(
137
	public abstract String formatDate(
119
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal,
138
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) Date cal,
Line -... Line 139...
-
 
139
			@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) DateFormatType format) throws XServicesFault;
-
 
140
	
-
 
141
	@WebMethod(operationName=OPERATION_GETTIMEZONES)
120
			@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) DateFormatType format) throws XServicesFault;
142
	public abstract List<TimeZoneType> getTimezones() throws XServicesFault;
121
	
143
	
122
	/**
144
	/**
123
	 * Formats a date with a free form pattern.
145
	 * Formats a date with a free form pattern.
Line 149... Line 171...
149
	 * @return Date time formatted according to format string
171
	 * @return Date time formatted according to format string
150
	 * @throws XServicesFault
172
	 * @throws XServicesFault
151
	 */
173
	 */
152
	@WebMethod(operationName=OPERATION_FORMATDATEADVANCED)
174
	@WebMethod(operationName=OPERATION_FORMATDATEADVANCED)
153
	public abstract String formatDateAdvanced(
175
	public abstract String formatDateAdvanced(
154
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal,
176
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) Date cal,
155
			@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) String format) throws XServicesFault;
177
			@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) String format) throws XServicesFault;
Line 156... Line 178...
156
	
178
	
157
	/**
179
	/**
158
	 * Converts a string into date using pre-defined date formats.
180
	 * Converts a string into date using pre-defined date formats.
Line 162... Line 184...
162
	 * @param timezone timezone
184
	 * @param timezone timezone
163
	 * @return XML Date
185
	 * @return XML Date
164
	 * @throws XServicesFault
186
	 * @throws XServicesFault
165
	 */
187
	 */
166
	@WebMethod(operationName=OPERATION_PARSEDATE)
188
	@WebMethod(operationName=OPERATION_PARSEDATE)
-
 
189
	@WSDLDocumentation(value="Converts a string into date using pre-defined date formats.")
167
	public abstract GregorianCalendar parseDate(
190
	public abstract Date parseDate(
168
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) String s,
191
			@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) String s,
169
			@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) DateFormatType format,
192
			@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) DateFormatType format,
170
			@WebParam(name=PARAM_TIMEZONE) String timezone) throws XServicesFault;
193
			@WebParam(name=PARAM_TIMEZONE) String timezone) throws XServicesFault;
Line 171... Line 194...
171
	
194
	
Line 190... Line 213...
190
	 * @return Elapsed time in milliseconds
213
	 * @return Elapsed time in milliseconds
191
	 * @throws XServicesFault
214
	 * @throws XServicesFault
192
	 */
215
	 */
193
	@WebMethod(operationName=OPERATION_DATETIMEDIFF)
216
	@WebMethod(operationName=OPERATION_DATETIMEDIFF)
194
	public abstract BigInteger dateTimeDiff(
217
	public abstract BigInteger dateTimeDiff(
195
			@WebParam(name="fromDateTime") @XmlElement(required=true) GregorianCalendar fromCal,
218
			@WebParam(name="fromDateTime") @XmlElement(required=true) Date fromCal,
196
			@WebParam(name="toDateTime") @XmlElement(required=true) GregorianCalendar toCal) throws XServicesFault;
219
			@WebParam(name="toDateTime") @XmlElement(required=true) Date toCal) throws XServicesFault;
Line 197... Line 220...
197
	
220
	
198
	/**
221
	/**
199
	 * Fully elapsed units between two dates.
222
	 * Fully elapsed units between two dates.
200
	 * 4:15:10-4:15:55 in minutes = 0 and in seconds = 45
223
	 * 4:15:10-4:15:55 in minutes = 0 and in seconds = 45
Line 206... Line 229...
206
	 * @throws XServicesFault
229
	 * @throws XServicesFault
207
	 */
230
	 */
208
	@WebMethod(operationName=OPERATION_DATETIMEDIFF2)
231
	@WebMethod(operationName=OPERATION_DATETIMEDIFF2)
209
	@WSDLDocumentation(value="Get elapsed time between to dates.")
232
	@WSDLDocumentation(value="Get elapsed time between to dates.")
210
	public abstract BigInteger dateTimeDiff2(
233
	public abstract BigInteger dateTimeDiff2(
211
			@WebParam(name="fromDateTime") @XmlElement(required=true) GregorianCalendar fromCal,
234
			@WebParam(name="fromDateTime") @XmlElement(required=true) Date fromCal,
212
			@WebParam(name="toDateTime") @XmlElement(required=true) GregorianCalendar toCal,
235
			@WebParam(name="toDateTime") @XmlElement(required=true) Date toCal,
213
			@WebParam(name="PARAM_UNIT") DateTimeUnits unit) throws XServicesFault;
236
			@WebParam(name=PARAM_UNIT) DateTimeUnits unit) throws XServicesFault;
Line 214... Line 237...
214
	
237
	
215
	/**
238
	/**
216
	 * Add or subtract a time span from a date.
239
	 * Add or subtract a time span from a date.
217
	 * 
240
	 *