Search in sources :

Example 11 with IndexException

use of org.bedework.util.indexing.IndexException in project bw-calendar-engine by Bedework.

the class DocBuilder method indexOrganizer.

private void indexOrganizer(final BwOrganizer val) throws CalFacadeException {
    try {
        if (val == null) {
            return;
        }
        startObject(getJname(PropertyInfoIndex.ORGANIZER));
        startObject(getJname(PropertyInfoIndex.PARAMETERS));
        makeField(ParameterInfoIndex.SCHEDULE_STATUS.getJname(), val.getScheduleStatus());
        makeField(ParameterInfoIndex.CN.getJname(), val.getCn());
        makeField(ParameterInfoIndex.DIR.getJname(), val.getDir());
        makeField(ParameterInfoIndex.LANGUAGE.getJname(), val.getLanguage());
        makeField(ParameterInfoIndex.SENT_BY.getJname(), val.getSentBy());
        endObject();
        makeField(getJname(PropertyInfoIndex.URI), val.getOrganizerUri());
        endObject();
    } catch (final IndexException e) {
        throw new CalFacadeException(e);
    }
}
Also used : IndexException(org.bedework.util.indexing.IndexException) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 12 with IndexException

use of org.bedework.util.indexing.IndexException in project bw-calendar-engine by Bedework.

the class EntityBuilder method restoreAlarms.

private Set<BwAlarm> restoreAlarms() throws CalFacadeException {
    final List<Object> vals = getFieldValues(PropertyInfoIndex.VALARM);
    if (Util.isEmpty(vals)) {
        return null;
    }
    final Set<BwAlarm> alarms = new TreeSet<>();
    for (final Object o : vals) {
        try {
            pushFields(o);
            final BwAlarm alarm = new BwAlarm();
            alarm.setOwnerHref(getString(PropertyInfoIndex.OWNER));
            alarm.setPublick(getBooleanNotNull(PropertyInfoIndex.PUBLIC));
            final String action = getString(PropertyInfoIndex.ACTION);
            final String actionVal = action.toUpperCase();
            int atype = -1;
            for (int i = 0; i < BwAlarm.alarmTypes.length; i++) {
                if (actionVal.equals(BwAlarm.alarmTypes[i])) {
                    atype = i;
                    break;
                }
            }
            if (atype < 0) {
                alarm.setAlarmType(BwAlarm.alarmTypeOther);
                alarm.addXproperty(BwXproperty.makeIcalProperty("ACTION", null, action));
            } else {
                alarm.setAlarmType(atype);
            }
            alarm.setTrigger(getString(PropertyInfoIndex.TRIGGER));
            alarm.setTriggerDateTime(getBool(PropertyInfoIndex.TRIGGER_DATE_TIME));
            final String rel = getString(ParameterInfoIndex.RELATED);
            alarm.setTriggerStart(rel == null);
            alarm.setDuration(getString(PropertyInfoIndex.DURATION));
            alarm.setRepeat(getInt(PropertyInfoIndex.REPEAT));
            if (atype == BwAlarm.alarmTypeAudio) {
                alarm.setAttach(getString(PropertyInfoIndex.ATTACH));
            } else if (atype == BwAlarm.alarmTypeDisplay) {
                alarm.setDescription(getString(PropertyInfoIndex.DESCRIPTION));
            } else if (atype == BwAlarm.alarmTypeEmail) {
                alarm.setAttach(getString(PropertyInfoIndex.ATTACH));
                alarm.setDescription(getString(PropertyInfoIndex.DESCRIPTION));
                alarm.setSummary(getString(PropertyInfoIndex.SUMMARY));
                alarm.setAttendees(restoreAttendees(false));
            } else if (atype == BwAlarm.alarmTypeProcedure) {
                alarm.setAttach(getString(PropertyInfoIndex.ATTACH));
                alarm.setDescription(getString(PropertyInfoIndex.DESCRIPTION));
            } else {
                alarm.setDescription(getString(PropertyInfoIndex.DESCRIPTION));
            }
            alarm.setXproperties(restoreXprops());
            alarms.add(alarm);
        } catch (final IndexException ie) {
            throw new CalFacadeException(ie);
        } finally {
            popFields();
        }
    }
    return alarms;
}
Also used : IndexException(org.bedework.util.indexing.IndexException) TreeSet(java.util.TreeSet) BwString(org.bedework.calfacade.BwString) BwLongString(org.bedework.calfacade.BwLongString) BwAlarm(org.bedework.calfacade.BwAlarm) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 13 with IndexException

use of org.bedework.util.indexing.IndexException in project bw-calendar-engine by Bedework.

the class EntityBuilder method restoreAttendees.

