本文整理了Java中net.fortuna.ical4j.model.TimeZone.getVTimeZone()
方法的一些代码示例,展示了TimeZone.getVTimeZone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimeZone.getVTimeZone()
方法的具体详情如下:
包路径:net.fortuna.ical4j.model.TimeZone
类名称:TimeZone
方法名:getVTimeZone
暂无
代码示例来源:origin: org.bedework/bw-ical4j-cl
/**
* {@inheritDoc}
*/
public final void register(final TimeZone timezone, boolean update) {
if (update) {
// load any available updates for the timezone..
timezones.put(timezone.getID(), new TimeZone(updateDefinition(timezone.getVTimeZone())));
}
else {
timezones.put(timezone.getID(), timezone);
}
}
代码示例来源:origin: org.bedework.ical4j/ical4j
/**
* {@inheritDoc}
*/
public final void register(final TimeZone timezone, boolean update) {
if (update) {
// load any available updates for the timezone..
timezones.put(timezone.getID(), new TimeZone(updateDefinition(timezone.getVTimeZone())));
} else {
timezones.put(timezone.getID(), timezone);
}
}
代码示例来源:origin: net.oneandone.ical4j/ical4j
/**
* {@inheritDoc}
*/
public final void register(final TimeZone timezone, boolean update) {
if (update) {
// load any available updates for the timezone..
timezones.put(timezone.getID(), new TimeZone(updateDefinition(timezone.getVTimeZone())));
} else {
timezones.put(timezone.getID(), timezone);
}
}
代码示例来源:origin: miltonio/milton2
@Override
void mapToCard(net.fortuna.ical4j.model.Calendar cal, Object bean, PropertyDescriptor pd) {
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
String tzId = propertyAccessor.get(bean, pd.getReadMethod(), String.class);
TimeZone timezone = null;
if (tzId != null && tzId.length() > 0) {
timezone = registry.getTimeZone(tzId); // Eg Pacific/Auckland
}
// TODO: do we need to use a default time zone if none given?
if (timezone != null) {
VTimeZone tz = timezone.getVTimeZone();
cal.getComponents().add(tz);
}
}
}
代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-ical
private void addIcalTimezone(final Calendar cal, final String tzid,
final TreeSet<String> added,
final TimeZoneRegistry tzreg) throws CalFacadeException {
VTimeZone vtz = null;
if ((tzid == null) ||
((added != null) && added.contains(tzid))) {
return;
}
//if (debug()) {
// debug("Look for timezone with id " + tzid);
//}
TimeZone tz = tzreg.getTimeZone(tzid);
if (tz != null) {
vtz = tz.getVTimeZone();
}
if (vtz != null) {
//if (debug()) {
// debug("found timezone with id " + tzid);
//}
cal.getComponents().add(vtz);
} else if (debug()) {
debug("Didn't find timezone with id " + tzid);
}
if (added != null) {
added.add(tzid);
}
}
代码示例来源:origin: micromata/projectforge
public VEvent convertVEvent(final TeamEventDO event)
{
final ICalConverterStore store = ICalConverterStore.getInstance();
// create vEvent
final VEvent vEvent = new VEvent(false);
// set time zone
if (this.timeZone != null) {
final net.fortuna.ical4j.model.TimeZone timezone = TIMEZONE_REGISTRY.getTimeZone(this.timeZone.getID());
vEvent.getProperties().add(timezone.getVTimeZone().getTimeZoneId());
}
for (String export : this.exportsVEvent) {
VEventComponentConverter converter = store.getVEventConverter(export);
if (converter == null) {
log.warn(String.format("No converter found for '%s', converter is skipped", export));
continue;
}
converter.toVEvent(event, vEvent);
}
return vEvent;
}
代码示例来源:origin: net.oneandone.cosmo/cosmo-core
/**
* Compact timezones.
* @param calendar The calendar.
*/
private void compactTimezones(Calendar calendar) {
if (calendar==null) {
return;
}
// Get list of timezones in master calendar and remove all timezone
// definitions that are in the registry. The idea is to not store
// extra data. Instead, the timezones will be added to the calendar
// by the getCalendar() api.
ComponentList<VTimeZone> timezones = calendar.getComponents(Component.VTIMEZONE);
List<VTimeZone> toRemove = new ArrayList<>();
for(VTimeZone vtz : timezones) {
String tzid = vtz.getTimeZoneId().getValue();
TimeZone tz = TIMEZONE_REGISTRY.getTimeZone(tzid);
// Remove timezone iff it matches the one in the registry
if(tz!=null && vtz.equals(tz.getVTimeZone())) {
toRemove.add(vtz);
}
}
// remove known timezones from master calendar
calendar.getComponents().removeAll(toRemove);
}
代码示例来源:origin: 1and1/cosmo
/**
* Compact timezones.
* @param calendar The calendar.
*/
private void compactTimezones(Calendar calendar) {
if (calendar==null) {
return;
}
// Get list of timezones in master calendar and remove all timezone
// definitions that are in the registry. The idea is to not store
// extra data. Instead, the timezones will be added to the calendar
// by the getCalendar() api.
ComponentList<VTimeZone> timezones = calendar.getComponents(Component.VTIMEZONE);
List<VTimeZone> toRemove = new ArrayList<>();
for(VTimeZone vtz : timezones) {
String tzid = vtz.getTimeZoneId().getValue();
TimeZone tz = TIMEZONE_REGISTRY.getTimeZone(tzid);
// Remove timezone iff it matches the one in the registry
if(tz!=null && vtz.equals(tz.getVTimeZone())) {
toRemove.add(vtz);
}
}
// remove known timezones from master calendar
calendar.getComponents().removeAll(toRemove);
}
代码示例来源:origin: micromata/projectforge
public ICalGenerator reset()
{
// creating a new calendar
this.calendar = new Calendar();
calendar.getProperties().add(new ProdId("-//" + user.getDisplayUsername() + "//ProjectForge//" + locale.toString().toUpperCase()));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
// set time zone
if (this.timeZone != null) {
final net.fortuna.ical4j.model.TimeZone timezone = TIMEZONE_REGISTRY.getTimeZone(this.timeZone.getID());
calendar.getComponents().add(timezone.getVTimeZone());
}
// set method
if (this.method != null) {
calendar.getProperties().add(method);
}
return this;
}
代码示例来源:origin: net.oneandone.cosmo/cosmo-core
/**
* Constructs an <code>ICalDate</code> from an iCalendar date.
* @param date The date.
* @throws UnknownTimeZoneException - if something is wrong this exception is thrown.
*/
public ICalDate(Date date) throws UnknownTimeZoneException {
if (date instanceof DateTime) {
value = Value.DATE_TIME;
tz = ((DateTime) date).getTimeZone();
// We only support known tzids (Olson for the most part)
if (tz != null) {
tz = tzTranslator.translateToOlsonTz(tz);
// If timezone can't be translated, then datetime will
// essentiallyi be floating.
if (tz != null) {
String id = tz.getVTimeZone().getProperties().
getProperty(Property.TZID).getValue();
tzid = new TzId(id);
}
}
} else {
value = Value.DATE;
}
this.anytime = false;
text = date.toString();
this.date = date;
}
代码示例来源:origin: 1and1/cosmo
/**
* Constructs an <code>ICalDate</code> from an iCalendar date.
* @param date The date.
* @throws UnknownTimeZoneException - if something is wrong this exception is thrown.
*/
public ICalDate(Date date) throws UnknownTimeZoneException {
if (date instanceof DateTime) {
value = Value.DATE_TIME;
tz = ((DateTime) date).getTimeZone();
// We only support known tzids (Olson for the most part)
if (tz != null) {
tz = tzTranslator.translateToOlsonTz(tz);
// If timezone can't be translated, then datetime will
// essentiallyi be floating.
if (tz != null) {
String id = tz.getVTimeZone().getProperties().
getProperty(Property.TZID).getValue();
tzid = new TzId(id);
}
}
} else {
value = Value.DATE;
}
this.anytime = false;
text = date.toString();
this.date = date;
}
代码示例来源:origin: micromata/projectforge
public static VEvent createVEvent(final Date startDate, final Date endDate, final String uid, final String summary,
final boolean allDay,
final TimeZone timezone)
{
VEvent vEvent;
if (allDay == true) {
final Date startUtc = CalendarUtils.getUTCMidnightDate(startDate);
final Date endUtc = CalendarUtils.getUTCMidnightDate(endDate);
final net.fortuna.ical4j.model.Date fortunaStartDate = new net.fortuna.ical4j.model.Date(startUtc);
final org.joda.time.DateTime jodaTime = new org.joda.time.DateTime(endUtc);
// requires plus 1 because one day will be omitted by calendar.
final net.fortuna.ical4j.model.Date fortunaEndDate = new net.fortuna.ical4j.model.Date(
jodaTime.plusDays(1).toDate());
vEvent = new VEvent(fortunaStartDate, fortunaEndDate, summary);
} else {
final net.fortuna.ical4j.model.DateTime fortunaStartDate = new net.fortuna.ical4j.model.DateTime(startDate);
fortunaStartDate.setTimeZone(timezone);
final net.fortuna.ical4j.model.DateTime fortunaEndDate = new net.fortuna.ical4j.model.DateTime(endDate);
fortunaEndDate.setTimeZone(timezone);
vEvent = new VEvent(fortunaStartDate, fortunaEndDate, summary);
vEvent.getProperties().add(timezone.getVTimeZone().getTimeZoneId());
}
vEvent.getProperties().add(new Uid(uid));
return vEvent;
}
代码示例来源:origin: net.oneandone.cosmo/cosmo-core
/**
* Constructs an <code>ICalDate</code> from an iCalendar date
* list. Date lists cannot be anytime.
* @param dates The date list.
* @throws UnknownTimeZoneException - if something is wrong this exception is thrown.
*/
public ICalDate(DateList dates) throws UnknownTimeZoneException {
value = dates.getType();
tz = dates.getTimeZone();
if (tz != null) {
String origId = tz.getID();
tz = tzTranslator.translateToOlsonTz(tz);
if (tz == null) {
throw new UnknownTimeZoneException(origId);
}
String id = tz.getVTimeZone().getProperties().
getProperty(Property.TZID).getValue();
tzid = new TzId(id);
}
text = dates.toString();
this.dates = dates;
}
代码示例来源:origin: micromata/projectforge
public VEvent convertVEvent(final Date startDate, final Date endDate, final boolean allDay, final String summary, final String uid)
{
VEvent vEvent = new VEvent(false);
final net.fortuna.ical4j.model.TimeZone timezone = TIMEZONE_REGISTRY.getTimeZone(timeZone.getID());
final net.fortuna.ical4j.model.Date fortunaStartDate, fortunaEndDate;
if (allDay == true) {
final Date startUtc = CalendarUtils.getUTCMidnightDate(startDate);
final Date endUtc = CalendarUtils.getUTCMidnightDate(endDate);
fortunaStartDate = new net.fortuna.ical4j.model.Date(startUtc);
// TODO should not be done
final org.joda.time.DateTime jodaTime = new org.joda.time.DateTime(endUtc);
// requires plus 1 because one day will be omitted by calendar.
fortunaEndDate = new net.fortuna.ical4j.model.Date(jodaTime.plusDays(1).toDate());
} else {
fortunaStartDate = new net.fortuna.ical4j.model.DateTime(startDate);
((net.fortuna.ical4j.model.DateTime) fortunaStartDate).setTimeZone(timezone);
fortunaEndDate = new net.fortuna.ical4j.model.DateTime(endDate);
((net.fortuna.ical4j.model.DateTime) fortunaEndDate).setTimeZone(timezone);
}
vEvent.getProperties().add(timezone.getVTimeZone().getTimeZoneId());
vEvent.getProperties().add(new DtStart(fortunaStartDate));
vEvent.getProperties().add(new DtEnd(fortunaEndDate));
vEvent.getProperties().add(new Summary(summary));
vEvent.getProperties().add(new Uid(uid));
return vEvent;
}
代码示例来源:origin: 1and1/cosmo
/**
* Constructs an <code>ICalDate</code> from an iCalendar date
* list. Date lists cannot be anytime.
* @param dates The date list.
* @throws UnknownTimeZoneException - if something is wrong this exception is thrown.
*/
public ICalDate(DateList dates) throws UnknownTimeZoneException {
value = dates.getType();
tz = dates.getTimeZone();
if (tz != null) {
String origId = tz.getID();
tz = tzTranslator.translateToOlsonTz(tz);
if (tz == null) {
throw new UnknownTimeZoneException(origId);
}
String id = tz.getVTimeZone().getProperties().
getProperty(Property.TZID).getValue();
tzid = new TzId(id);
}
text = dates.toString();
this.dates = dates;
}
代码示例来源:origin: ical4j/ical4j
/**
* @return
*/
public static TestSuite suite() {
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
TestSuite suite = new TestSuite();
suite.addTest(new VTimeZoneTest("testCreateDefinition", registry.getTimeZone("Australia/Melbourne").getVTimeZone()));
VTimeZone tz = new VTimeZone();
suite.addTest(new VTimeZoneTest("testIsCalendarComponent", tz));
suite.addTest(new VTimeZoneTest("testValidationException", tz));
return suite;
}
}
代码示例来源:origin: ical4j/ical4j
public void setUp() throws Exception {
super.setUp();
// relax validation to avoid UID requirement..
CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_VALIDATION, true);
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
// create timezone property..
VTimeZone tz = registry.getTimeZone("Australia/Melbourne").getVTimeZone();
// create tzid parameter..
tzParam = new TzId(tz.getProperty(Property.TZID).getValue());
}
代码示例来源:origin: FenixEdu/fenixedu-academic
public static Calendar createCalendar(List<EventBean> events) {
final String prodIdCompany = Unit.getInstitutionName().getContent();
Calendar calendar = new Calendar();
calendar.getProperties().add(new ProdId("-//" + prodIdCompany + "//" + PROD_ID_APPLICATION + "//PT"));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
VTimeZone tz = TIMEZONE.getVTimeZone();
calendar.getComponents().add(tz);
for (EventBean eventBean : events) {
calendar.getComponents().add(convertEventBean(eventBean));
}
return calendar;
}
代码示例来源:origin: ical4j/ical4j
protected void setUp() throws Exception {
super.setUp();
// relax validation to avoid UID requirement..
CompatibilityHints.setHintEnabled(
CompatibilityHints.KEY_RELAXED_VALIDATION, true);
registry = TimeZoneRegistryFactory.getInstance().createRegistry();
// create timezone property..
tz = registry.getTimeZone("Australia/Melbourne").getVTimeZone();
// create tzid parameter..
tzParam = new TzId(tz.getProperty(Property.TZID)
.getValue());
}
代码示例来源:origin: Baralga/baralga
timeZone = registry.getTimeZone(DEFAULT_TIME_ZONE_IDENTIFIER);
final VTimeZone vTimeZone = timeZone.getVTimeZone();
final TzId timeZoneId = vTimeZone.getTimeZoneId();
内容来源于网络,如有侵权,请联系作者删除!