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

com.avaje.ebeaninternal.server.query.CQueryHistorySupport Maven / Gradle / Ivy

There is a newer version: 9.5.1
Show newest version
package com.avaje.ebeaninternal.server.query;

import com.avaje.ebean.config.dbplatform.DbHistorySupport;

import java.util.Map;

/**
 * Helper to support history functions.
 */
class CQueryHistorySupport {

  /**
   * The DB specific support.
   */
  private final DbHistorySupport dbHistorySupport;

  /**
   * The mapping of base tables to their matching 'with history' views.
   */
  private final Map asOfTableMap;

  /**
   * The sys period column.
   */
  private final String sysPeriod;

  CQueryHistorySupport(DbHistorySupport dbHistorySupport, Map asOfTableMap, String sysPeriod) {
    this.dbHistorySupport = dbHistorySupport;
    this.asOfTableMap = asOfTableMap;
    this.sysPeriod = sysPeriod;
  }

  /**
   * Return true if the underlying history support is standards based.
   */
  boolean isStandardsBased() {
    return dbHistorySupport.isStandardsBased();
  }

  /**
   * Return the 'as of' history view for the given base table.
   */
  String getAsOfView(String table) {
    return asOfTableMap.get(table);
  }

  /**
   * Return the lower bound column.
   */
  String getSysPeriodLower(String tableAlias) {
    return dbHistorySupport.getSysPeriodLower(tableAlias, sysPeriod);
  }

  /**
   * Return the upper bound column.
   */
  String getSysPeriodUpper(String tableAlias) {
    return dbHistorySupport.getSysPeriodUpper(tableAlias, sysPeriod);
  }

  /**
   * Return the predicate appended to the end of the query.
   *
   * Note used for Oracle total recall etc with the more standard approach.
   */
  String getAsOfPredicate(String tableAlias) {
    return dbHistorySupport.getAsOfPredicate(tableAlias, sysPeriod);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy