public void validateUserStoryName(FacesContext context, UIComponent validate, Object value) throws ValidatorException { if (userStoryService.checkExistUserStory( Utils.standardizeString(value.toString()), getProjectId()) != null) { @SuppressWarnings("static-access") FacesMessage msg = new FacesMessage(utils.getMessage("myagile.backlog.Exists", null)); throw new ValidatorException(msg); } if (utils.isExistTooLongWord(value.toString())) { @SuppressWarnings("static-access") FacesMessage msg = new FacesMessage(utils.getMessage("myagile.backlog.LongestLength", null)); throw new ValidatorException(msg); } }
public void validateUserStoryWhenEdit(FacesContext context, UIInput validate, Object value) throws ValidatorException { final Long userStoryId = this.userStory.getUserStoryId(); final UserStory currentUserStory = this.userStoryService.findUserStoryById(userStoryId); final UserStory newUserStory = this.userStoryService.checkExistUserStory( Utils.standardizeString(value.toString()), this.userStory.getProject().getProjectId()); if ((newUserStory != null) && !(currentUserStory.getName().equals(Utils.standardizeString(value.toString())))) { @SuppressWarnings("static-access") FacesMessage msg = new FacesMessage(utils.getMessage("myagile.backlog.Exists", null)); throw new ValidatorException(msg); } if (utils.isExistTooLongWord(value.toString())) { @SuppressWarnings("static-access") FacesMessage msg = new FacesMessage(utils.getMessage("myagile.backlog.LongestLength", null)); throw new ValidatorException(msg); } }