Class WhereClauseHelper

java.lang.Object
com.primavera.integration.util.WhereClauseHelper

public final class WhereClauseHelper extends Object
Helper class containing static helper methods to be used when building the where clause specified when loading business objects.
  • Method Details

    • formatDate

      public static String formatDate(Session session, Date date)
      Formats the date to be compatible with all databases supported by the API. The database type is determined by invoking Session.getDatabaseType()

      Example: sWhereClause = "StartDate < " + WhereClauseHelper.formatDate(date, session);

      Parameters:
      date - the date to format
      session - the session instance to obtain the database type
      Returns:
      String the formatted date
      Throws:
      IllegalArgumentException - if the date parameter is null
    • formatGUID

      public static String formatGUID(String sGUID) throws InvalidValueException
      Formats a GUID to make it usable in a where clause when loading a business object. This changes the GUID to be in internal format.
      Parameters:
      sGUID - GUID in standard format {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}, where each x is an alphanumeric character
      Returns:
      internal representation of the GUID.
      Throws:
      InvalidValueException - if the GUID was not in the correct format
    • escapeSqlString

      public static String escapeSqlString(String s)
      Translates SQL statement's escape character, namely "'". Each "'" will changed to two "'"
      Parameters:
      s - the string to be translated
      Returns:
      the translated string.
      Throws:
      IllegalArgumentException - if the string parameter is null