Search in sources :

Example 11 with NoDump

use of org.bedework.calfacade.annotations.NoDump in project bw-calendar-engine by Bedework.

the class BwPreferences method getCalsuiteApproversList.

/**
 * @return List from approvers.
 */
@NoDump
public List<String> getCalsuiteApproversList() {
    final List<String> approvers = new ArrayList<>();
    final String s = getProp(propertyCalsuiteApprovers);
    if (s == null) {
        return approvers;
    }
    final String[] split = s.split(",");
    for (final String el : split) {
        if (el == null) {
            continue;
        }
        approvers.add(el);
    }
    return approvers;
}
Also used : ArrayList(java.util.ArrayList) ToString(org.bedework.util.misc.ToString) NoDump(org.bedework.calfacade.annotations.NoDump)

Example 12 with NoDump

use of org.bedework.calfacade.annotations.NoDump in project bw-calendar-engine by Bedework.

the class BwEvent method getTimeZoneIds.

/**
 * Return all timezone ids this event uses. This is used when an event is
 * added by another user to ensure that the target user has a copy of user
 * specific timezones.
 *
 * @return Set of timezone ids.
 * @throws CalFacadeException
 */
@NoProxy
@NoDump
public Set<String> getTimeZoneIds() throws CalFacadeException {
    Set<String> ids = new TreeSet<String>();
    BwDateTime dt = getDtstart();
    if ((dt != null) && (dt.getTzid() != null)) {
        ids.add(dt.getTzid());
    }
    dt = getDtend();
    if ((dt != null) && (dt.getTzid() != null)) {
        ids.add(dt.getTzid());
    }
    Set<BwDateTime> dts = getRdates();
    if (dts != null) {
        for (BwDateTime rdt : dts) {
            if (rdt.getTzid() != null) {
                ids.add(rdt.getTzid());
            }
        }
    }
    dts = getExdates();
    if (dts != null) {
        for (BwDateTime rdt : dts) {
            if (rdt.getTzid() != null) {
                ids.add(rdt.getTzid());
            }
        }
    }
    List<BwFreeBusyComponent> fbcs = getFreeBusyPeriods();
    if (fbcs != null) {
        for (BwFreeBusyComponent fbc : fbcs) {
            for (Period p : fbc.getPeriods()) {
                DateTime fdt = p.getStart();
                if (fdt.getTimeZone() != null) {
                    ids.add(fdt.getTimeZone().getID());
                }
                fdt = p.getEnd();
                if (fdt.getTimeZone() != null) {
                    ids.add(fdt.getTimeZone().getID());
                }
            }
        }
    }
    return ids;
}
Also used : TreeSet(java.util.TreeSet) Period(net.fortuna.ical4j.model.Period) ToString(org.bedework.util.misc.ToString) DateTime(net.fortuna.ical4j.model.DateTime) NoProxy(org.bedework.calfacade.annotations.ical.NoProxy) NoDump(org.bedework.calfacade.annotations.NoDump)

Example 13 with NoDump

use of org.bedework.calfacade.annotations.NoDump in project bw-calendar-engine by Bedework.

the class BwResourceContent method getStringContent.

/**
 * @return String value
 * @throws CalFacadeException
 */
@NoDump
public String getStringContent() throws CalFacadeException {
    try {
        final Blob b = getValue();
        if (b == null) {
            return null;
        }
        int len = -1;
        final int chunkSize = 1024;
        final byte[] buffer = new byte[chunkSize];
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        final InputStream str = b.getBinaryStream();
        while ((len = str.read(buffer)) != -1) {
            baos.write(buffer, 0, len);
        }
        return new String(baos.toByteArray());
    } catch (final Throwable t) {
        throw new CalFacadeException(t);
    }
}
Also used : Blob(java.sql.Blob) InputStream(java.io.InputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ToString(org.bedework.util.misc.ToString) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException) NoDump(org.bedework.calfacade.annotations.NoDump)

Example 14 with NoDump

use of org.bedework.calfacade.annotations.NoDump in project bw-calendar-engine by Bedework.

the class BwString method getRestoreCallback.

@NoDump
public static FromXmlCallback getRestoreCallback() {
    if (fromXmlCb == null) {
        fromXmlCb = new FromXmlCallback();
        fromXmlCb.addSkips("byteSize", "id", "seq", "size");
    }
    return fromXmlCb;
}
Also used : FromXmlCallback(org.bedework.util.xml.FromXmlCallback) NoDump(org.bedework.calfacade.annotations.NoDump)

Example 15 with NoDump

use of org.bedework.calfacade.annotations.NoDump in project bw-calendar-engine by Bedework.

the class BwCalendar method getSupportedComponents.

/**
 * @return the supported components
 */
@NoDump
public List<String> getSupportedComponents() {
    if (supportedComponents == null) {
        supportedComponents = new ArrayList<>();
        final int ctype = getCalType();
        if (ctype == calTypePoll) {
            supportedComponents.add("VPOLL");
            return supportedComponents;
        }
        if (ctype == calTypeTasks) {
            supportedComponents.add("VTODO");
            return supportedComponents;
        }
        if (ctype == calTypeInbox) {
            supportedComponents.add("VPOLL");
            supportedComponents.add("VEVENT");
            supportedComponents.add("VTODO");
            supportedComponents.add("VAVAILABILITY");
            return supportedComponents;
        }
        if ((ctype != calTypeCalendarCollection) && (ctype != calTypeOutbox) && (ctype != calTypeExtSub)) {
            return supportedComponents;
        }
        final String slist = getQproperty(CaldavTags.supportedCalendarComponentSet);
        if (slist == null) {
            supportedComponents.add("VEVENT");
        // supportedComponents.add("VTODO");
        // supportedComponents.add("VAVAILABILITY");
        } else {
            final String[] ss = slist.split(",");
            supportedComponents.addAll(Arrays.asList(ss));
        }
    }
    return supportedComponents;
}
Also used : ToString(org.bedework.util.misc.ToString) NoDump(org.bedework.calfacade.annotations.NoDump)

Aggregations

NoDump (org.bedework.calfacade.annotations.NoDump)21 ToString (org.bedework.util.misc.ToString)8 FromXmlCallback (org.bedework.util.xml.FromXmlCallback)7 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)5 TreeSet (java.util.TreeSet)4 ArrayList (java.util.ArrayList)3 NoProxy (org.bedework.calfacade.annotations.ical.NoProxy)3 Method (java.lang.reflect.Method)2 QName (javax.xml.namespace.QName)2 Dur (net.fortuna.ical4j.model.Dur)2 Xpar (org.bedework.calfacade.BwXproperty.Xpar)2 Dump (org.bedework.calfacade.annotations.Dump)2 NoWrap (org.bedework.calfacade.annotations.NoWrap)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 Blob (java.sql.Blob)1 Timestamp (java.sql.Timestamp)1 Date (java.util.Date)1 DateTime (net.fortuna.ical4j.model.DateTime)1 Period (net.fortuna.ical4j.model.Period)1