Commit 43b69a11 authored by Noel Alonso's avatar Noel Alonso
Browse files

Añade componentes para clonar settings

parent 98591426
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -131,6 +131,13 @@ public class SettingsController {
		return new BodyItemDTO<SettingsDTO>(service.clear(id, dto));
	}

	@PutMapping(value = "/clone/{id}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
	@ResponseBody
	public SuperDTO clone(@PathVariable("id") String id) {

		return new BodyItemDTO<SettingsDTO>(service.clone(id, serviceName));
	}

	@PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
	@ResponseBody
	public SuperDTO save(@Valid @RequestBody PersistenceDTO dto, BindingResult errorDto, HttpServletRequest request) {
+5 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;

import es.redmic.commandslib.usersettings.commands.ClearCommand;
import es.redmic.commandslib.usersettings.commands.CloneSettingsCommand;
import es.redmic.commandslib.usersettings.commands.DeleteSettingsCommand;
import es.redmic.commandslib.usersettings.commands.DeselectCommand;
import es.redmic.commandslib.usersettings.commands.SaveSettingsCommand;
@@ -63,6 +64,10 @@ public class SettingsService {
		return commandHandler.clear(new ClearCommand(selection));
	}

	public SettingsDTO clone(String id, String serviceName) {
		return commandHandler.clone(new CloneSettingsCommand(id, serviceName));
	}

	public SettingsDTO create(PersistenceDTO persistence) {
		return commandHandler.save(new SaveSettingsCommand(persistence));
	}