public AjoutRessource( String path, String menu, String managedBean, String description, String idmere) throws SQLException, ErrorException { this.path = path; this.menu = menu; this.managedBean = managedBean; this.description = description; this.idmere = idmere; this.ressource = moduleGlobal.getRessourceByPath(this.path); if (this.ressource != null) { throw new ErrorException("Path deja existant."); } this.ressource = moduleGlobal.getRessourceByMenu(this.menu); if (this.ressource != null) { throw new ErrorException("Menu deja existant."); } if (this.menu.length() < 3) { throw new ErrorException("Menu trop court."); } if (this.path.length() < 3) { throw new ErrorException("Path trop court."); } if (this.managedBean.length() == 0) { throw new ErrorException("Bean manquant."); } if (this.idmere != null) { this.ressource = moduleGlobal.getRessourceByMenu(this.idmere); this.ressource_ressource = moduleGlobal.getRessource_Ressource(new Ressource_Ressource(this.ressource)); if (this.ressource_ressource != null) { Ressource _newRessource = moduleGlobal.createRessourceWithRR( new Ressource(this.path, this.menu, this.managedBean, this.description)); moduleGlobal.updateidRR(_newRessource, this.ressource_ressource); } else { Ressource _newRessource = moduleGlobal.createRessourceWithRR( new Ressource( this.path, this.menu, this.managedBean, this.description, this.ressource)); Ressource_Ressource _newRessource_Ressource = moduleGlobal.createRessource_Ressource(this.ressource.getIdressource()); moduleGlobal.updateidRR(_newRessource, _newRessource_Ressource); } } else { moduleGlobal.createRessource( new Ressource(this.path, this.menu, this.managedBean, this.description)); } }
public class EditUserPW { private ServiceUserRight moduleGlobal = ServiceUserRight.getInstance(); private int id; private String pw1; private String pw2; public EditUserPW(int id, String pw1, String pw2) throws ErrorException, SQLException { this.id = id; this.pw1 = pw1; this.pw2 = pw2; int _error = 0; if ((this.pw1.length() < 3)) { _error++; throw new ErrorException("Password trop court"); } if (!(this.pw1.equals(this.pw2))) { _error++; throw new ErrorException("Password different"); } if (_error == 0) { User _user = new User(this.id, this.pw1); this.moduleGlobal.updateUserPassword(_user); } } }