Example usage for java.util SortedMap remove

List of usage examples for java.util SortedMap remove

Introduction

In this page you can find the example usage for java.util SortedMap remove.

Prototype

V remove(Object key);

Source Link

Document

Removes the mapping for a key from this map if it is present (optional operation).

Usage

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamIndexTable.java

public void deleteIndex(MSSBamAuthorization Authorization, MSSBamIndexBuff Buff) {
    final String S_ProcName = "MSSBamRamIndexTable.deleteIndex() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamIndexBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteIndex",
                "Existing record not found", "Index", pkey);
    }//from   ww w .  j  a v a 2 s .c  o  m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteIndex", pkey);
    }
    MSSBamIndexBySchemaIdxKey keySchemaIdx = schema.getFactoryIndex().newSchemaIdxKey();
    keySchemaIdx.setRequiredSchemaId(existing.getRequiredSchemaId());

    MSSBamIndexByTableIdxKey keyTableIdx = schema.getFactoryIndex().newTableIdxKey();
    keyTableIdx.setRequiredTableId(existing.getRequiredTableId());

    // Validate reverse foreign keys

    if (schema.getTableIndexCol().readDerivedByIndexIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteIndex",
                "Container", "Index", "IndexCol", pkey);
    }

    if (schema.getTableRelation().readDerivedByFromKeyIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteIndex",
                "Lookup", "FromIndex", "Relation", pkey);
    }

    if (schema.getTableRelation().readDerivedByToKeyIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteIndex",
                "Lookup", "ToIndex", "Relation", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictBySchemaIdx.get(keySchemaIdx);
    subdict.remove(pkey);

    subdict = dictByTableIdx.get(keyTableIdx);
    subdict.remove(pkey);

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamISOCountryCurrencyTable.java

public void updateISOCountryCurrency(MSSBamAuthorization Authorization, MSSBamISOCountryCurrencyBuff Buff) {
    MSSBamISOCountryCurrencyPKey pkey = schema.getFactoryISOCountryCurrency().newPKey();
    pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
    pkey.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());
    MSSBamISOCountryCurrencyBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "updateISOCountryCurrency", "Existing record not found", "ISOCountryCurrency", pkey);
    }/*from   w ww  . j ava 2 s.  c  om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "updateISOCountryCurrency", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamISOCountryCurrencyByCountryIdxKey existingKeyCountryIdx = schema.getFactoryISOCountryCurrency()
            .newCountryIdxKey();
    existingKeyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

    MSSBamISOCountryCurrencyByCountryIdxKey newKeyCountryIdx = schema.getFactoryISOCountryCurrency()
            .newCountryIdxKey();
    newKeyCountryIdx.setRequiredISOCountryId(Buff.getRequiredISOCountryId());

    MSSBamISOCountryCurrencyByCurrencyIdxKey existingKeyCurrencyIdx = schema.getFactoryISOCountryCurrency()
            .newCurrencyIdxKey();
    existingKeyCurrencyIdx.setRequiredISOCurrencyId(existing.getRequiredISOCurrencyId());

    MSSBamISOCountryCurrencyByCurrencyIdxKey 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

    SortedMap<MSSBamISOCountryCurrencyPKey, MSSBamISOCountryCurrencyBuff> 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 TreeMap<MSSBamISOCountryCurrencyPKey, MSSBamISOCountryCurrencyBuff>();
        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 TreeMap<MSSBamISOCountryCurrencyPKey, MSSBamISOCountryCurrencyBuff>();
        dictByCurrencyIdx.put(newKeyCurrencyIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamISOCountryCurrencyTable.java

public void deleteISOCountryCurrency(MSSBamAuthorization Authorization, MSSBamISOCountryCurrencyBuff Buff) {
    final String S_ProcName = "MSSBamRamISOCountryCurrencyTable.deleteISOCountryCurrency() ";
    MSSBamISOCountryCurrencyPKey pkey = schema.getFactoryISOCountryCurrency().newPKey();

    pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
    pkey.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());
    MSSBamISOCountryCurrencyBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "deleteISOCountryCurrency", "Existing record not found", "ISOCountryCurrency", pkey);
    }//from www. ja  v  a2 s  .c  om
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteISOCountryCurrency", pkey);
    }
    MSSBamISOCountryCurrencyByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryCurrency()
            .newCountryIdxKey();
    keyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

    MSSBamISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = schema.getFactoryISOCountryCurrency()
            .newCurrencyIdxKey();
    keyCurrencyIdx.setRequiredISOCurrencyId(existing.getRequiredISOCurrencyId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamISOCountryCurrencyPKey, MSSBamISOCountryCurrencyBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByCountryIdx.get(keyCountryIdx);
    subdict.remove(pkey);

    subdict = dictByCurrencyIdx.get(keyCurrencyIdx);
    subdict.remove(pkey);

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamISOCountryLanguageTable.java

public void updateISOCountryLanguage(MSSBamAuthorization Authorization, MSSBamISOCountryLanguageBuff Buff) {
    MSSBamISOCountryLanguagePKey pkey = schema.getFactoryISOCountryLanguage().newPKey();
    pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
    pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
    MSSBamISOCountryLanguageBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "updateISOCountryLanguage", "Existing record not found", "ISOCountryLanguage", pkey);
    }//  w ww. j  a v  a2s  . co m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "updateISOCountryLanguage", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamISOCountryLanguageByCountryIdxKey existingKeyCountryIdx = schema.getFactoryISOCountryLanguage()
            .newCountryIdxKey();
    existingKeyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

    MSSBamISOCountryLanguageByCountryIdxKey newKeyCountryIdx = schema.getFactoryISOCountryLanguage()
            .newCountryIdxKey();
    newKeyCountryIdx.setRequiredISOCountryId(Buff.getRequiredISOCountryId());

    MSSBamISOCountryLanguageByLanguageIdxKey existingKeyLanguageIdx = schema.getFactoryISOCountryLanguage()
            .newLanguageIdxKey();
    existingKeyLanguageIdx.setRequiredISOLanguageId(existing.getRequiredISOLanguageId());

    MSSBamISOCountryLanguageByLanguageIdxKey newKeyLanguageIdx = schema.getFactoryISOCountryLanguage()
            .newLanguageIdxKey();
    newKeyLanguageIdx.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableISOCountry().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredISOCountryId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateISOCountryLanguage", "Container", "ISOCountryLanguageCountry", "ISOCountry",
                        null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamISOCountryLanguagePKey, MSSBamISOCountryLanguageBuff> 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 TreeMap<MSSBamISOCountryLanguagePKey, MSSBamISOCountryLanguageBuff>();
        dictByCountryIdx.put(newKeyCountryIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByLanguageIdx.get(existingKeyLanguageIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByLanguageIdx.containsKey(newKeyLanguageIdx)) {
        subdict = dictByLanguageIdx.get(newKeyLanguageIdx);
    } else {
        subdict = new TreeMap<MSSBamISOCountryLanguagePKey, MSSBamISOCountryLanguageBuff>();
        dictByLanguageIdx.put(newKeyLanguageIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamISOCountryLanguageTable.java

public void deleteISOCountryLanguage(MSSBamAuthorization Authorization, MSSBamISOCountryLanguageBuff Buff) {
    final String S_ProcName = "MSSBamRamISOCountryLanguageTable.deleteISOCountryLanguage() ";
    MSSBamISOCountryLanguagePKey pkey = schema.getFactoryISOCountryLanguage().newPKey();

    pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
    pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
    MSSBamISOCountryLanguageBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "deleteISOCountryLanguage", "Existing record not found", "ISOCountryLanguage", pkey);
    }/*from   w w  w.  j a  v a2 s.  co m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteISOCountryLanguage", pkey);
    }
    MSSBamISOCountryLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryLanguage()
            .newCountryIdxKey();
    keyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

    MSSBamISOCountryLanguageByLanguageIdxKey keyLanguageIdx = schema.getFactoryISOCountryLanguage()
            .newLanguageIdxKey();
    keyLanguageIdx.setRequiredISOLanguageId(existing.getRequiredISOLanguageId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamISOCountryLanguagePKey, MSSBamISOCountryLanguageBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByCountryIdx.get(keyCountryIdx);
    subdict.remove(pkey);

    subdict = dictByLanguageIdx.get(keyLanguageIdx);
    subdict.remove(pkey);

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamISOCurrencyTable.java

public void updateISOCurrency(MSSBamAuthorization Authorization, MSSBamISOCurrencyBuff Buff) {
    MSSBamISOCurrencyPKey pkey = schema.getFactoryISOCurrency().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamISOCurrencyBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateISOCurrency",
                "Existing record not found", "ISOCurrency", pkey);
    }//w w  w. j  av a2s.  c  om
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateISOCurrency",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamISOCurrencyByCcyCdIdxKey existingKeyCcyCdIdx = schema.getFactoryISOCurrency().newCcyCdIdxKey();
    existingKeyCcyCdIdx.setRequiredISOCode(existing.getRequiredISOCode());

    MSSBamISOCurrencyByCcyCdIdxKey newKeyCcyCdIdx = schema.getFactoryISOCurrency().newCcyCdIdxKey();
    newKeyCcyCdIdx.setRequiredISOCode(Buff.getRequiredISOCode());

    // Check unique indexes

    // Validate foreign keys

    // Update is valid

    SortedMap<MSSBamISOCurrencyPKey, MSSBamISOCurrencyBuff> subdict;

    dictByPKey.remove(pkey);
    dictByPKey.put(pkey, Buff);

    subdict = dictByCcyCdIdx.get(existingKeyCcyCdIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByCcyCdIdx.containsKey(newKeyCcyCdIdx)) {
        subdict = dictByCcyCdIdx.get(newKeyCcyCdIdx);
    } else {
        subdict = new TreeMap<MSSBamISOCurrencyPKey, MSSBamISOCurrencyBuff>();
        dictByCcyCdIdx.put(newKeyCcyCdIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamISOCurrencyTable.java

public void deleteISOCurrency(MSSBamAuthorization Authorization, MSSBamISOCurrencyBuff Buff) {
    final String S_ProcName = "MSSBamRamISOCurrencyTable.deleteISOCurrency() ";
    MSSBamISOCurrencyPKey pkey = schema.getFactoryISOCurrency().newPKey();

    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamISOCurrencyBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteISOCurrency",
                "Existing record not found", "ISOCurrency", pkey);
    }//  www.j a  v  a2s. c o m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteISOCurrency",
                pkey);
    }
    MSSBamISOCurrencyByCcyCdIdxKey keyCcyCdIdx = schema.getFactoryISOCurrency().newCcyCdIdxKey();
    keyCcyCdIdx.setRequiredISOCode(existing.getRequiredISOCode());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamISOCurrencyPKey, MSSBamISOCurrencyBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByCcyCdIdx.get(keyCcyCdIdx);
    subdict.remove(pkey);

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamISOLanguageTable.java

public void updateISOLanguage(MSSBamAuthorization Authorization, MSSBamISOLanguageBuff Buff) {
    MSSBamISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamISOLanguageBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateISOLanguage",
                "Existing record not found", "ISOLanguage", pkey);
    }/*ww  w . j ava  2s  .c  o m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateISOLanguage",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamISOLanguageByBaseIdxKey existingKeyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
    existingKeyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode());

    MSSBamISOLanguageByBaseIdxKey newKeyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
    newKeyBaseIdx.setRequiredBaseLanguageCode(Buff.getRequiredBaseLanguageCode());

    MSSBamISOLanguageByCountryIdxKey existingKeyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey();
    existingKeyCountryIdx.setOptionalISOCountryId(existing.getOptionalISOCountryId());

    MSSBamISOLanguageByCountryIdxKey newKeyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey();
    newKeyCountryIdx.setOptionalISOCountryId(Buff.getOptionalISOCountryId());

    MSSBamISOLanguageByCodeIdxKey existingKeyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey();
    existingKeyCodeIdx.setRequiredISOCode(existing.getRequiredISOCode());

    MSSBamISOLanguageByCodeIdxKey newKeyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey();
    newKeyCodeIdx.setRequiredISOCode(Buff.getRequiredISOCode());

    // Check unique indexes

    if (!existingKeyCodeIdx.equals(newKeyCodeIdx)) {
        if (dictByCodeIdx.containsKey(newKeyCodeIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateISOLanguage", "ISOLanguageCodeIdx", newKeyCodeIdx);
        }
    }

    // Validate foreign keys

    // Update is valid

    SortedMap<MSSBamISOLanguagePKey, MSSBamISOLanguageBuff> subdict;

    dictByPKey.remove(pkey);
    dictByPKey.put(pkey, Buff);

    subdict = dictByBaseIdx.get(existingKeyBaseIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByBaseIdx.containsKey(newKeyBaseIdx)) {
        subdict = dictByBaseIdx.get(newKeyBaseIdx);
    } else {
        subdict = new TreeMap<MSSBamISOLanguagePKey, MSSBamISOLanguageBuff>();
        dictByBaseIdx.put(newKeyBaseIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByCountryIdx.get(existingKeyCountryIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByCountryIdx.containsKey(newKeyCountryIdx)) {
        subdict = dictByCountryIdx.get(newKeyCountryIdx);
    } else {
        subdict = new TreeMap<MSSBamISOLanguagePKey, MSSBamISOLanguageBuff>();
        dictByCountryIdx.put(newKeyCountryIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByCodeIdx.remove(existingKeyCodeIdx);
    dictByCodeIdx.put(newKeyCodeIdx, Buff);

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamISOLanguageTable.java

public void deleteISOLanguage(MSSBamAuthorization Authorization, MSSBamISOLanguageBuff Buff) {
    final String S_ProcName = "MSSBamRamISOLanguageTable.deleteISOLanguage() ";
    MSSBamISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey();

    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamISOLanguageBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteISOLanguage",
                "Existing record not found", "ISOLanguage", pkey);
    }//from www.  j ava 2s  .co m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteISOLanguage",
                pkey);
    }
    MSSBamISOLanguageByBaseIdxKey keyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
    keyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode());

    MSSBamISOLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey();
    keyCountryIdx.setOptionalISOCountryId(existing.getOptionalISOCountryId());

    MSSBamISOLanguageByCodeIdxKey keyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey();
    keyCodeIdx.setRequiredISOCode(existing.getRequiredISOCode());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamISOLanguagePKey, MSSBamISOLanguageBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByBaseIdx.get(keyBaseIdx);
    subdict.remove(pkey);

    subdict = dictByCountryIdx.get(keyCountryIdx);
    subdict.remove(pkey);

    dictByCodeIdx.remove(keyCodeIdx);

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamISOTimezoneTable.java

public void updateISOTimezone(MSSBamAuthorization Authorization, MSSBamISOTimezoneBuff Buff) {
    MSSBamISOTimezonePKey pkey = schema.getFactoryISOTimezone().newPKey();
    pkey.setRequiredISOTimezoneId(Buff.getRequiredISOTimezoneId());
    MSSBamISOTimezoneBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateISOTimezone",
                "Existing record not found", "ISOTimezone", pkey);
    }/*  ww w  .  ja  v a2  s. co  m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateISOTimezone",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamISOTimezoneByOffsetIdxKey existingKeyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey();
    existingKeyOffsetIdx.setRequiredTZHourOffset(existing.getRequiredTZHourOffset());
    existingKeyOffsetIdx.setRequiredTZMinOffset(existing.getRequiredTZMinOffset());

    MSSBamISOTimezoneByOffsetIdxKey newKeyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey();
    newKeyOffsetIdx.setRequiredTZHourOffset(Buff.getRequiredTZHourOffset());
    newKeyOffsetIdx.setRequiredTZMinOffset(Buff.getRequiredTZMinOffset());

    MSSBamISOTimezoneByUTZNameIdxKey existingKeyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey();
    existingKeyUTZNameIdx.setRequiredTZName(existing.getRequiredTZName());

    MSSBamISOTimezoneByUTZNameIdxKey newKeyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey();
    newKeyUTZNameIdx.setRequiredTZName(Buff.getRequiredTZName());

    MSSBamISOTimezoneByIso8601IdxKey existingKeyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey();
    existingKeyIso8601Idx.setRequiredIso8601(existing.getRequiredIso8601());

    MSSBamISOTimezoneByIso8601IdxKey newKeyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey();
    newKeyIso8601Idx.setRequiredIso8601(Buff.getRequiredIso8601());

    // Check unique indexes

    if (!existingKeyUTZNameIdx.equals(newKeyUTZNameIdx)) {
        if (dictByUTZNameIdx.containsKey(newKeyUTZNameIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateISOTimezone", "ISOTimezoneUTZNameIdx", newKeyUTZNameIdx);
        }
    }

    // Validate foreign keys

    // Update is valid

    SortedMap<MSSBamISOTimezonePKey, MSSBamISOTimezoneBuff> subdict;

    dictByPKey.remove(pkey);
    dictByPKey.put(pkey, Buff);

    subdict = dictByOffsetIdx.get(existingKeyOffsetIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByOffsetIdx.containsKey(newKeyOffsetIdx)) {
        subdict = dictByOffsetIdx.get(newKeyOffsetIdx);
    } else {
        subdict = new TreeMap<MSSBamISOTimezonePKey, MSSBamISOTimezoneBuff>();
        dictByOffsetIdx.put(newKeyOffsetIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUTZNameIdx.remove(existingKeyUTZNameIdx);
    dictByUTZNameIdx.put(newKeyUTZNameIdx, Buff);

    subdict = dictByIso8601Idx.get(existingKeyIso8601Idx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByIso8601Idx.containsKey(newKeyIso8601Idx)) {
        subdict = dictByIso8601Idx.get(newKeyIso8601Idx);
    } else {
        subdict = new TreeMap<MSSBamISOTimezonePKey, MSSBamISOTimezoneBuff>();
        dictByIso8601Idx.put(newKeyIso8601Idx, subdict);
    }
    subdict.put(pkey, Buff);

}