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 updateISOTimezone( CFSecurityAuthorization Authorization, CFSecurityISOTimezoneBuff Buff) { final String S_ProcName = "updateISOTimezone"; 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(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "exec sp_update_isotz ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"; 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++, "ITZN"); stmtUpdateByPKey.setShort(argIdx++, ISOTimezoneId); stmtUpdateByPKey.setString(argIdx++, Iso8601); stmtUpdateByPKey.setString(argIdx++, TZName); stmtUpdateByPKey.setShort(argIdx++, TZHourOffset); stmtUpdateByPKey.setShort(argIdx++, TZMinOffset); stmtUpdateByPKey.setString(argIdx++, Description); if (Visible) { stmtUpdateByPKey.setString(argIdx++, "Y"); } else { stmtUpdateByPKey.setString(argIdx++, "N"); } stmtUpdateByPKey.setInt(argIdx++, Revision); stmtUpdateByPKey.execute(); boolean moreResults = true; resultSet = null; while (resultSet == null) { try { moreResults = stmtUpdateByPKey.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { resultSet = stmtUpdateByPKey.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtUpdateByPKey.getUpdateCount()) { break; } } if (resultSet == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "resultSet"); } if (resultSet.next()) { CFSecurityISOTimezoneBuff updatedBuff = 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.setRequiredIso8601(updatedBuff.getRequiredIso8601()); Buff.setRequiredTZName(updatedBuff.getRequiredTZName()); Buff.setRequiredTZHourOffset(updatedBuff.getRequiredTZHourOffset()); Buff.setRequiredTZMinOffset(updatedBuff.getRequiredTZMinOffset()); Buff.setRequiredDescription(updatedBuff.getRequiredDescription()); Buff.setRequiredVisible(updatedBuff.getRequiredVisible()); 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; } } }