org.jooq.types.ULong Java Examples

The following examples show how to use org.jooq.types.ULong. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GetPlacesGraph.java    From curiostack with MIT License 6 votes vote down vote up
@Produces
static ListenableFuture<List<Place>> fetchPlaces(
    S2LatLngRect viewport, DSLContext db, @ForDatabase ListeningExecutorService dbExecutor) {
  var coverer = new S2RegionCoverer();
  var coveredCells = coverer.getCovering(viewport);

  Condition locationCondition =
      DSL.or(
          Streams.stream(coveredCells)
              .map(
                  cell ->
                      PLACE
                          .S2_CELL
                          .ge(ULong.valueOf(cell.rangeMin().id()))
                          .and(PLACE.S2_CELL.le(ULong.valueOf(cell.rangeMax().id()))))
              .collect(toImmutableList()));

  return dbExecutor.submit(
      () -> db.selectFrom(PLACE).where(DSL.or(locationCondition)).fetchInto(Place.class));
}
 
Example #2
Source File: ListLandmarksGraph.java    From curiostack with MIT License 6 votes vote down vote up
@Produces
static ListenableFuture<List<List<Landmark>>> fetchDbLandmarks(
    S2CellUnion coveredCells, DSLContext db, @ForDatabase ListeningExecutorService dbExecutor) {
  return Futures.successfulAsList(
      Streams.stream(coveredCells)
          .map(
              cell ->
                  dbExecutor.submit(
                      () ->
                          db.selectFrom(LANDMARK)
                              .where(
                                  LANDMARK
                                      .S2_CELL
                                      .ge(ULong.valueOf(cell.rangeMin().id()))
                                      .and(
                                          LANDMARK.S2_CELL.le(
                                              ULong.valueOf(cell.rangeMax().id()))))
                              .fetchInto(Landmark.class)))
          .collect(toImmutableList()));
}
 
Example #3
Source File: Place.java    From curiostack with MIT License 6 votes vote down vote up
public Place(
    ULong         id,
    String        name,
    Double        latitude,
    Double        longitude,
    ULong         s2Cell,
    String        instagramId,
    String        googlePlaceId,
    LocalDateTime createdAt,
    LocalDateTime updatedAt
) {
    this.id = id;
    this.name = name;
    this.latitude = latitude;
    this.longitude = longitude;
    this.s2Cell = s2Cell;
    this.instagramId = instagramId;
    this.googlePlaceId = googlePlaceId;
    this.createdAt = createdAt;
    this.updatedAt = updatedAt;
}
 
Example #4
Source File: GenomeStatisticsRecord.java    From hmftools with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Create a detached, initialised GenomeStatisticsRecord
 */
public GenomeStatisticsRecord(UInteger genomeStatisticsId, String statistic, ULong value, UInteger speciesId, UInteger attribTypeId, Timestamp timestamp) {
    super(GenomeStatistics.GENOME_STATISTICS);

    set(0, genomeStatisticsId);
    set(1, statistic);
    set(2, value);
    set(3, speciesId);
    set(4, attribTypeId);
    set(5, timestamp);
}
 
Example #5
Source File: PlaceRecord.java    From curiostack with MIT License 5 votes vote down vote up
/**
 * Create a detached, initialised PlaceRecord
 */
public PlaceRecord(ULong id, String name, Double latitude, Double longitude, ULong s2Cell, String instagramId, String googlePlaceId, LocalDateTime createdAt, LocalDateTime updatedAt) {
    super(Place.PLACE);

    set(0, id);
    set(1, name);
    set(2, latitude);
    set(3, longitude);
    set(4, s2Cell);
    set(5, instagramId);
    set(6, googlePlaceId);
    set(7, createdAt);
    set(8, updatedAt);
}
 
Example #6
Source File: PlaceRecord.java    From curiostack with MIT License 5 votes vote down vote up
@Override
public PlaceRecord values(ULong value1, String value2, Double value3, Double value4, ULong value5, String value6, String value7, LocalDateTime value8, LocalDateTime value9) {
    value1(value1);
    value2(value2);
    value3(value3);
    value4(value4);
    value5(value5);
    value6(value6);
    value7(value7);
    value8(value8);
    value9(value9);
    return this;
}
 
