@RequestMapping(
     method = {RequestMethod.POST},
     value = "templates")
 public void novoFormulario(@RequestBody Template formulario)
     throws BussinessException, ValidationException {
   service.salvaTemplate(formulario);
 }
 @RequestMapping(
     method = {RequestMethod.PUT},
     value = "templates/{id}")
 public void atualizaFormulario(
     @RequestBody Template formulario, @PathVariable(value = "id") String id)
     throws BussinessException, ValidationException {
   service.atualizaTemplate(id, formulario);
 }
 @RequestMapping(
     method = {RequestMethod.GET},
     value = "templates/{id}/data")
 public DataVO buscaValores(@PathVariable(value = "id") String id)
     throws BussinessException, ValidationException, JsonParseException, JsonMappingException,
         IOException {
   return service.buscaDados(id);
 }
 @RequestMapping(
     method = {RequestMethod.POST},
     value = "templates/{id}/data")
 public void atualizaValores(
     @PathVariable(value = "id") String id, @RequestBody Map<String, Object> map)
     throws BussinessException, ValidationException, JsonParseException, JsonMappingException,
         IOException {
   service.atualizaDados(id, map);
 }
 @RequestMapping(
     method = {RequestMethod.GET},
     value = "templates/{id}")
 public TemplateDTO buscaFormularioById(@PathVariable(value = "id") String id)
     throws BussinessException {
   Template template = service.buscaTemplateById(id);
   TemplateDTO mappedObj = new TemplateDTO();
   mappedObj._id = template.getId();
   mappedObj.fields = template.getFields();
   mappedObj.title = template.getTitle();
   mappedObj.data = template.getData();
   return mappedObj;
 }
 @RequestMapping(
     method = {RequestMethod.GET},
     value = "templates")
 public TemplateDTO[] buscaFormulario() throws BussinessException, ValidationException {
   final Template[] template = service.buscaTemplates();
   final TemplateDTO[] returned = new TemplateDTO[template.length];
   for (int i = 0; i < returned.length; i++) {
     final TemplateDTO mappedObj = new TemplateDTO();
     returned[i] = mappedObj;
     mappedObj._id = template[i].getId();
     final Field[] fields = template[i].getFields();
     final FieldInfo[] infos = new FieldInfo[fields.length];
     mappedObj.fields = infos;
     for (int j = 0; j < fields.length; j++) {
       infos[j] = new FieldInfo();
       final Field field = new Field();
       field.setLabel(fields[j].getLabel());
       infos[j].label = field.getLabel();
     }
     mappedObj.title = template[i].getTitle();
     mappedObj.dataCount = template[i].getData().length;
   }
   return returned;
 }
 @RequestMapping(
     method = {RequestMethod.DELETE},
     value = "templates/{id}")
 public void excluir(@PathVariable(value = "id") String id) throws BussinessException {
   service.removeTemplate(id);
 }