List of usage examples for java.lang Short shortValue
@HotSpotIntrinsicCandidate public short shortValue()
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMSSql.CFCrmMSSqlContactTable.java
public void createContact(CFCrmAuthorization Authorization, CFCrmContactBuff Buff) { final String S_ProcName = "createContact"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from w ww .jav a 2s.co m*/ ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); long ContactListId = Buff.getRequiredContactListId(); Short ISOTimezoneId = Buff.getOptionalISOTimezoneId(); String FullName = Buff.getRequiredFullName(); String LastName = Buff.getOptionalLastName(); String FirstName = Buff.getOptionalFirstName(); String Custom = Buff.getOptionalCustom(); String Custom2 = Buff.getOptionalCustom2(); String Custom3 = Buff.getOptionalCustom3(); Connection cnx = schema.getCnx(); String sql = "exec sp_create_contact ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtCreateByPKey.setString(argIdx++, "CTC"); stmtCreateByPKey.setLong(argIdx++, TenantId); stmtCreateByPKey.setLong(argIdx++, ContactListId); if (ISOTimezoneId != null) { stmtCreateByPKey.setShort(argIdx++, ISOTimezoneId.shortValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtCreateByPKey.setString(argIdx++, FullName); if (LastName != null) { stmtCreateByPKey.setString(argIdx++, LastName); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (FirstName != null) { stmtCreateByPKey.setString(argIdx++, FirstName); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom != null) { stmtCreateByPKey.setString(argIdx++, Custom); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom2 != null) { stmtCreateByPKey.setString(argIdx++, Custom2); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom3 != null) { stmtCreateByPKey.setString(argIdx++, Custom3); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } stmtCreateByPKey.execute(); boolean moreResults = true; resultSet = null; while (resultSet == null) { try { moreResults = stmtCreateByPKey.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { resultSet = stmtCreateByPKey.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtCreateByPKey.getUpdateCount()) { break; } } if (resultSet == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "resultSet"); } if (resultSet.next()) { CFCrmContactBuff createdBuff = unpackContactResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredTenantId(createdBuff.getRequiredTenantId()); Buff.setRequiredContactId(createdBuff.getRequiredContactId()); Buff.setRequiredContactListId(createdBuff.getRequiredContactListId()); Buff.setOptionalISOTimezoneId(createdBuff.getOptionalISOTimezoneId()); Buff.setRequiredFullName(createdBuff.getRequiredFullName()); Buff.setOptionalLastName(createdBuff.getOptionalLastName()); Buff.setOptionalFirstName(createdBuff.getOptionalFirstName()); Buff.setOptionalCustom(createdBuff.getOptionalCustom()); Buff.setOptionalCustom2(createdBuff.getOptionalCustom2()); Buff.setOptionalCustom3(createdBuff.getOptionalCustom3()); Buff.setRequiredRevision(createdBuff.getRequiredRevision()); Buff.setCreatedByUserId(createdBuff.getCreatedByUserId()); Buff.setCreatedAt(createdBuff.getCreatedAt()); Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId()); Buff.setUpdatedAt(createdBuff.getUpdatedAt()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMySql.CFCrmMySqlContactTable.java
public void createContact(CFCrmAuthorization Authorization, CFCrmContactBuff Buff) { final String S_ProcName = "createContact"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from w ww. j a va 2 s .c o m*/ ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); long ContactListId = Buff.getRequiredContactListId(); Short ISOTimezoneId = Buff.getOptionalISOTimezoneId(); String FullName = Buff.getRequiredFullName(); String LastName = Buff.getOptionalLastName(); String FirstName = Buff.getOptionalFirstName(); String Custom = Buff.getOptionalCustom(); String Custom2 = Buff.getOptionalCustom2(); String Custom3 = Buff.getOptionalCustom3(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_create_contact( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtCreateByPKey.setString(argIdx++, "CTC"); stmtCreateByPKey.setLong(argIdx++, TenantId); stmtCreateByPKey.setLong(argIdx++, ContactListId); if (ISOTimezoneId != null) { stmtCreateByPKey.setShort(argIdx++, ISOTimezoneId.shortValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtCreateByPKey.setString(argIdx++, FullName); if (LastName != null) { stmtCreateByPKey.setString(argIdx++, LastName); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (FirstName != null) { stmtCreateByPKey.setString(argIdx++, FirstName); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom != null) { stmtCreateByPKey.setString(argIdx++, Custom); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom2 != null) { stmtCreateByPKey.setString(argIdx++, Custom2); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom3 != null) { stmtCreateByPKey.setString(argIdx++, Custom3); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } try { resultSet = stmtCreateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFCrmContactBuff createdBuff = unpackContactResultSetToBuff(resultSet); if ((resultSet != null) && resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredTenantId(createdBuff.getRequiredTenantId()); Buff.setRequiredContactId(createdBuff.getRequiredContactId()); Buff.setRequiredContactListId(createdBuff.getRequiredContactListId()); Buff.setOptionalISOTimezoneId(createdBuff.getOptionalISOTimezoneId()); Buff.setRequiredFullName(createdBuff.getRequiredFullName()); Buff.setOptionalLastName(createdBuff.getOptionalLastName()); Buff.setOptionalFirstName(createdBuff.getOptionalFirstName()); Buff.setOptionalCustom(createdBuff.getOptionalCustom()); Buff.setOptionalCustom2(createdBuff.getOptionalCustom2()); Buff.setOptionalCustom3(createdBuff.getOptionalCustom3()); Buff.setRequiredRevision(createdBuff.getRequiredRevision()); Buff.setCreatedByUserId(createdBuff.getCreatedByUserId()); Buff.setCreatedAt(createdBuff.getCreatedAt()); Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId()); Buff.setUpdatedAt(createdBuff.getUpdatedAt()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlContactTable.java
public void createContact(CFAccAuthorization Authorization, CFAccContactBuff Buff) { final String S_ProcName = "createContact"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }// ww w . j a v a 2s .co m ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); long ContactListId = Buff.getRequiredContactListId(); Short ISOTimezoneId = Buff.getOptionalISOTimezoneId(); String FullName = Buff.getRequiredFullName(); String LastName = Buff.getOptionalLastName(); String FirstName = Buff.getOptionalFirstName(); String Custom = Buff.getOptionalCustom(); String Custom2 = Buff.getOptionalCustom2(); String Custom3 = Buff.getOptionalCustom3(); Connection cnx = schema.getCnx(); String sql = "exec sp_create_contact ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtCreateByPKey.setString(argIdx++, "CTC"); stmtCreateByPKey.setLong(argIdx++, TenantId); stmtCreateByPKey.setLong(argIdx++, ContactListId); if (ISOTimezoneId != null) { stmtCreateByPKey.setShort(argIdx++, ISOTimezoneId.shortValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtCreateByPKey.setString(argIdx++, FullName); if (LastName != null) { stmtCreateByPKey.setString(argIdx++, LastName); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (FirstName != null) { stmtCreateByPKey.setString(argIdx++, FirstName); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom != null) { stmtCreateByPKey.setString(argIdx++, Custom); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom2 != null) { stmtCreateByPKey.setString(argIdx++, Custom2); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom3 != null) { stmtCreateByPKey.setString(argIdx++, Custom3); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } stmtCreateByPKey.execute(); boolean moreResults = true; resultSet = null; while (resultSet == null) { try { moreResults = stmtCreateByPKey.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { resultSet = stmtCreateByPKey.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtCreateByPKey.getUpdateCount()) { break; } } if (resultSet == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "resultSet"); } if (resultSet.next()) { CFAccContactBuff createdBuff = unpackContactResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredTenantId(createdBuff.getRequiredTenantId()); Buff.setRequiredContactId(createdBuff.getRequiredContactId()); Buff.setRequiredContactListId(createdBuff.getRequiredContactListId()); Buff.setOptionalISOTimezoneId(createdBuff.getOptionalISOTimezoneId()); Buff.setRequiredFullName(createdBuff.getRequiredFullName()); Buff.setOptionalLastName(createdBuff.getOptionalLastName()); Buff.setOptionalFirstName(createdBuff.getOptionalFirstName()); Buff.setOptionalCustom(createdBuff.getOptionalCustom()); Buff.setOptionalCustom2(createdBuff.getOptionalCustom2()); Buff.setOptionalCustom3(createdBuff.getOptionalCustom3()); Buff.setRequiredRevision(createdBuff.getRequiredRevision()); Buff.setCreatedByUserId(createdBuff.getCreatedByUserId()); Buff.setCreatedAt(createdBuff.getCreatedAt()); Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId()); Buff.setUpdatedAt(createdBuff.getUpdatedAt()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlContactTable.java
public void createContact(CFAccAuthorization Authorization, CFAccContactBuff Buff) { final String S_ProcName = "createContact"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from www . jav a 2 s .co m*/ ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); long ContactListId = Buff.getRequiredContactListId(); Short ISOTimezoneId = Buff.getOptionalISOTimezoneId(); String FullName = Buff.getRequiredFullName(); String LastName = Buff.getOptionalLastName(); String FirstName = Buff.getOptionalFirstName(); String Custom = Buff.getOptionalCustom(); String Custom2 = Buff.getOptionalCustom2(); String Custom3 = Buff.getOptionalCustom3(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerSchemaDbName() + ".sp_create_contact( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtCreateByPKey.setString(argIdx++, "CTC"); stmtCreateByPKey.setLong(argIdx++, TenantId); stmtCreateByPKey.setLong(argIdx++, ContactListId); if (ISOTimezoneId != null) { stmtCreateByPKey.setShort(argIdx++, ISOTimezoneId.shortValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtCreateByPKey.setString(argIdx++, FullName); if (LastName != null) { stmtCreateByPKey.setString(argIdx++, LastName); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (FirstName != null) { stmtCreateByPKey.setString(argIdx++, FirstName); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom != null) { stmtCreateByPKey.setString(argIdx++, Custom); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom2 != null) { stmtCreateByPKey.setString(argIdx++, Custom2); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom3 != null) { stmtCreateByPKey.setString(argIdx++, Custom3); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } try { resultSet = stmtCreateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFAccContactBuff createdBuff = unpackContactResultSetToBuff(resultSet); if ((resultSet != null) && resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredTenantId(createdBuff.getRequiredTenantId()); Buff.setRequiredContactId(createdBuff.getRequiredContactId()); Buff.setRequiredContactListId(createdBuff.getRequiredContactListId()); Buff.setOptionalISOTimezoneId(createdBuff.getOptionalISOTimezoneId()); Buff.setRequiredFullName(createdBuff.getRequiredFullName()); Buff.setOptionalLastName(createdBuff.getOptionalLastName()); Buff.setOptionalFirstName(createdBuff.getOptionalFirstName()); Buff.setOptionalCustom(createdBuff.getOptionalCustom()); Buff.setOptionalCustom2(createdBuff.getOptionalCustom2()); Buff.setOptionalCustom3(createdBuff.getOptionalCustom3()); Buff.setRequiredRevision(createdBuff.getRequiredRevision()); Buff.setCreatedByUserId(createdBuff.getCreatedByUserId()); Buff.setCreatedAt(createdBuff.getCreatedAt()); Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId()); Buff.setUpdatedAt(createdBuff.getUpdatedAt()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccPgSql.CFAccPgSqlContactTable.java
public void createContact(CFAccAuthorization Authorization, CFAccContactBuff Buff) { final String S_ProcName = "createContact"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from w w w. ja v a2 s . com*/ ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); long ContactListId = Buff.getRequiredContactListId(); Short ISOTimezoneId = Buff.getOptionalISOTimezoneId(); String FullName = Buff.getRequiredFullName(); String LastName = Buff.getOptionalLastName(); String FirstName = Buff.getOptionalFirstName(); String Custom = Buff.getOptionalCustom(); String Custom2 = Buff.getOptionalCustom2(); String Custom3 = Buff.getOptionalCustom3(); Connection cnx = schema.getCnx(); String sql = "select * from " + schema.getLowerSchemaDbName() + ".sp_create_contact( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtCreateByPKey.setString(argIdx++, "CTC"); stmtCreateByPKey.setLong(argIdx++, TenantId); stmtCreateByPKey.setLong(argIdx++, ContactListId); if (ISOTimezoneId != null) { stmtCreateByPKey.setShort(argIdx++, ISOTimezoneId.shortValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtCreateByPKey.setString(argIdx++, FullName); if (LastName != null) { stmtCreateByPKey.setString(argIdx++, LastName); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (FirstName != null) { stmtCreateByPKey.setString(argIdx++, FirstName); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom != null) { stmtCreateByPKey.setString(argIdx++, Custom); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom2 != null) { stmtCreateByPKey.setString(argIdx++, Custom2); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom3 != null) { stmtCreateByPKey.setString(argIdx++, Custom3); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } resultSet = stmtCreateByPKey.executeQuery(); if (resultSet.next()) { CFAccContactBuff createdBuff = unpackContactResultSetToBuff(resultSet); if (resultSet.next()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response"); } Buff.setRequiredTenantId(createdBuff.getRequiredTenantId()); Buff.setRequiredContactId(createdBuff.getRequiredContactId()); Buff.setRequiredContactListId(createdBuff.getRequiredContactListId()); Buff.setOptionalISOTimezoneId(createdBuff.getOptionalISOTimezoneId()); Buff.setRequiredFullName(createdBuff.getRequiredFullName()); Buff.setOptionalLastName(createdBuff.getOptionalLastName()); Buff.setOptionalFirstName(createdBuff.getOptionalFirstName()); Buff.setOptionalCustom(createdBuff.getOptionalCustom()); Buff.setOptionalCustom2(createdBuff.getOptionalCustom2()); Buff.setOptionalCustom3(createdBuff.getOptionalCustom3()); Buff.setRequiredRevision(createdBuff.getRequiredRevision()); Buff.setCreatedByUserId(createdBuff.getCreatedByUserId()); Buff.setCreatedAt(createdBuff.getCreatedAt()); Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId()); Buff.setUpdatedAt(createdBuff.getUpdatedAt()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbPgSql.CFGenKbPgSqlNmTokenFormatterTable.java
public CFGenKbNmTokenFormatterBuff readBuffByAltIdx(CFGenKbAuthorization Authorization, String Name, short ToolSetId, Short ScopeDefId, short GenDefId) { final String S_ProcName = "readBuffByAltIdx"; ResultSet resultSet = null;/*from w ww .j ava 2 s . c o m*/ try { Connection cnx = schema.getCnx(); String sql = "SELECT * FROM " + schema.getLowerSchemaDbName() + ".sp_read_kbnmtokenfmt_by_altidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtReadBuffByAltIdx == null) { stmtReadBuffByAltIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByAltIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByAltIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByAltIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByAltIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByAltIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByAltIdx.setString(argIdx++, Name); stmtReadBuffByAltIdx.setShort(argIdx++, ToolSetId); if (ScopeDefId != null) { stmtReadBuffByAltIdx.setShort(argIdx++, ScopeDefId.shortValue()); } else { stmtReadBuffByAltIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtReadBuffByAltIdx.setShort(argIdx++, GenDefId); resultSet = stmtReadBuffByAltIdx.executeQuery(); if (resultSet.next()) { CFGenKbNmTokenFormatterBuff buff = unpackNmTokenFormatterResultSetToBuff(resultSet); if (resultSet.next()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response"); } return (buff); } else { return (null); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbPgSql.CFGenKbPgSqlNmTokenFormatterTable.java
public void deleteNmTokenFormatterByAltIdx(CFGenKbAuthorization Authorization, String argName, short argToolSetId, Short argScopeDefId, short argGenDefId) { final String S_ProcName = "deleteNmTokenFormatterByAltIdx"; ResultSet resultSet = null;/* w ww . j av a 2 s . com*/ try { Connection cnx = schema.getCnx(); String sql = "SELECT " + schema.getLowerSchemaDbName() + ".sp_delete_kbnmtokenfmt_by_altidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ) as DeletedFlag"; if (stmtDeleteByAltIdx == null) { stmtDeleteByAltIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByAltIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByAltIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByAltIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByAltIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByAltIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByAltIdx.setString(argIdx++, argName); stmtDeleteByAltIdx.setShort(argIdx++, argToolSetId); if (argScopeDefId != null) { stmtDeleteByAltIdx.setShort(argIdx++, argScopeDefId.shortValue()); } else { stmtDeleteByAltIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtDeleteByAltIdx.setShort(argIdx++, argGenDefId); resultSet = stmtDeleteByAltIdx.executeQuery(); if (resultSet.next()) { boolean deleteFlag = resultSet.getBoolean(1); if (resultSet.next()) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response"); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWContactTable.java
public void updateContact(CFCrmAuthorization Authorization, CFCrmContactBuff Buff) { final String S_ProcName = "updateContact"; if ("CTC".equals(Buff.getClassCode()) && (!schema.isTenantUser(Authorization, Buff.getRequiredTenantId(), "UpdateContact"))) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Permission denied -- User not part of TSecGroup UpdateContact"); }// ww w . jav a 2 s .c om ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); long ContactId = Buff.getRequiredContactId(); long ContactListId = Buff.getRequiredContactListId(); Short ISOTimezoneId = Buff.getOptionalISOTimezoneId(); String FullName = Buff.getRequiredFullName(); String LastName = Buff.getOptionalLastName(); String FirstName = Buff.getOptionalFirstName(); String Custom = Buff.getOptionalCustom(); String Custom2 = Buff.getOptionalCustom2(); String Custom3 = Buff.getOptionalCustom3(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); final String sql = "CALL sp_update_contact( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtUpdateByPKey == null) { stmtUpdateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtUpdateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtUpdateByPKey.setString(argIdx++, "CTC"); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, ContactId); stmtUpdateByPKey.setLong(argIdx++, ContactListId); if (ISOTimezoneId != null) { stmtUpdateByPKey.setShort(argIdx++, ISOTimezoneId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtUpdateByPKey.setString(argIdx++, FullName); if (LastName != null) { stmtUpdateByPKey.setString(argIdx++, LastName); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (FirstName != null) { stmtUpdateByPKey.setString(argIdx++, FirstName); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom != null) { stmtUpdateByPKey.setString(argIdx++, Custom); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom2 != null) { stmtUpdateByPKey.setString(argIdx++, Custom2); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom3 != null) { stmtUpdateByPKey.setString(argIdx++, Custom3); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } stmtUpdateByPKey.setInt(argIdx++, Revision); resultSet = stmtUpdateByPKey.executeQuery(); if (resultSet.next()) { CFCrmContactBuff updatedBuff = unpackContactResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredContactListId(updatedBuff.getRequiredContactListId()); Buff.setOptionalISOTimezoneId(updatedBuff.getOptionalISOTimezoneId()); Buff.setRequiredFullName(updatedBuff.getRequiredFullName()); Buff.setOptionalLastName(updatedBuff.getOptionalLastName()); Buff.setOptionalFirstName(updatedBuff.getOptionalFirstName()); Buff.setOptionalCustom(updatedBuff.getOptionalCustom()); Buff.setOptionalCustom2(updatedBuff.getOptionalCustom2()); Buff.setOptionalCustom3(updatedBuff.getOptionalCustom3()); Buff.setRequiredRevision(updatedBuff.getRequiredRevision()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWContactTable.java
public void updateContact(CFAccAuthorization Authorization, CFAccContactBuff Buff) { final String S_ProcName = "updateContact"; if ("CTC".equals(Buff.getClassCode()) && (!schema.isTenantUser(Authorization, Buff.getRequiredTenantId(), "UpdateContact"))) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Permission denied -- User not part of TSecGroup UpdateContact"); }/* w w w .j a v a2s . co m*/ ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); long ContactId = Buff.getRequiredContactId(); long ContactListId = Buff.getRequiredContactListId(); Short ISOTimezoneId = Buff.getOptionalISOTimezoneId(); String FullName = Buff.getRequiredFullName(); String LastName = Buff.getOptionalLastName(); String FirstName = Buff.getOptionalFirstName(); String Custom = Buff.getOptionalCustom(); String Custom2 = Buff.getOptionalCustom2(); String Custom3 = Buff.getOptionalCustom3(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); final String sql = "CALL sp_update_contact( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtUpdateByPKey == null) { stmtUpdateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtUpdateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtUpdateByPKey.setString(argIdx++, "CTC"); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, ContactId); stmtUpdateByPKey.setLong(argIdx++, ContactListId); if (ISOTimezoneId != null) { stmtUpdateByPKey.setShort(argIdx++, ISOTimezoneId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtUpdateByPKey.setString(argIdx++, FullName); if (LastName != null) { stmtUpdateByPKey.setString(argIdx++, LastName); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (FirstName != null) { stmtUpdateByPKey.setString(argIdx++, FirstName); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom != null) { stmtUpdateByPKey.setString(argIdx++, Custom); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom2 != null) { stmtUpdateByPKey.setString(argIdx++, Custom2); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom3 != null) { stmtUpdateByPKey.setString(argIdx++, Custom3); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } stmtUpdateByPKey.setInt(argIdx++, Revision); resultSet = stmtUpdateByPKey.executeQuery(); if (resultSet.next()) { CFAccContactBuff updatedBuff = unpackContactResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredContactListId(updatedBuff.getRequiredContactListId()); Buff.setOptionalISOTimezoneId(updatedBuff.getOptionalISOTimezoneId()); Buff.setRequiredFullName(updatedBuff.getRequiredFullName()); Buff.setOptionalLastName(updatedBuff.getOptionalLastName()); Buff.setOptionalFirstName(updatedBuff.getOptionalFirstName()); Buff.setOptionalCustom(updatedBuff.getOptionalCustom()); Buff.setOptionalCustom2(updatedBuff.getOptionalCustom2()); Buff.setOptionalCustom3(updatedBuff.getOptionalCustom3()); Buff.setRequiredRevision(updatedBuff.getRequiredRevision()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMySql.CFCrmMySqlContactTable.java
public void updateContact(CFCrmAuthorization Authorization, CFCrmContactBuff Buff) { final String S_ProcName = "updateContact"; ResultSet resultSet = null;//from w w w . ja v a 2s. c o m try { long TenantId = Buff.getRequiredTenantId(); long ContactId = Buff.getRequiredContactId(); long ContactListId = Buff.getRequiredContactListId(); Short ISOTimezoneId = Buff.getOptionalISOTimezoneId(); String FullName = Buff.getRequiredFullName(); String LastName = Buff.getOptionalLastName(); String FirstName = Buff.getOptionalFirstName(); String Custom = Buff.getOptionalCustom(); String Custom2 = Buff.getOptionalCustom2(); String Custom3 = Buff.getOptionalCustom3(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_contact( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtUpdateByPKey == null) { stmtUpdateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtUpdateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtUpdateByPKey.setString(argIdx++, "CTC"); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, ContactId); stmtUpdateByPKey.setLong(argIdx++, ContactListId); if (ISOTimezoneId != null) { stmtUpdateByPKey.setShort(argIdx++, ISOTimezoneId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtUpdateByPKey.setString(argIdx++, FullName); if (LastName != null) { stmtUpdateByPKey.setString(argIdx++, LastName); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (FirstName != null) { stmtUpdateByPKey.setString(argIdx++, FirstName); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom != null) { stmtUpdateByPKey.setString(argIdx++, Custom); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom2 != null) { stmtUpdateByPKey.setString(argIdx++, Custom2); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } if (Custom3 != null) { stmtUpdateByPKey.setString(argIdx++, Custom3); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFCrmContactBuff updatedBuff = unpackContactResultSetToBuff(resultSet); if ((resultSet != null) && resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredContactListId(updatedBuff.getRequiredContactListId()); Buff.setOptionalISOTimezoneId(updatedBuff.getOptionalISOTimezoneId()); Buff.setRequiredFullName(updatedBuff.getRequiredFullName()); Buff.setOptionalLastName(updatedBuff.getOptionalLastName()); Buff.setOptionalFirstName(updatedBuff.getOptionalFirstName()); Buff.setOptionalCustom(updatedBuff.getOptionalCustom()); Buff.setOptionalCustom2(updatedBuff.getOptionalCustom2()); Buff.setOptionalCustom3(updatedBuff.getOptionalCustom3()); Buff.setRequiredRevision(updatedBuff.getRequiredRevision()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }