本文整理汇总了Java中biweekly.property.Priority类的典型用法代码示例。如果您正苦于以下问题:Java Priority类的具体用法?Java Priority怎么用?Java Priority使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Priority类属于biweekly.property包,在下文中一共展示了Priority类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import biweekly.property.Priority; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void validate(List<ICalComponent> components, ICalVersion version, List<ValidationWarning> warnings) {
if (version != ICalVersion.V1_0) {
checkRequiredCardinality(warnings, Uid.class, DateTimeStamp.class);
checkOptionalCardinality(warnings, Classification.class, Completed.class, Created.class, Description.class, DateStart.class, Geo.class, LastModified.class, Location.class, Organizer.class, PercentComplete.class, Priority.class, RecurrenceId.class, Sequence.class, Status.class, Summary.class, Url.class);
}
checkOptionalCardinality(warnings, Color.class);
Status[] validStatuses;
switch (version) {
case V1_0:
validStatuses = new Status[] { Status.needsAction(), Status.completed(), Status.accepted(), Status.declined(), Status.delegated(), Status.sent() };
break;
default:
validStatuses = new Status[] { Status.needsAction(), Status.completed(), Status.inProgress(), Status.cancelled() };
break;
}
checkStatus(warnings, validStatuses);
ICalDate dateStart = getValue(getDateStart());
ICalDate dateDue = getValue(getDateDue());
if (dateStart != null && dateDue != null) {
//DTSTART must come before DUE
if (dateStart.compareTo(dateDue) > 0) {
warnings.add(new ValidationWarning(22));
}
//DTSTART and DUE must have the same data type
if (dateStart.hasTime() != dateDue.hasTime()) {
warnings.add(new ValidationWarning(23));
}
}
//DUE and DURATION cannot both exist
DurationProperty duration = getDuration();
if (dateDue != null && duration != null) {
warnings.add(new ValidationWarning(24));
}
//DTSTART is required if DURATION exists
if (dateStart == null && duration != null) {
warnings.add(new ValidationWarning(25));
}
//DTSTART and RECURRENCE-ID must have the same data type
ICalDate recurrenceId = getValue(getRecurrenceId());
if (recurrenceId != null && dateStart != null && dateStart.hasTime() != recurrenceId.hasTime()) {
warnings.add(new ValidationWarning(19));
}
//BYHOUR, BYMINUTE, and BYSECOND cannot be specified in RRULE if DTSTART's data type is "date"
//RFC 5545 p. 167
Recurrence rrule = getValue(getRecurrenceRule());
if (dateStart != null && rrule != null) {
if (!dateStart.hasTime() && (!rrule.getByHour().isEmpty() || !rrule.getByMinute().isEmpty() || !rrule.getBySecond().isEmpty())) {
warnings.add(new ValidationWarning(5));
}
}
//there *should* be only 1 instance of RRULE
//RFC 5545 p. 167
if (getProperties(RecurrenceRule.class).size() > 1) {
warnings.add(new ValidationWarning(6));
}
}
示例2: validate
import biweekly.property.Priority; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void validate(List<ICalComponent> components, ICalVersion version, List<ValidationWarning> warnings) {
if (version != ICalVersion.V1_0) {
checkRequiredCardinality(warnings, Uid.class, DateTimeStamp.class);
checkOptionalCardinality(warnings, Classification.class, Created.class, Description.class, Geo.class, LastModified.class, Location.class, Organizer.class, Priority.class, Status.class, Summary.class, Transparency.class, Url.class, RecurrenceId.class);
}
checkOptionalCardinality(warnings, Color.class);
Status[] validStatuses;
switch (version) {
case V1_0:
validStatuses = new Status[] { Status.tentative(), Status.confirmed(), Status.declined(), Status.needsAction(), Status.sent(), Status.delegated() };
break;
default:
validStatuses = new Status[] { Status.tentative(), Status.confirmed(), Status.cancelled() };
break;
}
checkStatus(warnings, validStatuses);
ICalDate dateStart = getValue(getDateStart());
ICalDate dateEnd = getValue(getDateEnd());
//DTSTART is always required, unless there is a METHOD property at the iCal root
ICalComponent ical = components.get(0);
if (version != ICalVersion.V1_0 && dateStart == null && ical.getProperty(Method.class) == null) {
warnings.add(new ValidationWarning(14));
}
//DTSTART is required if DTEND exists
if (dateEnd != null && dateStart == null) {
warnings.add(new ValidationWarning(15));
}
if (dateStart != null && dateEnd != null) {
//DTSTART must come before DTEND
if (dateStart.compareTo(dateEnd) > 0) {
warnings.add(new ValidationWarning(16));
}
//DTSTART and DTEND must have the same data type
if (dateStart.hasTime() != dateEnd.hasTime()) {
warnings.add(new ValidationWarning(17));
}
}
//DTEND and DURATION cannot both exist
if (dateEnd != null && getDuration() != null) {
warnings.add(new ValidationWarning(18));
}
//DTSTART and RECURRENCE-ID must have the same data type
ICalDate recurrenceId = getValue(getRecurrenceId());
if (recurrenceId != null && dateStart != null && dateStart.hasTime() != recurrenceId.hasTime()) {
warnings.add(new ValidationWarning(19));
}
//BYHOUR, BYMINUTE, and BYSECOND cannot be specified in RRULE if DTSTART's data type is "date"
//RFC 5545 p. 167
Recurrence rrule = getValue(getRecurrenceRule());
if (dateStart != null && rrule != null) {
if (!dateStart.hasTime() && (!rrule.getByHour().isEmpty() || !rrule.getByMinute().isEmpty() || !rrule.getBySecond().isEmpty())) {
warnings.add(new ValidationWarning(5));
}
}
//there *should* be only 1 instance of RRULE
//RFC 5545 p. 167
if (getProperties(RecurrenceRule.class).size() > 1) {
warnings.add(new ValidationWarning(6));
}
}
示例3: PriorityScribe
import biweekly.property.Priority; //导入依赖的package包/类
public PriorityScribe() {
super(Priority.class, "PRIORITY");
}
示例4: newInstance
import biweekly.property.Priority; //导入依赖的package包/类
@Override
protected Priority newInstance(Integer value) {
return new Priority(value);
}
示例5: validate_cardinality_optional
import biweekly.property.Priority; //导入依赖的package包/类
@Test
public void validate_cardinality_optional() {
VTodo component = new VTodo();
component.addProperty(Classification.confidential());
component.addProperty(new Completed(new Date()));
component.addProperty(new Created(new Date()));
component.addProperty(new Description(""));
component.addProperty(new DateStart(new Date()));
component.addProperty(new Geo(1.1, 1.1));
component.addProperty(new LastModified(new Date()));
component.addProperty(new Location(""));
component.addProperty(new Organizer("", ""));
component.addProperty(new PercentComplete(0));
component.addProperty(new Priority(0));
component.addProperty(new Sequence(0));
component.addProperty(Status.needsAction());
component.addProperty(new Summary(""));
component.addProperty(new Url(""));
component.addProperty(new RecurrenceId(new Date()));
component.addProperty(new Color(""));
assertValidate(component).versions(V1_0).run();
assertValidate(component).versions(V2_0_DEPRECATED, V2_0).run();
component.addProperty(Classification.confidential());
component.addProperty(new Completed(new Date()));
component.addProperty(new Created(new Date()));
component.addProperty(new Description(""));
component.addProperty(new DateStart(new Date()));
component.addProperty(new Geo(1.1, 1.1));
component.addProperty(new LastModified(new Date()));
component.addProperty(new Location(""));
component.addProperty(new Organizer("", ""));
component.addProperty(new PercentComplete(0));
component.addProperty(new Priority(0));
component.addProperty(new Sequence(0));
component.addProperty(Status.needsAction());
component.addProperty(new Summary(""));
component.addProperty(new Url(""));
component.addProperty(new RecurrenceId(new Date()));
component.addProperty(new Color(""));
assertValidate(component).versions(V1_0).run(3);
assertValidate(component).versions(V2_0_DEPRECATED, V2_0).run(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3);
}
示例6: validate_cardinality_optional
import biweekly.property.Priority; //导入依赖的package包/类
@Test
public void validate_cardinality_optional() {
TestComponent parent = new TestComponent();
VEvent component = new VEvent();
component.setDateStart(new Date()); //suppress "no start date" warning
assertValidate(component).parents(parent).run();
component.addProperty(Classification.confidential());
component.addProperty(new Created(new Date()));
component.addProperty(new Description(""));
component.addProperty(new Geo(1.1, 1.1));
component.addProperty(new LastModified(new Date()));
component.addProperty(new Location(""));
component.addProperty(new Organizer(null, null));
component.addProperty(new Priority(1));
Status status1 = Status.confirmed();
component.addProperty(status1);
component.addProperty(new Summary(""));
component.addProperty(Transparency.opaque());
component.addProperty(new Url(""));
component.addProperty(new RecurrenceId(new Date()));
component.addProperty(new Color(""));
assertValidate(component).parents(parent).run();
component.addProperty(Classification.confidential());
component.addProperty(new Created(new Date()));
component.addProperty(new Description(""));
component.addProperty(new Geo(1.1, 1.1));
component.addProperty(new LastModified(new Date()));
component.addProperty(new Location(""));
component.addProperty(new Organizer(null, null));
component.addProperty(new Priority(1));
Status status2 = Status.confirmed();
component.addProperty(status2);
component.addProperty(new Summary(""));
component.addProperty(Transparency.opaque());
component.addProperty(new Url(""));
component.addProperty(new RecurrenceId(new Date()));
component.addProperty(new Color(""));
assertValidate(component).parents(parent).versions(V1_0).run(3);
assertValidate(component).parents(parent).versions(V2_0_DEPRECATED, V2_0).run(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3);
}
示例7: getPriority
import biweekly.property.Priority; //导入依赖的package包/类
/**
* Gets the priority of the to-do task.
* @return the priority or null if not set
* @see <a href="http://tools.ietf.org/html/rfc5545#page-89">RFC 5545
* p.89-90</a>
* @see <a href="http://tools.ietf.org/html/rfc2445#page-85">RFC 2445
* p.85-7</a>
* @see <a href="http://www.imc.org/pdi/vcal-10.doc">vCal 1.0 p.33</a>
*/
public Priority getPriority() {
return getProperty(Priority.class);
}
示例8: setPriority
import biweekly.property.Priority; //导入依赖的package包/类
/**
* Sets the priority of the to-do task.
* @param priority the priority or null to remove
* @see <a href="http://tools.ietf.org/html/rfc5545#page-89">RFC 5545
* p.89-90</a>
* @see <a href="http://tools.ietf.org/html/rfc2445#page-85">RFC 2445
* p.85-7</a>
* @see <a href="http://www.imc.org/pdi/vcal-10.doc">vCal 1.0 p.33</a>
*/
public void setPriority(Priority priority) {
setProperty(Priority.class, priority);
}
示例9: getPriority
import biweekly.property.Priority; //导入依赖的package包/类
/**
* Gets the priority of the event.
* @return the priority or null if not set
* @see <a href="http://tools.ietf.org/html/rfc5545#page-89">RFC 5545
* p.89-90</a>
* @see <a href="http://tools.ietf.org/html/rfc2445#page-85">RFC 2445
* p.85-7</a>
* @see <a href="http://www.imc.org/pdi/vcal-10.doc">vCal 1.0 p.33</a>
*/
public Priority getPriority() {
return getProperty(Priority.class);
}
示例10: setPriority
import biweekly.property.Priority; //导入依赖的package包/类
/**
* Sets the priority of the event.
* @param priority the priority or null to remove
* @see <a href="http://tools.ietf.org/html/rfc5545#page-89">RFC 5545
* p.89-90</a>
* @see <a href="http://tools.ietf.org/html/rfc2445#page-85">RFC 2445
* p.85-7</a>
* @see <a href="http://www.imc.org/pdi/vcal-10.doc">vCal 1.0 p.33</a>
*/
public void setPriority(Priority priority) {
setProperty(Priority.class, priority);
}