Java tutorial
// Description: Java 7 XMsg Client DbIO implementation for CFInternet. /* * CF Customer Information Managerment template model * * Copyright (c) 2010-2014 Mark Sobkow * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * *********************************************************************** * * Code manufactured by MSS Code Factory */ package net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetXMsgClient; import java.lang.reflect.*; import java.math.*; import java.sql.*; import java.text.*; import java.util.*; import javax.naming.*; import javax.sql.*; import net.sourceforge.msscodefactory.cflib.v1_11.CFLib.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternet.*; import net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetObj.*; import net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetXMsg.*; import net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetXMsgRspnHandler.*; public class CFInternetXMsgClientSchema extends CFInternetSchema { protected CFInternetXMsgRspnHandler responseHandler = null; protected boolean transactionOpen = false; public CFInternetXMsgClientSchema() { super(); tableAuditAction = new CFInternetXMsgClientAuditActionTable(this); tableCluster = new CFInternetXMsgClientClusterTable(this); tableDomain = new CFInternetXMsgClientDomainTable(this); tableDomainBase = new CFInternetXMsgClientDomainBaseTable(this); tableHostNode = new CFInternetXMsgClientHostNodeTable(this); tableISOCountry = new CFInternetXMsgClientISOCountryTable(this); tableISOCountryCurrency = new CFInternetXMsgClientISOCountryCurrencyTable(this); tableISOCountryLanguage = new CFInternetXMsgClientISOCountryLanguageTable(this); tableISOCurrency = new CFInternetXMsgClientISOCurrencyTable(this); tableISOLanguage = new CFInternetXMsgClientISOLanguageTable(this); tableISOTimezone = new CFInternetXMsgClientISOTimezoneTable(this); tableMajorVersion = new CFInternetXMsgClientMajorVersionTable(this); tableMimeType = new CFInternetXMsgClientMimeTypeTable(this); tableMinorVersion = new CFInternetXMsgClientMinorVersionTable(this); tableProjectBase = new CFInternetXMsgClientProjectBaseTable(this); tableRealProject = new CFInternetXMsgClientRealProjectTable(this); tableSecApp = new CFInternetXMsgClientSecAppTable(this); tableSecForm = new CFInternetXMsgClientSecFormTable(this); tableSecGroup = new CFInternetXMsgClientSecGroupTable(this); tableSecGroupForm = new CFInternetXMsgClientSecGroupFormTable(this); tableSecGroupInclude = new CFInternetXMsgClientSecGroupIncludeTable(this); tableSecGroupMember = new CFInternetXMsgClientSecGroupMemberTable(this); tableSecSession = new CFInternetXMsgClientSecSessionTable(this); tableSecUser = new CFInternetXMsgClientSecUserTable(this); tableService = new CFInternetXMsgClientServiceTable(this); tableServiceType = new CFInternetXMsgClientServiceTypeTable(this); tableSubProject = new CFInternetXMsgClientSubProjectTable(this); tableTSecGroup = new CFInternetXMsgClientTSecGroupTable(this); tableTSecGroupInclude = new CFInternetXMsgClientTSecGroupIncludeTable(this); tableTSecGroupMember = new CFInternetXMsgClientTSecGroupMemberTable(this); tableTenant = new CFInternetXMsgClientTenantTable(this); tableTld = new CFInternetXMsgClientTldTable(this); tableTopDomain = new CFInternetXMsgClientTopDomainTable(this); tableTopProject = new CFInternetXMsgClientTopProjectTable(this); tableURLProtocol = new CFInternetXMsgClientURLProtocolTable(this); tableVersion = new CFInternetXMsgClientVersionTable(this); setResponseHandlerSchemaObj(null); } public CFInternetXMsgClientSchema(CFInternetSchemaObj handlerSchema) { super(); tableAuditAction = new CFInternetXMsgClientAuditActionTable(this); tableCluster = new CFInternetXMsgClientClusterTable(this); tableDomain = new CFInternetXMsgClientDomainTable(this); tableDomainBase = new CFInternetXMsgClientDomainBaseTable(this); tableHostNode = new CFInternetXMsgClientHostNodeTable(this); tableISOCountry = new CFInternetXMsgClientISOCountryTable(this); tableISOCountryCurrency = new CFInternetXMsgClientISOCountryCurrencyTable(this); tableISOCountryLanguage = new CFInternetXMsgClientISOCountryLanguageTable(this); tableISOCurrency = new CFInternetXMsgClientISOCurrencyTable(this); tableISOLanguage = new CFInternetXMsgClientISOLanguageTable(this); tableISOTimezone = new CFInternetXMsgClientISOTimezoneTable(this); tableMajorVersion = new CFInternetXMsgClientMajorVersionTable(this); tableMimeType = new CFInternetXMsgClientMimeTypeTable(this); tableMinorVersion = new CFInternetXMsgClientMinorVersionTable(this); tableProjectBase = new CFInternetXMsgClientProjectBaseTable(this); tableRealProject = new CFInternetXMsgClientRealProjectTable(this); tableSecApp = new CFInternetXMsgClientSecAppTable(this); tableSecForm = new CFInternetXMsgClientSecFormTable(this); tableSecGroup = new CFInternetXMsgClientSecGroupTable(this); tableSecGroupForm = new CFInternetXMsgClientSecGroupFormTable(this); tableSecGroupInclude = new CFInternetXMsgClientSecGroupIncludeTable(this); tableSecGroupMember = new CFInternetXMsgClientSecGroupMemberTable(this); tableSecSession = new CFInternetXMsgClientSecSessionTable(this); tableSecUser = new CFInternetXMsgClientSecUserTable(this); tableService = new CFInternetXMsgClientServiceTable(this); tableServiceType = new CFInternetXMsgClientServiceTypeTable(this); tableSubProject = new CFInternetXMsgClientSubProjectTable(this); tableTSecGroup = new CFInternetXMsgClientTSecGroupTable(this); tableTSecGroupInclude = new CFInternetXMsgClientTSecGroupIncludeTable(this); tableTSecGroupMember = new CFInternetXMsgClientTSecGroupMemberTable(this); tableTenant = new CFInternetXMsgClientTenantTable(this); tableTld = new CFInternetXMsgClientTldTable(this); tableTopDomain = new CFInternetXMsgClientTopDomainTable(this); tableTopProject = new CFInternetXMsgClientTopProjectTable(this); tableURLProtocol = new CFInternetXMsgClientURLProtocolTable(this); tableVersion = new CFInternetXMsgClientVersionTable(this); setResponseHandlerSchemaObj(handlerSchema); } public CFInternetXMsgClientSchema(CFInternetSchemaObj handlerSchema, CFInternetConfigurationFile conf) { super(conf); tableAuditAction = new CFInternetXMsgClientAuditActionTable(this); tableCluster = new CFInternetXMsgClientClusterTable(this); tableDomain = new CFInternetXMsgClientDomainTable(this); tableDomainBase = new CFInternetXMsgClientDomainBaseTable(this); tableHostNode = new CFInternetXMsgClientHostNodeTable(this); tableISOCountry = new CFInternetXMsgClientISOCountryTable(this); tableISOCountryCurrency = new CFInternetXMsgClientISOCountryCurrencyTable(this); tableISOCountryLanguage = new CFInternetXMsgClientISOCountryLanguageTable(this); tableISOCurrency = new CFInternetXMsgClientISOCurrencyTable(this); tableISOLanguage = new CFInternetXMsgClientISOLanguageTable(this); tableISOTimezone = new CFInternetXMsgClientISOTimezoneTable(this); tableMajorVersion = new CFInternetXMsgClientMajorVersionTable(this); tableMimeType = new CFInternetXMsgClientMimeTypeTable(this); tableMinorVersion = new CFInternetXMsgClientMinorVersionTable(this); tableProjectBase = new CFInternetXMsgClientProjectBaseTable(this); tableRealProject = new CFInternetXMsgClientRealProjectTable(this); tableSecApp = new CFInternetXMsgClientSecAppTable(this); tableSecForm = new CFInternetXMsgClientSecFormTable(this); tableSecGroup = new CFInternetXMsgClientSecGroupTable(this); tableSecGroupForm = new CFInternetXMsgClientSecGroupFormTable(this); tableSecGroupInclude = new CFInternetXMsgClientSecGroupIncludeTable(this); tableSecGroupMember = new CFInternetXMsgClientSecGroupMemberTable(this); tableSecSession = new CFInternetXMsgClientSecSessionTable(this); tableSecUser = new CFInternetXMsgClientSecUserTable(this); tableService = new CFInternetXMsgClientServiceTable(this); tableServiceType = new CFInternetXMsgClientServiceTypeTable(this); tableSubProject = new CFInternetXMsgClientSubProjectTable(this); tableTSecGroup = new CFInternetXMsgClientTSecGroupTable(this); tableTSecGroupInclude = new CFInternetXMsgClientTSecGroupIncludeTable(this); tableTSecGroupMember = new CFInternetXMsgClientTSecGroupMemberTable(this); tableTenant = new CFInternetXMsgClientTenantTable(this); tableTld = new CFInternetXMsgClientTldTable(this); tableTopDomain = new CFInternetXMsgClientTopDomainTable(this); tableTopProject = new CFInternetXMsgClientTopProjectTable(this); tableURLProtocol = new CFInternetXMsgClientURLProtocolTable(this); tableVersion = new CFInternetXMsgClientVersionTable(this); setSchemaDbName(conf.getDbDatabase()); setResponseHandlerSchemaObj(handlerSchema); } public CFInternetXMsgClientSchema(CFInternetSchemaObj handlerSchema, String argJndiName) { super(argJndiName); tableAuditAction = new CFInternetXMsgClientAuditActionTable(this); tableCluster = new CFInternetXMsgClientClusterTable(this); tableDomain = new CFInternetXMsgClientDomainTable(this); tableDomainBase = new CFInternetXMsgClientDomainBaseTable(this); tableHostNode = new CFInternetXMsgClientHostNodeTable(this); tableISOCountry = new CFInternetXMsgClientISOCountryTable(this); tableISOCountryCurrency = new CFInternetXMsgClientISOCountryCurrencyTable(this); tableISOCountryLanguage = new CFInternetXMsgClientISOCountryLanguageTable(this); tableISOCurrency = new CFInternetXMsgClientISOCurrencyTable(this); tableISOLanguage = new CFInternetXMsgClientISOLanguageTable(this); tableISOTimezone = new CFInternetXMsgClientISOTimezoneTable(this); tableMajorVersion = new CFInternetXMsgClientMajorVersionTable(this); tableMimeType = new CFInternetXMsgClientMimeTypeTable(this); tableMinorVersion = new CFInternetXMsgClientMinorVersionTable(this); tableProjectBase = new CFInternetXMsgClientProjectBaseTable(this); tableRealProject = new CFInternetXMsgClientRealProjectTable(this); tableSecApp = new CFInternetXMsgClientSecAppTable(this); tableSecForm = new CFInternetXMsgClientSecFormTable(this); tableSecGroup = new CFInternetXMsgClientSecGroupTable(this); tableSecGroupForm = new CFInternetXMsgClientSecGroupFormTable(this); tableSecGroupInclude = new CFInternetXMsgClientSecGroupIncludeTable(this); tableSecGroupMember = new CFInternetXMsgClientSecGroupMemberTable(this); tableSecSession = new CFInternetXMsgClientSecSessionTable(this); tableSecUser = new CFInternetXMsgClientSecUserTable(this); tableService = new CFInternetXMsgClientServiceTable(this); tableServiceType = new CFInternetXMsgClientServiceTypeTable(this); tableSubProject = new CFInternetXMsgClientSubProjectTable(this); tableTSecGroup = new CFInternetXMsgClientTSecGroupTable(this); tableTSecGroupInclude = new CFInternetXMsgClientTSecGroupIncludeTable(this); tableTSecGroupMember = new CFInternetXMsgClientTSecGroupMemberTable(this); tableTenant = new CFInternetXMsgClientTenantTable(this); tableTld = new CFInternetXMsgClientTldTable(this); tableTopDomain = new CFInternetXMsgClientTopDomainTable(this); tableTopProject = new CFInternetXMsgClientTopProjectTable(this); tableURLProtocol = new CFInternetXMsgClientURLProtocolTable(this); tableVersion = new CFInternetXMsgClientVersionTable(this); setResponseHandlerSchemaObj(handlerSchema); } /** * Get the CFInternetSchemaObj that is used by the response processor to * import the response objects during the parsing of response message strings. * * @return The CFInternetSchemaObj that is providing a persistence implementation * for the parsing of response message strings. */ public ICFInternetSchemaObj getResponseHandlerSchemaObj() { ICFInternetSchemaObj handlerSchema = getResponseHandler().getSchemaObj(); return (handlerSchema); } /** * Set the CFInternetSchemaObj that is to be used by the response processor to * import the response objects during the parsing of response message strings. * * @param handlerSchema The CFInternetSchemaObj that is to provide a persistence implementation * for the parsing of response message strings. */ public void setResponseHandlerSchemaObj(ICFInternetSchemaObj handlerSchema) { getResponseHandler().setSchemaObj(handlerSchema); } public ICFLibMessageLog getLog() { ICFLibMessageLog mylog = getResponseHandler().getLog(); return (mylog); } public void setLog(ICFLibMessageLog newlog) { getResponseHandler().setLog(newlog); } /** * Get the CFInternetDeleted flag that is used by the response processor to * indate that a Deleted response was processed. * * @return True if a Deleted message was processed, otherwise false. */ public boolean getResponseHandlerDeleted() { boolean deleted = getResponseHandler().getDeleted(); return (deleted); } /** * Set the CFInternetDeleted flag that is to be used by the response processor to * indicate that a Deleted response was processed. * * @param deleted True if a Deleted response was processed, otherwise false. */ public void setResponseHandlerDeleted(boolean deleted) { getResponseHandler().setDeleted(deleted); } public boolean isConnected() { ICFInternetSchemaObj schemaObj = getResponseHandlerSchemaObj(); if (schemaObj.getAuthorization() != null) { return (true); } else { return (false); } } /** * Send the request and receive a response string from the server. * <p> * You are expected to overload the implementation of this method * when binding an XMsgClient package to a particular transport * mechanism. The implementation of sendReceive() is for pure XML * strings, so you can wire it to pretty much any implementation * you choose. * * @param Authorization -- null for connection requests * * @param rqst The String to send to the server * * @return rspn The response string recieved from the server, ready to be parsed as an XML file content. */ public String sendReceive(CFInternetAuthorization Authorization, String rqst) { throw CFLib.getDefaultExceptionFactory().newMustOverrideException(getClass(), "sendReceive"); } public CFInternetXMsgRspnHandler getResponseHandler() { if (responseHandler == null) { responseHandler = new CFInternetXMsgRspnHandler(); } return (responseHandler); } public boolean connect() { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "connect"); } public boolean connect(String username, String password) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "connect-userpw"); } public boolean connect(String clusterName, String tenantName, String secUserName, String dbusername, String dbpassword) { final String S_ProcName = "connect-auth-userpw"; String rqst = CFInternetXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRqstLogIn("\n\t\t\t", clusterName, tenantName, secUserName, dbusername, dbpassword) + "\n" + CFInternetXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = sendReceive(null, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } // The response handler sets up the authorization responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } // If we got a response instead of an exception, we succeeded at logging in. return (true); } public void disconnect(boolean doCommit) { } public void logout(CFInternetAuthorization auth) { final String S_ProcName = "logout"; if ((auth == null) || (null == auth.getSecSessionId())) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Not authorized/connected"); } String rqst = CFInternetXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFInternetXMsgSchemaMessageFormatter.formatRqstLogOut("\n\t\t\t", auth.getSecSessionId()) + "\n" + CFInternetXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = sendReceive(auth, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } } public boolean isTransactionOpen() { return (transactionOpen); } public boolean beginTransaction() { if (transactionOpen) { return (false); } else { transactionOpen = true; return (true); } } public void commit() { transactionOpen = false; } public void rollback() { transactionOpen = false; } public boolean isSystemUser(CFInternetAuthorization Authorization) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "isSystemUser"); } public boolean isClusterUser(CFInternetAuthorization Authorization, long clusterId, String groupName) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "isClusterUser"); } public boolean isTenantUser(CFInternetAuthorization Authorization, long tenantId, String groupName) { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "isTenantUser"); } public int nextServiceTypeIdGen() { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "nextServiceTypeIdGen"); } public int nextMimeTypeIdGen() { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "nextMimeTypeIdGen"); } public long nextClusterIdGen() { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "nextClusterIdGen"); } public long nextTenantIdGen() { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "nextTenantIdGen"); } public UUID nextSecSessionIdGen() { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "nextSecSessionIdGen"); } public UUID nextSecUserIdGen() { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "nextSecUserIdGen"); } /** * Release the prepared statements. * <p> * When the schema changes connections, the prepared statements * have to be released because they contain connection-specific * information for most databases. */ public void releasePreparedStatements() { throw CFLib.getDefaultExceptionFactory().newNotSupportedException(getClass(), "releasePreparedStatements"); } public static String getQuotedString(String val) { if (val == null) { return ("null"); } else { char c; StringBuilder quoted = new StringBuilder(); quoted.append("'"); int len = val.length(); for (int i = 0; i < len; i++) { if (val.charAt(i) == '\'') { quoted.append("''"); } else if (val.charAt(i) == '\\') { quoted.append("'||E'\\\\'||'"); } else { c = val.charAt(i); if ((c == '0') || (c == '1') || (c == '2') || (c == '3') || (c == '4') || (c == '5') || (c == '6') || (c == '7') || (c == '8') || (c == '9') || (c == 'a') || (c == 'b') || (c == 'c') || (c == 'd') || (c == 'e') || (c == 'f') || (c == 'g') || (c == 'h') || (c == 'i') || (c == 'j') || (c == 'k') || (c == 'l') || (c == 'm') || (c == 'n') || (c == 'o') || (c == 'p') || (c == 'q') || (c == 'r') || (c == 's') || (c == 't') || (c == 'u') || (c == 'v') || (c == 'w') || (c == 'x') || (c == 'y') || (c == 'z') || (c == 'A') || (c == 'B') || (c == 'C') || (c == 'D') || (c == 'E') || (c == 'F') || (c == 'G') || (c == 'H') || (c == 'I') || (c == 'J') || (c == 'K') || (c == 'L') || (c == 'M') || (c == 'N') || (c == 'O') || (c == 'P') || (c == 'Q') || (c == 'R') || (c == 'S') || (c == 'T') || (c == 'U') || (c == 'V') || (c == 'W') || (c == 'X') || (c == 'Y') || (c == 'Z') || (c == ' ') || (c == '\t') || (c == '\r') || (c == '\n') || (c == '`') || (c == '~') || (c == '!') || (c == '@') || (c == '#') || (c == '$') || (c == '%') || (c == '^') || (c == '&') || (c == '*') || (c == '(') || (c == ')') || (c == '-') || (c == '_') || (c == '=') || (c == '+') || (c == '[') || (c == ']') || (c == '{') || (c == '}') || (c == '|') || (c == ';') || (c == ':') || (c == '"') || (c == '<') || (c == '>') || (c == ',') || (c == '.') || (c == '/') || (c == '?')) { quoted.append(c); } else { // Syslog.warn("\t\t\tReplacing invalid character '" + c + "' with space"); quoted.append(' '); } } } quoted.append("'"); return (quoted.toString()); } } public static String getNullableString(ResultSet reader, int colidx) { try { String val = reader.getString(colidx); if (reader.wasNull()) { return (null); } else { return (val); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFInternetXMsgClientSchema.class, "getNullableString", e); } } public static String getBlobString(byte[] val) { if (val == null) { return ("null"); } else { return ("'" + Base64.encodeBase64(val).toString() + "'"); } } public static String getBoolString(Boolean val) { if (val == null) { return ("null"); } else { if (val) { return ("true"); } else { return ("false"); } } } public static String getBoolString(boolean val) { if (val) { return ("true"); } else { return ("false"); } } public static String getInt16String(Short val) { if (val == null) { return ("null"); } else { return (val.toString()); } } public static String getInt16String(short val) { return (Short.toString(val)); } public static String getInt32String(Integer val) { if (val == null) { return ("null"); } else { return (val.toString()); } } public static String getInt32String(int val) { return (Integer.toString(val)); } public static String getInt64String(Long val) { if (val == null) { return ("null"); } else { return (val.toString()); } } public static String getInt64String(long val) { return (Long.toString(val)); } public static String getUInt16String(Integer val) { if (val == null) { return ("null"); } else { return (val.toString()); } } public static String getUInt16String(int val) { return (Integer.toString(val)); } public static String getUInt32String(Long val) { if (val == null) { return ("null"); } else { return (val.toString()); } } public static String getUInt32String(long val) { return (Long.toString(val)); } public static String getUInt64String(BigDecimal val) { if (val == null) { return ("null"); } else { return (val.toString()); } } public static String getFloatString(Float val) { if (val == null) { return ("null"); } else { return (val.toString()); } } public static String getFloatString(float val) { return (Float.toString(val)); } public static String getDoubleString(Double val) { if (val == null) { return ("null"); } else { return (val.toString()); } } public static String getDoubleString(double val) { return (Double.toString(val)); } public static String getNumberString(BigDecimal val) { if (val == null) { return ("null"); } else { return (val.toString()); } } public static Integer getNullableInt32(ResultSet reader, int colidx) { try { int val = reader.getInt(colidx); if (reader.wasNull()) { return (null); } else { return (new Integer(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFInternetXMsgClientSchema.class, "getNullableInt32", e); } } public static Short getNullableInt16(ResultSet reader, int colidx) { try { short val = reader.getShort(colidx); if (reader.wasNull()) { return (null); } else { return (new Short(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFInternetXMsgClientSchema.class, "getNullableInt64", e); } } public static Integer getNullableUInt16(ResultSet reader, int colidx) { try { int val = reader.getInt(colidx); if (reader.wasNull()) { return (null); } else { return (new Integer(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFInternetXMsgClientSchema.class, "getNullableUInt16", e); } } public static Long getNullableUInt32(ResultSet reader, int colidx) { try { long val = reader.getLong(colidx); if (reader.wasNull()) { return (null); } else { return (new Long(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFInternetXMsgClientSchema.class, "getNullableUInt32", e); } } public static BigDecimal getNullableUInt64(ResultSet reader, int colidx) { try { String strval = reader.getString(colidx); if (reader.wasNull() || (strval == null) || (strval.length() <= 0)) { return (null); } else { BigDecimal retval = new BigDecimal(strval); return (retval); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFInternetXMsgClientSchema.class, "getNullableUInt64", e); } } public static Byte getNullableByte(ResultSet reader, int colidx) { try { byte val = reader.getByte(colidx); if (reader.wasNull()) { return (null); } else { return (new Byte(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFInternetXMsgClientSchema.class, "getNullableByte", e); } } public static String getQuotedDateString(Calendar val) { if (val == null) { return ("null"); } else { StringBuffer buff = new StringBuffer("'"); Formatter fmt = new Formatter(buff); Calendar db = CFLibDbUtil.getDbServerCalendar(val); fmt.format("%1$04d", db.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH)); buff.append("'"); fmt.close(); return (buff.toString()); } } public static String getQuotedTimeString(Calendar val) { if (val == null) { return ("null"); } else { StringBuffer buff = new StringBuffer("'"); Formatter fmt = new Formatter(buff); Calendar db = CFLibDbUtil.getDbServerCalendar(val); fmt.format("%1$02d", db.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.SECOND)); buff.append("'"); fmt.close(); return (buff.toString()); } } public static String getQuotedTimestampString(Calendar val) { if (val == null) { return ("null"); } else { StringBuffer buff = new StringBuffer("'"); Formatter fmt = new Formatter(buff); Calendar db = CFLibDbUtil.getDbServerCalendar(val); fmt.format("%1$04d", db.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH)); buff.append(" "); fmt.format("%1$02d", db.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.SECOND)); buff.append("'"); fmt.close(); return (buff.toString()); } } public static String getQuotedTZDateString(Calendar val) { if (val == null) { return ("null"); } else { Calendar db = CFLibDbUtil.getDbServerCalendar(val); StringBuffer buff = new StringBuffer("'"); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", db.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH)); buff.append(" "); fmt.format("%1$02d", db.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.SECOND)); buff.append("'"); fmt.close(); return (buff.toString()); } } public static String getQuotedTZTimeString(Calendar val) { if (val == null) { return ("null"); } else { Calendar db = CFLibDbUtil.getDbServerCalendar(val); StringBuffer buff = new StringBuffer("'"); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", db.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH)); buff.append(" "); fmt.format("%1$02d", db.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.SECOND)); buff.append("'"); fmt.close(); return (buff.toString()); } } public static String getQuotedTZTimestampString(Calendar val) { if (val == null) { return ("null"); } else { Calendar db = CFLibDbUtil.getDbServerCalendar(val); StringBuffer buff = new StringBuffer("'"); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", db.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH)); buff.append(" "); fmt.format("%1$02d", db.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.SECOND)); buff.append("'"); fmt.close(); return (buff.toString()); } } public static String getDateString(Calendar val) { if (val == null) { return ("null"); } else { StringBuffer buff = new StringBuffer(); Formatter fmt = new Formatter(buff); Calendar db = CFLibDbUtil.getDbServerCalendar(val); fmt.format("%1$04d", db.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH)); fmt.close(); return (buff.toString()); } } public static String getTimeString(Calendar val) { if (val == null) { return ("null"); } else { StringBuffer buff = new StringBuffer(); Formatter fmt = new Formatter(buff); Calendar db = CFLibDbUtil.getDbServerCalendar(val); fmt.format("%1$02d", db.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.SECOND)); fmt.close(); return (buff.toString()); } } public static String getTimestampString(Calendar val) { if (val == null) { return ("null"); } else { StringBuffer buff = new StringBuffer(); Formatter fmt = new Formatter(buff); Calendar db = CFLibDbUtil.getDbServerCalendar(val); fmt.format("%1$04d", db.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH)); buff.append(" "); fmt.format("%1$02d", db.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.SECOND)); fmt.close(); return (buff.toString()); } } public static String getTZDateString(Calendar val) { if (val == null) { return ("null"); } else { Calendar db = CFLibDbUtil.getDbServerCalendar(val); StringBuffer buff = new StringBuffer(); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", db.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH)); buff.append(" "); fmt.format("%1$02d", db.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.SECOND)); fmt.close(); return (buff.toString()); } } public static String getTZTimeString(Calendar val) { if (val == null) { return ("null"); } else { Calendar db = CFLibDbUtil.getDbServerCalendar(val); StringBuffer buff = new StringBuffer(); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", db.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH)); buff.append(" "); fmt.format("%1$02d", db.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.SECOND)); fmt.close(); return (buff.toString()); } } public static String getTZTimestampString(Calendar val) { if (val == null) { return ("null"); } else { Calendar db = CFLibDbUtil.getDbServerCalendar(val); StringBuffer buff = new StringBuffer(); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", db.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH)); buff.append(" "); fmt.format("%1$02d", db.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.SECOND)); fmt.close(); return (buff.toString()); } } public static String getUuidString(UUID val) { if (val == null) { return ("null"); } else { return ("'" + val.toString() + "'"); } } public static Calendar convertDateString(String val) { if ((val == null) || (val.length() == 0)) { return (null); } else if (val.length() != 10) { throw CFLib.getDefaultExceptionFactory().newUsageException(CFInternetXMsgClientSchema.class, "convertDateString", "Value must be in YYYY-MM-DD format, \"" + val + "\" is invalid"); } else if (((val.charAt(0) >= '0') && (val.charAt(0) <= '9')) && ((val.charAt(1) >= '0') && (val.charAt(1) <= '9')) && ((val.charAt(2) >= '0') && (val.charAt(2) <= '9')) && ((val.charAt(3) >= '0') && (val.charAt(3) <= '9')) && (val.charAt(4) == '-') && ((val.charAt(5) >= '0') && (val.charAt(5) <= '1')) && ((val.charAt(6) >= '0') && (val.charAt(6) <= '9')) && (val.charAt(7) == '-') && ((val.charAt(8) >= '0') && (val.charAt(8) <= '3')) && ((val.charAt(9) >= '0') && (val.charAt(9) <= '9'))) { /* * NOTE: * .Net uses substring( startcol, lengthOfSubstring ) * Java uses substring( startcol, endcol ) and does not * include charAt( endcol ); */ int year = Integer.parseInt(val.substring(0, 4)); int month = Integer.parseInt(val.substring(5, 7)); int day = Integer.parseInt(val.substring(8, 10)); Calendar retval = new GregorianCalendar(CFLibDbUtil.getDbServerTimeZone()); retval.set(Calendar.YEAR, year); retval.set(Calendar.MONTH, month - 1); retval.set(Calendar.DAY_OF_MONTH, day); retval.set(Calendar.HOUR_OF_DAY, 0); retval.set(Calendar.MINUTE, 0); retval.set(Calendar.SECOND, 0); Calendar local = new GregorianCalendar(); local.setTimeInMillis(retval.getTimeInMillis()); return (local); } else { throw CFLib.getDefaultExceptionFactory().newUsageException(CFInternetXMsgClientSchema.class, "convertDateString", "Value must be in YYYY-MM-DD format, \"" + val + "\" is invalid"); } } public static Calendar convertTimeString(String val) { if ((val == null) || (val.length() == 0)) { return (null); } else if (val.length() != 8) { throw CFLib.getDefaultExceptionFactory().newUsageException(CFInternetXMsgClientSchema.class, "convertTimeString", "Value must be in HH24:MI:SS format, \"" + val + "\" is invalid"); } else if (((val.charAt(0) >= '0') && (val.charAt(0) <= '2')) && ((val.charAt(1) >= '0') && (val.charAt(1) <= '9')) && (val.charAt(2) == ':') && ((val.charAt(3) >= '0') && (val.charAt(3) <= '5')) && ((val.charAt(4) >= '0') && (val.charAt(4) <= '9')) && (val.charAt(5) == ':') && ((val.charAt(6) >= '0') && (val.charAt(6) <= '5')) && ((val.charAt(7) >= '0') && (val.charAt(7) <= '9'))) { /* * NOTE: * .Net uses substring( startcol, lengthOfSubstring ) * Java uses substring( startcol, endcol ) and does not * include charAt( endcol ); */ int hour = Integer.parseInt(val.substring(0, 2)); int minute = Integer.parseInt(val.substring(3, 5)); int second = Integer.parseInt(val.substring(6, 8)); Calendar retval = new GregorianCalendar(CFLibDbUtil.getDbServerTimeZone()); retval.set(Calendar.YEAR, 2000); retval.set(Calendar.MONTH, 0); retval.set(Calendar.DAY_OF_MONTH, 1); retval.set(Calendar.HOUR_OF_DAY, hour); retval.set(Calendar.MINUTE, minute); retval.set(Calendar.SECOND, second); Calendar local = new GregorianCalendar(); local.setTimeInMillis(retval.getTimeInMillis()); return (local); } else { throw CFLib.getDefaultExceptionFactory().newUsageException(CFInternetXMsgClientSchema.class, "convertTimeString", "Value must be in HH24:MI:SS format \"" + val + "\" is invalid"); } } public static Calendar convertTimestampString(String val) { if ((val == null) || (val.length() == 0)) { return (null); } else if (val.length() != 19) { throw CFLib.getDefaultExceptionFactory().newUsageException(CFInternetXMsgClientSchema.class, "convertTimestampString", "Value must be in YYYY-MM-DD HH24:MI:SS format \"" + val + "\" is invalid"); } else if (((val.charAt(0) >= '0') && (val.charAt(0) <= '9')) && ((val.charAt(1) >= '0') && (val.charAt(1) <= '9')) && ((val.charAt(2) >= '0') && (val.charAt(2) <= '9')) && ((val.charAt(3) >= '0') && (val.charAt(3) <= '9')) && (val.charAt(4) == '-') && ((val.charAt(5) >= '0') && (val.charAt(5) <= '1')) && ((val.charAt(6) >= '0') && (val.charAt(6) <= '9')) && (val.charAt(7) == '-') && ((val.charAt(8) >= '0') && (val.charAt(8) <= '3')) && ((val.charAt(9) >= '0') && (val.charAt(9) <= '9')) && (val.charAt(10) == ' ') && ((val.charAt(11) >= '0') && (val.charAt(11) <= '2')) && ((val.charAt(12) >= '0') && (val.charAt(12) <= '9')) && (val.charAt(13) == ':') && ((val.charAt(14) >= '0') && (val.charAt(14) <= '5')) && ((val.charAt(15) >= '0') && (val.charAt(15) <= '9')) && (val.charAt(16) == ':') && ((val.charAt(17) >= '0') && (val.charAt(17) <= '5')) && ((val.charAt(18) >= '0') && (val.charAt(18) <= '9'))) { /* * NOTE: * .Net uses substring( startcol, lengthOfSubstring ) * Java uses substring( startcol, endcol ) and does not * include charAt( endcol ); */ int year = Integer.parseInt(val.substring(0, 4)); int month = Integer.parseInt(val.substring(5, 7)); int day = Integer.parseInt(val.substring(8, 10)); int hour = Integer.parseInt(val.substring(11, 13)); int minute = Integer.parseInt(val.substring(14, 16)); int second = Integer.parseInt(val.substring(17, 19)); Calendar retval = new GregorianCalendar(CFLibDbUtil.getDbServerTimeZone()); retval.set(Calendar.YEAR, year); retval.set(Calendar.MONTH, month - 1); retval.set(Calendar.DAY_OF_MONTH, day); retval.set(Calendar.HOUR_OF_DAY, hour); retval.set(Calendar.MINUTE, minute); retval.set(Calendar.SECOND, second); Calendar local = new GregorianCalendar(); local.setTimeInMillis(retval.getTimeInMillis()); return (local); } else { throw CFLib.getDefaultExceptionFactory().newUsageException(CFInternetXMsgClientSchema.class, "convertTimestampString", "Value must be in YYYY-MM-DD HH24:MI:SS format \"" + val + "\" is invalid"); } } public static Calendar convertTZDateString(String val) { if ((val == null) || (val.length() == 0)) { return (null); } else if (val.length() != 19) { throw CFLib.getDefaultExceptionFactory().newUsageException(CFInternetXMsgClientSchema.class, "convertTZDateString", "Value must be in YYYY-MM-DD HH24:MI:SS format \"" + val + "\" is invalid"); } else if (((val.charAt(0) >= '0') && (val.charAt(0) <= '9')) && ((val.charAt(1) >= '0') && (val.charAt(1) <= '9')) && ((val.charAt(2) >= '0') && (val.charAt(2) <= '9')) && ((val.charAt(3) >= '0') && (val.charAt(3) <= '9')) && (val.charAt(4) == '-') && ((val.charAt(5) >= '0') && (val.charAt(5) <= '1')) && ((val.charAt(6) >= '0') && (val.charAt(6) <= '9')) && (val.charAt(7) == '-') && ((val.charAt(8) >= '0') && (val.charAt(8) <= '3')) && ((val.charAt(9) >= '0') && (val.charAt(9) <= '9')) && (val.charAt(10) == ' ') && ((val.charAt(11) >= '0') && (val.charAt(11) <= '2')) && ((val.charAt(12) >= '0') && (val.charAt(12) <= '9')) && (val.charAt(13) == ':') && ((val.charAt(14) >= '0') && (val.charAt(14) <= '5')) && ((val.charAt(15) >= '0') && (val.charAt(15) <= '9')) && (val.charAt(16) == ':') && ((val.charAt(17) >= '0') && (val.charAt(17) <= '5')) && ((val.charAt(18) >= '0') && (val.charAt(18) <= '9'))) { /* * NOTE: * .Net uses substring( startcol, lengthOfSubstring ) * Java uses substring( startcol, endcol ) and does not * include charAt( endcol ); */ int year = Integer.parseInt(val.substring(0, 4)); int month = Integer.parseInt(val.substring(5, 7)); int day = Integer.parseInt(val.substring(8, 10)); int hour = Integer.parseInt(val.substring(11, 13)); int minute = Integer.parseInt(val.substring(14, 16)); int second = Integer.parseInt(val.substring(17, 19)); Calendar retval = new GregorianCalendar(CFLibDbUtil.getDbServerTimeZone()); retval.set(Calendar.YEAR, year); retval.set(Calendar.MONTH, month - 1); retval.set(Calendar.DAY_OF_MONTH, day); retval.set(Calendar.HOUR_OF_DAY, hour); retval.set(Calendar.MINUTE, minute); retval.set(Calendar.SECOND, second); Calendar utc = CFLibDbUtil.getUTCCalendar(retval); return (utc); } else { throw CFLib.getDefaultExceptionFactory().newUsageException(CFInternetXMsgClientSchema.class, "convertTZDateString", "Value must be in YYYY-MM-DD HH24:MI:SS format \"" + val + "\" is invalid"); } } public static Calendar convertTZTimeString(String val) { if ((val == null) || (val.length() == 0)) { return (null); } else if (val.length() != 19) { throw CFLib.getDefaultExceptionFactory().newUsageException(CFInternetXMsgClientSchema.class, "convertTZTimeString", "Value must be in YYYY-MM-DD HH24:MI:SS format \"" + val + "\" is invalid"); } else if (((val.charAt(0) >= '0') && (val.charAt(0) <= '9')) && ((val.charAt(1) >= '0') && (val.charAt(1) <= '9')) && ((val.charAt(2) >= '0') && (val.charAt(2) <= '9')) && ((val.charAt(3) >= '0') && (val.charAt(3) <= '9')) && (val.charAt(4) == '-') && ((val.charAt(5) >= '0') && (val.charAt(5) <= '1')) && ((val.charAt(6) >= '0') && (val.charAt(6) <= '9')) && (val.charAt(7) == '-') && ((val.charAt(8) >= '0') && (val.charAt(8) <= '3')) && ((val.charAt(9) >= '0') && (val.charAt(9) <= '9')) && (val.charAt(10) == ' ') && ((val.charAt(11) >= '0') && (val.charAt(11) <= '2')) && ((val.charAt(12) >= '0') && (val.charAt(12) <= '9')) && (val.charAt(13) == ':') && ((val.charAt(14) >= '0') && (val.charAt(14) <= '5')) && ((val.charAt(15) >= '0') && (val.charAt(15) <= '9')) && (val.charAt(16) == ':') && ((val.charAt(17) >= '0') && (val.charAt(17) <= '5')) && ((val.charAt(18) >= '0') && (val.charAt(18) <= '9'))) { /* * NOTE: * .Net uses substring( startcol, lengthOfSubstring ) * Java uses substring( startcol, endcol ) and does not * include charAt( endcol ); */ int year = Integer.parseInt(val.substring(0, 4)); int month = Integer.parseInt(val.substring(5, 7)); int day = Integer.parseInt(val.substring(8, 10)); int hour = Integer.parseInt(val.substring(11, 13)); int minute = Integer.parseInt(val.substring(14, 16)); int second = Integer.parseInt(val.substring(17, 19)); Calendar retval = new GregorianCalendar(CFLibDbUtil.getDbServerTimeZone()); retval.set(Calendar.YEAR, year); retval.set(Calendar.MONTH, month - 1); retval.set(Calendar.DAY_OF_MONTH, day); retval.set(Calendar.HOUR_OF_DAY, hour); retval.set(Calendar.MINUTE, minute); retval.set(Calendar.SECOND, second); Calendar utc = CFLibDbUtil.getUTCCalendar(retval); return (utc); } else { throw CFLib.getDefaultExceptionFactory().newUsageException(CFInternetXMsgClientSchema.class, "convertTZTimeString", "Value must be in YYYY-MM-DD HH24:MI:SS format \"" + val + "\" is invalid"); } } public static Calendar convertTZTimestampString(String val) { if ((val == null) || (val.length() == 0)) { return (null); } else if (val.length() != 19) { throw CFLib.getDefaultExceptionFactory().newUsageException(CFInternetXMsgClientSchema.class, "convertTZTimestampString", "Value must be in YYYY-MM-DD HH24:MI:SS format \"" + val + "\" is invalid"); } else if (((val.charAt(0) >= '0') && (val.charAt(0) <= '9')) && ((val.charAt(1) >= '0') && (val.charAt(1) <= '9')) && ((val.charAt(2) >= '0') && (val.charAt(2) <= '9')) && ((val.charAt(3) >= '0') && (val.charAt(3) <= '9')) && (val.charAt(4) == '-') && ((val.charAt(5) >= '0') && (val.charAt(5) <= '1')) && ((val.charAt(6) >= '0') && (val.charAt(6) <= '9')) && (val.charAt(7) == '-') && ((val.charAt(8) >= '0') && (val.charAt(8) <= '3')) && ((val.charAt(9) >= '0') && (val.charAt(9) <= '9')) && (val.charAt(10) == ' ') && ((val.charAt(11) >= '0') && (val.charAt(11) <= '2')) && ((val.charAt(12) >= '0') && (val.charAt(12) <= '9')) && (val.charAt(13) == ':') && ((val.charAt(14) >= '0') && (val.charAt(14) <= '5')) && ((val.charAt(15) >= '0') && (val.charAt(15) <= '9')) && (val.charAt(16) == ':') && ((val.charAt(17) >= '0') && (val.charAt(17) <= '5')) && ((val.charAt(18) >= '0') && (val.charAt(18) <= '9'))) { /* * NOTE: * .Net uses substring( startcol, lengthOfSubstring ) * Java uses substring( startcol, endcol ) and does not * include charAt( endcol ); */ int year = Integer.parseInt(val.substring(0, 4)); int month = Integer.parseInt(val.substring(5, 7)); int day = Integer.parseInt(val.substring(8, 10)); int hour = Integer.parseInt(val.substring(11, 13)); int minute = Integer.parseInt(val.substring(14, 16)); int second = Integer.parseInt(val.substring(17, 19)); Calendar retval = new GregorianCalendar(CFLibDbUtil.getDbServerTimeZone()); retval.set(Calendar.YEAR, year); retval.set(Calendar.MONTH, month - 1); retval.set(Calendar.DAY_OF_MONTH, day); retval.set(Calendar.HOUR_OF_DAY, hour); retval.set(Calendar.MINUTE, minute); retval.set(Calendar.SECOND, second); Calendar utc = CFLibDbUtil.getUTCCalendar(retval); return (utc); } else { throw CFLib.getDefaultExceptionFactory().newUsageException(CFInternetXMsgClientSchema.class, "convertTZTimestampString", "Value must be in YYYY-MM-DD HH24:MI:SS format \"" + val + "\" is invalid"); } } public static UUID convertUuidString(String val) { if ((val == null) || (val.length() == 0)) { return (null); } else { return (UUID.fromString(val)); } } }