Package net.fortuna.ical4j.model

Examples of net.fortuna.ical4j.model.PropertyList


      LastModified lastMod = new LastModified(new DateTime(kEvent.getLastModified()));
      vEvent.getProperties().add(lastMod);
    }

    // Uid
    PropertyList vEventProperties = vEvent.getProperties();
    vEventProperties.add(new Uid(kEvent.getID()));
   
    // clazz
    switch (kEvent.getClassification()) {
      case KalendarEvent.CLASS_PRIVATE: vEventProperties.add(ICAL_CLASS_PRIVATE); break;
      case KalendarEvent.CLASS_PUBLIC: vEventProperties.add(ICAL_CLASS_PUBLIC); break;
      case KalendarEvent.CLASS_X_FREEBUSY: vEventProperties.add(ICAL_CLASS_X_FREEBUSY); break;
      default: vEventProperties.add(ICAL_CLASS_PRIVATE); break;
    }

    // location
    if (kEvent.getLocation() != null) {
      vEventProperties.add(new Location(kEvent.getLocation()));
    }
   
    // event links
    List kalendarEventLinks = kEvent.getKalendarEventLinks();
    if ((kalendarEventLinks != null) && !kalendarEventLinks.isEmpty()) {
      for (Iterator iter = kalendarEventLinks.iterator(); iter.hasNext();) {
        KalendarEventLink link = (KalendarEventLink) iter.next();
        StringBuilder linkEncoded = new StringBuilder(200);
        linkEncoded.append(link.getProvider());
        linkEncoded.append("§");
        linkEncoded.append(link.getId());
        linkEncoded.append("§");
        linkEncoded.append(link.getDisplayName());
        linkEncoded.append("§");
        linkEncoded.append(link.getURI());
        linkEncoded.append("§");
        linkEncoded.append(link.getIconCssClass());
        XProperty linkProperty = new XProperty(ICAL_X_OLAT_LINK, linkEncoded.toString());
        vEventProperties.add(linkProperty);
      }
    }
   
    if (kEvent.getComment() != null) {
      vEventProperties.add(new XProperty(ICAL_X_OLAT_COMMENT, kEvent.getComment()));
    }
    if (kEvent.getNumParticipants() != null) {
      vEventProperties.add(new XProperty(ICAL_X_OLAT_NUMPARTICIPANTS, Integer.toString(kEvent.getNumParticipants())));
    }
    if (kEvent.getParticipants() != null) {
      StringBuffer strBuf = new StringBuffer();
      String[] participants = kEvent.getParticipants();
      for ( String participant : participants ) {
        strBuf.append(participant);
        strBuf.append("§");
      }
      vEventProperties.add(new XProperty(ICAL_X_OLAT_PARTICIPANTS, strBuf.toString()));
    }
    if (kEvent.getSourceNodeId() != null) {
      vEventProperties.add(new XProperty(ICAL_X_OLAT_SOURCENODEID, kEvent.getSourceNodeId()));
    }
   
    // recurrence
    String recurrence = kEvent.getRecurrenceRule();
    if(recurrence != null && !recurrence.equals("")) {
      try {
        Recur recur = new Recur(recurrence);
        RRule rrule = new RRule(recur);
        vEventProperties.add(rrule);
      } catch (ParseException e) {
        Tracing.createLoggerFor(getClass()).error("cannot create recurrence rule: " + recurrence.toString(), e);
      }
    }
    // recurrence exclusions
    String recurrenceExc = kEvent.getRecurrenceExc();
    if(recurrenceExc != null && !recurrenceExc.equals("")) {
      ExDate exdate = new ExDate();
      try {
        exdate.setValue(recurrenceExc);
        vEventProperties.add(exdate);
      } catch (ParseException e) {
        e.printStackTrace();
      }
    }
   
