net.fortuna.ical4j.model.TimeZone.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中net.fortuna.ical4j.model.TimeZone.<init>()方法的一些代码示例,展示了TimeZone.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimeZone.<init>()方法的具体详情如下:
包路径:net.fortuna.ical4j.model.TimeZone
类名称:TimeZone
方法名:<init>

TimeZone.<init>介绍

[英]Constructs a new instance based on the specified VTimeZone.
[中]基于指定的VTimeZone构造新实例。

代码示例

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

/**
 * Return ical4j TimeZone instance for timezone id.
 * @param id timezone id
 * @return ical4j TimeZone instance
 */
public static net.fortuna.ical4j.model.TimeZone getTimeZone(String id) {
  if(!allTimezoneIds.contains(id)) {
    return null;
  } 
  
  VTimeZone vtz = getVTimeZone(id);
  if(vtz==null) {
    return null;
  }
  
  return new net.fortuna.ical4j.model.TimeZone(vtz);
}

代码示例来源:origin: 1and1/cosmo

/**
 * Return ical4j TimeZone instance for timezone id.
 * @param id timezone id
 * @return ical4j TimeZone instance
 */
public static net.fortuna.ical4j.model.TimeZone getTimeZone(String id) {
  if(!allTimezoneIds.contains(id)) {
    return null;
  } 
  
  VTimeZone vtz = getVTimeZone(id);
  if(vtz==null) {
    return null;
  }
  
  return new net.fortuna.ical4j.model.TimeZone(vtz);
}

代码示例来源:origin: ical4j/ical4j

/**
 * {@inheritDoc}
 */
