Search in sources :

Example 6 with BwProperty

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

the class EntityBuilder method restoreProperties.

private void restoreProperties(final BwCalendar col) throws CalFacadeException {
    final Collection<Object> vals = getFieldValues(PropertyInfoIndex.COL_PROPERTIES);
    if (Util.isEmpty(vals)) {
        return;
    }
    final Set<BwProperty> props = new TreeSet<>();
    for (final Object o : vals) {
        try {
            pushFields(o);
            final String name = getString(PropertyInfoIndex.NAME);
            final String val = getString(PropertyInfoIndex.VALUE);
            props.add(new BwProperty(name, val));
        } catch (final IndexException ie) {
            throw new CalFacadeException(ie);
        } finally {
            popFields();
        }
    }
    col.setProperties(props);
}
Also used : IndexException(org.bedework.util.indexing.IndexException) TreeSet(java.util.TreeSet) BwString(org.bedework.calfacade.BwString) BwLongString(org.bedework.calfacade.BwLongString) BwProperty(org.bedework.calfacade.BwProperty) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 7 with BwProperty

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

the class PropertiesRule method end.

@Override
@SuppressWarnings("unchecked")
public void end(final String ns, final String name) throws Exception {
    if (name.equals("properties")) {
        /* Top should be the collection
       */
        Set<BwProperty> ps = (Set<BwProperty>) pop();
        PropertiesEntity pe = (PropertiesEntity) top();
        pe.setProperties(ps);
        return;
    }
    /* Top should be a BwProperty to add to the collection */
    BwProperty p = (BwProperty) pop();
    Collection<BwProperty> ps = (Collection<BwProperty>) top();
    ps.add(p);
}
Also used : PropertiesEntity(org.bedework.calfacade.base.PropertiesEntity) Set(java.util.Set) TreeSet(java.util.TreeSet) Collection(java.util.Collection) BwProperty(org.bedework.calfacade.BwProperty)

Example 8 with BwProperty

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

the class BwPreferences method getProps.

/**
 * @return String values.
 */
@NoDump
private Set<String> getProps(final String name) {
    final Set<BwProperty> props = getProperties(name);
    final Set<String> vals = new TreeSet<>();
    if (props == null) {
        return vals;
    }
    for (final BwProperty p : props) {
        vals.add(p.getValue());
    }
    return vals;
}
Also used : TreeSet(java.util.TreeSet) ToString(org.bedework.util.misc.ToString) BwProperty(org.bedework.calfacade.BwProperty) NoDump(org.bedework.calfacade.annotations.NoDump)

Aggregations

BwProperty (org.bedework.calfacade.BwProperty)8 TreeSet (java.util.TreeSet)3 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)2 IndexException (org.bedework.util.indexing.IndexException)2 ToString (org.bedework.util.misc.ToString)2 Collection (java.util.Collection)1 Set (java.util.Set)1 BwLongString (org.bedework.calfacade.BwLongString)1 BooleanPrincipalProperty (org.bedework.calfacade.BwPrincipalInfo.BooleanPrincipalProperty)1 IntPrincipalProperty (org.bedework.calfacade.BwPrincipalInfo.IntPrincipalProperty)1 BwString (org.bedework.calfacade.BwString)1 NoDump (org.bedework.calfacade.annotations.NoDump)1 PropertiesEntity (org.bedework.calfacade.base.PropertiesEntity)1