@Test
  public void testProjectDMOAnnotationAttributes2() throws Exception {
    final ProjectDataModelOracleBuilder builder =
        ProjectDataModelOracleBuilder.newProjectOracleBuilder();
    final ProjectDataModelOracleImpl oracle = new ProjectDataModelOracleImpl();

    final ClassFactBuilder cb =
        new ClassFactBuilder(builder, RoleSmurf.class, false, TypeSource.JAVA_PROJECT);
    cb.build(oracle);

    assertEquals(1, oracle.getProjectModelFields().size());
    assertContains(
        "org.kie.workbench.common.services.datamodel.backend.server.testclasses.annotations.RoleSmurf",
        oracle.getProjectModelFields().keySet());

    final Set<Annotation> annotations =
        oracle
            .getProjectTypeAnnotations()
            .get(
                "org.kie.workbench.common.services.datamodel.backend.server.testclasses.annotations.RoleSmurf");
    assertNotNull(annotations);
    assertEquals(1, annotations.size());

    final Annotation annotation = annotations.iterator().next();
    assertEquals("org.kie.api.definition.type.Role", annotation.getQualifiedTypeName());
    assertEquals(Role.Type.EVENT.name(), annotation.getAttributes().get("value"));
  }
  @Override
  public <T> void validateField(
      final String factType,
      final String fieldName,
      final T value,
      final Callback<Set<ConstraintViolation<T>>> callback) {
    if (factType == null || factType.isEmpty()) {
      callback.callback(Collections.emptySet());
      return;
    }
    if (fieldName == null || fieldName.isEmpty()) {
      callback.callback(Collections.emptySet());
      return;
    }
    if (callback == null) {
      return;
    }

    if (validatorInstance.isUnsatisfied()) {
      callback.callback(Collections.emptySet());
      return;

    } else if (validator == null) {
      validator = validatorInstance.get();
    }

    getTypeFieldsAnnotations(
        factType,
        (Map<String, Set<Annotation>> result) -> {
          final Set<ConstraintViolation<T>> violations = new HashSet<>();
          final Set<Annotation> fieldAnnotations = result.get(fieldName);
          if (fieldAnnotations == null || fieldAnnotations.isEmpty()) {
            callback.callback(violations);
            return;
          }

          for (Annotation fieldAnnotation : fieldAnnotations) {
            final Map<String, Object> fieldAnnotationAttributes = fieldAnnotation.getParameters();
            violations.addAll(
                validator.validate(
                    fieldAnnotation.getQualifiedTypeName(), fieldAnnotationAttributes, value));
          }
          callback.callback(violations);
        });
  }