public CFSecurityISOCountryCurrencyBuff lockBuff( CFSecurityAuthorization Authorization, CFSecurityISOCountryCurrencyPKey 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(); short ISOCountryId = PKey.getRequiredISOCountryId(); short ISOCurrencyId = PKey.getRequiredISOCurrencyId(); final String sql = "CALL sp_lock_iso_cntryccy( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; 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.setShort(argIdx++, ISOCountryId); stmtLockBuffByPKey.setShort(argIdx++, ISOCurrencyId); resultSet = stmtLockBuffByPKey.executeQuery(); if (resultSet.next()) { CFSecurityISOCountryCurrencyBuff buff = unpackISOCountryCurrencyResultSetToBuff(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 startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFAsteriskXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; String attrRevision = null; // Primary Key Attributes for Constant Enum support String attrISOCountryId = null; String attrISOCurrencyId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstISOCountryCurrencyDelete"); CFAsteriskXMsgRqstHandler xmsgRqstHandler = (CFAsteriskXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFAsteriskSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFSecurityISOCountryCurrencyPKey pkey = ((ICFAsteriskSchema) schemaObj.getBackingStore()) .getFactoryISOCountryCurrency() .newPKey(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOCountryId")) { if (attrISOCountryId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCountryId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOCurrencyId")) { if (attrISOCurrencyId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOCurrencyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory() .newUnrecognizedAttributeException( getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrISOCountryId == null) || (attrISOCountryId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOCountryId"); } if ((attrISOCurrencyId == null) || (attrISOCurrencyId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "ISOCurrencyId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. short natISOCountryId; natISOCountryId = Short.parseShort(attrISOCountryId); pkey.setRequiredISOCountryId(natISOCountryId); pkey.setRequiredISOCountryId(natISOCountryId); short natISOCurrencyId; natISOCurrencyId = Short.parseShort(attrISOCurrencyId); pkey.setRequiredISOCurrencyId(natISOCurrencyId); pkey.setRequiredISOCurrencyId(natISOCurrencyId); int natRevision = Integer.parseInt(attrRevision); // Delete the object ICFAsteriskISOCountryCurrencyObj read = ((ICFAsteriskISOCountryCurrencyObj) schemaObj.getISOCountryCurrencyTableObj().readISOCountryCurrency(pkey)); if (read != null) { if (read.getISOCountryCurrencyBuff().getRequiredRevision() > natRevision) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException( getClass(), S_ProcName, "Collision detected preparing to delete ISOCountryCurrency"); } else { ICFAsteriskISOCountryCurrencyEditObj editBuff = (ICFAsteriskISOCountryCurrencyEditObj) read.beginEdit(); if (editBuff != null) { editBuff.delete(); editBuff.endEdit(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgISOCountryCurrencyMessageFormatter .formatISOCountryCurrencyRspnDeleted() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFAsteriskXMsgRqstHandler) getParser()).appendResponse(response); } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "read.beginEdit()"); } } } else { String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFAsteriskXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
public void deleteISOCountryCurrencyByIdIdx( CFSecurityAuthorization Authorization, CFSecurityISOCountryCurrencyPKey argKey) { deleteISOCountryCurrencyByIdIdx( Authorization, argKey.getRequiredISOCountryId(), argKey.getRequiredISOCurrencyId()); }