class LdapGroupNameValidator implements ConstraintValidator<LdapGroupNameValidation, AcmGroup> {

    @Override
    public boolean isValid(AcmGroup acmGroup, ConstraintValidatorContext context)
    {

        if (acmGroup == null)
        {
            return false;
        }

        AcmGroupType groupType = acmGroup.getType();
        String groupName = acmGroup.getName();

        if (groupType == null)
        {
            return false;
        }

        if (groupType.equals(AcmGroupType.LDAP_GROUP))
        {
            if (groupName.length() > 64)
            {
                return false;
            }
        }
        return true;
    }

}