当前位置: 首页>>代码示例>>Java>>正文


Java RRule类代码示例

本文整理汇总了Java中net.fortuna.ical4j.model.property.RRule的典型用法代码示例。如果您正苦于以下问题:Java RRule类的具体用法?Java RRule怎么用?Java RRule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RRule类属于net.fortuna.ical4j.model.property包,在下文中一共展示了RRule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: nextReminderFromRecurrenceRule

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
public static Long nextReminderFromRecurrenceRule(long reminder, long currentTime, String recurrenceRule) {
    RRule rule = new RRule();
    try {
        rule.setValue(recurrenceRule);
        net.fortuna.ical4j.model.DateTime seed = new net.fortuna.ical4j.model.DateTime(reminder);
        long startTimestamp = reminder + 60 * 1000;
        if (startTimestamp < currentTime) {
            startTimestamp = currentTime;
        }
        net.fortuna.ical4j.model.DateTime start = new net.fortuna.ical4j.model.DateTime(startTimestamp);
        Date nextDate = rule.getRecur().getNextDate(seed, start);
        return nextDate == null ? 0L : nextDate.getTime();
    } catch (ParseException e) {
        Log.e(Constants.TAG, "Error parsing rrule");
    }
    return 0L;
}
 
开发者ID:ApplicationFactory,项目名称:PEP---Notes,代码行数:18,代码来源:DateHelper.java