View Full Code Here


        String workEffortId = workEffort.getString("workEffortId");
        List<GenericValue> reminderList = delegator.findList("WorkEffortEventReminder", EntityCondition.makeCondition("workEffortId", EntityOperator.EQUALS, workEffort.get("workEffortId")), null, null, null, false);
        for (GenericValue reminder : reminderList) {
            String reminderId = workEffortId + "-" + reminder.getString("sequenceId");
            VAlarm alarm = null;
            PropertyList alarmProps = null;
            boolean newAlarm = true;
            Iterator<VAlarm> i = UtilGenerics.cast(alarms.iterator());
            while (i.hasNext()) {
                alarm = i.next();
                Property xProperty = alarm.getProperty(reminderXPropName);
                if (xProperty != null && reminderId.equals(xProperty.getValue())) {
                    newAlarm = false;
                    alarmProps = alarm.getProperties();
                    // TODO: Write update code. For now, just re-create
                    alarmProps.clear();
                    break;
                }
            }
            if (newAlarm) {
                alarm = createAlarm(reminder);
                alarms.add(alarm);
                alarmProps = alarm.getProperties();
                alarmProps.add(new XProperty(reminderXPropName, reminderId));
            }
            GenericValue contactMech = reminder.getRelatedOne("ContactMech");
            if (contactMech != null && "EMAIL_ADDRESS".equals(contactMech.get("contactMechTypeId"))) {
                try {
                    alarmProps.add(new Attendee(contactMech.getString("infoString")));
                    alarmProps.add(Action.EMAIL);
                    alarmProps.add(summary);
                    alarmProps.add(description);
                } catch (URISyntaxException e) {
                    alarmProps.add(Action.DISPLAY);
                    alarmProps.add(new Description("Error encountered while creating iCalendar: " + e));
                }
            } else {
                alarmProps.add(Action.DISPLAY);
                alarmProps.add(description);
            }
            if (Debug.verboseOn()) {
                try {
                    alarm.validate(true);
                    Debug.logVerbose("iCalendar alarm passes validation", module);
View Full Code Here

            replaceParameter(parameterList, toParticipationStatus(partyAssign.getString("assignmentStatusId")));
        }
    }

    protected static void loadRelatedParties(List<GenericValue> relatedParties, PropertyList componentProps, Map<String, Object> context) {
        PropertyList attendees = componentProps.getProperties("ATTENDEE");
        for (GenericValue partyValue : relatedParties) {
            if ("CAL_ORGANIZER~CAL_OWNER".contains(partyValue.getString("roleTypeId"))) {
                // RFC 2445 4.6.1, 4.6.2, and 4.6.3 ORGANIZER can appear only once
                replaceProperty(componentProps, createOrganizer(partyValue, context));
            } else {
                String partyId = partyValue.getString("partyId");
                boolean newAttendee = true;
                Attendee attendee = null;
                Iterator<Attendee> i = UtilGenerics.cast(attendees.iterator());
                while (i.hasNext()) {
                    attendee = i.next();
                    Parameter xParameter = attendee.getParameter(partyIdXParamName);
                    if (xParameter != null && partyId.equals(xParameter.getValue())) {
                        loadPartyAssignment(attendee, partyValue, context);
View Full Code Here

            } catch (Exception e) {
                Debug.logError(e, "Error while parsing saved iCalendar, creating new iCalendar: ", module);
                calendar = new Calendar();
            }
        }
        PropertyList propList = calendar.getProperties();
        replaceProperty(propList, prodId);
        replaceProperty(propList, new XProperty(workEffortIdXPropName, workEffort.getString("workEffortId")));
        if (newCalendar) {
            propList.add(Version.VERSION_2_0);
            propList.add(CalScale.GREGORIAN);
            // TODO: Get time zone from publish properties value
            java.util.TimeZone tz = java.util.TimeZone.getDefault();
            TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
            net.fortuna.ical4j.model.TimeZone timezone = registry.getTimeZone(tz.getID());
            calendar.getComponents().add(timezone.getVTimeZone());
View Full Code Here

            replaceParameter(property.getParameters(), toXParameter(partyIdXParamName, partyId));
        }
    }

    protected static void setWorkEffortServiceMap(Component component, Map<String, Object> serviceMap) {
        PropertyList propertyList = component.getProperties();
        setMapElement(serviceMap, "scopeEnumId", fromClazz(propertyList));
        setMapElement(serviceMap, "description", fromDescription(propertyList));
        setMapElement(serviceMap, "locationDesc", fromLocation(propertyList));
        setMapElement(serviceMap, "priority", fromPriority(propertyList));
        setMapElement(serviceMap, "currentStatusId", fromStatus(propertyList));
View Full Code Here

        }
        return responseProps;
    }

    protected static ResponseProperties storeWorkEffort(Component component, Map<String, Object> context) throws GenericEntityException, GenericServiceException {
        PropertyList propertyList = component.getProperties();
        String workEffortId = fromXProperty(propertyList, workEffortIdXPropName);
        Delegator delegator = (Delegator) context.get("delegator");
        GenericValue workEffort = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), false);
        if (workEffort == null) {
            return ICalWorker.createNotFoundResponse(null);
View Full Code Here

            alarms = event.getAlarms();
        }
        if (newComponent) {
            components.add(result);
        }
        PropertyList componentProps = result.getProperties();
        loadWorkEffort(componentProps, workEffort);
        if (isTask) {
            replaceProperty(componentProps, toCompleted(workEffort.getTimestamp("actualCompletionDate")));
            replaceProperty(componentProps, toPercentComplete(workEffort.getLong("percentComplete")));
        } else {
View Full Code Here

     */
    public VEvent getRecessEvent() {
        if (startRecess == null)
            return null;
        VEvent v = new VEvent(getStartRecessDate(), "Recess Week");
        PropertyList pl = v.getProperties();
        pl.add(new RRule(new Recur(Recur.DAILY, 5)));
        try {
            UidGenerator ug = new UidGenerator("1");
            pl.add(ug.generateUid());
        } catch (SocketException ex) {
        }
        return v;
    }
View Full Code Here

*/
public class SemesterCalendar extends Calendar {

    public SemesterCalendar(SemesterTimetable st) {
        super();
        PropertyList pl = getProperties();
        ComponentList cl = getComponents();
        pl.add(new ProdId("-//Nia Mutiara//NTU Timetable to iCalendar//EN"));
        pl.add(Version.VERSION_2_0);
        pl.add(CalScale.GREGORIAN);
        Iterator<ClassTimetable> it = st.getClassTimetables().iterator();
        ClassTimetable ct;
        while (it.hasNext()) {
            ct = it.next();
            cl.add(ct.toEvent());
View Full Code Here

public class ClassVEvent extends VEvent {

    public ClassVEvent(ClassTimetable ct) {
        super();
        Course course = ct.getCourse();
        PropertyList pl = getProperties();
        DateTime[] timeStandard = ct.getDtStartEnd();
        pl.add(new DtStart(timeStandard[0]));
        if (timeStandard[1] != null) {
            pl.add(new DtEnd(timeStandard[1]));
        }
        try {
            UidGenerator ug = new UidGenerator("1");
            pl.add(ug.generateUid());
        } catch (SocketException ex) {
            Logger.getLogger(ClassVEvent.class).error(
                    "Error when assigning UID to "
                    + course.getCourseName() + " class timetable ", ex);
        }
        pl.add(new Description(course.getCourseName() + "("
                + course.getIndexNum() + ", " + ct.getGroup() + ")\n"
                + course.getCourseType()
                + (course.getCourseType().isPrescribed()
                ? " " + course.getGeneralPEType() : "")));
        pl.add(new Location(ct.getVenue()));
        pl.add(new Summary(course.getCourseName() + " " + ct.getClassType()
                + " " + ct.getRemark()));
        String[] split = ct.getSemesterTimetable().getStartExam().split("-");
        String str = split[0] + split[1] + split[2];
        try {
            pl.add(new RRule(new Recur(Recur.WEEKLY, new Date(str))));
        } catch (ParseException ex) {
            Logger.getLogger(ClassVEvent.class).error("Error when parsing "
                    + "recurrence rule for " + course.getCourseName()
                    + " class timetable", ex);
        }
View Full Code Here

TOP

Related Classes of net.fortuna.ical4j.model.PropertyList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.