Search in sources :

Example 1 with FormulaKey

use of pcgen.cdom.enumeration.FormulaKey in project pcgen by PCGen.

the class AbstractObjectContext method commit.

void commit() {
    ObjectCommitStrategy commit = getCommitStrategy();
    for (URI uri : edits.preClearSet.getKeySet()) {
        for (ConcretePrereqObject cpo : edits.preClearSet.getListFor(uri)) {
            commit.clearPrerequisiteList(cpo);
        }
    }
    for (URI uri : edits.globalClearSet.getKeySet()) {
        for (CDOMObject cdo : edits.globalClearSet.getSecondaryKeySet(uri)) {
            for (ListKey<?> lk : edits.globalClearSet.getListFor(uri, cdo)) {
                commit.removeList(cdo, lk);
            }
        }
    }
    for (URI uri : edits.negativeMap.getKeySet()) {
        for (ConcretePrereqObject cpo : edits.negativeMap.getSecondaryKeySet(uri)) {
            if (cpo instanceof CDOMObject) {
                CDOMObject cdo = (CDOMObject) cpo;
                CDOMObject neg = edits.negativeMap.get(uri, cdo);
                for (ObjectKey<?> ok : neg.getSafeListFor(ListKey.REMOVED_OBJECTKEY)) {
                    commit.remove(cdo, ok);
                }
                for (FactKey<?> ok : neg.getSafeListFor(ListKey.REMOVED_FACTKEY)) {
                    commit.remove(cdo, ok);
                }
                for (StringKey sk : neg.getSafeListFor(ListKey.REMOVED_STRINGKEY)) {
                    commit.remove(cdo, sk);
                }
                for (IntegerKey ik : neg.getSafeListFor(ListKey.REMOVED_INTEGERKEY)) {
                    commit.remove(cdo, ik);
                }
                for (FactSetKey<?> key : neg.getFactSetKeys()) {
                    removeFactSetKey(cdo, key, neg);
                }
                for (ListKey<?> key : neg.getListKeys()) {
                    removeListKey(cdo, key, neg);
                }
                for (MapKey<?, ?> key1 : neg.getMapKeys()) {
                    removeMapKey(cdo, key1, neg);
                }
            }
        }
    }
    for (URI uri : edits.positiveMap.getKeySet()) {
        for (ConcretePrereqObject cpo : edits.positiveMap.getSecondaryKeySet(uri)) {
            CDOMObject pos = edits.positiveMap.get(uri, cpo);
            for (Prerequisite p : pos.getPrerequisiteList()) {
                commit.put(cpo, p);
            }
            if (cpo instanceof CDOMObject) {
                CDOMObject cdo = (CDOMObject) cpo;
                for (StringKey key : pos.getStringKeys()) {
                    commit.put(cdo, key, pos.get(key));
                }
                for (IntegerKey key : pos.getIntegerKeys()) {
                    commit.put(cdo, key, pos.get(key));
                }
                for (FormulaKey key : pos.getFormulaKeys()) {
                    commit.put(cdo, key, pos.get(key));
                }
                for (VariableKey key : pos.getVariableKeys()) {
                    commit.put(cdo, key, pos.get(key));
                }
                for (ObjectKey<?> key : pos.getObjectKeys()) {
                    putObjectKey(cdo, key, pos);
                }
                for (FactKey<?> key : pos.getFactKeys()) {
                    putFactKey(cdo, key, pos);
                }
                for (ListKey<?> key : pos.getListKeys()) {
                    putListKey(cdo, key, pos);
                }
                for (FactSetKey<?> key : pos.getFactSetKeys()) {
                    putFactSetKey(cdo, key, pos);
                }
                for (MapKey<?, ?> key1 : pos.getMapKeys()) {
                    putMapKey(cdo, key1, pos);
                }
            /*
					 * No need to deal with ListMods because that's done in
					 * listContext
					 */
            /*
					 * TODO Deal with cloned objects
					 */
            }
        }
    }
    for (URI uri : edits.patternClearSet.getKeySet()) {
        for (CDOMObject cdo : edits.patternClearSet.getSecondaryKeySet(uri)) {
            for (ListKey<?> lk : edits.patternClearSet.getTertiaryKeySet(uri, cdo)) {
                for (String s : edits.patternClearSet.getListFor(uri, cdo, lk)) {
                    commit.removePatternFromList(cdo, lk, s);
                }
            }
        }
    }
    rollback();
}
Also used : ConcretePrereqObject(pcgen.cdom.base.ConcretePrereqObject) StringKey(pcgen.cdom.enumeration.StringKey) URI(java.net.URI) FormulaKey(pcgen.cdom.enumeration.FormulaKey) CDOMObject(pcgen.cdom.base.CDOMObject) VariableKey(pcgen.cdom.enumeration.VariableKey) IntegerKey(pcgen.cdom.enumeration.IntegerKey) Prerequisite(pcgen.core.prereq.Prerequisite)

Aggregations

URI (java.net.URI)1 CDOMObject (pcgen.cdom.base.CDOMObject)1 ConcretePrereqObject (pcgen.cdom.base.ConcretePrereqObject)1 FormulaKey (pcgen.cdom.enumeration.FormulaKey)1 IntegerKey (pcgen.cdom.enumeration.IntegerKey)1 StringKey (pcgen.cdom.enumeration.StringKey)1 VariableKey (pcgen.cdom.enumeration.VariableKey)1 Prerequisite (pcgen.core.prereq.Prerequisite)1