Package org.bedework.util.calendar
Class XcalUtil
- java.lang.Object
-
- org.bedework.util.calendar.XcalUtil
-
public class XcalUtil extends Object
- Author:
- douglm
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXcalUtil.DtTzidstatic interfaceXcalUtil.TzGetterClass allowing fetch of timezones
-
Field Summary
Fields Modifier and Type Field Description static IntegerAlarmKindstatic IntegerOuterKindstatic IntegerRecurringKindstatic IntegerTzDaylightstatic IntegerTzKindstatic IntegerTzStandardstatic IntegerUidKindstatic IntegerUnknownKind
-
Constructor Summary
Constructors Constructor Description XcalUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ietf.params.xml.ns.icalendar_2.BaseComponentTypecloneComponent(ietf.params.xml.ns.icalendar_2.BaseComponentType val)static ietf.params.xml.ns.icalendar_2.BaseParameterTypecloneProperty(ietf.params.xml.ns.icalendar_2.BaseParameterType val)static ietf.params.xml.ns.icalendar_2.BasePropertyTypecloneProperty(ietf.params.xml.ns.icalendar_2.BasePropertyType val)static ietf.params.xml.ns.icalendar_2.BaseComponentTypefindComponent(ietf.params.xml.ns.icalendar_2.BaseComponentType bcPar, QName name)static ietf.params.xml.ns.icalendar_2.BaseComponentTypefindComponent(ietf.params.xml.ns.icalendar_2.IcalendarType ical, QName name)static ietf.params.xml.ns.icalendar_2.BaseComponentTypefindEntity(ietf.params.xml.ns.icalendar_2.IcalendarType ical)static ietf.params.xml.ns.icalendar_2.BaseParameterTypefindParam(ietf.params.xml.ns.icalendar_2.BasePropertyType prop, QName name)Searches the property for the named parameter.static ietf.params.xml.ns.icalendar_2.BasePropertyTypefindProperty(ietf.params.xml.ns.icalendar_2.BaseComponentType bcPar, QName name)Searches this entity for the named property.static XMLGregorianCalendarfromDtval(String dtval)static intgetCompKind(QName name)static QNamegetCompName(Class<?> cl)static List<javax.xml.bind.JAXBElement<? extends ietf.params.xml.ns.icalendar_2.BaseComponentType>>getComponents(ietf.params.xml.ns.icalendar_2.BaseComponentType c)Get enclosed components for the supplied component.static XcalUtil.DtTzidgetDtTzid(ietf.params.xml.ns.icalendar_2.DateDatetimePropertyType dt)static StringgetIcalFormatDateTime(String dt)static StringgetIcalFormatDateTime(XMLGregorianCalendar dt)static StringgetIcalFormatTime(String tm)static StringgetIcalUtcOffset(String tm)static StringgetUTC(ietf.params.xml.ns.icalendar_2.DateDatetimePropertyType dt, XcalUtil.TzGetter tzs)For date only values and floating convert to local UTC.static StringgetXmlFormatDateTime(String val)static StringgetXmlFormatTime(String val)static StringgetXmlFormatUtcOffset(String val)static XMLGregorianCalendargetXMlUTCCal(String dtval)static voidinitDt(ietf.params.xml.ns.icalendar_2.DateDatetimePropertyType dt, String dtval, String tzid)Initialize the DateDatetimePropertystatic voidinitUntilRecur(ietf.params.xml.ns.icalendar_2.UntilRecurType dt, String dtval)Initialize the recur propertystatic DurationmakeXmlDuration(String dur)
-
-
-
Field Detail
-
UnknownKind
public static final Integer UnknownKind
-
OuterKind
public static final Integer OuterKind
-
RecurringKind
public static final Integer RecurringKind
-
UidKind
public static final Integer UidKind
-
AlarmKind
public static final Integer AlarmKind
-
TzKind
public static final Integer TzKind
-
TzDaylight
public static final Integer TzDaylight
-
TzStandard
public static final Integer TzStandard
-
-
Method Detail
-
initDt
public static void initDt(ietf.params.xml.ns.icalendar_2.DateDatetimePropertyType dt, String dtval, String tzid)Initialize the DateDatetimeProperty- Parameters:
dt- to be initializeddtval- date stringtzid- timezone id- Throws:
RuntimeException- on bad date
-
initUntilRecur
public static void initUntilRecur(ietf.params.xml.ns.icalendar_2.UntilRecurType dt, String dtval)Initialize the recur property- Parameters:
dt- to be initializeddtval- to convert
-
fromDtval
public static XMLGregorianCalendar fromDtval(String dtval)
- Parameters:
dtval- to convert- Returns:
- XMLGregorianCalendar
- Throws:
RuntimeException- on bad date or new instance failure
-
makeXmlDuration
public static Duration makeXmlDuration(String dur)
- Parameters:
dur- string duration- Returns:
- Duration
-
getXMlUTCCal
public static XMLGregorianCalendar getXMlUTCCal(String dtval)
- Parameters:
dtval- to convert- Returns:
- utc
-
getUTC
public static String getUTC(ietf.params.xml.ns.icalendar_2.DateDatetimePropertyType dt, XcalUtil.TzGetter tzs)
For date only values and floating convert to local UTC. For UTC just return the value. For non-floating convert.- Parameters:
dt- to converttzs- tz getter- Returns:
- string UTC value
-
getDtTzid
public static XcalUtil.DtTzid getDtTzid(ietf.params.xml.ns.icalendar_2.DateDatetimePropertyType dt)
- Parameters:
dt- date time property- Returns:
- DtTzid filled in
-
getXmlFormatDateTime
public static String getXmlFormatDateTime(String val)
- Parameters:
val- ical format or xml format date or datetime- Returns:
- XML formatted
-
getIcalFormatDateTime
public static String getIcalFormatDateTime(XMLGregorianCalendar dt)
- Parameters:
dt- to reformat to ical format- Returns:
- rfc5545 date or date/time
-
getIcalFormatDateTime
public static String getIcalFormatDateTime(String dt)
- Parameters:
dt- to reformat to ical format- Returns:
- rfc5545 date or date/time or null for none or invalid
-
getXmlFormatTime
public static String getXmlFormatTime(String val)
- Parameters:
val- ical format or xml format time- Returns:
- XML formatted
-
getIcalFormatTime
public static String getIcalFormatTime(String tm)
- Parameters:
tm- to convert- Returns:
- rfc5545 time
-
getIcalUtcOffset
public static String getIcalUtcOffset(String tm)
- Parameters:
tm- date time value- Returns:
- rfc5545 time
-
getXmlFormatUtcOffset
public static String getXmlFormatUtcOffset(String val)
- Parameters:
val- ical format or xml format date or datetime- Returns:
- XML formatted
-
cloneComponent
public static ietf.params.xml.ns.icalendar_2.BaseComponentType cloneComponent(ietf.params.xml.ns.icalendar_2.BaseComponentType val)
- Parameters:
val- to clone- Returns:
- cloned empty component
- Throws:
RuntimeException- for illegal access exception
-
cloneProperty
public static ietf.params.xml.ns.icalendar_2.BasePropertyType cloneProperty(ietf.params.xml.ns.icalendar_2.BasePropertyType val)
- Parameters:
val- to clone- Returns:
- cloned empty property
-
cloneProperty
public static ietf.params.xml.ns.icalendar_2.BaseParameterType cloneProperty(ietf.params.xml.ns.icalendar_2.BaseParameterType val)
- Parameters:
val- to clone- Returns:
- cloned empty parameter
-
findComponent
public static ietf.params.xml.ns.icalendar_2.BaseComponentType findComponent(ietf.params.xml.ns.icalendar_2.IcalendarType ical, QName name)- Parameters:
ical- Icalendar valuename- of component- Returns:
- null or first matching component
-
getComponents
public static List<javax.xml.bind.JAXBElement<? extends ietf.params.xml.ns.icalendar_2.BaseComponentType>> getComponents(ietf.params.xml.ns.icalendar_2.BaseComponentType c)
Get enclosed components for the supplied component.- Parameters:
c- component- Returns:
- list of components or null for none or unrecognized class.
-
findComponent
public static ietf.params.xml.ns.icalendar_2.BaseComponentType findComponent(ietf.params.xml.ns.icalendar_2.BaseComponentType bcPar, QName name)- Parameters:
bcPar- componentname- to find- Returns:
- null or first matching component
-
findEntity
public static ietf.params.xml.ns.icalendar_2.BaseComponentType findEntity(ietf.params.xml.ns.icalendar_2.IcalendarType ical)
- Parameters:
ical- entity- Returns:
- null or first contained entity
-
findProperty
public static ietf.params.xml.ns.icalendar_2.BasePropertyType findProperty(ietf.params.xml.ns.icalendar_2.BaseComponentType bcPar, QName name)Searches this entity for the named property. Does not recurse down.- Parameters:
bcPar- entityname- to find- Returns:
- null or first matching property
-
findParam
public static ietf.params.xml.ns.icalendar_2.BaseParameterType findParam(ietf.params.xml.ns.icalendar_2.BasePropertyType prop, QName name)Searches the property for the named parameter.- Parameters:
prop- propertyname- to find- Returns:
- null or first matching property
-
getCompName
public static QName getCompName(Class<?> cl)
- Parameters:
cl- class- Returns:
- QName for component
-
getCompKind
public static int getCompKind(QName name)
- Parameters:
name- for component- Returns:
- component kind
-
-