// Set id field to be unique
form.getField("id").addValidator(new Validator() {
public void validate(Object value) throws InvalidValueException {
if (!isValid(value)) {
throw new InvalidValueException(i18nManager.getMessage(Messages.GROUP_ID_UNIQUE));
}
}
public boolean isValid(Object value) {
if (value != null) {
return identityService.createGroupQuery().groupId(value.toString()).singleResult() == null;