示例2: ICalRecurrence

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
public ICalRecurrence(String rrule_text) throws ImportException {
	
	if (rrule_text == null) {
		return;	
	}
	
	try {
		this.rrule_text = rrule_text;
		this.rrule = new RRule(rrule_text);
	} catch (ParseException e) {
		log.warn("Parse exception for iCal recurrence rule: "+rrule_text);
		throw new ImportException(e);
	}
	
	// The RRule has been successfully created, now use it.
	recur = rrule.getRecur();

	// Make sure the rule makes sense.
	isValidateRRule();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:21,代码来源:ICalRecurrence.java

示例3: isValid

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
@Override
protected boolean isValid(VEvent event, ValidationConfig config) {
                    
    List<? extends Property> rrules = event.getProperties(prop);
    if(rrules == null){
        return true;
    }
    for(Property p : rrules){
        RRule rrule = (RRule)p; 
        if(! isRRuleValid(rrule, config)){
            return false;
        }
    }
    
    return true;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:17,代码来源:EventValidator.java

示例4: isRRuleValid

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
private boolean isRRuleValid(RRule rrule, ValidationConfig config){
    if(rrule == null){
        return true;
    }
    
    if(rrule.getRecur() == null || rrule.getRecur().getFrequency() == null){
        return false;
    }
    
    String recurFrequency = rrule.getRecur().getFrequency();
    if(!config.allowedRecurrenceFrequencies.contains(recurFrequency)){
        return false;
    }
    
    return true;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:17,代码来源:EventValidator.java

示例5: calculateRecurrenceRule

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
/**
 * 
 * @param rruleString
 * @return null if rruleString is empty, otherwise new RRule object.
 */
public static RRule calculateRecurrenceRule(final String rruleString)
{
  if (StringUtils.isBlank(rruleString) == true) {
    return null;
  }
  try {
    final RRule rule = new RRule(rruleString);
    // set the recurrence end date to the last minute of the day
    final Recur recur = rule.getRecur();
    final net.fortuna.ical4j.model.Date until = recur != null ? recur.getUntil() : null;
    if (until != null) {
      final Date untilEndOfDay = CalendarUtils.getEndOfDay(until, PFUserContext.getTimeZone());
      recur.setUntil(new net.fortuna.ical4j.model.Date(untilEndOfDay));
    }
    return rule;
  } catch (final ParseException ex) {
    log.error("Exception encountered while parsing rrule '" + rruleString + "': " + ex.getMessage(), ex);
    return null;
  }
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:26,代码来源:ICal4JUtils.java

示例6: calculateRRule

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
public static String calculateRRule(final TeamEventRecurrenceData recurData)
{
  if (recurData == null || recurData.getFrequency() == null || recurData.getFrequency() == RecurrenceFrequency.NONE) {
    return null;
  }
  if (recurData.isCustomized() == false) {
    recurData.setInterval(1);
  }
  final Recur recur = new Recur();
  final net.fortuna.ical4j.model.Date untilDate = ICal4JUtils.getICal4jDate(recurData.getUntil(), recurData.getTimeZone());
  if (untilDate != null) {
    recur.setUntil(untilDate);
  }
  recur.setInterval(recurData.getInterval());
  recur.setFrequency(ICal4JUtils.getCal4JFrequencyString(recurData.getFrequency()));
  final RRule rrule = new RRule(recur);
  return rrule.getValue();
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:19,代码来源:TeamEventUtils.java

示例7: createRepeatRule

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
private RRule createRepeatRule(Event event) {
    RRule rRule = new RRule();
    String rRuleString = "";
    try {
        rRuleString = SyncUtils.getRepeatRule(event);
        rRule.setValue(rRuleString);
    } catch (Exception e) {
        Log.e(TAG, "Can't set RRULE value: " + rRuleString);
    }
    return rRule;
}
 
开发者ID:memfis19,项目名称:Cadar,代码行数:12,代码来源:EventComponentCreator.java

示例8: fixIcuVTimeZone

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
/**
 * ICU4J generates VTIMEZONE RRULEs with floating UNTIL, which results
 * in a bad VTIMEZONE because the UNTIL is converted to UTC, which will
 * be different depending on the default timezone of the server.  So
 * to fix this, always add a day to UNTIL to make sure the RRULE
 * doesn't fall short.  This should work for most timezones as timezones
 * don't usually change from day to day.  Hopefully this is fixed in
 * an icu4j update.
 * @param vtz
 */
protected static void fixIcuVTimeZone(VTimeZone vtz) {
    for(Iterator<Observance> obIt = vtz.getObservances().iterator();obIt.hasNext();) {
        PropertyList<RRule> rruleList= obIt.next().getProperties(Property.RRULE);
        for(RRule rrule: rruleList) {
            Recur recur = rrule.getRecur();
            if(recur.getUntil()!=null) {
                recur.getUntil().setTime(recur.getUntil().getTime() + ONE_DAY);
            }
        }
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:22,代码来源:TimeZoneUtils.java

示例9: getRecurrenceRules

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
public List<Recur> getRecurrenceRules() {
    List<Recur> toReturn = new ArrayList<>();
    VEvent event = getEvent();
    if(event != null) {
        PropertyList<RRule> rruleProperties = event.getProperties().getProperties(Property.RRULE);
        for (RRule rrule : rruleProperties) {
            toReturn.add(rrule.getRecur());
        }
    }
    return toReturn;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:12,代码来源:HibBaseEventStamp.java

示例10: setRecurrenceRules

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
public void setRecurrenceRules(List<Recur> recurs) {
    if (recurs == null) {
        return;
    }
    PropertyList<Property> properties = getEvent().getProperties();
    for (Property rrule : properties.getProperties(Property.RRULE)) {
        properties.remove(rrule);
    }
    for (Recur recur : recurs) {
        properties.add(new RRule(recur));
    }      
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:13,代码来源:HibBaseEventStamp.java

示例11: getRecurrenceRules

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
/**
 * Gets recurrence rules.
 * @return The list.
 */
public List<Recur> getRecurrenceRules() {
    ArrayList<Recur> l = new ArrayList<Recur>();
    VEvent event = getEvent();
    if(event!=null) {
        for (Object rrule : getEvent().getProperties().getProperties(Property.RRULE)) {
            l.add(((RRule)rrule).getRecur());
        }
    }
    return l;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:15,代码来源:MockBaseEventStamp.java

示例12: setRecurrenceRules

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
/**
 * Sets recurrence rules.
 * @param recurs List with recurrence rules.
 */
public void setRecurrenceRules(List<Recur> recurs) {
    if (recurs == null) {
        return;
    }
    PropertyList<Property> pl = getEvent().getProperties();
    for (Property rrule : pl.getProperties(Property.RRULE)) {
        pl.remove(rrule);
    }
    for (Recur recur : recurs) {
        pl.add(new RRule(recur));
    }
  
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:18,代码来源:MockBaseEventStamp.java

示例13: getRecurrenceRuleObject

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
/**
 * Will be renewed if {@link #setRecurrenceRule(String)} is called.
 * @return the recurrenceRuleObject
 */
@Transient
public RRule getRecurrenceRuleObject()
{
  if (recurrenceRuleObject == null) {
    recalculate();
  }
  return recurrenceRuleObject;
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:13,代码来源:TeamEventDO.java

示例14: getRecurrenceObject

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
/**
 * Will be renewed if {@link #setRecurrenceRule(String)} is called.
 * @return the recurrenceRuleObject
 */
@Transient
public Recur getRecurrenceObject()
{
  final RRule rrule = getRecurrenceRuleObject();
  return rrule != null ? rrule.getRecur() : null;
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:11,代码来源:TeamEventDO.java

示例15: createVEvent

import net.fortuna.ical4j.model.property.RRule; //导入依赖的package包/类
public static VEvent createVEvent(final TeamEventDO eventDO, final TimeZone timezone)
{
  final VEvent vEvent = ICal4JUtils.createVEvent(eventDO.getStartDate(), eventDO.getEndDate(), eventDO.getUid(), eventDO.getSubject(),
      eventDO.isAllDay(), timezone);
  if (eventDO.hasRecurrence() == true) {
    final RRule rrule = eventDO.getRecurrenceRuleObject();
    vEvent.getProperties().add(rrule);
  }
  return vEvent;
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:11,代码来源:TeamEventUtils.java


注:本文中的net.fortuna.ical4j.model.property.RRule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。