/** * @param nameSMD : le Nom de SMD qui a envoyer la requete * @param newVersion : la nouvelle versions (le cas de MAJ) * @return "SMD Not Found" : si le SMD n'existe pas "Version Updated" : sinon */ @POST @Path("setVersion") public String setVersion( @FormParam("nameSMD") String nameSMD, @FormParam("newVersion") String newVersion) { OperationInformationResources.logger.log( Level.INFO, "Version with (SMD = " + nameSMD + ", newVersion = " + newVersion + ")"); Session connect = HibernateUtil.getSessionFactory().openSession(); SiteSMD smd = SiteSMD.findByName(connect, nameSMD); String result = "SMD Not Found"; if (smd != null) { String lst[] = newVersion.split("-"); if (lst.length == 2) { smd.setVersion_code(lst[0]); smd.setVersion_system(lst[1]); connect.beginTransaction(); connect.saveOrUpdate(smd); connect.getTransaction().commit(); result = "Version Updated"; } else { result = "Version Envoyer Incorrect"; } } connect.close(); OperationInformationResources.logger.log(Level.FINEST, "Returned Value " + result); return result; }