Example #7
Source File: LandmarkRecord.java    From curiostack with MIT License 5 votes vote down vote up
@Override
public LandmarkRecord values(ULong value1, String value2, ULong value3, String value4, LocalDateTime value5, LocalDateTime value6) {
    value1(value1);
    value2(value2);
    value3(value3);
    value4(value4);
    value5(value5);
    value6(value6);
    return this;
}
 
Example #8
Source File: LandmarkRecord.java    From curiostack with MIT License 5 votes vote down vote up
/**
 * Create a detached, initialised LandmarkRecord
 */
public LandmarkRecord(ULong id, String googlePlaceId, ULong s2Cell, String type, LocalDateTime createdAt, LocalDateTime updatedAt) {
    super(Landmark.LANDMARK);

    set(0, id);
    set(1, googlePlaceId);
    set(2, s2Cell);
    set(3, type);
    set(4, createdAt);
    set(5, updatedAt);
}
 
Example #9
Source File: Landmark.java    From curiostack with MIT License 5 votes vote down vote up
public Landmark(
    ULong         id,
    String        googlePlaceId,
    ULong         s2Cell,
    String        type,
    LocalDateTime createdAt,
    LocalDateTime updatedAt
) {
    this.id = id;
    this.googlePlaceId = googlePlaceId;
    this.s2Cell = s2Cell;
    this.type = type;
    this.createdAt = createdAt;
    this.updatedAt = updatedAt;
}
 
Example #10
Source File: ListLandmarksGraph.java    From curiostack with MIT License 5 votes vote down vote up
@Produces
static ListenableFuture<List<Landmark>> writeNewLandmarksToDb(
    PlacesSearchResponse searchResponse,
    List<List<Landmark>> dbLandmarks,
    DSLContext cafemapdb,
    @ForDatabase ListeningExecutorService dbExecutor) {
  if (searchResponse.results.length == 0) {
    return immediateFuture(ImmutableList.of());
  }

  Set<String> dbPlaceIds =
      dbLandmarks.stream()
          .flatMap(List::stream)
          .map(Landmark::getGooglePlaceId)
          .collect(toImmutableSet());

  List<LandmarkRecord> newLandmarks =
      Arrays.stream(searchResponse.results)
          .filter(result -> !dbPlaceIds.contains(result.placeId))
          .map(
              result ->
                  new LandmarkRecord()
                      .setGooglePlaceId(result.placeId)
                      .setType("park")
                      .setS2Cell(
                          ULong.valueOf(
                              S2CellId.fromLatLng(
                                      S2Util.convertFromLatLng(result.geometry.location))
                                  .id())))
          .collect(toImmutableList());

  return dbExecutor.submit(
      () -> {
        int[] numInserted = cafemapdb.batchStore(newLandmarks).execute();
        return newLandmarks.stream().map(Landmark::new).collect(toImmutableList());
      });
}
 
Example #11
Source File: GetPlaceGraph.java    From curiostack with MIT License 5 votes vote down vote up
@Produces
static ListenableFuture<Place> fetchPlace(
    GetPlaceRequest request,
    DSLContext cafemapDb,
    @ForDatabase ListeningExecutorService dbExecutor) {
  return dbExecutor.submit(
      () ->
          cafemapDb
              .selectFrom(PLACE)
              .where(PLACE.ID.eq(ULong.valueOf(request.getId())))
              .fetchOneInto(Place.class));
}
 
Example #12
Source File: GenomeStatisticsRecord.java    From hmftools with GNU General Public License v3.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public GenomeStatisticsRecord values(UInteger value1, String value2, ULong value3, UInteger value4, UInteger value5, Timestamp value6) {
    value1(value1);
    value2(value2);
    value3(value3);
    value4(value4);
    value5(value5);
    value6(value6);
    return this;
}
 
Example #13
Source File: GenomeStatisticsRecord.java    From hmftools with GNU General Public License v3.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public ULong value3() {
    return getValue();
}
 
