code: String getResourceIdOrThrow(CMAResource resource, String param) {
      final String resourceId = resource.getId();
      if (resourceId == null) {
        throw new IllegalArgumentException(String.format(
            "%s.setId() was not called.", param));
      }
      return resourceId;
    }
docs: Extracts the resource ID from the given {@code resource} of name {@code param}.
  Throws {@link IllegalArgumentException} if the value is not present.