@Override public void createState(State state) { String id = (String) state.get(KEY_ID); if (log.isTraceEnabled()) { log.trace("Mem: CREATE " + id + ": " + state); } if (states.containsKey(id)) { throw new NuxeoException("Already exists: " + id); } state = StateHelper.deepCopy(state, true); // thread-safe StateHelper.resetDeltas(state); states.put(id, state); }
/** * Changes the deltas stored into actual full values. * * @since 6.0 */ public static void resetDeltas(State state) { if (Boolean.parseBoolean(Framework.getProperty(DISABLED_DELTA_PROP, "false"))) { return; } for (Entry<String, Serializable> en : state.entrySet()) { Serializable value = en.getValue(); if (value instanceof State) { resetDeltas((State) value); } else if (value instanceof Delta) { state.put(en.getKey(), ((Delta) value).getFullValue()); } } }