All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.molgenis.api.data.v2.EntityCollectionResponseV2 Maven / Gradle / Ivy

There is a newer version: 8.4.5
Show newest version
package org.molgenis.api.data.v2;

import static java.util.Objects.requireNonNull;

import java.util.List;
import java.util.Map;
import org.molgenis.api.data.v1.EntityPager;
import org.molgenis.data.DataService;
import org.molgenis.data.Fetch;
import org.molgenis.data.meta.model.EntityType;
import org.molgenis.security.core.UserPermissionEvaluator;

class EntityCollectionResponseV2 {
  private final String href;
  private final EntityTypeResponseV2 meta;
  private final Integer start;
  private final Integer num;
  private final Long total;
  private final String prevHref;
  private final String nextHref;
  private final List> items;

  public EntityCollectionResponseV2(String href) {
    this.href = requireNonNull(href);
    this.meta = null;
    this.start = null;
    this.num = null;
    this.total = null;
    this.prevHref = null;
    this.nextHref = null;
    this.items = null;
  }

  public EntityCollectionResponseV2(
      EntityPager entityPager,
      List> items,
      Fetch fetch,
      String href,
      EntityType meta,
      UserPermissionEvaluator permissionService,
      DataService dataService,
      String prevHref,
      String nextHref,
      boolean includeCategories) {
    this.href = href;
    this.meta =
        new EntityTypeResponseV2(meta, fetch, permissionService, dataService, includeCategories);
    this.start = entityPager.getStart();
    this.num = entityPager.getNum();
    this.total = entityPager.getTotal();
    this.prevHref = prevHref;
    this.nextHref = nextHref;
    this.items = items;
  }

  public String getHref() {
    return href;
  }

  public EntityTypeResponseV2 getMeta() {
    return meta;
  }

  public int getStart() {
    return start;
  }

  public int getNum() {
    return num;
  }

  public long getTotal() {
    return total;
  }

  public String getPrevHref() {
    return prevHref;
  }

  public String getNextHref() {
    return nextHref;
  }

  public List> getItems() {
    return items;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy