@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;
  }
Beispiel #2
0
 public static <T> void show(String title, Stream<T> stream) {
   final int SIZE = 10;
   List<T> firstElements = stream.limit(SIZE + 1).collect(Collectors.toList());
   System.out.print(title + ": ");
   if (firstElements.size() <= SIZE) System.out.println(firstElements);
   else {
     firstElements.remove(SIZE);
     String out = firstElements.toString();
     System.out.println(out.substring(0, out.length() - 1) + ", ...]");
   }
 }
Beispiel #3
0
    public void requestExamples() {
      // #ws-holder
      WSRequest request = ws.url("http://example.com");
      // #ws-holder

      // #ws-complex-holder
      WSRequest complexRequest =
          request
              .setHeader("headerKey", "headerValue")
              .setRequestTimeout(1000)
              .setQueryParameter("paramKey", "paramValue");
      // #ws-complex-holder

      // #ws-get
      CompletionStage<WSResponse> responsePromise = complexRequest.get();
      // #ws-get

      String url = "http://example.com";
      // #ws-auth
      ws.url(url).setAuth("user", "password", WSAuthScheme.BASIC).get();
      // #ws-auth

      // #ws-follow-redirects
      ws.url(url).setFollowRedirects(true).get();
      // #ws-follow-redirects

      // #ws-query-parameter
      ws.url(url).setQueryParameter("paramKey", "paramValue");
      // #ws-query-parameter

      // #ws-header
      ws.url(url).setHeader("headerKey", "headerValue").get();
      // #ws-header

      String jsonString = "{\"key1\":\"value1\"}";
      // #ws-header-content-type
      ws.url(url).setHeader("Content-Type", "application/json").post(jsonString);
      // OR
      ws.url(url).setContentType("application/json").post(jsonString);
      // #ws-header-content-type

      // #ws-timeout
      ws.url(url).setRequestTimeout(1000).get();
      // #ws-timeout

      // #ws-post-form-data
      ws.url(url)
          .setContentType("application/x-www-form-urlencoded")
          .post("key1=value1&key2=value2");
      // #ws-post-form-data

      // #ws-post-json
      JsonNode json = Json.newObject().put("key1", "value1").put("key2", "value2");

      ws.url(url).post(json);
      // #ws-post-json

      String value =
          IntStream.range(0, 100).boxed().map(i -> "abcdefghij").reduce("", (a, b) -> a + b);
      ByteString seedValue = ByteString.fromString(value);
      Stream<ByteString> largeSource = IntStream.range(0, 10).boxed().map(i -> seedValue);
      Source<ByteString, ?> largeImage = Source.from(largeSource.collect(Collectors.toList()));
      // #ws-stream-request
      CompletionStage<WSResponse> wsResponse = ws.url(url).setBody(largeImage).execute("PUT");
      // #ws-stream-request
    }
Beispiel #4
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;
  }