v2/googlecloud-to-googlecloud/src/main/java/com/google/cloud/teleport/v2/utils/FirestoreConverters.java [906:934]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public PCollectionTuple expand(PCollection<Entity> entities) {
      return entities.apply(
          "DetectInvalidEntities",
          ParDo.of(
                  new DoFn<Entity, Entity>() {
                    private EntityJsonPrinter entityJsonPrinter;

                    @Setup
                    public void setup() {
                      entityJsonPrinter = new EntityJsonPrinter();
                    }

                    @ProcessElement
                    public void processElement(ProcessContext c) throws IOException {
                      Entity entity = c.element();
                      if (entity.hasKey()) {
                        c.output(entity);
                      } else {
                        ErrorMessage errorMessage =
                            ErrorMessage.newBuilder()
                                .setMessage("Datastore Entity Without Key")
                                .setData(entityJsonPrinter.print(entity))
                                .build();
                        c.output(failureTag(), errorMessage.toJson());
                      }
                    }
                  })
              .withOutputTags(successTag(), TupleTagList.of(failureTag())));
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



v1/src/main/java/com/google/cloud/teleport/templates/common/DatastoreConverters.java [889:917]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public PCollectionTuple expand(PCollection<Entity> entities) {
      return entities.apply(
          "DetectInvalidEntities",
          ParDo.of(
                  new DoFn<Entity, Entity>() {
                    private EntityJsonPrinter entityJsonPrinter;

                    @Setup
                    public void setup() {
                      entityJsonPrinter = new EntityJsonPrinter();
                    }

                    @ProcessElement
                    public void processElement(ProcessContext c) throws IOException {
                      Entity entity = c.element();
                      if (entity.hasKey()) {
                        c.output(entity);
                      } else {
                        ErrorMessage errorMessage =
                            ErrorMessage.newBuilder()
                                .setMessage("Datastore Entity Without Key")
                                .setData(entityJsonPrinter.print(entity))
                                .build();
                        c.output(failureTag(), errorMessage.toJson());
                      }
                    }
                  })
              .withOutputTags(successTag(), TupleTagList.of(failureTag())));
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



