Package com.primavera.integration.util
Class WhereClauseHelper
java.lang.Object
com.primavera.integration.util.WhereClauseHelper
Helper class containing static helper methods to be used when building the where clause
specified when loading business objects.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringTranslates SQL statement's escape character, namely "'".static StringformatDate(Session session, Date date) Formats the date to be compatible with all databases supported by the API.static StringformatGUID(String sGUID) Formats a GUID to make it usable in a where clause when loading a business object.
-
Method Details
-
formatDate
Formats the date to be compatible with all databases supported by the API. The database type is determined by invokingSession.getDatabaseType()Example: sWhereClause = "StartDate < " + WhereClauseHelper.formatDate(date, session);
- Parameters:
date- the date to formatsession- the session instance to obtain the database type- Returns:
- String the formatted date
- Throws:
IllegalArgumentException- if the date parameter is null
-
formatGUID
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
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
-