예제 #1
0
 public String insertVS(VirtualStorage vs, int idCreador) {
   Usuario creador = udao.buscarID(idCreador);
   if (creador == null) {
     return "500-Error-Sin_Usuario";
   }
   if (searchVSByName(vs.getName()) == null) {
     return "501-Error-Ya existe AV";
   } else {
     vs.setOwner(creador);
     em.persist(vs);
     em.flush();
     return vs.getName();
   }
 }
예제 #2
0
 public String createVS(VirtualStorage vs, int ownerId) {
   try {
     Usuario owner = udao.buscarID(ownerId);
     if (owner != null) {
       vs.setOwner(owner);
       vs.setCreatedDate(new Date());
       em.persist(vs);
       em.flush();
       return String.valueOf(vs.getId());
     }
     return "500-Error-no_existe_usuario";
   } catch (Exception ex) {
     return "500-Error-" + ex.getMessage();
   }
 }