public static String formatISOTimezoneBuffAttributes( String separator, CFSecurityISOTimezoneBuff buff) { String retval = CFAccXMsgISOTimezoneMessageFormatter.formatISOTimezonePKeyAttributes(separator, buff) + CFLibXmlUtil.formatRequiredInt32(separator, "Revision", buff.getRequiredRevision()) + CFLibXmlUtil.formatOptionalUuid(separator, "CreatedBy", buff.getCreatedByUserId()) + CFLibXmlUtil.formatOptionalTimestamp(separator, "CreatedAt", buff.getCreatedAt()) + CFLibXmlUtil.formatOptionalUuid(separator, "UpdatedBy", buff.getUpdatedByUserId()) + CFLibXmlUtil.formatOptionalTimestamp(separator, "UpdatedAt", buff.getUpdatedAt()) + CFLibXmlUtil.formatRequiredXmlString(separator, "Iso8601", buff.getRequiredIso8601()) + CFLibXmlUtil.formatRequiredXmlString(separator, "TZName", buff.getRequiredTZName()) + CFLibXmlUtil.formatRequiredInt16( separator, "TZHourOffset", buff.getRequiredTZHourOffset()) + CFLibXmlUtil.formatRequiredInt16( separator, "TZMinOffset", buff.getRequiredTZMinOffset()) + CFLibXmlUtil.formatRequiredXmlString( separator, "Description", buff.getRequiredDescription()) + CFLibXmlUtil.formatRequiredBoolean(separator, "Visible", buff.getRequiredVisible()); return (retval); }
public void createISOTimezone( CFSecurityAuthorization Authorization, CFSecurityISOTimezoneBuff Buff) { final String S_ProcName = "createISOTimezone"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { short ISOTimezoneId = Buff.getRequiredISOTimezoneId(); String Iso8601 = Buff.getRequiredIso8601(); String TZName = Buff.getRequiredTZName(); short TZHourOffset = Buff.getRequiredTZHourOffset(); short TZMinOffset = Buff.getRequiredTZMinOffset(); String Description = Buff.getRequiredDescription(); boolean Visible = Buff.getRequiredVisible(); Connection cnx = schema.getCnx(); String sql = "exec sp_create_isotz ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"; 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++, "ITZN"); stmtCreateByPKey.setShort(argIdx++, ISOTimezoneId); stmtCreateByPKey.setString(argIdx++, Iso8601); stmtCreateByPKey.setString(argIdx++, TZName); stmtCreateByPKey.setShort(argIdx++, TZHourOffset); stmtCreateByPKey.setShort(argIdx++, TZMinOffset); stmtCreateByPKey.setString(argIdx++, Description); if (Visible) { stmtCreateByPKey.setString(argIdx++, "Y"); } else { stmtCreateByPKey.setString(argIdx++, "N"); } 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()) { CFSecurityISOTimezoneBuff createdBuff = unpackISOTimezoneResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredISOTimezoneId(createdBuff.getRequiredISOTimezoneId()); Buff.setRequiredIso8601(createdBuff.getRequiredIso8601()); Buff.setRequiredTZName(createdBuff.getRequiredTZName()); Buff.setRequiredTZHourOffset(createdBuff.getRequiredTZHourOffset()); Buff.setRequiredTZMinOffset(createdBuff.getRequiredTZMinOffset()); Buff.setRequiredDescription(createdBuff.getRequiredDescription()); Buff.setRequiredVisible(createdBuff.getRequiredVisible()); 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; } } }