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


Java DateEnd类代码示例

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


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

示例1: printExam

import biweekly.property.DateEnd; //导入依赖的package包/类
private void printExam(Exam exam, ICalendar ical) throws IOException {
	if (exam.getAssignedPeriod() == null) return;

       VEvent vevent = new VEvent();
       vevent.setSequence(0);
       vevent.setUid(exam.getUniqueId().toString());
   	DateStart dstart = new DateStart(exam.getAssignedPeriod().getStartTime(), true);
   	vevent.setDateStart(dstart);
       Calendar endTime = Calendar.getInstance(); endTime.setTime(exam.getAssignedPeriod().getStartTime());
       endTime.add(Calendar.MINUTE, exam.getLength());
   	DateEnd dend = new DateEnd(endTime.getTime(), true);
   	vevent.setDateEnd(dend);
   	vevent.setSummary(exam.getLabel()+" ("+exam.getExamType().getLabel()+" Exam)");
       if (!exam.getAssignedRooms().isEmpty()) {
           String rooms = "";
           for (Iterator i=new TreeSet(exam.getAssignedRooms()).iterator();i.hasNext();) {
               Location location = (Location)i.next();
               if (rooms.length()>0) rooms+=", ";
               rooms+=location.getLabel();
           }
           vevent.setLocation(rooms);
       }
       vevent.setStatus(Status.confirmed());
       ical.addEvent(vevent);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:26,代码来源:CalendarServlet.java

示例2: validate_time_in_rrule

import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_time_in_rrule() {
	TestComponent parent = new TestComponent();

	//@formatter:off
	Recurrence[] recurrences = {
		new Recurrence.Builder(Frequency.DAILY).byHour(1).build(),
		new Recurrence.Builder(Frequency.DAILY).byMinute(1).build(),
		new Recurrence.Builder(Frequency.DAILY).bySecond(1).build()
	};
	//@formatter:on
	for (Recurrence recurrence : recurrences) {
		VEvent component = new VEvent();
		component.setDateStart(new DateStart(date("2000-01-01"), false));
		component.setDateEnd(new DateEnd(date("2000-01-10"), false));
		component.setRecurrenceRule(recurrence);
		assertValidate(component).parents(parent).run(5);
	}
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:20,代码来源:VEventTest.java

示例3: validate_cardinality_optional

import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_cardinality_optional() {
	VFreeBusy component = new VFreeBusy();
	component.addProperty(new Contact(""));
	component.addProperty(new DateStart(date("2000-01-01")));
	component.addProperty(new DateEnd(date("2000-01-10")));
	component.addProperty(new Organizer(null, null));
	component.addProperty(new Url(""));
	assertValidate(component).versions(V1_0).run(48);
	assertValidate(component).versions(V2_0_DEPRECATED, V2_0).run();

	component.addProperty(new Contact(""));
	component.addProperty(new DateStart(date("2000-01-01")));
	component.addProperty(new DateEnd(date("2000-01-10")));
	component.addProperty(new Organizer("", ""));
	component.addProperty(new Url(""));
	assertValidate(component).versions(V1_0).run(48, 3, 3, 3, 3, 3);
	assertValidate(component).versions(V2_0_DEPRECATED, V2_0).run(3, 3, 3, 3, 3);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:20,代码来源:VFreeBusyTest.java

示例4: validate

import biweekly.property.DateEnd; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void validate(List<ICalComponent> components, ICalVersion version, List<ValidationWarning> warnings) {
	if (version == ICalVersion.V1_0) {
		warnings.add(new ValidationWarning(48, version));
	}

	checkRequiredCardinality(warnings, Uid.class, DateTimeStamp.class);
	checkOptionalCardinality(warnings, Contact.class, DateStart.class, DateEnd.class, Organizer.class, Url.class);

	ICalDate dateStart = getValue(getDateStart());
	ICalDate dateEnd = getValue(getDateEnd());

	//DTSTART is required if DTEND exists
	if (dateEnd != null && dateStart == null) {
		warnings.add(new ValidationWarning(15));
	}

	//DTSTART and DTEND must contain a time component
	if (dateStart != null && !dateStart.hasTime()) {
		warnings.add(new ValidationWarning(20, DateStart.class.getSimpleName()));
	}
	if (dateEnd != null && !dateEnd.hasTime()) {
		warnings.add(new ValidationWarning(20, DateEnd.class.getSimpleName()));
	}

	//DTSTART must come before DTEND
	if (dateStart != null && dateEnd != null && dateStart.compareTo(dateEnd) >= 0) {
		warnings.add(new ValidationWarning(16));
	}
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:32,代码来源:VFreeBusy.java

示例5: determineStartDate

import biweekly.property.DateEnd; //导入依赖的package包/类
/**
 * Determines what the alarm property's start date should be.
 * @param valarm the component that is being converted to a vCal alarm
 * property
 * @param parent the component's parent
 * @return the start date or null if it cannot be determined
 */
private static Date determineStartDate(VAlarm valarm, ICalComponent parent) {
	Trigger trigger = valarm.getTrigger();
	if (trigger == null) {
		return null;
	}

	Date triggerStart = trigger.getDate();
	if (triggerStart != null) {
		return triggerStart;
	}

	Duration triggerDuration = trigger.getDuration();
	if (triggerDuration == null) {
		return null;
	}

	if (parent == null) {
		return null;
	}

	Related related = trigger.getRelated();
	Date date = null;
	if (related == Related.START) {
		date = ValuedProperty.getValue(parent.getProperty(DateStart.class));
	} else if (related == Related.END) {
		date = ValuedProperty.getValue(parent.getProperty(DateEnd.class));
		if (date == null) {
			Date dateStart = ValuedProperty.getValue(parent.getProperty(DateStart.class));
			Duration duration = ValuedProperty.getValue(parent.getProperty(DurationProperty.class));
			if (duration != null && dateStart != null) {
				date = duration.add(dateStart);
			}
		}
	}

	return (date == null) ? null : triggerDuration.add(date);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:45,代码来源:VAlarmScribe.java

示例6: validate_different_date_datatypes

import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_different_date_datatypes() {
	TestComponent parent = new TestComponent();
	VEvent component = new VEvent();
	component.setDateStart(new DateStart(date("2000-01-01"), false));
	component.setDateEnd(new DateEnd(date("2000-01-10"), true));
	assertValidate(component).parents(parent).run(17);

	parent = new TestComponent();
	component = new VEvent();
	component.setDateStart(new DateStart(date("2000-01-01"), false));
	component.setDateEnd(new DateEnd(date("2000-01-10"), false));
	component.setRecurrenceId(new RecurrenceId(date("2000-01-01"), true));
	assertValidate(component).parents(parent).run(19);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:16,代码来源:VEventTest.java

示例7: validate_multiple_rrules

import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_multiple_rrules() {
	TestComponent parent = new TestComponent();
	VEvent component = new VEvent();
	component.setDateStart(new DateStart(date("2000-01-01"), false));
	component.setDateEnd(new DateEnd(date("2000-01-10"), false));
	component.addProperty(new RecurrenceRule(new Recurrence.Builder(Frequency.DAILY).build()));
	component.addProperty(new RecurrenceRule(new Recurrence.Builder(Frequency.DAILY).build()));
	assertValidate(component).parents(parent).run(6);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:11,代码来源:VEventTest.java

示例8: validate_no_startDate

import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_no_startDate() {
	VFreeBusy component = new VFreeBusy();
	component.setDateEnd(new DateEnd(date("2000-01-10"), true));
	assertValidate(component).versions(V1_0).run(48, 15);
	assertValidate(component).versions(V2_0_DEPRECATED, V2_0).run(15);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:8,代码来源:VFreeBusyTest.java

示例9: validate_dates_do_not_have_times

import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_dates_do_not_have_times() {
	VFreeBusy component = new VFreeBusy();
	component.setDateStart(new DateStart(date("2000-01-01"), false));
	component.setDateEnd(new DateEnd(date("2000-01-10"), false));
	assertValidate(component).versions(V1_0).run(48, 20, 20);
	assertValidate(component).versions(V2_0_DEPRECATED, V2_0).run(20, 20);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:9,代码来源:VFreeBusyTest.java

示例10: validate_startDate_before_endDate

import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_startDate_before_endDate() {
	VFreeBusy component = new VFreeBusy();
	component.setDateStart(new DateStart(date("2000-01-10"), true));
	component.setDateEnd(new DateEnd(date("2000-01-01"), true));
	assertValidate(component).versions(V1_0).run(48, 16);
	assertValidate(component).versions(V2_0_DEPRECATED, V2_0).run(16);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:9,代码来源:VFreeBusyTest.java

示例11: parse

import biweekly.property.DateEnd; //导入依赖的package包/类
public static FBEvent parse(VEvent vevent) {
    FBEvent fbEvent = new FBEvent();
    ContentValues values = fbEvent.mValues;

    String uid = vevent.getUid().getValue();
    boolean isBirthday = true;
    if (uid.startsWith("e")) { // events
        uid = uid.substring(1, uid.indexOf("@"));
        isBirthday = false;
    }

    values.put(CalendarContract.Events.UID_2445, uid);
    values.put(CalendarContract.Events.TITLE, vevent.getSummary().getValue());
    Description desc = vevent.getDescription();
    if (desc != null) {
        values.put(CalendarContract.Events.DESCRIPTION, desc.getValue());
    }
    Organizer organizer = vevent.getOrganizer();
    if (organizer != null) {
        values.put(CalendarContract.Events.ORGANIZER, organizer.getCommonName());
    }
    Location location = vevent.getLocation();
    if (location != null) {
        values.put(CalendarContract.Events.EVENT_LOCATION, location.getValue());
    }
    values.put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().getID());

    if (isBirthday) {
        ICalDate date = vevent.getDateStart().getValue();
        Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
        // HACK: Facebook only lists the "next" birthdays, which means birthdays disappear from
        // the listing the day after it they pass. Many users dislike that (and I understand why)
        // so we hack around by always setting the year as current year - 1 and setting yearly
        // recurrence so that they don't disappear from the calendar
        calendar.set(calendar.get(Calendar.YEAR) - 1, date.getMonth(), date.getDate(), 0, 0, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        values.put(CalendarContract.Events.DTSTART, calendar.getTimeInMillis());
        // Those are identical for all birthdays, so we hardcode them
        values.put(CalendarContract.Events.ALL_DAY, 1);
        values.put(CalendarContract.Events.RRULE, "FREQ=YEARLY");
        values.put(CalendarContract.Events.DURATION, "P1D");

        fbEvent.mRSVP = FBCalendar.CalendarType.TYPE_BIRTHDAY;
    } else {
        DateStart start = vevent.getDateStart();
        values.put(CalendarContract.Events.DTSTART, start.getValue().getTime());
        DateEnd end = vevent.getDateEnd();
        if (end != null) {
            values.put(CalendarContract.Events.DTEND, end.getValue().getTime());
        }

        RawProperty prop = vevent.getExperimentalProperty("PARTSTAT");
        if (prop != null) {
            switch (prop.getValue()) {
                case "ACCEPTED":
                    fbEvent.mRSVP = FBCalendar.CalendarType.TYPE_ATTENDING;
                    break;
                case "TENTATIVE":
                    fbEvent.mRSVP = FBCalendar.CalendarType.TYPE_MAYBE;
                    break;
                case "DECLINED":
                    fbEvent.mRSVP = FBCalendar.CalendarType.TYPE_DECLINED;
                    break;
                case "NEEDS-ACTION":
                    fbEvent.mRSVP = FBCalendar.CalendarType.TYPE_NOT_REPLIED;
                    break;
            }
        }
    }

    return fbEvent;
}
 
开发者ID:danvratil,项目名称:FBEventSync,代码行数:73,代码来源:FBEvent.java

示例12: getDateEnd

import biweekly.property.DateEnd; //导入依赖的package包/类
public DateEnd getDateEnd() {
	DateEnd de = new DateEnd(iEnd.toDate(), true);
	return de;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:5,代码来源:CalendarServlet.java

示例13: validate

import biweekly.property.DateEnd; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void validate(List<ICalComponent> components, ICalVersion version, List<ValidationWarning> warnings) {
	checkRequiredCardinality(warnings, Action.class, Trigger.class);

	Action action = getAction();
	if (action != null) {
		//AUDIO alarms should not have more than 1 attachment
		if (action.isAudio()) {
			if (getAttachments().size() > 1) {
				warnings.add(new ValidationWarning(7));
			}
		}

		//DESCRIPTION is required for DISPLAY alarms 
		if (action.isDisplay()) {
			checkRequiredCardinality(warnings, Description.class);
		}

		if (action.isEmail()) {
			//SUMMARY and DESCRIPTION is required for EMAIL alarms
			checkRequiredCardinality(warnings, Summary.class, Description.class);

			//EMAIL alarms must have at least 1 ATTENDEE
			if (getAttendees().isEmpty()) {
				warnings.add(new ValidationWarning(8));
			}
		} else {
			//only EMAIL alarms can have ATTENDEEs
			if (!getAttendees().isEmpty()) {
				warnings.add(new ValidationWarning(9));
			}
		}

		if (action.isProcedure()) {
			checkRequiredCardinality(warnings, Description.class);
		}
	}

	Trigger trigger = getTrigger();
	if (trigger != null) {
		Related related = trigger.getRelated();
		if (related != null) {
			ICalComponent parent = components.get(components.size() - 1);

			//if the TRIGGER is relative to DTSTART, confirm that DTSTART exists
			if (related == Related.START && parent.getProperty(DateStart.class) == null) {
				warnings.add(new ValidationWarning(11));
			}

			//if the TRIGGER is relative to DTEND, confirm that DTEND (or DUE) exists
			if (related == Related.END) {
				boolean noEndDate = false;

				if (parent instanceof VEvent) {
					noEndDate = (parent.getProperty(DateEnd.class) == null && (parent.getProperty(DateStart.class) == null || parent.getProperty(DurationProperty.class) == null));
				} else if (parent instanceof VTodo) {
					noEndDate = (parent.getProperty(DateDue.class) == null && (parent.getProperty(DateStart.class) == null || parent.getProperty(DurationProperty.class) == null));
				}

				if (noEndDate) {
					warnings.add(new ValidationWarning(12));
				}
			}
		}
	}
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:68,代码来源:VAlarm.java

示例14: DateEndScribe

import biweekly.property.DateEnd; //导入依赖的package包/类
public DateEndScribe() {
	super(DateEnd.class, "DTEND");
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:4,代码来源:DateEndScribe.java

示例15: newInstance

import biweekly.property.DateEnd; //导入依赖的package包/类
@Override
protected DateEnd newInstance(ICalDate date) {
	return new DateEnd(date);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:5,代码来源:DateEndScribe.java


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