public CFGenKbISOCountryCurrencyBuff[] readDerivedByCurrencyIdx( CFGenKbAuthorization Authorization, short ISOCurrencyId) { final String S_ProcName = "CFGenKbRamISOCountryCurrency.readDerivedByCurrencyIdx() "; CFGenKbISOCountryCurrencyByCurrencyIdxKey key = schema.getFactoryISOCountryCurrency().newCurrencyIdxKey(); key.setRequiredISOCurrencyId(ISOCurrencyId); CFGenKbISOCountryCurrencyBuff[] recArray; if (dictByCurrencyIdx.containsKey(key)) { Map<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff> subdictCurrencyIdx = dictByCurrencyIdx.get(key); recArray = new CFGenKbISOCountryCurrencyBuff[subdictCurrencyIdx.size()]; Iterator<CFGenKbISOCountryCurrencyBuff> iter = subdictCurrencyIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff> subdictCurrencyIdx = new HashMap<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff>(); dictByCurrencyIdx.put(key, subdictCurrencyIdx); recArray = new CFGenKbISOCountryCurrencyBuff[0]; } return (recArray); }
public CFGenKbISOCountryCurrencyBuff[] readAllDerived(CFGenKbAuthorization Authorization) { final String S_ProcName = "CFGenKbRamISOCountryCurrency.readAllDerived() "; CFGenKbISOCountryCurrencyBuff[] retList = new CFGenKbISOCountryCurrencyBuff[dictByPKey.values().size()]; Iterator<CFGenKbISOCountryCurrencyBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); }
public CFGenKbISOCountryCurrencyBuff lockDerived( CFGenKbAuthorization Authorization, CFGenKbISOCountryCurrencyPKey PKey) { final String S_ProcName = "CFGenKbRamISOCountryCurrency.readDerived() "; CFGenKbISOCountryCurrencyPKey key = schema.getFactoryISOCountryCurrency().newPKey(); key.setRequiredISOCountryId(PKey.getRequiredISOCountryId()); key.setRequiredISOCurrencyId(PKey.getRequiredISOCurrencyId()); CFGenKbISOCountryCurrencyBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); }
public CFGenKbCursor openISOCountryCurrencyCursorByCountryIdx( CFGenKbAuthorization Authorization, short ISOCountryId) { CFGenKbCursor cursor; CFGenKbISOCountryCurrencyByCountryIdxKey key = schema.getFactoryISOCountryCurrency().newCountryIdxKey(); key.setRequiredISOCountryId(ISOCountryId); if (dictByCountryIdx.containsKey(key)) { Map<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff> subdictCountryIdx = dictByCountryIdx.get(key); cursor = new CFGenKbRamISOCountryCurrencyCursor(Authorization, schema, subdictCountryIdx.values()); } else { cursor = new CFGenKbRamISOCountryCurrencyCursor( Authorization, schema, new ArrayList<CFGenKbISOCountryCurrencyBuff>()); } return (cursor); }
public void deleteISOCountryCurrency( CFGenKbAuthorization Authorization, CFGenKbISOCountryCurrencyBuff Buff) { final String S_ProcName = "CFGenKbRamISOCountryCurrencyTable.deleteISOCountryCurrency() "; CFGenKbISOCountryCurrencyPKey pkey = schema.getFactoryISOCountryCurrency().newPKey(); pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId()); pkey.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId()); CFGenKbISOCountryCurrencyBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteISOCountryCurrency", pkey); } CFGenKbISOCountryCurrencyByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryCurrency().newCountryIdxKey(); keyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId()); CFGenKbISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = schema.getFactoryISOCountryCurrency().newCurrencyIdxKey(); keyCurrencyIdx.setRequiredISOCurrencyId(existing.getRequiredISOCurrencyId()); // Validate reverse foreign keys // Delete is valid Map<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff> subdict; dictByPKey.remove(pkey); subdict = dictByCountryIdx.get(keyCountryIdx); subdict.remove(pkey); subdict = dictByCurrencyIdx.get(keyCurrencyIdx); subdict.remove(pkey); }
public void deleteISOCountryCurrencyByCurrencyIdx( CFGenKbAuthorization Authorization, CFGenKbISOCountryCurrencyByCurrencyIdxKey argKey) { CFGenKbISOCountryCurrencyBuff cur; LinkedList<CFGenKbISOCountryCurrencyBuff> matchSet = new LinkedList<CFGenKbISOCountryCurrencyBuff>(); Iterator<CFGenKbISOCountryCurrencyBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFGenKbISOCountryCurrencyBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOCountryCurrency(Authorization, cur); } }
public void createISOCountryCurrency( CFGenKbAuthorization Authorization, CFGenKbISOCountryCurrencyBuff Buff) { final String S_ProcName = "createISOCountryCurrency"; CFGenKbISOCountryCurrencyPKey pkey = schema.getFactoryISOCountryCurrency().newPKey(); pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId()); pkey.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId()); Buff.setRequiredISOCountryId(pkey.getRequiredISOCountryId()); Buff.setRequiredISOCurrencyId(pkey.getRequiredISOCurrencyId()); CFGenKbISOCountryCurrencyByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryCurrency().newCountryIdxKey(); keyCountryIdx.setRequiredISOCountryId(Buff.getRequiredISOCountryId()); CFGenKbISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = schema.getFactoryISOCountryCurrency().newCurrencyIdxKey(); keyCurrencyIdx.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema .getTableISOCountry() .readDerivedByIdIdx(Authorization, Buff.getRequiredISOCountryId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Container", "ISOCountryCurrencyCountry", "ISOCountry", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); Map<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff> subdictCountryIdx; if (dictByCountryIdx.containsKey(keyCountryIdx)) { subdictCountryIdx = dictByCountryIdx.get(keyCountryIdx); } else { subdictCountryIdx = new HashMap<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff>(); dictByCountryIdx.put(keyCountryIdx, subdictCountryIdx); } subdictCountryIdx.put(pkey, Buff); Map<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff> subdictCurrencyIdx; if (dictByCurrencyIdx.containsKey(keyCurrencyIdx)) { subdictCurrencyIdx = dictByCurrencyIdx.get(keyCurrencyIdx); } else { subdictCurrencyIdx = new HashMap<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff>(); dictByCurrencyIdx.put(keyCurrencyIdx, subdictCurrencyIdx); } subdictCurrencyIdx.put(pkey, Buff); }
public CFGenKbCursor openISOCountryCurrencyCursorAll(CFGenKbAuthorization Authorization) { CFGenKbCursor cursor = new CFGenKbRamISOCountryCurrencyCursor(Authorization, schema, dictByPKey.values()); return (cursor); }
public void updateISOCountryCurrency( CFGenKbAuthorization Authorization, CFGenKbISOCountryCurrencyBuff Buff) { CFGenKbISOCountryCurrencyPKey pkey = schema.getFactoryISOCountryCurrency().newPKey(); pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId()); pkey.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId()); CFGenKbISOCountryCurrencyBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateISOCountryCurrency", "Existing record not found", "ISOCountryCurrency", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateISOCountryCurrency", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFGenKbISOCountryCurrencyByCountryIdxKey existingKeyCountryIdx = schema.getFactoryISOCountryCurrency().newCountryIdxKey(); existingKeyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId()); CFGenKbISOCountryCurrencyByCountryIdxKey newKeyCountryIdx = schema.getFactoryISOCountryCurrency().newCountryIdxKey(); newKeyCountryIdx.setRequiredISOCountryId(Buff.getRequiredISOCountryId()); CFGenKbISOCountryCurrencyByCurrencyIdxKey existingKeyCurrencyIdx = schema.getFactoryISOCountryCurrency().newCurrencyIdxKey(); existingKeyCurrencyIdx.setRequiredISOCurrencyId(existing.getRequiredISOCurrencyId()); CFGenKbISOCountryCurrencyByCurrencyIdxKey newKeyCurrencyIdx = schema.getFactoryISOCountryCurrency().newCurrencyIdxKey(); newKeyCurrencyIdx.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema .getTableISOCountry() .readDerivedByIdIdx(Authorization, Buff.getRequiredISOCountryId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateISOCountryCurrency", "Container", "ISOCountryCurrencyCountry", "ISOCountry", null); } } } // Update is valid Map<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByCountryIdx.get(existingKeyCountryIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByCountryIdx.containsKey(newKeyCountryIdx)) { subdict = dictByCountryIdx.get(newKeyCountryIdx); } else { subdict = new HashMap<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff>(); dictByCountryIdx.put(newKeyCountryIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByCurrencyIdx.get(existingKeyCurrencyIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByCurrencyIdx.containsKey(newKeyCurrencyIdx)) { subdict = dictByCurrencyIdx.get(newKeyCurrencyIdx); } else { subdict = new HashMap<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff>(); dictByCurrencyIdx.put(newKeyCurrencyIdx, subdict); } subdict.put(pkey, Buff); }