Search in sources :

Example 1 with XBedeworkExsynchEndtzidPropType

use of ietf.params.xml.ns.icalendar_2.XBedeworkExsynchEndtzidPropType in project bw-calendar-engine by Bedework.

the class Xutil method xpropertiesToXcal.

/**
 * @param pl
 * @param xprops
 * @param pattern
 * @param masterClass
 * @param wrapXprops wrap x-properties in bedework object - allows
 *                   us to push them through soap
 * @throws Throwable
 */
@SuppressWarnings("deprecation")
public static void xpropertiesToXcal(final List<JAXBElement<? extends BasePropertyType>> pl, final List<BwXproperty> xprops, final BaseComponentType pattern, final Class masterClass, final boolean wrapXprops) throws Throwable {
    for (final BwXproperty x : xprops) {
        // Skip any timezone we saved in the event.
        final String xname = x.getName();
        final String val = x.getValue();
        if (xname.startsWith(BwXproperty.bedeworkTimezonePrefix)) {
            continue;
        }
        if (xname.equals(BwXproperty.bedeworkExsynchEndtzid)) {
            if (!emit(pattern, masterClass, XBedeworkExsynchEndtzidPropType.class)) {
                continue;
            }
            final XBedeworkExsynchEndtzidPropType p = new XBedeworkExsynchEndtzidPropType();
            p.setText(val);
            pl.add(of.createXBedeworkExsynchEndtzid(p));
            continue;
        }
        if (xname.equals(BwXproperty.bedeworkExsynchLastmod)) {
            if (!emit(pattern, masterClass, XBedeworkExsynchLastmodPropType.class)) {
                continue;
            }
            final XBedeworkExsynchLastmodPropType p = new XBedeworkExsynchLastmodPropType();
            p.setText(val);
            pl.add(of.createXBedeworkExsynchLastmod(p));
            continue;
        }
        if (xname.equals(BwXproperty.bedeworkExsynchOrganizer)) {
            continue;
        }
        if (xname.equals(BwXproperty.bedeworkExsynchStarttzid)) {
            if (!emit(pattern, masterClass, XBedeworkExsynchStarttzidPropType.class)) {
                continue;
            }
            final XBedeworkExsynchStarttzidPropType p = new XBedeworkExsynchStarttzidPropType();
            p.setText(val);
            pl.add(of.createXBedeworkExsynchStarttzid(p));
            continue;
        }
        if (xname.equals(BwXproperty.bedeworkEventRegStart)) {
            if (!emit(pattern, masterClass, XBedeworkRegistrationStartPropType.class)) {
                continue;
            }
            final XBedeworkRegistrationStartPropType p = new XBedeworkRegistrationStartPropType();
            String tzid = null;
            for (final Xpar xp : x.getParameters()) {
                if (xp.getName().equalsIgnoreCase("TZID")) {
                    tzid = xp.getValue();
                    break;
                }
            }
            XcalUtil.initDt(p, val, tzid);
            pl.add(of.createXBedeworkRegistrationStart(p));
            continue;
        }
        if (xname.equals(BwXproperty.bedeworkEventRegEnd)) {
            if (!emit(pattern, masterClass, XBedeworkRegistrationEndPropType.class)) {
                continue;
            }
            final XBedeworkRegistrationEndPropType p = new XBedeworkRegistrationEndPropType();
            String tzid = null;
            for (final Xpar xp : x.getParameters()) {
                if (xp.getName().equalsIgnoreCase("TZID")) {
                    tzid = xp.getValue();
                    break;
                }
            }
            XcalUtil.initDt(p, val, tzid);
            pl.add(of.createXBedeworkRegistrationEnd(p));
            continue;
        }
        if (xname.equals(BwXproperty.bedeworkEventRegMaxTickets)) {
            if (!emit(pattern, masterClass, XBedeworkMaxTicketsPropType.class)) {
                continue;
            }
            final XBedeworkMaxTicketsPropType p = new XBedeworkMaxTicketsPropType();
            p.setInteger(BigInteger.valueOf(Long.valueOf(val)));
            pl.add(of.createXBedeworkMaxTickets(p));
            continue;
        }
        if (xname.equals(BwXproperty.bedeworkEventRegMaxTicketsPerUser)) {
            if (!emit(pattern, masterClass, XBedeworkMaxTicketsPerUserPropType.class)) {
                continue;
            }
            final XBedeworkMaxTicketsPerUserPropType p = new XBedeworkMaxTicketsPerUserPropType();
            p.setInteger(BigInteger.valueOf(Long.valueOf(val)));
            pl.add(of.createXBedeworkMaxTicketsPerUser(p));
            continue;
        }
        if (xname.equals(BwXproperty.bedeworkEventRegWaitListLimit)) {
            if (!emit(pattern, masterClass, XBedeworkWaitListLimitPropType.class)) {
                continue;
            }
            final XBedeworkWaitListLimitPropType p = new XBedeworkWaitListLimitPropType();
            p.setText(val);
            pl.add(of.createXBedeworkWaitListLimit(p));
            continue;
        }
        if (xname.equals(BwXproperty.xBedeworkCategories)) {
            if (!emit(pattern, masterClass, XBwCategoriesPropType.class)) {
                continue;
            }
            final XBwCategoriesPropType p = new XBwCategoriesPropType();
            p.getText().add(val);
            pl.add(of.createXBedeworkCategories(p));
            continue;
        }
        if (xname.equals(BwXproperty.xBedeworkContact)) {
            if (!emit(pattern, masterClass, XBwContactPropType.class)) {
                continue;
            }
            final XBwContactPropType p = new XBwContactPropType();
            p.setText(val);
            pl.add(of.createXBedeworkContact(p));
            continue;
        }
        if (xname.equals(BwXproperty.xBedeworkLocation)) {
            if (!emit(pattern, masterClass, XBwLocationPropType.class)) {
                continue;
            }
            final XBwLocationPropType p = new XBwLocationPropType();
            p.setText(val);
            pl.add(of.createXBedeworkLocation(p));
            continue;
        }
        if (!wrapXprops) {
            if (getLog().isDebugEnabled()) {
                warn("Not handing x-property " + xname);
            }
            continue;
        }
        final XBedeworkWrapperPropType wrapper = new XBedeworkWrapperPropType();
        if (x.getParameters() != null) {
            for (final Xpar xp : x.getParameters()) {
                xparam(wrapper, xp);
            }
        }
        final XBedeworkWrappedNameParamType wnp = new XBedeworkWrappedNameParamType();
        wnp.setText(x.getName());
        if (wrapper.getParameters() == null) {
            wrapper.setParameters(new ArrayOfParameters());
        }
        wrapper.getParameters().getBaseParameter().add(of.createXBedeworkWrappedName(wnp));
        wrapper.setText(val);
        pl.add(of.createXBedeworkWrapper(wrapper));
    }
}
Also used : Xpar(org.bedework.calfacade.BwXproperty.Xpar) XBedeworkRegistrationEndPropType(ietf.params.xml.ns.icalendar_2.XBedeworkRegistrationEndPropType) XBwContactPropType(ietf.params.xml.ns.icalendar_2.XBwContactPropType) XBwCategoriesPropType(ietf.params.xml.ns.icalendar_2.XBwCategoriesPropType) XBedeworkExsynchStarttzidPropType(ietf.params.xml.ns.icalendar_2.XBedeworkExsynchStarttzidPropType) ArrayOfParameters(ietf.params.xml.ns.icalendar_2.ArrayOfParameters) XBedeworkMaxTicketsPropType(ietf.params.xml.ns.icalendar_2.XBedeworkMaxTicketsPropType) XBedeworkWaitListLimitPropType(ietf.params.xml.ns.icalendar_2.XBedeworkWaitListLimitPropType) XBedeworkExsynchEndtzidPropType(ietf.params.xml.ns.icalendar_2.XBedeworkExsynchEndtzidPropType) XBedeworkExsynchLastmodPropType(ietf.params.xml.ns.icalendar_2.XBedeworkExsynchLastmodPropType) XBwLocationPropType(ietf.params.xml.ns.icalendar_2.XBwLocationPropType) BwXproperty(org.bedework.calfacade.BwXproperty) XBedeworkMaxTicketsPerUserPropType(ietf.params.xml.ns.icalendar_2.XBedeworkMaxTicketsPerUserPropType) XBedeworkWrapperPropType(ietf.params.xml.ns.icalendar_2.XBedeworkWrapperPropType) XBedeworkRegistrationStartPropType(ietf.params.xml.ns.icalendar_2.XBedeworkRegistrationStartPropType) XBedeworkWrappedNameParamType(ietf.params.xml.ns.icalendar_2.XBedeworkWrappedNameParamType)

