public CFSecurityCursor openISOLanguageCursorByCode2Idx( CFSecurityAuthorization Authorization, String ISO6391Code) { CFSecurityCursor cursor; CFSecurityISOLanguageByCode2IdxKey key = schema.getFactoryISOLanguage().newCode2IdxKey(); key.setOptionalISO6391Code(ISO6391Code); if (dictByCode2Idx.containsKey(key)) { Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictCode2Idx = dictByCode2Idx.get(key); cursor = new CFInternetRamISOLanguageCursor(Authorization, schema, subdictCode2Idx.values()); } else { cursor = new CFInternetRamISOLanguageCursor( Authorization, schema, new ArrayList<CFSecurityISOLanguageBuff>()); } return (cursor); }
public void createISOLanguage( CFSecurityAuthorization Authorization, CFSecurityISOLanguageBuff Buff) { final String S_ProcName = "createISOLanguage"; CFSecurityISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey(); pkey.setRequiredISOLanguageId(schema.nextISOLanguageIdGen()); Buff.setRequiredISOLanguageId(pkey.getRequiredISOLanguageId()); CFSecurityISOLanguageByCode3IdxKey keyCode3Idx = schema.getFactoryISOLanguage().newCode3IdxKey(); keyCode3Idx.setRequiredISO6392Code(Buff.getRequiredISO6392Code()); CFSecurityISOLanguageByCode2IdxKey keyCode2Idx = schema.getFactoryISOLanguage().newCode2IdxKey(); keyCode2Idx.setOptionalISO6391Code(Buff.getOptionalISO6391Code()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } if (dictByCode3Idx.containsKey(keyCode3Idx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "ISOLanguage6392Idx", keyCode3Idx); } // Validate foreign keys // Proceed with adding the new record dictByPKey.put(pkey, Buff); dictByCode3Idx.put(keyCode3Idx, Buff); Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictCode2Idx; if (dictByCode2Idx.containsKey(keyCode2Idx)) { subdictCode2Idx = dictByCode2Idx.get(keyCode2Idx); } else { subdictCode2Idx = new HashMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>(); dictByCode2Idx.put(keyCode2Idx, subdictCode2Idx); } subdictCode2Idx.put(pkey, Buff); }
public void deleteISOLanguage( CFSecurityAuthorization Authorization, CFSecurityISOLanguageBuff Buff) { final String S_ProcName = "CFInternetRamISOLanguageTable.deleteISOLanguage() "; CFSecurityISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey(); pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId()); CFSecurityISOLanguageBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteISOLanguage", pkey); } CFSecurityISOLanguageByCode3IdxKey keyCode3Idx = schema.getFactoryISOLanguage().newCode3IdxKey(); keyCode3Idx.setRequiredISO6392Code(existing.getRequiredISO6392Code()); CFSecurityISOLanguageByCode2IdxKey keyCode2Idx = schema.getFactoryISOLanguage().newCode2IdxKey(); keyCode2Idx.setOptionalISO6391Code(existing.getOptionalISO6391Code()); // Validate reverse foreign keys // Delete is valid schema .getTableISOCountryLanguage() .deleteISOCountryLanguageByLanguageIdx(Authorization, Buff.getRequiredISOLanguageId()); Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdict; dictByPKey.remove(pkey); dictByCode3Idx.remove(keyCode3Idx); subdict = dictByCode2Idx.get(keyCode2Idx); subdict.remove(pkey); }
public CFSecurityISOLanguageBuff[] readDerivedByCode2Idx( CFSecurityAuthorization Authorization, String ISO6391Code) { final String S_ProcName = "CFInternetRamISOLanguage.readDerivedByCode2Idx"; CFSecurityISOLanguageByCode2IdxKey key = schema.getFactoryISOLanguage().newCode2IdxKey(); key.setOptionalISO6391Code(ISO6391Code); CFSecurityISOLanguageBuff[] recArray; if (dictByCode2Idx.containsKey(key)) { Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictCode2Idx = dictByCode2Idx.get(key); recArray = new CFSecurityISOLanguageBuff[subdictCode2Idx.size()]; Iterator<CFSecurityISOLanguageBuff> iter = subdictCode2Idx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictCode2Idx = new HashMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>(); dictByCode2Idx.put(key, subdictCode2Idx); recArray = new CFSecurityISOLanguageBuff[0]; } return (recArray); }
public void deleteISOLanguageByCode2Idx( CFSecurityAuthorization Authorization, String argISO6391Code) { CFSecurityISOLanguageByCode2IdxKey key = schema.getFactoryISOLanguage().newCode2IdxKey(); key.setOptionalISO6391Code(argISO6391Code); deleteISOLanguageByCode2Idx(Authorization, key); }
public void updateISOLanguage( CFSecurityAuthorization Authorization, CFSecurityISOLanguageBuff Buff) { CFSecurityISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey(); pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId()); CFSecurityISOLanguageBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateISOLanguage", "Existing record not found", "ISOLanguage", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateISOLanguage", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFSecurityISOLanguageByCode3IdxKey existingKeyCode3Idx = schema.getFactoryISOLanguage().newCode3IdxKey(); existingKeyCode3Idx.setRequiredISO6392Code(existing.getRequiredISO6392Code()); CFSecurityISOLanguageByCode3IdxKey newKeyCode3Idx = schema.getFactoryISOLanguage().newCode3IdxKey(); newKeyCode3Idx.setRequiredISO6392Code(Buff.getRequiredISO6392Code()); CFSecurityISOLanguageByCode2IdxKey existingKeyCode2Idx = schema.getFactoryISOLanguage().newCode2IdxKey(); existingKeyCode2Idx.setOptionalISO6391Code(existing.getOptionalISO6391Code()); CFSecurityISOLanguageByCode2IdxKey newKeyCode2Idx = schema.getFactoryISOLanguage().newCode2IdxKey(); newKeyCode2Idx.setOptionalISO6391Code(Buff.getOptionalISO6391Code()); // Check unique indexes if (!existingKeyCode3Idx.equals(newKeyCode3Idx)) { if (dictByCode3Idx.containsKey(newKeyCode3Idx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateISOLanguage", "ISOLanguage6392Idx", newKeyCode3Idx); } } // Validate foreign keys // Update is valid Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByCode3Idx.remove(existingKeyCode3Idx); dictByCode3Idx.put(newKeyCode3Idx, Buff); subdict = dictByCode2Idx.get(existingKeyCode2Idx); if (subdict != null) { subdict.remove(pkey); } if (dictByCode2Idx.containsKey(newKeyCode2Idx)) { subdict = dictByCode2Idx.get(newKeyCode2Idx); } else { subdict = new HashMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>(); dictByCode2Idx.put(newKeyCode2Idx, subdict); } subdict.put(pkey, Buff); }