public CFInternetTopDomainBuff lockBuff( CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); long TenantId = PKey.getRequiredTenantId(); long Id = PKey.getRequiredId(); final String sql = "CALL sp_lock_tdomdef( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtLockBuffByPKey == null) { stmtLockBuffByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtLockBuffByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtLockBuffByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtLockBuffByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtLockBuffByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtLockBuffByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtLockBuffByPKey.setLong(argIdx++, TenantId); stmtLockBuffByPKey.setLong(argIdx++, Id); resultSet = stmtLockBuffByPKey.executeQuery(); if (resultSet.next()) { CFInternetTopDomainBuff buff = unpackTopDomainResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } 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; } } }
public CFInternetTopDomainBuff[] readAllBuff(CFSecurityAuthorization Authorization) { final String S_ProcName = "readAllBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_tdomdef_all( ?, ?, ?, ?, ? )"; if (stmtReadAllBuff == null) { stmtReadAllBuff = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadAllBuff.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadAllBuff.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadAllBuff.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadAllBuff.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadAllBuff.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); resultSet = stmtReadAllBuff.executeQuery(); List<CFInternetTopDomainBuff> buffList = new LinkedList<CFInternetTopDomainBuff>(); while (resultSet.next()) { CFInternetTopDomainBuff buff = unpackTopDomainResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFInternetTopDomainBuff[] retBuff = new CFInternetTopDomainBuff[buffList.size()]; Iterator<CFInternetTopDomainBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
public String getSqlSelectTopDomainDistinctClassCode() { if (S_sqlSelectTopDomainDistinctClassCode == null) { S_sqlSelectTopDomainDistinctClassCode = "SELECT " + "DISTINCT bdom.ClassCode " + "FROM " + schema.getLowerDbSchemaName() + ".bdomdef AS bdom " + "INNER JOIN " + schema.getLowerDbSchemaName() + ".tdomdef tdom ON " + "tdom.TenantId = bdom.TenantId " + "AND tdom.Id = bdom.Id "; } return (S_sqlSelectTopDomainDistinctClassCode); }
public CFInternetTopDomainBuff readBuffByNameIdx( CFSecurityAuthorization Authorization, long TenantId, long TldId, String Name) { final String S_ProcName = "readBuffByNameIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_read_tdomdef_by_nameidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtReadBuffByNameIdx == null) { stmtReadBuffByNameIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByNameIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByNameIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByNameIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByNameIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByNameIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByNameIdx.setLong(argIdx++, TenantId); stmtReadBuffByNameIdx.setLong(argIdx++, TldId); stmtReadBuffByNameIdx.setString(argIdx++, Name); resultSet = stmtReadBuffByNameIdx.executeQuery(); if (resultSet.next()) { CFInternetTopDomainBuff buff = unpackTopDomainResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } 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; } } }
public void deleteTopDomain(CFSecurityAuthorization Authorization, CFInternetTopDomainBuff Buff) { final String S_ProcName = "deleteTopDomain"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); long TenantId = Buff.getRequiredTenantId(); long Id = Buff.getRequiredId(); final String sql = "CALL sp_delete_tdomdef( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtDeleteByPKey == null) { stmtDeleteByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setLong(argIdx++, TenantId); stmtDeleteByPKey.setLong(argIdx++, Id); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; resultSet = stmtDeleteByPKey.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } 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; } } }
public CFInternetTopDomainBuff[] readAllDerived(CFSecurityAuthorization Authorization) { final String S_ProcName = "readAllDerived"; CFInternetTopDomainBuff[] buffArray; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } buffArray = readAllBuff(Authorization); return (buffArray); }
public CFInternetTopDomainBuff[] readDerivedByTldIdx( CFSecurityAuthorization Authorization, long TenantId, long TldId) { final String S_ProcName = "readDerivedByTldIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFInternetTopDomainBuff[] buffList = readBuffByTldIdx(Authorization, TenantId, TldId); return (buffList); }
public CFSecurityAuditActionBuff readDerivedByUDescrIdx( CFSecurityAuthorization Authorization, String Description) { final String S_ProcName = "CFDbTestDb2LUWAuditActionTable.readDerivedByUDescrIdx() "; CFSecurityAuditActionBuff buff; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } buff = readBuffByUDescrIdx(Authorization, Description); return (buff); }
public CFSecurityAuditActionBuff readDerived( CFSecurityAuthorization Authorization, CFSecurityAuditActionPKey PKey) { final String S_ProcName = "readDerived"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFSecurityAuditActionBuff buff; buff = readBuff(Authorization, PKey); return (buff); }
public CFInternetTopDomainBuff lockDerived( CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "lockDerived"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFInternetTopDomainBuff buff; buff = lockBuff(Authorization, PKey); return (buff); }
public String getSqlSelectAuditActionDistinctClassCode() { if (S_sqlSelectAuditActionDistinctClassCode == null) { S_sqlSelectAuditActionDistinctClassCode = "SELECT " + "DISTINCT audt.ClassCode " + "FROM " + schema.getLowerDbSchemaName() + ".AuditAction AS audt "; } return (S_sqlSelectAuditActionDistinctClassCode); }
public CFInternetTopDomainBuff readDerivedByNameIdx( CFSecurityAuthorization Authorization, long TenantId, long TldId, String Name) { final String S_ProcName = "CFDbTestDb2LUWTopDomainTable.readDerivedByNameIdx() "; CFInternetTopDomainBuff buff; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } buff = readBuffByNameIdx(Authorization, TenantId, TldId, Name); return (buff); }
public void deleteAuditActionByUDescrIdx( CFSecurityAuthorization Authorization, String argDescription) { final String S_ProcName = "deleteAuditActionByUDescrIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_auditaction_by_udescridx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtDeleteByUDescrIdx == null) { stmtDeleteByUDescrIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByUDescrIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByUDescrIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByUDescrIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByUDescrIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByUDescrIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByUDescrIdx.setString(argIdx++, argDescription); resultSet = stmtDeleteByUDescrIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } 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; } } }
public String getSqlSelectTopDomainBuff() { if (S_sqlSelectTopDomainBuff == null) { S_sqlSelectTopDomainBuff = "SELECT " + "bdom.ClassCode, " + "bdom.TenantId, " + "bdom.Id, " + "bdom.descr, " + "tdom.TldId, " + "tdom.Name, " + "bdom.Revision " + "FROM " + schema.getLowerDbSchemaName() + ".bdomdef AS bdom " + "INNER JOIN " + schema.getLowerDbSchemaName() + ".tdomdef tdom ON " + "tdom.TenantId = bdom.TenantId " + "AND tdom.Id = bdom.Id "; } return (S_sqlSelectTopDomainBuff); }
public String getSqlSelectAuditActionBuff() { if (S_sqlSelectAuditActionBuff == null) { S_sqlSelectAuditActionBuff = "SELECT " + "audt.AuditActionId, " + "audt.Description, " + "audt.Revision " + "FROM " + schema.getLowerDbSchemaName() + ".AuditAction AS audt "; } return (S_sqlSelectAuditActionBuff); }
protected CFSecurityAuditActionBuff unpackAuditActionResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackAuditActionResultSetToBuff"; int idxcol = 1; CFSecurityAuditActionBuff buff = schema.getFactoryAuditAction().newBuff(); buff.setRequiredAuditActionId( CFSecuritySchema.ordinalToAuditActionEnum(resultSet.getShort(idxcol))); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
protected CFInternetTopDomainBuff unpackTopDomainResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackTopDomainResultSetToBuff"; int idxcol = 1; String classCode = resultSet.getString(idxcol); idxcol++; CFInternetTopDomainBuff buff; if (classCode.equals("TDOM")) { buff = schema.getFactoryTopDomain().newBuff(); } else { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Unrecognized class code \"" + classCode + "\""); } { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFDbTestDb2LUWSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFDbTestDb2LUWSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredTenantId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredId(resultSet.getLong(idxcol)); idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalDescription(null); } else { buff.setOptionalDescription(colVal); } } idxcol++; buff.setRequiredTldId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
public void updateTopDomain(CFSecurityAuthorization Authorization, CFInternetTopDomainBuff Buff) { final String S_ProcName = "updateTopDomain"; if ("TDOM".equals(Buff.getClassCode()) && (!schema.isTenantUser(Authorization, Buff.getRequiredTenantId(), "UpdateTopDomain"))) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Permission denied -- User not part of TSecGroup UpdateTopDomain"); } ResultSet resultSet = null; try { String ClassCode = Buff.getClassCode(); long TenantId = Buff.getRequiredTenantId(); long Id = Buff.getRequiredId(); String Description = Buff.getOptionalDescription(); long TldId = Buff.getRequiredTldId(); String Name = Buff.getRequiredName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); final String sql = "CALL sp_update_tdomdef( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, ClassCode); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, Id); if (Description != null) { stmtUpdateByPKey.setString(argIdx++, Description); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR); } stmtUpdateByPKey.setLong(argIdx++, TldId); stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setInt(argIdx++, Revision); resultSet = stmtUpdateByPKey.executeQuery(); if (resultSet.next()) { CFInternetTopDomainBuff updatedBuff = unpackTopDomainResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setOptionalDescription(updatedBuff.getOptionalDescription()); Buff.setRequiredTldId(updatedBuff.getRequiredTldId()); Buff.setRequiredName(updatedBuff.getRequiredName()); 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; } } }
public void createAuditAction( CFSecurityAuthorization Authorization, CFSecurityAuditActionBuff Buff) { final String S_ProcName = "createAuditAction"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { ICFSecuritySchema.AuditActionEnum AuditActionId = Buff.getRequiredAuditActionId(); String Description = Buff.getRequiredDescription(); Connection cnx = schema.getCnx(); final String sql = "CALL sp_create_auditaction( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; 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++, "AUDT"); stmtCreateByPKey.setShort(argIdx++, (short) AuditActionId.ordinal()); stmtCreateByPKey.setString(argIdx++, Description); resultSet = stmtCreateByPKey.executeQuery(); if (resultSet.next()) { CFSecurityAuditActionBuff createdBuff = unpackAuditActionResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredAuditActionId(createdBuff.getRequiredAuditActionId()); Buff.setRequiredDescription(createdBuff.getRequiredDescription()); Buff.setRequiredRevision(createdBuff.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; } } }