Aggregations

ArrayOfParameters (ietf.params.xml.ns.icalendar_2.ArrayOfParameters)1 XBedeworkExsynchEndtzidPropType (ietf.params.xml.ns.icalendar_2.XBedeworkExsynchEndtzidPropType)1 XBedeworkExsynchLastmodPropType (ietf.params.xml.ns.icalendar_2.XBedeworkExsynchLastmodPropType)1 XBedeworkExsynchStarttzidPropType (ietf.params.xml.ns.icalendar_2.XBedeworkExsynchStarttzidPropType)1 XBedeworkMaxTicketsPerUserPropType (ietf.params.xml.ns.icalendar_2.XBedeworkMaxTicketsPerUserPropType)1 XBedeworkMaxTicketsPropType (ietf.params.xml.ns.icalendar_2.XBedeworkMaxTicketsPropType)1 XBedeworkRegistrationEndPropType (ietf.params.xml.ns.icalendar_2.XBedeworkRegistrationEndPropType)1 XBedeworkRegistrationStartPropType (ietf.params.xml.ns.icalendar_2.XBedeworkRegistrationStartPropType)1 XBedeworkWaitListLimitPropType (ietf.params.xml.ns.icalendar_2.XBedeworkWaitListLimitPropType)1 XBedeworkWrappedNameParamType (ietf.params.xml.ns.icalendar_2.XBedeworkWrappedNameParamType)1 XBedeworkWrapperPropType (ietf.params.xml.ns.icalendar_2.XBedeworkWrapperPropType)1 XBwCategoriesPropType (ietf.params.xml.ns.icalendar_2.XBwCategoriesPropType)1 XBwContactPropType (ietf.params.xml.ns.icalendar_2.XBwContactPropType)1 XBwLocationPropType (ietf.params.xml.ns.icalendar_2.XBwLocationPropType)1 BwXproperty (org.bedework.calfacade.BwXproperty)1 Xpar (org.bedework.calfacade.BwXproperty.Xpar)1