public final void register(final TimeZone timezone, boolean update) {
  if (update) {
    try {
      // load any available updates for the timezone..
      timezones.put(timezone.getID(), new TimeZone(timeZoneLoader.loadVTimeZone(timezone.getID())));
    } catch (IOException | ParserException | ParseException e) {
      Logger log = LoggerFactory.getLogger(TimeZoneRegistryImpl.class);
      log.warn("Error occurred loading VTimeZone", e);
    }
  } 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: org.mnode.ical4j/ical4j

/**
 * {@inheritDoc}
 */
public final void register(final TimeZone timezone, boolean update) {
  if (update) {
    try {
      // load any available updates for the timezone..
      timezones.put(timezone.getID(), new TimeZone(timeZoneLoader.loadVTimeZone(timezone.getID())));
    } catch (IOException | ParserException | ParseException e) {
      Logger log = LoggerFactory.getLogger(TimeZoneRegistryImpl.class);
      log.warn("Error occurred loading VTimeZone", e);
    }
  } 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: 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: net.oneandone.cosmo/cosmo-core

public TimeZone getTimezone() {
  Calendar timezone = getTimezoneCalendar();
  if (timezone == null) {
    return null;
  }
  VTimeZone vtz = (VTimeZone) timezone.getComponents().getComponent(Component.VTIMEZONE);
  return new TimeZone(vtz);
}

代码示例来源:origin: 1and1/cosmo

public TimeZone getTimezone() {
  Calendar timezone = getTimezoneCalendar();
  if (timezone == null) {
    return null;
  }
  VTimeZone vtz = (VTimeZone) timezone.getComponents().getComponent(Component.VTIMEZONE);
  return new TimeZone(vtz);
}

代码示例来源:origin: ical4j/ical4j

/**
 * @param testMethod
 * @param vtimezoneDef
 * @param String       zuluStr
 * @param String       expectedLocalStr
 */
public TimeZoneTest(String testMethod, String vtimezoneDef, String zuluDateTimeStr,
          String expectedLocalDateTimeStr) throws Exception {
  super(testMethod);
  net.fortuna.ical4j.model.Calendar cal = new CalendarBuilder().build(new StringReader(vtimezoneDef));
  VTimeZone vtz = (VTimeZone) cal.getComponent(VTimeZone.VTIMEZONE);
  this.timezone = new TimeZone(vtz);
  this.zuluDateTimeStr = zuluDateTimeStr;
  this.expectedLocalDateTimeStr = expectedLocalDateTimeStr;
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

private void handleEventCompFilter(ComponentFilter compFilter, NoteItemFilter itemFilter) {
  // TODO: handle case of multiple VEVENT filters
  EventStampFilter eventFilter = new EventStampFilter();
  itemFilter.getStampFilters().add(eventFilter);
  TimeRangeFilter trf = compFilter.getTimeRangeFilter();
  // handle time-range filter
  if (trf != null) {
    eventFilter.setPeriod(trf.getPeriod());
    if (trf.getTimezone() != null) {
      eventFilter.setTimezone(new TimeZone(trf.getTimezone()));
    }
  }
  for (ComponentFilter subComp : compFilter.getComponentFilters()) {
    throw new IllegalArgumentException("unsupported sub component filter: " + subComp.getName());
  }
  for (PropertyFilter propFilter : compFilter.getPropFilters()) {
    handleEventPropFilter(propFilter, itemFilter);
  }
}

代码示例来源:origin: org.mnode.ical4j/ical4j

@Override
public void endComponent(String name) {
  assertComponent(componentBuilder);
  if (subComponentBuilder != null) {
    Component subComponent = subComponentBuilder.build();
    componentBuilder.subComponent(subComponent);
    subComponentBuilder = null;
  } else {
    CalendarComponent component = componentBuilder.build();
    calendar.getComponents().add(component);
    if (component instanceof VTimeZone && tzRegistry != null) {
      // register the timezone for use with iCalendar objects..
      tzRegistry.register(new TimeZone((VTimeZone) component));
    }
    componentBuilder = null;
  }
}

代码示例来源:origin: 1and1/cosmo

private void handleEventCompFilter(ComponentFilter compFilter, NoteItemFilter itemFilter) {
  // TODO: handle case of multiple VEVENT filters
  EventStampFilter eventFilter = new EventStampFilter();
  itemFilter.getStampFilters().add(eventFilter);
  TimeRangeFilter trf = compFilter.getTimeRangeFilter();
  // handle time-range filter
  if (trf != null) {
    eventFilter.setPeriod(trf.getPeriod());
    if (trf.getTimezone() != null) {
      eventFilter.setTimezone(new TimeZone(trf.getTimezone()));
    }
  }
  for (ComponentFilter subComp : compFilter.getComponentFilters()) {
    throw new IllegalArgumentException("unsupported sub component filter: " + subComp.getName());
  }
  for (PropertyFilter propFilter : compFilter.getPropFilters()) {
    handleEventPropFilter(propFilter, itemFilter);
  }
}

代码示例来源:origin: ical4j/ical4j

@Override
public void endComponent(String name) {
  assertComponent(componentBuilder);
  if (subComponentBuilder != null) {
    Component subComponent = subComponentBuilder.build();
    componentBuilder.subComponent(subComponent);
    subComponentBuilder = null;
  } else {
    CalendarComponent component = componentBuilder.build();
    calendar.getComponents().add(component);
    if (component instanceof VTimeZone && tzRegistry != null) {
      // register the timezone for use with iCalendar objects..
      tzRegistry.register(new TimeZone((VTimeZone) component));
    }
    componentBuilder = null;
  }
}

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-ical

private TimeZoneInfo doTimeZone(final VTimeZone vtz) throws CalFacadeException {
 TzId tzid = vtz.getTimeZoneId();
 if (tzid == null) {
  throw new CalFacadeException("Missing tzid property");
 }
 String id = tzid.getValue();
 //if (debug()) {
 //  debug("Got timezone: \n" + vtz.toString() + " with id " + id);
 //}
 try {
  TimeZone tz = Timezones.getTz(id);
  String tzSpec = null;
  if (tz == null) {
   tz = new TimeZone(vtz);
   tzSpec = vtz.toString();
  }
  return new TimeZoneInfo(id, tz, tzSpec);
 } catch (Throwable t) {
  throw new CalFacadeException(t);
 }
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

/**
 * Evaluates VJournal time range.
 * @param journal The VJournal.
 * @param filter The time range filter.
 * @return The result.
 */
private boolean evaluateVJournalTimeRange(VJournal journal, TimeRangeFilter filter) {
  DtStart start = journal.getStartDate();
 
  if(start==null) {
    return false;
  }
  
  InstanceList instances = new InstanceList();
  if (filter.getTimezone() != null) {
    instances.setTimezone(new TimeZone(filter.getTimezone()));
  }
  instances.addComponent(journal, filter.getPeriod().getStart(),
      filter.getPeriod().getEnd());
  return instances.size() > 0;
}

代码示例来源:origin: 1and1/cosmo

/**
 * Evaluates VJournal time range.
 * @param journal The VJournal.
 * @param filter The time range filter.
 * @return The result.
 */
private boolean evaluateVJournalTimeRange(VJournal journal, TimeRangeFilter filter) {
  DtStart start = journal.getStartDate();
 
  if(start==null) {
    return false;
  }
  
  InstanceList instances = new InstanceList();
  if (filter.getTimezone() != null) {
    instances.setTimezone(new TimeZone(filter.getTimezone()));
  }
  instances.addComponent(journal, filter.getPeriod().getStart(),
      filter.getPeriod().getEnd());
  return instances.size() > 0;
}

代码示例来源:origin: net.oneandone.ical4j/ical4j

public void endComponent(final String name) {
  assertComponent(component);
  if (subComponent != null) {
    if (component instanceof VTimeZone) {
      ((VTimeZone) component).getObservances().add((Observance) subComponent);
    } else if (component instanceof VEvent) {
      ((VEvent) component).getAlarms().add((VAlarm) subComponent);
    } else if (component instanceof VToDo) {
      ((VToDo) component).getAlarms().add((VAlarm) subComponent);
    } else if (component instanceof VAvailability) {
      ((VAvailability) component).getAvailable().add((Available) subComponent);
    }
    subComponent = null;
  } else {
    calendar.getComponents().add(component);
    if (component instanceof VTimeZone && tzRegistry != null) {
      // register the timezone for use with iCalendar objects..
      tzRegistry.register(new TimeZone((VTimeZone) component));
    }
    component = null;
  }
}

代码示例来源:origin: 1and1/cosmo

instances.setTimezone(new TimeZone(filter.getTimezone()));

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

instances.setTimezone(new TimeZone(filter.getTimezone()));

相关文章