Search in sources :

Example 96 with CalFacadeException

use of org.bedework.calfacade.exc.CalFacadeException in project bw-calendar-engine by Bedework.

the class DocBuilder method makeDoc.

/* Return the docinfo for the indexer */
EsDocInfo makeDoc(final BwCalendar col) throws CalFacadeException {
    try {
        final long version = col.getMicrosecsVersion();
        startObject();
        makeShareableContained(col);
        makeField(PropertyInfoIndex.LAST_MODIFIED, col.getLastmod().getTimestamp());
        makeField(PropertyInfoIndex.CREATED, col.getCreated());
        // makeField(PropertyInfoIndex.VERSION, version);
        makeField(PropertyInfoIndex.NAME, col.getName());
        makeField(PropertyInfoIndex.HREF, col.getPath());
        makeField(PropertyInfoIndex.SUMMARY, col.getSummary());
        makeField(PropertyInfoIndex.DESCRIPTION, col.getDescription());
        makeField(PropertyInfoIndex.AFFECTS_FREE_BUSY, col.getAffectsFreeBusy());
        makeField(PropertyInfoIndex.ALIAS_URI, col.getAliasUri());
        makeField(PropertyInfoIndex.CALTYPE, col.getCalType());
        makeField(PropertyInfoIndex.DISPLAY, col.getDisplay());
        makeField(PropertyInfoIndex.FILTER_EXPR, col.getFilterExpr());
        makeField(PropertyInfoIndex.IGNORE_TRANSP, col.getIgnoreTransparency());
        makeField(PropertyInfoIndex.LAST_REFRESH, col.getLastRefresh());
        makeField(PropertyInfoIndex.LAST_REFRESH_STATUS, col.getLastRefreshStatus());
        makeField(PropertyInfoIndex.REFRESH_RATE, col.getRefreshRate());
        makeField(PropertyInfoIndex.REMOTE_ID, col.getRemoteId());
        makeField(PropertyInfoIndex.REMOTE_PW, col.getRemotePw());
        makeField(PropertyInfoIndex.UNREMOVEABLE, col.getUnremoveable());
        // mailListId
        indexProperties(col.getProperties());
        indexCategories(col.getCategories());
        endObject();
        return makeDocInfo(BwIndexer.docTypeCollection, version, col.getPath());
    } catch (final CalFacadeException cfe) {
        throw cfe;
    } catch (final Throwable t) {
        throw new CalFacadeException(t);
    }
}
Also used : CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 97 with CalFacadeException

use of org.bedework.calfacade.exc.CalFacadeException in project bw-calendar-engine by Bedework.

the class DocBuilder method indexGeo.

private void indexGeo(final BwGeo val) throws CalFacadeException {
    try {
        if (val == null) {
            return;
        }
        startObject(getJname(PropertyInfoIndex.GEO));
        makeField("lat", val.getLatitude().toPlainString());
        makeField("lon", val.getLongitude().toPlainString());
        endObject();
    } catch (final IndexException e) {
        throw new CalFacadeException(e);
    }
}
Also used : IndexException(org.bedework.util.indexing.IndexException) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 98 with CalFacadeException

use of org.bedework.calfacade.exc.CalFacadeException in project bw-calendar-engine by Bedework.

the class DocBuilder method makeDoc.

/* Return the docinfo for the indexer */
EsDocInfo makeDoc(final BwCategory ent) throws CalFacadeException {
    try {
        /* We don't have real collections. It's been the practice to
         create "/" delimited names to emulate a hierarchy. Look out
         for these and try to create a real path based on them.
       */
        ent.fixNames(basicSysprops, principal);
        startObject();
        makeShareableContained(ent);
        makeField(PropertyInfoIndex.NAME, ent.getName());
        makeField(PropertyInfoIndex.UID, ent.getUid());
        makeField(PropertyInfoIndex.HREF, ent.getHref());
        makeField(PropertyInfoIndex.CATEGORIES, ent.getWord());
        makeField(PropertyInfoIndex.DESCRIPTION, ent.getDescription());
        endObject();
        return makeDocInfo(BwIndexer.docTypeCategory, 0, ent.getHref());
    } catch (final CalFacadeException cfe) {
        throw cfe;
    } catch (final Throwable t) {
        throw new CalFacadeException(t);
    }
}
Also used : CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 99 with CalFacadeException

