Search in sources :

Example 1 with IntPrincipalProperty

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

the class AbstractDirImpl method mergePreferences.

@Override
public boolean mergePreferences(final BwPreferences prefs, final BwPrincipalInfo pinfo) throws CalFacadeException {
    boolean changed = false;
    // PrincipalProperty kind = pinfo.findProperty("kind");
    /* ============ auto scheduling ================== */
    final BooleanPrincipalProperty pautoSched = (BooleanPrincipalProperty) pinfo.findProperty("auto-schedule");
    if ((pautoSched != null) && (pautoSched.getVal() != prefs.getScheduleAutoRespond())) {
        prefs.setScheduleAutoRespond(pautoSched.getVal());
        if (pautoSched.getVal()) {
            // Ensure we delete cancelled
            prefs.setScheduleAutoCancelAction(BwPreferences.scheduleAutoCancelDelete);
        }
        changed = true;
    }
    final IntPrincipalProperty pschedMaxInstances = (IntPrincipalProperty) pinfo.findProperty("max-instances");
    if (pschedMaxInstances != null) {
        int mi = pschedMaxInstances.getVal();
        String strMi = String.valueOf(mi);
        BwProperty pmi = prefs.findProperty(BwPreferences.propertyScheduleMaxinstances);
        if (pmi == null) {
            prefs.addProperty(new BwProperty(BwPreferences.propertyScheduleMaxinstances, strMi));
        } else if (!pmi.getValue().equals(strMi)) {
            pmi.setValue(strMi);
        }
        changed = true;
    }
    return changed;
}
Also used : BooleanPrincipalProperty(org.bedework.calfacade.BwPrincipalInfo.BooleanPrincipalProperty) IntPrincipalProperty(org.bedework.calfacade.BwPrincipalInfo.IntPrincipalProperty) BwProperty(org.bedework.calfacade.BwProperty)

Aggregations

BooleanPrincipalProperty (org.bedework.calfacade.BwPrincipalInfo.BooleanPrincipalProperty)1 IntPrincipalProperty (org.bedework.calfacade.BwPrincipalInfo.IntPrincipalProperty)1 BwProperty (org.bedework.calfacade.BwProperty)1