@Override public void attributeSet(ConfiguredObject object, String attributeName, Object oldAttributeValue, Object newAttributeValue) { if (object.isDurable() && !_bulkChanges) { _store.update(false, object.asObjectRecord()); } }
@Override public void bulkChangeEnd(final ConfiguredObject<?> object) { if (object.isDurable() && _bulkChanges) { _store.update(false, object.asObjectRecord()); } _bulkChanges = false; }
@Override public void stateChanged(ConfiguredObject object, State oldState, State newState) { if (newState == State.DELETED) { if(object.isDurable()) { _store.remove(object.asObjectRecord()); } object.removeChangeListener(this); } }
@Override public void childRemoved(ConfiguredObject object, ConfiguredObject child) { if (!object.managesChildStorage()) { if (child.isDurable()) { _store.remove(child.asObjectRecord()); } child.removeChangeListener(this); } }
@Override public void childAdded(ConfiguredObject<?> object, ConfiguredObject<?> child) { if (!object.managesChildStorage()) { if(object.isDurable() && child.isDurable()) { Model model = child.getModel(); Class<? extends ConfiguredObject> parentType = model.getParentType(child.getCategoryClass()); if(parentType.equals(object.getCategoryClass())) { child.addChangeListener(this); _store.update(true, child.asObjectRecord()); Class<? extends ConfiguredObject> categoryClass = child.getCategoryClass(); Collection<Class<? extends ConfiguredObject>> childTypes = model.getChildTypes(categoryClass); for (Class<? extends ConfiguredObject> childClass : childTypes) { for (ConfiguredObject<?> grandchild : child.getChildren(childClass)) { childAdded(child, grandchild); } } } } } }