Example #14
Source File: GenomeStatisticsRecord.java    From hmftools with GNU General Public License v3.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Field<ULong> field3() {
    return GenomeStatistics.GENOME_STATISTICS.VALUE;
}
 
Example #15
Source File: GenomeStatisticsRecord.java    From hmftools with GNU General Public License v3.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Row6<UInteger, String, ULong, UInteger, UInteger, Timestamp> valuesRow() {
    return (Row6) super.valuesRow();
}
 
Example #16
Source File: PlaceDao.java    From curiostack with MIT License 4 votes vote down vote up
/**
 * Fetch records that have <code>id IN (values)</code>
 */
public List<org.curioswitch.database.cafemapdb.tables.pojos.Place> fetchById(ULong... values) {
    return fetch(Place.PLACE.ID, values);
}
 
Example #17
Source File: PlaceDao.java    From curiostack with MIT License 4 votes vote down vote up
/**
 * Fetch a unique record that has <code>id = value</code>
 */
public org.curioswitch.database.cafemapdb.tables.pojos.Place fetchOneById(ULong value) {
    return fetchOne(Place.PLACE.ID, value);
}
 
Example #18
Source File: PlaceDao.java    From curiostack with MIT License 4 votes vote down vote up
/**
 * Fetch records that have <code>s2_cell BETWEEN lowerInclusive AND upperInclusive</code>
 */
public List<org.curioswitch.database.cafemapdb.tables.pojos.Place> fetchRangeOfS2Cell(ULong lowerInclusive, ULong upperInclusive) {
    return fetchRange(Place.PLACE.S2_CELL, lowerInclusive, upperInclusive);
}
 
Example #19
Source File: LandmarkRecord.java    From curiostack with MIT License 4 votes vote down vote up
@Override
public LandmarkRecord value3(ULong value) {
    setS2Cell(value);
    return this;
}
 
Example #20
Source File: LandmarkRecord.java    From curiostack with MIT License 4 votes vote down vote up
@Override
public LandmarkRecord value1(ULong value) {
    setId(value);
    return this;
}
 
Example #21
Source File: LandmarkRecord.java    From curiostack with MIT License 4 votes vote down vote up
@Override
public ULong value3() {
    return getS2Cell();
}
 
Example #22
Source File: LandmarkRecord.java    From curiostack with MIT License 4 votes vote down vote up
@Override
public ULong value1() {
    return getId();
}
 
Example #23
Source File: LandmarkRecord.java    From curiostack with MIT License 4 votes vote down vote up
@Override
public ULong component3() {
    return getS2Cell();
}
 
Example #24
Source File: LandmarkRecord.java    From curiostack with MIT License 4 votes vote down vote up
@Override
public ULong component1() {
    return getId();
}
 
Example #25
Source File: LandmarkRecord.java    From curiostack with MIT License 4 votes vote down vote up
@Override
public Field<ULong> field3() {
    return Landmark.LANDMARK.S2_CELL;
}
 
Example #26
Source File: LandmarkRecord.java    From curiostack with MIT License 4 votes vote down vote up
@Override
public Field<ULong> field1() {
    return Landmark.LANDMARK.ID;
}
 
Example #27
Source File: LandmarkRecord.java    From curiostack with MIT License 4 votes vote down vote up
@Override
public Row6<ULong, String, ULong, String, LocalDateTime, LocalDateTime> valuesRow() {
    return (Row6) super.valuesRow();
}
 
Example #28
Source File: LandmarkDao.java    From curiostack with MIT License 4 votes vote down vote up
@Override
public ULong getId(org.curioswitch.database.cafemapdb.tables.pojos.Landmark object) {
    return object.getId();
}
 
Example #29
Source File: LandmarkRecord.java    From curiostack with MIT License 4 votes vote down vote up
@Override
public Record1<ULong> key() {
    return (Record1) super.key();
}
 
Example #30
Source File: Place.java    From curiostack with MIT License 4 votes vote down vote up
@Override
public ULong getId() {
    return this.id;
}