}
}
@Override
public Memento save(ResourceSetCollector resourceSetCollector) {
Memento memento = new Memento();
for (Entry<Slot, ViewItemValueResolver> entry : slotsToValueResolvers
.entrySet()) {
Slot slot = entry.getKey();
ViewItemValueResolver resolver = entry.getValue();
Memento child = new Memento();
if (resolver instanceof FirstResourcePropertyResolver) {
child.setValue(MEMENTO_KEY_TYPE,
MEMENTO_VALUE_FIRST_RESOURCE_PROPERTY);
child.setValue(MEMENTO_KEY_PROPERTY,
((FirstResourcePropertyResolver) resolver)
.getProperty());
} else if (resolver instanceof CalculationResolver) {
child.setValue(MEMENTO_KEY_TYPE, MEMENTO_VALUE_CALCULATION);
Calculation calculation = ((CalculationResolver) resolver)
.getCalculation();
child.setValue(MEMENTO_KEY_PROPERTY,
((CalculationResolver) resolver).getProperty());
if (calculation instanceof SumCalculation) {
child.setValue(MEMENTO_KEY_CALCULATION_TYPE, "sum");
} else if (calculation instanceof AverageCalculation) {
child.setValue(MEMENTO_KEY_CALCULATION_TYPE, "average");
} else if (calculation instanceof MinCalculation) {
child.setValue(MEMENTO_KEY_CALCULATION_TYPE, "min");
} else if (calculation instanceof MaxCalculation) {
child.setValue(MEMENTO_KEY_CALCULATION_TYPE, "max");
}
} else if (resolver instanceof Persistable) {
child = ((Persistable) resolver).save(resourceSetCollector);
}