Search in sources :

Example 16 with IndexException

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

the class DocBuilder method indexContacts.

private void indexContacts(final Set<BwContact> val) throws CalFacadeException {
    try {
        if (Util.isEmpty(val)) {
            return;
        }
        // Only index enough to retrieve the actual contact
        startArray(getJname(PropertyInfoIndex.CONTACT));
        for (final BwContact c : val) {
            c.fixNames(basicSysprops, principal);
            startObject();
            makeField(PropertyInfoIndex.HREF, c.getHref());
            makeField(PropertyInfoIndex.CN, c.getCn());
            makeField(ParameterInfoIndex.UID.getJname(), c.getUid());
            makeField(ParameterInfoIndex.ALTREP.getJname(), c.getLink());
            endObject();
        }
        endArray();
    } catch (final IndexException e) {
        throw new CalFacadeException(e);
    }
}
Also used : IndexException(org.bedework.util.indexing.IndexException) BwContact(org.bedework.calfacade.BwContact) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 17 with IndexException

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

the class DocBuilder method indexReqStat.

private void indexReqStat(final Set<BwRequestStatus> val) throws CalFacadeException {
    try {
        if (Util.isEmpty(val)) {
            return;
        }
        startArray(getJname(PropertyInfoIndex.REQUEST_STATUS));
        for (final BwRequestStatus rs : val) {
            value(rs.strVal());
        }
        endArray();
    } catch (final IndexException e) {
        throw new CalFacadeException(e);
    }
}
Also used : BwRequestStatus(org.bedework.calfacade.BwRequestStatus) IndexException(org.bedework.util.indexing.IndexException) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 18 with IndexException

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

the class DocBuilder method indexBwStrings.

private void indexBwStrings(final PropertyInfoIndex pi, final Set<? extends BwStringBase> val) throws CalFacadeException {
    try {
        if (Util.isEmpty(val)) {
            return;
        }
        startArray(getJname(pi));
        for (final BwStringBase s : val) {
            makeField((PropertyInfoIndex) null, s);
        }
        endArray();
    } catch (final IndexException e) {
        throw new CalFacadeException(e);
    }
}
Also used : IndexException(org.bedework.util.indexing.IndexException) BwStringBase(org.bedework.calfacade.base.BwStringBase) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 19 with IndexException

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

the class DocBuilder method makeLocKeys.

private void makeLocKeys(final List<BwLocation.KeyFld> vals) throws CalFacadeException {
    try {
        if (Util.isEmpty(vals)) {
            return;
        }
        startArray(getJname(PropertyInfoIndex.LOC_KEYS_FLD));
        for (final BwLocation.KeyFld kf : vals) {
            startObject();
            makeField(PropertyInfoIndex.NAME, kf.getKeyName());
            makeField(PropertyInfoIndex.VALUE, kf.getKeyVal());
            endObject();
        }
        endArray();
    } catch (final IndexException e) {
        throw new CalFacadeException(e);
    }
}
Also used : BwLocation(org.bedework.calfacade.BwLocation) IndexException(org.bedework.util.indexing.IndexException) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 20 with IndexException

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

the class EntityBuilder method restoreBwDateTimeSet.

private Set<BwDateTime> restoreBwDateTimeSet(final PropertyInfoIndex pi) throws CalFacadeException {
    final List<Object> vals = getFieldValues(pi);
    if (Util.isEmpty(vals)) {
        return null;
    }
    final Set<BwDateTime> tms = new TreeSet<>();
    for (final Object o : vals) {
        try {
            pushFields(o);
            final String date = getString(PropertyInfoIndex.LOCAL);
            final String utcDate = getString(PropertyInfoIndex.UTC);
            final String tzid = getString(PropertyInfoIndex.TZID);
            final boolean floating = getBool(PropertyInfoIndex.FLOATING);
            final boolean dateType = date.length() == 8;
            final BwDateTime tm = BwDateTime.makeBwDateTime(dateType, date, utcDate, tzid, floating);
            tms.add(tm);
        } catch (final IndexException ie) {
            throw new CalFacadeException(ie);
        } finally {
            popFields();
        }
    }
    return tms;
}
Also used : BwDateTime(org.bedework.calfacade.BwDateTime) 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)

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