src/main/java/org/beigesoft/replicator/filter/FilterPersistableBaseImmutable.java
@Override
  public final String makeFilter(final Class<?> pEntityClass,
    final Map<String, Object> pAddParam) throws Exception {
    if (!APersistableBase.class.isAssignableFrom(pEntityClass)) {
      throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
        "This class not descendant of APersistableBase: "
          + pEntityClass);
    }
    int requestedDatabaseId;
    try {
      requestedDatabaseId = Integer.parseInt(pAddParam
        .get("requestedDatabaseId").toString());
    } catch (Exception e) {
      throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
        "Wrong or missing parameter requestedDatabaseId (in pAddParam): "
          + pAddParam.get("requestedDatabaseId"));
    }
    String queryMaxIdBirth = "select max(IDBIRTH) as MAX_IDBIRTH from "
    + pEntityClass.getSimpleName().toUpperCase() + " where IDDATABASEBIRTH="
      + requestedDatabaseId + ";";
    Long maxIdBirth = this.srvDatabase
      .evalLongResult(queryMaxIdBirth, "MAX_IDBIRTH");
    if (maxIdBirth == null) {
      maxIdBirth = 0L;
    }
    String tblNm = pEntityClass.getSimpleName().toUpperCase();
    return "(" + tblNm + ".ITSID>" + maxIdBirth + " and " + tblNm
      + ".IDDATABASEBIRTH=" + requestedDatabaseId + ")";
  }
@Override
  public final String makeFilter(final Class<?> pEntityClass,
    final Map<String, Object> pAddParam) throws Exception {
    if (!APersistableBase.class.isAssignableFrom(pEntityClass)) {
      throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
        "This class not descendant of APersistableBase: "
          + pEntityClass);
    }
    int requestedDatabaseId;
    try {
      requestedDatabaseId = Integer.parseInt(pAddParam
        .get("requestedDatabaseId").toString());
    } catch (Exception e) {
      throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
        "Wrong or missing parameter requestedDatabaseId (in pAddParam): "
          + pAddParam.get("requestedDatabaseId"));
    }
    String queryMaxIdBirth = "select max(IDBIRTH) as MAX_IDBIRTH from "
    + pEntityClass.getSimpleName().toUpperCase() + " where IDDATABASEBIRTH="
      + requestedDatabaseId + ";";
    Long maxIdBirth = this.srvDatabase
      .evalLongResult(queryMaxIdBirth, "MAX_IDBIRTH");
    if (maxIdBirth == null) {
      maxIdBirth = 0L;
    }
    String tblNm = pEntityClass.getSimpleName().toUpperCase();
    return "(" + tblNm + ".ITSID>" + maxIdBirth + " and " + tblNm
      + ".IDDATABASEBIRTH=" + requestedDatabaseId + ")";
  }
@ Override public final String makeFilter ( final Class < ? > pEntityClass , final Map < String , Object > pAddParam ) throws Exception { if ( ! APersistableBase . class . isAssignableFrom ( pEntityClass ) ) { throw new ExceptionWithCode ( ExceptionWithCode . CONFIGURATION_MISTAKE , "This class not descendant of APersistableBase: " + pEntityClass ) ; } int requestedDatabaseId ; try { requestedDatabaseId = Integer . parseInt ( pAddParam . get ( "requestedDatabaseId" ) . toString ( ) ) ; } catch ( Exception e ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "Wrong or missing parameter requestedDatabaseId (in pAddParam): " + pAddParam . get ( "requestedDatabaseId" ) ) ; } String queryMaxIdBirth = "select max(IDBIRTH) as MAX_IDBIRTH from " + pEntityClass . getSimpleName ( ) . toUpperCase ( ) + " where IDDATABASEBIRTH=" + requestedDatabaseId + ";" ; Long maxIdBirth = this . srvDatabase . evalLongResult ( queryMaxIdBirth , "MAX_IDBIRTH" ) ; if ( maxIdBirth == null ) { maxIdBirth = 0L ; } String tblNm = pEntityClass . getSimpleName ( ) . toUpperCase ( ) ; return "(" + tblNm + ".ITSID>" + maxIdBirth + " and " + tblNm + ".IDDATABASEBIRTH=" + requestedDatabaseId + ")" ; }
<p>
Filter for immutable entities of type APersistableBase.
</p>
@param pEntityClass Entity Class
@param pAddParam additional params (must present requestedDatabaseId
of String type (WEB parameter))
@return filter e.g. "(ITSID>0 and IDDATABASEBIRTH=2135)"
@throws Exception - an exception
<p > Filter for immutable entities of type APersistableBase . < / p >