use of org.bedework.calfacade.exc.CalFacadeException in project bw-calendar-engine by Bedework.

the class DocBuilder method indexXprops.

private void indexXprops(final XpropsEntity ent) throws CalFacadeException {
    try {
        if (Util.isEmpty(ent.getXproperties())) {
            return;
        }
        /* First output ones we know about with our own name */
        for (final String nm : interestingXprops.keySet()) {
            final List<BwXproperty> props = ent.getXproperties(nm);
            if (Util.isEmpty(props)) {
                continue;
            }
            startArray(interestingXprops.get(nm));
            for (final BwXproperty xp : props) {
                if (xp.getName().equals(BwXproperty.bedeworkSuggestedTo)) {
                    final String val = xp.getValue();
                    // Find the second ":" delimiter
                    final int pos = val.indexOf(":", 2);
                    if (pos < 0) {
                        // Bad value
                        continue;
                    }
                    value(val.substring(0, pos));
                    continue;
                }
                String pars = xp.getPars();
                if (pars == null) {
                    pars = "";
                }
                value(pars + "\t" + xp.getValue());
            }
            endArray();
        }
        /* Now ones we don't know or care about */
        startArray(getJname(PropertyInfoIndex.XPROP));
        for (final BwXproperty xp : ent.getXproperties()) {
            final String nm = interestingXprops.get(xp.getName());
            if (nm != null) {
                continue;
            }
            startObject();
            makeField(PropertyInfoIndex.NAME, xp.getName());
            if (xp.getPars() != null) {
                makeField(getJname(PropertyInfoIndex.PARAMETERS), xp.getPars());
            }
            makeField(getJname(PropertyInfoIndex.VALUE), xp.getValue());
            endObject();
        }
        endArray();
    } catch (final IndexException e) {
        throw new CalFacadeException(e);
    }
}
Also used : IndexException(org.bedework.util.indexing.IndexException) BwXproperty(org.bedework.calfacade.BwXproperty) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 100 with CalFacadeException

use of org.bedework.calfacade.exc.CalFacadeException in project bw-calendar-engine by Bedework.

the class DocBuilder method indexProperties.

private void indexProperties(final Set<BwProperty> props) throws CalFacadeException {
    if (props == null) {
        return;
    }
    try {
        startArray(getJname(PropertyInfoIndex.COL_PROPERTIES));
        for (final BwProperty prop : props) {
            startObject();
            makeField(PropertyInfoIndex.NAME, prop.getName());
            makeField(PropertyInfoIndex.VALUE, prop.getValue());
            endObject();
        }
        endArray();
    } catch (final IndexException e) {
        throw new CalFacadeException(e);
    }
}
Also used : IndexException(org.bedework.util.indexing.IndexException) BwProperty(org.bedework.calfacade.BwProperty) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Aggregations

CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)298 BwCalendar (org.bedework.calfacade.BwCalendar)55 BwEvent (org.bedework.calfacade.BwEvent)55 EventInfo (org.bedework.calfacade.svc.EventInfo)37 WebdavException (org.bedework.webdav.servlet.shared.WebdavException)32 ArrayList (java.util.ArrayList)28 BwString (org.bedework.calfacade.BwString)26 BwDateTime (org.bedework.calfacade.BwDateTime)24 IndexException (org.bedework.util.indexing.IndexException)23 BwPrincipal (org.bedework.calfacade.BwPrincipal)22 TreeSet (java.util.TreeSet)19 BwAttendee (org.bedework.calfacade.BwAttendee)18 CalFacadeAccessException (org.bedework.calfacade.exc.CalFacadeAccessException)16 Calendar (net.fortuna.ical4j.model.Calendar)15 DateTime (net.fortuna.ical4j.model.DateTime)15 Period (net.fortuna.ical4j.model.Period)13 BwCategory (org.bedework.calfacade.BwCategory)13 StringReader (java.io.StringReader)12 CoreEventInfo (org.bedework.calcorei.CoreEventInfo)12 BwEventProxy (org.bedework.calfacade.BwEventProxy)12