|
soap tutorial | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectadriani.jws.template.util.Utilities
public abstract class Utilities
General utilities class for conversion of different formats, typically date and time formats.
Let's recall the standard Java date and time lexicon:
Calendar.ZONE_OFFSET: this offset represent the offset of the date specified
in the data string description, for example "+01:00" or "+02:00".
Example: the date "2010-02-26T15:40:00+00:00" will be converted into a calendar with offset equals 0,
the date "2010-02-26T15:40:00+01:00" will be have an offset set to 3600000, while the date
"2010-02-26T15:40:00+02:00" will be have an offset set to 7200000.
TimeZone: describes the time zone bound to a Calendar
object.
If the user changes the machine setting (e.g. on Windows: setting daylight saving in the control panel)
the default TimeZone
object will immediately reflect this change, as visible for example
by calling the useDaylightTime()
method. Instead, the raw offset of the time zone will
not be affected by such a change, since it describes the difference with respect of the UTC time.
In other words, the raw offset for the Italian time zone is always 3600000, and will never change.
Notice that usually a calendar relies on the local default time zone instead of using
the custom time zone depicting where the calendar was created (fortunately).
Field Summary | |
---|---|
protected static java.lang.String |
leadingName
Beginning of each logging message produced by this class. |
protected static java.text.SimpleDateFormat |
sdf_date
The data pattern used as output for the date, in this case: yyyy-MM-dd HH |
protected static java.text.SimpleDateFormat |
sdf_ita
The data pattern used by Log4j for the timestamp, in this case: yyyy-MM-dd HH:mm:ss,SSS |
protected static java.text.SimpleDateFormat |
sdf_log
The data pattern used by Log4j for the timestamp, in this case: yyyy-MM-dd HH:mm:ss,SSS |
protected static java.text.SimpleDateFormat |
sdf_oracle
The data pattern used by Oracle to describe dates |
static java.text.SimpleDateFormat |
sdf_oracle_fs
Java utility object using same pattern of the FIRSTCHECK web service |
protected static java.text.SimpleDateFormat |
sdf_summer
SimpleDateFormat static reference for conversion from the format yyyy-MM-dd'T'HH:mm:ss'+02:00', used in Italy DURING the saving light season. |
protected static java.text.SimpleDateFormat |
sdf_time
The data pattern used as output for the time, in this case: HH:mm:ss,SSS |
protected static java.text.SimpleDateFormat |
sdf_utc
SimpleDateFormat static reference for conversion from the format yyyy-MM-dd'T'HH:mm:ss'+00:00', referred to the standard UTC time. |
protected static java.text.SimpleDateFormat |
sdf_winter
SimpleDateFormat static reference for conversion from the format yyyy-MM-dd'T'HH:mm:ss'+01:00', used in Italy when NOT in the saving light season. |
Constructor Summary | |
---|---|
Utilities()
|
Method Summary | |
---|---|
static java.util.Calendar |
dateToCalendar(java.sql.Date date)
Convert the input java.sql.date into a Calendar instance. |
static java.lang.String |
formatDate(java.util.Date date,
java.lang.String pattern)
Convert the input java.util.Date to the string format, using the format
dd-MMM-yy . |
static java.lang.String |
formatDate(long timestamp,
java.lang.String pattern)
Convert the input timestamp to the string format, using the input
pattern to define the conversion format. |
static java.util.Calendar |
getCalendar(java.lang.String value)
Due the Axis2 design the Calendar obtained from a SOAP REQUEST does not consider the
time zone, but it's created using the local time zone, which for Italy is GMT+01:00
(Central Europe Time) in winter and GMT+02:00 (Central Europe Summer Time) in summer. |
static java.lang.String |
getShortDate(java.util.Calendar calendar)
Convert the input Calendar to the string format, using the format
dd-MMM-yy . |
static java.lang.String |
getShortDate(java.util.Date date)
Convert the input java.util.Date to the string format, using the format
dd-MMM-yy . |
static java.lang.String |
getShortDate(long timestamp)
Convert the input timestamp to the string format, using the format
dd-MMM-yy . |
static java.lang.String |
introspectElement(java.lang.Object object)
Utility for printing introspection information about the ADBBeans elements. |
static java.util.Date |
parseDate(java.lang.String date,
java.lang.String pattern)
Parse the string value of the input String date into a java.util.date value ,
using the input pattern. |
static java.sql.Date |
shortValueOfSQLDate(java.lang.String string)
Parse the string value of the input String into a java.sql.date value ,
using a pattern like 'yyyy-MM-dd'. |
static java.sql.Date |
shortValueOfSQLDate(java.lang.StringBuffer buffer)
Parse the string value of the input StringBuffer into a java.sql.date value ,
using a pattern like 'yyyy-MM-dd'. |
static java.util.Date |
valueOfDate(java.lang.String string)
Parse the string value of the input String into a java.util.date value ,
using a pattern like 'yyyy-MM-dd HH:mm:ss'. |
static java.util.Date |
valueOfDate(java.lang.StringBuffer buffer)
Parse the string value of the input StringBuffer into a java.util.date value
using a pattern like 'yyyy-MM-dd HH:mm:ss'. |
static java.sql.Date |
valueOfSQLDate(java.lang.String string)
Parse the string value of the input String into a java.sql.date value ,
using a pattern like 'yyyy-MM-dd HH:mm:ss'. |
static java.sql.Date |
valueOfSQLDate(java.lang.StringBuffer buffer)
Parse the string value of the input StringBuffer into a java.sql.date value ,
using a pattern like 'yyyy-MM-dd HH:mm:ss'. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.text.SimpleDateFormat sdf_log
protected static java.text.SimpleDateFormat sdf_ita
protected static java.text.SimpleDateFormat sdf_time
protected static java.text.SimpleDateFormat sdf_date
protected static java.text.SimpleDateFormat sdf_oracle
public static final java.text.SimpleDateFormat sdf_oracle_fs
protected static java.text.SimpleDateFormat sdf_utc
protected static java.text.SimpleDateFormat sdf_winter
protected static java.text.SimpleDateFormat sdf_summer
protected static java.lang.String leadingName
Constructor Detail |
---|
public Utilities()
Method Detail |
---|
public static java.util.Calendar getCalendar(java.lang.String value) throws java.text.ParseException
Calendar
obtained from a SOAP REQUEST does not consider the
time zone, but it's created using the local time zone, which for Italy is GMT+01:00
(Central Europe Time) in winter and GMT+02:00 (Central Europe Summer Time) in summer.
For this reason, the time zone of the input datetime parameter will be specified in the
Calendar.ZONE_OFFSET
field.
value
- a string
object describing a Date
Calendar
object
java.text.ParseException
public static java.lang.String getShortDate(java.util.Calendar calendar)
Calendar
to the string format, using the format
dd-MMM-yy
.
calendar
- the Calendar
to be converted
sdf_date
public static java.lang.String getShortDate(java.util.Date date)
java.util.Date
to the string format, using the format
dd-MMM-yy
.
date
- the java.util.Date
to be converted
sdf_date
public static java.lang.String getShortDate(long timestamp)
timestamp
to the string format, using the format
dd-MMM-yy
.
timestamp
- the timestamp to be converted
sdf_date
public static java.util.Date valueOfDate(java.lang.StringBuffer buffer)
StringBuffer
into a java.util.date value
using a pattern like 'yyyy-MM-dd HH:mm:ss'.
buffer
- the input StringBuffer
object
java.util.date
value of the input stringsdf_oracle
public static java.sql.Date valueOfSQLDate(java.lang.StringBuffer buffer)
StringBuffer
into a java.sql.date value
,
using a pattern like 'yyyy-MM-dd HH:mm:ss'.
buffer
- the input StringBuffer object
sdf_oracle
public static java.sql.Date valueOfSQLDate(java.lang.String string)
String
into a java.sql.date value
,
using a pattern like 'yyyy-MM-dd HH:mm:ss'.
string
- the input string object
java.sql.date
value of the input stringsdf_oracle
public static java.util.Date valueOfDate(java.lang.String string)
String
into a java.util.date value
,
using a pattern like 'yyyy-MM-dd HH:mm:ss'.
string
- the input string object
java.util.Date
value of the input stringsdf_oracle
public static java.sql.Date shortValueOfSQLDate(java.lang.String string)
String
into a java.sql.date value
,
using a pattern like 'yyyy-MM-dd'.
string
- the input string object
java.sql.date
value of the input stringsdf_oracle_fs
public static java.sql.Date shortValueOfSQLDate(java.lang.StringBuffer buffer)
StringBuffer
into a java.sql.date value
,
using a pattern like 'yyyy-MM-dd'.
buffer
- the input string object
java.sql.date
value of the input stringsdf_oracle_fs
public static java.util.Calendar dateToCalendar(java.sql.Date date)
java.sql.date
into a Calendar
instance.
date
- the input java.sql.date
object
Calendar
value of the input datepublic static java.util.Date parseDate(java.lang.String date, java.lang.String pattern)
String
date into a java.util.date value
,
using the input pattern.
date
- the input date in string formatpattern
- the string pattern to be used in the conversion (e.g. "dd-MMM-yy")
java.util.Date
value of the input stringsdf_oracle
public static java.lang.String formatDate(java.util.Date date, java.lang.String pattern)
java.util.Date
to the string format, using the format
dd-MMM-yy
.
date
- the java.util.Date
to be convertedpattern
- the string pattern to be used in the conversion (e.g. "dd-MMM-yy")
sdf_date
public static java.lang.String formatDate(long timestamp, java.lang.String pattern)
timestamp
to the string format, using the input
pattern to define the conversion format.
timestamp
- the timestamp to be convertedpattern
- the string pattern to be used in the conversion (e.g. "dd-MMM-yy")
public static java.lang.String introspectElement(java.lang.Object object)
object
- the XML node value retrieved from a ADBBean
object
|
Build 18/09/2012 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |