@Override public int hashCode() { int result = (int) (idCategorieStoc ^ (idCategorieStoc >>> 32)); result = 31 * result + (codCategorie != null ? codCategorie.hashCode() : 0); result = 31 * result + (numeCategorie != null ? numeCategorie.hashCode() : 0); result = 31 * result + (parent != null ? parent.hashCode() : 0); result = 31 * result + (children != null ? children.hashCode() : 0); return result; }
@PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_SUPERUSER')") @RequestMapping( value = "/addcategory", method = RequestMethod.POST, produces = "application/json") @ResponseBody public JSONResponseWithId addCategory(@RequestBody CategorieStoc categorieStoc) { JSONResponseWithId response = new JSONResponseWithId(); try { CategorieStoc categorie = inventoryService.saveCategorie(categorieStoc); response.setId(categorie.getIdCategorieStoc()); response.setMessage("S-a adăugat categoria: " + categorieStoc.getNumeCategorie()); } catch (DataAccessException e) { response.setId(-1); response.setMessage("Categoria nu s-a adăugat"); } return response; }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof CategorieStoc)) return false; CategorieStoc that = (CategorieStoc) o; if (idCategorieStoc != that.idCategorieStoc) return false; if (codCategorie != null ? !codCategorie.equals(that.codCategorie) : that.codCategorie != null) return false; if (numeCategorie != null ? !numeCategorie.equals(that.numeCategorie) : that.numeCategorie != null) return false; if (parent != null ? !parent.equals(that.parent) : that.parent != null) return false; return !(children != null ? !children.equals(that.children) : that.children != null); }