本文整理匯總了Java中net.fortuna.ical4j.model.component.VJournal類的典型用法代碼示例。如果您正苦於以下問題:Java VJournal類的具體用法?Java VJournal怎麽用?Java VJournal使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
VJournal類屬於net.fortuna.ical4j.model.component包,在下文中一共展示了VJournal類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: evaluate
import net.fortuna.ical4j.model.component.VJournal; //導入依賴的package包/類
/**
* Evaluates.
* @param comps The component list.
* @param filter The time range filter.
* @return the result.
*/
private boolean evaluate(ComponentList comps, TimeRangeFilter filter) {
Component comp = (Component) comps.get(0);
if(comp instanceof VEvent) {
return evaluateVEventTimeRange(comps, filter);
}
else if(comp instanceof VToDo) {
return evaulateVToDoTimeRange(comps, filter);
}
else if(comp instanceof VJournal) {
return evaluateVJournalTimeRange((VJournal) comp, filter);
}
else if(comp instanceof VAlarm) {
return evaluateVAlarmTimeRange(comps, filter);
}
else {
return false;
}
}
示例2: evaluateVJournalTimeRange
import net.fortuna.ical4j.model.component.VJournal; //導入依賴的package包/類
/**
* 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;
}
示例3: evaluate
import net.fortuna.ical4j.model.component.VJournal; //導入依賴的package包/類
/**
* Evaluates.
* @param comps The component list.
* @param filter The time range filter.
* @return the result.
*/
private boolean evaluate(ComponentList<? extends Component> comps, TimeRangeFilter filter) {
Component comp = (Component) comps.get(0);
if(comp instanceof VEvent) {
return evaluateVEventTimeRange(comps, filter);
}
else if(comp instanceof VFreeBusy) {
return evaulateVFreeBusyTimeRange((VFreeBusy) comp, filter);
}
else if(comp instanceof VToDo) {
return evaulateVToDoTimeRange(comps, filter);
}
else if(comp instanceof VJournal) {
return evaluateVJournalTimeRange((VJournal) comp, filter);
}
else if(comp instanceof VAlarm) {
return evaluateVAlarmTimeRange(comps, filter);
}
else {
return false;
}
}
示例4: setCalendarAttributes
import net.fortuna.ical4j.model.component.VJournal; //導入依賴的package包/類
/**
* Sets calendar attributes.
* @param note The note item.
* @param journal The VJournal.
*/
private void setCalendarAttributes(NoteItem note, VJournal journal) {
// UID
if(journal.getUid()!=null) {
note.setIcalUid(journal.getUid().getValue());
}
// for now displayName is limited to 1024 chars
if (journal.getSummary() != null) {
note.setDisplayName(StringUtils.substring(journal.getSummary()
.getValue(), 0, 1024));
}
if (journal.getDescription() != null) {
note.setBody(journal.getDescription().getValue());
}
// look for DTSTAMP
if (journal.getDateStamp() != null) {
note.setClientModifiedDate(journal.getDateStamp().getDate());
}
}
示例5: convertJournalCalendar
import net.fortuna.ical4j.model.component.VJournal; //導入依賴的package包/類
/**
* Update existing NoteItem with calendar containing single VJOURNAL
* @param note note to update
* @param calendar calendar containing VJOURNAL
* @return NoteItem representation of VJOURNAL
*/
public NoteItem convertJournalCalendar(NoteItem note, Calendar calendar) {
VJournal vj = (VJournal) getMasterComponent(calendar.getComponents(Component.VJOURNAL));
setCalendarAttributes(note, vj);
return note;
}
示例6: setCalendar
import net.fortuna.ical4j.model.component.VJournal; //導入依賴的package包/類
/**
* <p>
* @param cal Imports a calendar object containing a VJOURNAL. Sets the
* following properties:
* </p>
* <ul>
* <li>display name: the VJOURNAL's SUMMARY (or the item's name, if the
* SUMMARY is blank)</li>
* <li>icalUid: the VJOURNAL's UID</li>
* <li>body: the VJOURNAL's DESCRIPTION</li>
* </ul>
*/
public void setCalendar(Calendar cal)
throws CosmoDavException {
NoteItem note = (NoteItem) getItem();
ComponentList<VJournal> vjournals = cal.getComponents(Component.VJOURNAL);
if (vjournals.isEmpty()) {
throw new UnprocessableEntityException("VCALENDAR does not contain any VJOURNALS");
}
EntityConverter converter = new EntityConverter(getEntityFactory());
converter.convertJournalCalendar(note, cal);
}
示例7: readComponent
import net.fortuna.ical4j.model.component.VJournal; //導入依賴的package包/類
/**
* @param componentList
* - receives a list of components which contains either Events,
* ToDos, Journal entries or Free/Busy times
* @return temporalDataSet - returns a TemporalDataSet containing all the
* data (Temp.Elements & Temp.Objects) of each component contained
* in the given componentList
* @throws TemporalDataException
* @throws ParseException
* @throws URISyntaxException
* @throws IOException
*/
private TemporalDataset readComponent(ComponentList componentList)
throws TemporalDataException {
// Adding several new columns to the temporalDataSet to
// present data occurring in different types of iCalendar entries
dataset.addDataColumn(CREATED, Date.class, new Date(0L));
dataset.addDataColumn(DESCRIPTION, String.class, "");
dataset.addDataColumn(LOCATION, String.class, "");
dataset.addDataColumn(SUMMARY, String.class, "");
dataset.addDataColumn(UID, String.class, "");
// iterate through the componentList and process every
// component according to its type (event, journal, freebusy)
for (int i = 0; i < componentList.size(); i++) {
if (m_componentType == Component.VEVENT) {
VEvent event = (VEvent) componentList.get(i);
fillEvent(event);
} else if (m_componentType == Component.VJOURNAL) {
VJournal journal = (VJournal) componentList.get(i);
fillJournal(journal);
} else if (m_componentType == Component.VFREEBUSY) {
VFreeBusy freeBusy = (VFreeBusy) componentList.get(i);
fillFreeBusy(freeBusy);
}
}
return dataset;
}
示例8: fillJournal
import net.fortuna.ical4j.model.component.VJournal; //導入依賴的package包/類
/**
* Checks if the specified values exist in the component, adds
* them to Temporal Elements/Objects and, where required, uses
* default values for non-existent fields
*
* @param journal
* - A Journal component of the ical4j library
*/
private void fillJournal(VJournal journal) {
// see fillEvent for detailed description
Date dStamp = (checkNull(journal.getDateStamp())) ? journal
.getDateStamp().getDate() : new Date(0L);
if (checkNull(journal.getProperty(Property.RRULE))) {
checkRecurrences(journal, dStamp, dStamp);
}
if (checkNull(journal.getProperty(Property.RDATE))) {
checkRDates(journal, dStamp, dStamp);
}
tempElement = dataset.addTemporalElement(dStamp.getTime(),
dStamp.getTime(), minuteGranularity.getIdentifier(), minuteGranularity.getGranularityContextIdentifier(),
TemporalElementStore.PRIMITIVE_INSTANT);
tempObject = dataset.addTemporalObject(tempElement);
Date created = (checkNull(journal.getCreated())) ? journal.getCreated()
.getDate() : new Date(0L);
String description = (checkNull(journal.getDescription())) ? journal
.getDescription().getValue() : null;
String summary = (checkNull(journal.getSummary())) ? journal
.getSummary().getValue() : null;
String uid = (checkNull(journal.getUid())) ? journal.getUid()
.getValue() : null;
tempObject.set(CREATED, created);
tempObject.set(DESCRIPTION, description);
tempObject.set(SUMMARY, summary);
tempObject.set(UID, uid);
}
示例9: fillSingleComponent
import net.fortuna.ical4j.model.component.VJournal; //導入依賴的package包/類
/**
* Creates a copy of a component which doesn't contain the original component's
* recurrence information.
*
* @param component
* - the component to be filled
* @param date
* - the startDate that will be assigned to the component
* @param duration
* - the duration (only relevant for events)
*/
private void fillSingleComponent(Component component, Date date,
long duration) {
// copy all the properties from the original component
PropertyList list = getPropertyList(component);
// if the component is an event perform event-specific actions
if (component instanceof VEvent) {
// the new endDate of this single event will
// be the previously calculated duration in combination
// with the current startDate
Date newEndDate = new DateTime(date.getTime() + duration);
// add new dates to the property list
list.add(new DtStart(date));
list.add(new DtEnd(newEndDate));
// create a new event with the properties of the property list
// and add it to the temporalDataSet
VEvent singleEvent = new VEvent(list);
fillEvent(singleEvent);
} else if (component instanceof VJournal) { // otherwise perfom
// journal-specific actions
// set the time stamp of the new journal
// to the current nextDate (occurrence)
list.add(new DtStamp((DateTime) date));
// create a new journal with the properties
// and add it to the temporalDataSet
VJournal singleJournal = new VJournal(list);
fillJournal(singleJournal);
}
}
示例10: getPropertyList
import net.fortuna.ical4j.model.component.VJournal; //導入依賴的package包/類
/**
* Creates a PorpertyList containing the given component's
* properties excluding recurrence information.
*
* @param component
* - takes the original event from which the needed properties
* are extracted
* @return PropertyList - a list containing all the properties from the
* original event
*/
private PropertyList getPropertyList(Component component) {
PropertyList list = new PropertyList();
// check the components type
// and copy its properties to a separate property list
if (component instanceof VEvent) {
VEvent tempEvent = (VEvent) component;
if (checkNull(tempEvent.getCreated()))
list.add(tempEvent.getCreated());
if (checkNull(tempEvent.getDescription()))
list.add(tempEvent.getDescription());
if (checkNull(tempEvent.getLocation()))
list.add(tempEvent.getLocation());
if (checkNull(tempEvent.getSummary()))
list.add(tempEvent.getSummary());
if (checkNull(tempEvent.getUid()))
list.add(tempEvent.getUid());
} else if (component instanceof VJournal) {
VJournal tempJournal = (VJournal) component;
if (checkNull(tempJournal.getCreated()))
list.add(tempJournal.getCreated());
if (checkNull(tempJournal.getDescription()))
list.add(tempJournal.getDescription());
if (checkNull(tempJournal.getSummary()))
list.add(tempJournal.getSummary());
if (checkNull(tempJournal.getUid()))
list.add(tempJournal.getUid());
}
return list;
}