code: private boolean hasAttributeThatReferences(EntityType candidate, String entityTypeId) {
      Iterable<Attribute> attributes = candidate.getOwnAtomicAttributes();
      return stream(attributes)
          .filter(Attribute::hasRefEntity)
          .map(attribute -> attribute.getRefEntity().getId())
          .anyMatch(entityTypeId::equals);
    }
docs: Determines if an entityType has an attribute that references another entity
  
  @param candidate the EntityType that is examined
  @param entityTypeId the ID of the entity that may be referenced
  @return indication if candidate references entityTypeID