use of org.openforis.collect.command.UpdateAttributeCommand in project collect by openforis.
the class CommandController method addOrUpdateAttributes.
@RequestMapping(value = "record/attributes", method = POST, consumes = APPLICATION_JSON_VALUE)
@Transactional
@ResponseBody
public List<RecordEventView> addOrUpdateAttributes(@RequestBody UpdateAttributesCommandWrapper commandsWrapper) {
List<RecordEvent> events = new ArrayList<RecordEvent>();
commandsWrapper.commands.forEach(c -> {
UpdateAttributeCommand command = c.toCommand();
events.addAll(commandDispatcher.submit(command));
});
return toView(events);
}
use of org.openforis.collect.command.UpdateAttributeCommand in project collect by openforis.
the class CommandController method updateAttribute.
@RequestMapping(value = "record/attribute", method = PATCH, consumes = APPLICATION_JSON_VALUE)
@Transactional
@ResponseBody
public List<RecordEventView> updateAttribute(@RequestBody UpdateAttributeCommandWrapper commandWrapper) {
UpdateAttributeCommand command = commandWrapper.toCommand();
List<RecordEvent> events = commandDispatcher.submit(command);
return toView(events);
}
Aggregations