public Optional findById()

in src/main/java/com/epam/digital/data/platform/restapi/core/queryhandler/AbstractQueryHandler.java [59:77]


  public Optional<O> findById(Request<I> input) {
    log.info("Reading from DB");

    validateAccess(input);

    I id = input.getPayload();
    try {
      final O dto =
          context
              .select(selectFields())
              .from(DSL.table(tableDataProvider.tableName()))
              .where(DSL.field(tableDataProvider.pkColumnName()).eq(id))
                  .and(getCommonCondition(input))
              .fetchOneInto(entityType());
      return Optional.ofNullable(dto);
    } catch (Exception e) {
      throw new SqlErrorException("Can not read from DB", e);
    }
  }