private Set<BwAttendee> restoreAttendees(final boolean vpoll) throws CalFacadeException {
    final PropertyInfoIndex pi;
    if (vpoll) {
        pi = PropertyInfoIndex.VOTER;
    } else {
        pi = PropertyInfoIndex.ATTENDEE;
    }
    final List<Object> vals = getFieldValues(pi);
    if (Util.isEmpty(vals)) {
        return null;
    }
    final Set<BwAttendee> atts = new TreeSet<>();
    for (final Object o : vals) {
        try {
            pushFields(o);
            final BwAttendee att = new BwAttendee();
            if (pushFields(PropertyInfoIndex.PARAMETERS)) {
                try {
                    att.setRsvp(getBool(ParameterInfoIndex.RSVP));
                    att.setCn(getString(ParameterInfoIndex.CN));
                    att.setPartstat(getString(ParameterInfoIndex.PARTSTAT));
                    att.setScheduleStatus(getString(ParameterInfoIndex.SCHEDULE_STATUS));
                    att.setCuType(getString(ParameterInfoIndex.CUTYPE));
                    att.setDelegatedFrom(getString(ParameterInfoIndex.DELEGATED_FROM));
                    att.setDelegatedTo(getString(ParameterInfoIndex.DELEGATED_TO));
                    att.setDir(getString(ParameterInfoIndex.DIR));
                    att.setLanguage(getString(ParameterInfoIndex.LANGUAGE));
                    att.setMember(getString(ParameterInfoIndex.MEMBER));
                    att.setRole(getString(ParameterInfoIndex.ROLE));
                    att.setSentBy(getString(ParameterInfoIndex.SENT_BY));
                    if (vpoll) {
                        att.setStayInformed(getBool(ParameterInfoIndex.STAY_INFORMED));
                    }
                } finally {
                    popFields();
                }
            }
            att.setAttendeeUri(getString(PropertyInfoIndex.URI));
            atts.add(att);
        } catch (final IndexException ie) {
            throw new CalFacadeException(ie);
        } finally {
            popFields();
        }
    }
    return atts;
}
Also used : PropertyInfoIndex(org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex) IndexException(org.bedework.util.indexing.IndexException) TreeSet(java.util.TreeSet) BwAttendee(org.bedework.calfacade.BwAttendee) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 14 with IndexException

use of org.bedework.util.indexing.IndexException in project bw-calendar-engine by Bedework.

the class EntityBuilder method getUids.

private Set<String> getUids(final List<Object> vals) throws CalFacadeException {
    if (Util.isEmpty(vals)) {
        return null;
    }
    final Set<String> uids = new TreeSet<>();
    for (final Object o : vals) {
        try {
            pushFields(o);
            final String uid = getString(PropertyInfoIndex.UID);
            uids.add(uid);
        } catch (final IndexException ie) {
            throw new CalFacadeException(ie);
        } finally {
            popFields();
        }
    }
    return uids;
}
Also used : IndexException(org.bedework.util.indexing.IndexException) TreeSet(java.util.TreeSet) BwString(org.bedework.calfacade.BwString) BwLongString(org.bedework.calfacade.BwLongString) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 15 with IndexException

use of org.bedework.util.indexing.IndexException in project bw-calendar-engine by Bedework.

the class DocBuilder method makeBwDateTimes.

private void makeBwDateTimes(final PropertyInfoIndex pi, final Set<BwDateTime> vals) throws CalFacadeException {
    try {
        if (Util.isEmpty(vals)) {
            return;
        }
        startArray(getJname(pi));
        for (final BwDateTime dt : vals) {
            indexDate(null, dt);
        }
        endArray();
    } catch (final IndexException e) {
        throw new CalFacadeException(e);
    }
}
Also used : BwDateTime(org.bedework.calfacade.BwDateTime) IndexException(org.bedework.util.indexing.IndexException) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Aggregations

CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)23 IndexException (org.bedework.util.indexing.IndexException)23 TreeSet (java.util.TreeSet)7 BwLongString (org.bedework.calfacade.BwLongString)5 BwString (org.bedework.calfacade.BwString)5 BwXproperty (org.bedework.calfacade.BwXproperty)3 BwAlarm (org.bedework.calfacade.BwAlarm)2 BwAttendee (org.bedework.calfacade.BwAttendee)2 BwDateTime (org.bedework.calfacade.BwDateTime)2 BwProperty (org.bedework.calfacade.BwProperty)2 BwStringBase (org.bedework.calfacade.base.BwStringBase)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Date (java.util.Date)1 BwCategory (org.bedework.calfacade.BwCategory)1 BwContact (org.bedework.calfacade.BwContact)1 BwLocation (org.bedework.calfacade.BwLocation)1 BwRequestStatus (org.bedework.calfacade.BwRequestStatus)1 PropertyInfoIndex (org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex)1