Commit 8bb9f91d authored by Roberto Loayza's avatar Roberto Loayza

GoalService

parent 16c9203a
...@@ -43,7 +43,7 @@ public class GoalService extends XDFService<Goal, Map, Long> { ...@@ -43,7 +43,7 @@ public class GoalService extends XDFService<Goal, Map, Long> {
model = new Goal(); model = new Goal();
} }
model.setId((Long) map.get("id")); model.setId((Long) map.get("id"));
model.setIdentifier(String.valueOf(map.get("ident"))); model.setIdentifier(String.valueOf(map.get("identifier")));
model.setAgenId((Long) map.get("agentId")); model.setAgenId((Long) map.get("agentId"));
return model; return model;
} }
...@@ -52,7 +52,7 @@ public class GoalService extends XDFService<Goal, Map, Long> { ...@@ -52,7 +52,7 @@ public class GoalService extends XDFService<Goal, Map, Long> {
protected Map toBean(Goal model) { protected Map toBean(Goal model) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("id",model.getId()); map.put("id",model.getId());
map.put("ident", model.getIdentifier()); map.put("identifier", model.getIdentifier());
map.put("agentId", model.getAgenId()); map.put("agentId", model.getAgenId());
return map; return map;
} }
...@@ -72,13 +72,13 @@ public class GoalService extends XDFService<Goal, Map, Long> { ...@@ -72,13 +72,13 @@ public class GoalService extends XDFService<Goal, Map, Long> {
throw new NotFoundException("Debe poseer minimo un action."); throw new NotFoundException("Debe poseer minimo un action.");
} }
Long agenId = Long.valueOf(body.get("AgentId").toString()); Long agenId = Long.valueOf(body.get("agentId").toString());
if (!agentRepository.existsById(agenId)) { if (!agentRepository.existsById(agenId)) {
throw new NotFoundException("Agente no registrado."); throw new NotFoundException("Agente no registrado.");
} }
String ident = body.get("Ident").toString(); String ident = body.get("identifier").toString();
Optional<Goal> goalOptional= goalRepository.findByAgentAndIdent(agenId, ident); Optional<Goal> goalOptional= goalRepository.findByAgentAndIdent(agenId, ident);
if (goalOptional.isPresent()) { if (goalOptional.isPresent()) {
...@@ -120,8 +120,8 @@ public class GoalService extends XDFService<Goal, Map, Long> { ...@@ -120,8 +120,8 @@ public class GoalService extends XDFService<Goal, Map, Long> {
throw new NotFoundException("Debe poseer minimo un action."); throw new NotFoundException("Debe poseer minimo un action.");
} }
Long agenId = Long.valueOf(body.get("AgentId").toString()); Long agenId = Long.valueOf(body.get("agentId").toString());
String ident = body.get("Ident").toString(); String ident = body.get("identifier").toString();
if (!agentRepository.existsById(agenId)) { if (!agentRepository.existsById(agenId)) {
throw new NotFoundException("Agente no registrado."); throw new NotFoundException("Agente no registrado.");
...@@ -161,8 +161,8 @@ public class GoalService extends XDFService<Goal, Map, Long> { ...@@ -161,8 +161,8 @@ public class GoalService extends XDFService<Goal, Map, Long> {
} }
result.put("id", goal.get().getId()); result.put("id", goal.get().getId());
result.put("AgentId", goal.get().getAgenId()); result.put("agentId", goal.get().getAgenId());
result.put("Ident", goal.get().getIdentifier()); result.put("identifier", goal.get().getIdentifier());
result.put("actionList", listAction); result.put("actionList", listAction);
return result; return result;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment