public void deleteISOCountryCurrencyByIdIdx(short ISOCountryId, short ISOCurrencyId) { CFSecurityISOCountryCurrencyPKey pkey = ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountryCurrency().newPKey(); pkey.setRequiredISOCountryId(ISOCountryId); pkey.setRequiredISOCurrencyId(ISOCurrencyId); ICFSecurityISOCountryCurrencyObj obj = readISOCountryCurrency(pkey); if (obj != null) { ICFSecurityISOCountryCurrencyEditObj editObj = (ICFSecurityISOCountryCurrencyEditObj) obj.getEdit(); boolean editStarted; if (editObj == null) { editObj = (ICFSecurityISOCountryCurrencyEditObj) obj.beginEdit(); if (editObj != null) { editStarted = true; } else { editStarted = false; } } else { editStarted = false; } if (editObj != null) { editObj.delete(); if (editStarted) { editObj.endEdit(); } } obj.forget(true); } }
public ICFSecurityISOCountryCurrencyObj readISOCountryCurrencyByIdIdx( short ISOCountryId, short ISOCurrencyId, boolean forceRead) { CFSecurityISOCountryCurrencyPKey pkey = ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountryCurrency().newPKey(); pkey.setRequiredISOCountryId(ISOCountryId); pkey.setRequiredISOCurrencyId(ISOCurrencyId); ICFSecurityISOCountryCurrencyObj obj = readISOCountryCurrency(pkey, forceRead); return (obj); }
public void forgetISOCountryCurrencyByIdIdx(short ISOCountryId, short ISOCurrencyId) { if (members == null) { return; } CFSecurityISOCountryCurrencyPKey key = ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountryCurrency().newPKey(); key.setRequiredISOCountryId(ISOCountryId); key.setRequiredISOCurrencyId(ISOCurrencyId); if (members.containsKey(key)) { ICFSecurityISOCountryCurrencyObj probed = members.get(key); if (probed != null) { probed.forget(true); } } }
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); } }