Exemplo n.º 1
1
  @SuppressWarnings("unchecked")
  public ResidentConverter(List<ObjectConverter.ColumnInfo> allColumns) throws java.io.IOException {
    Optional<ObjectConverter.ColumnInfo> column;

    final java.util.List<ObjectConverter.ColumnInfo> columns =
        allColumns
            .stream()
            .filter(
                it ->
                    "mixinReference".equals(it.typeSchema) && "Resident_entity".equals(it.typeName))
            .collect(Collectors.toList());
    columnCount = columns.size();

    readers = new ObjectConverter.Reader[columnCount];
    for (int i = 0; i < readers.length; i++) {
      readers[i] = (instance, rdr, ctx) -> StringConverter.skip(rdr, ctx);
    }

    final java.util.List<ObjectConverter.ColumnInfo> columnsExtended =
        allColumns
            .stream()
            .filter(
                it ->
                    "mixinReference".equals(it.typeSchema)
                        && "-ngs_Resident_type-".equals(it.typeName))
            .collect(Collectors.toList());
    columnCountExtended = columnsExtended.size();

    readersExtended = new ObjectConverter.Reader[columnCountExtended];
    for (int i = 0; i < readersExtended.length; i++) {
      readersExtended[i] = (instance, rdr, ctx) -> StringConverter.skip(rdr, ctx);
    }

    column = columns.stream().filter(it -> "id".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'id' column in mixinReference Resident_entity. Check if DB is in sync");
    __index___id = (int) column.get().order - 1;

    column = columnsExtended.stream().filter(it -> "id".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'id' column in mixinReference Resident. Check if DB is in sync");
    __index__extended_id = (int) column.get().order - 1;

    column = columns.stream().filter(it -> "birth".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'birth' column in mixinReference Resident_entity. Check if DB is in sync");
    __index___birth = (int) column.get().order - 1;

    column = columnsExtended.stream().filter(it -> "birth".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'birth' column in mixinReference Resident. Check if DB is in sync");
    __index__extended_birth = (int) column.get().order - 1;
  }
Exemplo n.º 2
0
  @SuppressWarnings("unchecked")
  public Detail2Converter(List<ObjectConverter.ColumnInfo> allColumns) throws java.io.IOException {
    Optional<ObjectConverter.ColumnInfo> column;

    final java.util.List<ObjectConverter.ColumnInfo> columns =
        allColumns
            .stream()
            .filter(it -> "test".equals(it.typeSchema) && "Detail2_entity".equals(it.typeName))
            .collect(Collectors.toList());
    columnCount = columns.size();

    readers = new ObjectConverter.Reader[columnCount];
    for (int i = 0; i < readers.length; i++) {
      readers[i] =
          (instance, rdr, ctx) -> {
            StringConverter.skip(rdr, ctx);
            return instance;
          };
    }

    final java.util.List<ObjectConverter.ColumnInfo> columnsExtended =
        allColumns
            .stream()
            .filter(it -> "test".equals(it.typeSchema) && "-ngs_Detail2_type-".equals(it.typeName))
            .collect(Collectors.toList());
    columnCountExtended = columnsExtended.size();

    readersExtended = new ObjectConverter.Reader[columnCountExtended];
    for (int i = 0; i < readersExtended.length; i++) {
      readersExtended[i] =
          (instance, rdr, ctx) -> {
            StringConverter.skip(rdr, ctx);
            return instance;
          };
    }

    column = columns.stream().filter(it -> "u".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'u' column in test Detail2_entity. Check if DB is in sync");
    __index___u = (int) column.get().order - 1;

    column = columnsExtended.stream().filter(it -> "u".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'u' column in test Detail2. Check if DB is in sync");
    __index__extended_u = (int) column.get().order - 1;

    column = columns.stream().filter(it -> "dd".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'dd' column in test Detail2_entity. Check if DB is in sync");
    __index___dd = (int) column.get().order - 1;

    column = columnsExtended.stream().filter(it -> "dd".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'dd' column in test Detail2. Check if DB is in sync");
    __index__extended_dd = (int) column.get().order - 1;

    column = columns.stream().filter(it -> "EntityCompositeid".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'EntityCompositeid' column in test Detail2_entity. Check if DB is in sync");
    __index___EntityCompositeid = (int) column.get().order - 1;

    column =
        columnsExtended.stream().filter(it -> "EntityCompositeid".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'EntityCompositeid' column in test Detail2. Check if DB is in sync");
    __index__extended_EntityCompositeid = (int) column.get().order - 1;

    column = columns.stream().filter(it -> "EntityIndex".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'EntityIndex' column in test Detail2_entity. Check if DB is in sync");
    __index___EntityIndex = (int) column.get().order - 1;

    column = columnsExtended.stream().filter(it -> "EntityIndex".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'EntityIndex' column in test Detail2. Check if DB is in sync");
    __index__extended_EntityIndex = (int) column.get().order - 1;

    column = columns.stream().filter(it -> "Index".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'Index' column in test Detail2_entity. Check if DB is in sync");
    __index___Index = (int) column.get().order - 1;

    column = columnsExtended.stream().filter(it -> "Index".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'Index' column in test Detail2. Check if DB is in sync");
    __index__extended_Index = (int) column.get().order - 1;
  }