コード例 #1
0
 @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;
 }
コード例 #2
0
 @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;
 }