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.MSSBamRamContactURLTable.java

public void deleteContactURL(MSSBamAuthorization Authorization, MSSBamContactURLBuff Buff) {
    final String S_ProcName = "MSSBamRamContactURLTable.deleteContactURL() ";
    MSSBamContactURLPKey pkey = schema.getFactoryContactURL().newPKey();

    pkey.setRequiredContactURLId(schema.nextContactURLIdGen());
    MSSBamContactURLBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteContactURL",
                "Existing record not found", "ContactURL", pkey);
    }/*from   ww w. j  a  va2 s  .  c  o  m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteContactURL",
                pkey);
    }
    MSSBamContactURLByContactIdxKey keyContactIdx = schema.getFactoryContactURL().newContactIdxKey();
    keyContactIdx.setRequiredContactId(existing.getRequiredContactId());

    MSSBamContactURLByProtocolIdxKey keyProtocolIdx = schema.getFactoryContactURL().newProtocolIdxKey();
    keyProtocolIdx.setOptionalURLProtocolId(existing.getOptionalURLProtocolId());

    MSSBamContactURLByUNameIdxKey keyUNameIdx = schema.getFactoryContactURL().newUNameIdxKey();
    keyUNameIdx.setRequiredContactId(existing.getRequiredContactId());
    keyUNameIdx.setRequiredName(existing.getRequiredName());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamContactURLPKey, MSSBamContactURLBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByContactIdx.get(keyContactIdx);
    subdict.remove(pkey);

    subdict = dictByProtocolIdx.get(keyProtocolIdx);
    subdict.remove(pkey);

    dictByUNameIdx.remove(keyUNameIdx);

}

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

public void updateDataScope(MSSBamAuthorization Authorization, MSSBamDataScopeBuff Buff) {
    MSSBamDataScopePKey pkey = schema.getFactoryDataScope().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamDataScopeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateDataScope",
                "Existing record not found", "DataScope", pkey);
    }//from  ww w.j a  v  a 2s  .  co  m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateDataScope",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamDataScopeByUNameIdxKey existingKeyUNameIdx = schema.getFactoryDataScope().newUNameIdxKey();
    existingKeyUNameIdx.setRequiredName(existing.getRequiredName());

    MSSBamDataScopeByUNameIdxKey newKeyUNameIdx = schema.getFactoryDataScope().newUNameIdxKey();
    newKeyUNameIdx.setRequiredName(Buff.getRequiredName());

    // Check unique indexes

    // Validate foreign keys

    // Update is valid

    SortedMap<MSSBamDataScopePKey, MSSBamDataScopeBuff> subdict;

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

    subdict = dictByUNameIdx.get(existingKeyUNameIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByUNameIdx.containsKey(newKeyUNameIdx)) {
        subdict = dictByUNameIdx.get(newKeyUNameIdx);
    } else {
        subdict = new TreeMap<MSSBamDataScopePKey, MSSBamDataScopeBuff>();
        dictByUNameIdx.put(newKeyUNameIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteDataScope(MSSBamAuthorization Authorization, MSSBamDataScopeBuff Buff) {
    final String S_ProcName = "MSSBamRamDataScopeTable.deleteDataScope() ";
    MSSBamDataScopePKey pkey = schema.getFactoryDataScope().newPKey();

    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamDataScopeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteDataScope",
                "Existing record not found", "DataScope", pkey);
    }/*from www.  j  a v  a  2 s.  c  o  m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteDataScope",
                pkey);
    }
    MSSBamDataScopeByUNameIdxKey keyUNameIdx = schema.getFactoryDataScope().newUNameIdxKey();
    keyUNameIdx.setRequiredName(existing.getRequiredName());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamDataScopePKey, MSSBamDataScopeBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByUNameIdx.get(keyUNameIdx);
    subdict.remove(pkey);

}

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

public void updateDictionary(MSSBamAuthorization Authorization, MSSBamDictionaryBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamDictionaryBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateDictionary",
                "Existing record not found", "Dictionary", pkey);
    }/*from  w  w  w. j  a  v a 2s  .com*/
    MSSBamDictionaryByDictTenantIdxKey existingKeyDictTenantIdx = schema.getFactoryDictionary()
            .newDictTenantIdxKey();
    existingKeyDictTenantIdx.setRequiredDictTenantId(existing.getRequiredDictTenantId());

    MSSBamDictionaryByDictTenantIdxKey newKeyDictTenantIdx = schema.getFactoryDictionary()
            .newDictTenantIdxKey();
    newKeyDictTenantIdx.setRequiredDictTenantId(Buff.getRequiredDictTenantId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableScope().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateDictionary", "Superclass", "SuperClass", "Scope", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamDictionaryBuff> subdict;

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

    subdict = dictByDictTenantIdx.get(existingKeyDictTenantIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByDictTenantIdx.containsKey(newKeyDictTenantIdx)) {
        subdict = dictByDictTenantIdx.get(newKeyDictTenantIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamDictionaryBuff>();
        dictByDictTenantIdx.put(newKeyDictTenantIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteDictionary(MSSBamAuthorization Authorization, MSSBamDictionaryBuff Buff) {
    final String S_ProcName = "MSSBamRamDictionaryTable.deleteDictionary() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamDictionaryBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteDictionary",
                "Existing record not found", "Dictionary", pkey);
    }//from   w  w  w  . j av  a2  s.  co  m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteDictionary",
                pkey);
    }
    MSSBamDictionaryByDictTenantIdxKey keyDictTenantIdx = schema.getFactoryDictionary().newDictTenantIdxKey();
    keyDictTenantIdx.setRequiredDictTenantId(existing.getRequiredDictTenantId());

    // Validate reverse foreign keys

    if (schema.getTableMSSBam().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteDictionary",
                "Superclass", "SuperClass", "MSSBam", pkey);
    }

    if (schema.getTableTLD().readDerivedByDictIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteDictionary",
                "Container", "Dictionary", "TLD", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamDictionaryBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByDictTenantIdx.get(keyDictTenantIdx);
    subdict.remove(pkey);

}

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

public void updateDomain(MSSBamAuthorization Authorization, MSSBamDomainBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamDomainBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateDomain",
                "Existing record not found", "Domain", pkey);
    }/*from   w w w .jav a2  s  . c  o m*/
    MSSBamDomainByContainerIdxKey existingKeyContainerIdx = schema.getFactoryDomain().newContainerIdxKey();
    existingKeyContainerIdx.setOptionalContainerDomainId(existing.getOptionalContainerDomainId());

    MSSBamDomainByContainerIdxKey newKeyContainerIdx = schema.getFactoryDomain().newContainerIdxKey();
    newKeyContainerIdx.setOptionalContainerDomainId(Buff.getOptionalContainerDomainId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableBaseDomain().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateDomain", "Superclass", "SuperClass", "BaseDomain", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamDomainBuff> subdict;

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

    subdict = dictByContainerIdx.get(existingKeyContainerIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByContainerIdx.containsKey(newKeyContainerIdx)) {
        subdict = dictByContainerIdx.get(newKeyContainerIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamDomainBuff>();
        dictByContainerIdx.put(newKeyContainerIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteDomain(MSSBamAuthorization Authorization, MSSBamDomainBuff Buff) {
    final String S_ProcName = "MSSBamRamDomainTable.deleteDomain() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamDomainBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteDomain",
                "Existing record not found", "Domain", pkey);
    }// w  w  w.  java2  s  .c  o  m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteDomain",
                pkey);
    }
    MSSBamDomainByContainerIdxKey keyContainerIdx = schema.getFactoryDomain().newContainerIdxKey();
    keyContainerIdx.setOptionalContainerDomainId(existing.getOptionalContainerDomainId());

    // Validate reverse foreign keys

    if (schema.getTableLegalEntity().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteDomain",
                "Superclass", "SuperClass", "LegalEntity", pkey);
    }

    if (schema.getTableProject().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteDomain",
                "Superclass", "SuperClass", "Project", pkey);
    }

    if (schema.getTableVersion().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteDomain",
                "Superclass", "SuperClass", "Version", pkey);
    }

    if (schema.getTableLicense().readDerivedByDomainIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteDomain",
                "Container", "Domain", "License", pkey);
    }

    if (schema.getTableUser().readDerivedByDomainIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteDomain",
                "Container", "Domain", "User", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamDomainBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByContainerIdx.get(keyContainerIdx);
    subdict.remove(pkey);

}

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

public void updateEnumTag(MSSBamAuthorization Authorization, MSSBamEnumTagBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamEnumTagBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateEnumTag",
                "Existing record not found", "EnumTag", pkey);
    }//from ww  w  . j av a  2 s  .c o  m
    MSSBamEnumTagByEnumIdxKey existingKeyEnumIdx = schema.getFactoryEnumTag().newEnumIdxKey();
    existingKeyEnumIdx.setRequiredEnumId(existing.getRequiredEnumId());

    MSSBamEnumTagByEnumIdxKey newKeyEnumIdx = schema.getFactoryEnumTag().newEnumIdxKey();
    newKeyEnumIdx.setRequiredEnumId(Buff.getRequiredEnumId());

    MSSBamEnumTagByPrevIdxKey existingKeyPrevIdx = schema.getFactoryEnumTag().newPrevIdxKey();
    existingKeyPrevIdx.setOptionalPrevId(existing.getOptionalPrevId());

    MSSBamEnumTagByPrevIdxKey newKeyPrevIdx = schema.getFactoryEnumTag().newPrevIdxKey();
    newKeyPrevIdx.setOptionalPrevId(Buff.getOptionalPrevId());

    MSSBamEnumTagByNextIdxKey existingKeyNextIdx = schema.getFactoryEnumTag().newNextIdxKey();
    existingKeyNextIdx.setOptionalNextId(existing.getOptionalNextId());

    MSSBamEnumTagByNextIdxKey newKeyNextIdx = schema.getFactoryEnumTag().newNextIdxKey();
    newKeyNextIdx.setOptionalNextId(Buff.getOptionalNextId());

    MSSBamEnumTagByContPrevIdxKey existingKeyContPrevIdx = schema.getFactoryEnumTag().newContPrevIdxKey();
    existingKeyContPrevIdx.setRequiredEnumId(existing.getRequiredEnumId());
    existingKeyContPrevIdx.setOptionalPrevId(existing.getOptionalPrevId());

    MSSBamEnumTagByContPrevIdxKey newKeyContPrevIdx = schema.getFactoryEnumTag().newContPrevIdxKey();
    newKeyContPrevIdx.setRequiredEnumId(Buff.getRequiredEnumId());
    newKeyContPrevIdx.setOptionalPrevId(Buff.getOptionalPrevId());

    MSSBamEnumTagByContNextIdxKey existingKeyContNextIdx = schema.getFactoryEnumTag().newContNextIdxKey();
    existingKeyContNextIdx.setRequiredEnumId(existing.getRequiredEnumId());
    existingKeyContNextIdx.setOptionalNextId(existing.getOptionalNextId());

    MSSBamEnumTagByContNextIdxKey newKeyContNextIdx = schema.getFactoryEnumTag().newContNextIdxKey();
    newKeyContNextIdx.setRequiredEnumId(Buff.getRequiredEnumId());
    newKeyContNextIdx.setOptionalNextId(Buff.getOptionalNextId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableAnyObj().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateEnumTag", "Superclass", "SuperClass", "AnyObj", null);
            }
        }
    }

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableEnumDef().readDerivedByIdIdx(Authorization, Buff.getRequiredEnumId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateEnumTag", "Container", "EnumDef", "EnumDef", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamEnumTagBuff> subdict;

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

    subdict = dictByEnumIdx.get(existingKeyEnumIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByEnumIdx.containsKey(newKeyEnumIdx)) {
        subdict = dictByEnumIdx.get(newKeyEnumIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamEnumTagBuff>();
        dictByEnumIdx.put(newKeyEnumIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByPrevIdx.get(existingKeyPrevIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByPrevIdx.containsKey(newKeyPrevIdx)) {
        subdict = dictByPrevIdx.get(newKeyPrevIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamEnumTagBuff>();
        dictByPrevIdx.put(newKeyPrevIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByNextIdx.get(existingKeyNextIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByNextIdx.containsKey(newKeyNextIdx)) {
        subdict = dictByNextIdx.get(newKeyNextIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamEnumTagBuff>();
        dictByNextIdx.put(newKeyNextIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByContPrevIdx.get(existingKeyContPrevIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByContPrevIdx.containsKey(newKeyContPrevIdx)) {
        subdict = dictByContPrevIdx.get(newKeyContPrevIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamEnumTagBuff>();
        dictByContPrevIdx.put(newKeyContPrevIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByContNextIdx.get(existingKeyContNextIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByContNextIdx.containsKey(newKeyContNextIdx)) {
        subdict = dictByContNextIdx.get(newKeyContNextIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamEnumTagBuff>();
        dictByContNextIdx.put(newKeyContNextIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteEnumTag(MSSBamAuthorization Authorization, MSSBamEnumTagBuff Buff) {
    final String S_ProcName = "MSSBamRamEnumTagTable.deleteEnumTag() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamEnumTagBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteEnumTag",
                "Existing record not found", "EnumTag", pkey);
    }// w ww  . ja  v  a2 s.c  o  m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteEnumTag",
                pkey);
    }
    MSSBamEnumTagByEnumIdxKey keyEnumIdx = schema.getFactoryEnumTag().newEnumIdxKey();
    keyEnumIdx.setRequiredEnumId(existing.getRequiredEnumId());

    MSSBamEnumTagByPrevIdxKey keyPrevIdx = schema.getFactoryEnumTag().newPrevIdxKey();
    keyPrevIdx.setOptionalPrevId(existing.getOptionalPrevId());

    MSSBamEnumTagByNextIdxKey keyNextIdx = schema.getFactoryEnumTag().newNextIdxKey();
    keyNextIdx.setOptionalNextId(existing.getOptionalNextId());

    MSSBamEnumTagByContPrevIdxKey keyContPrevIdx = schema.getFactoryEnumTag().newContPrevIdxKey();
    keyContPrevIdx.setRequiredEnumId(existing.getRequiredEnumId());
    keyContPrevIdx.setOptionalPrevId(existing.getOptionalPrevId());

    MSSBamEnumTagByContNextIdxKey keyContNextIdx = schema.getFactoryEnumTag().newContNextIdxKey();
    keyContNextIdx.setRequiredEnumId(existing.getRequiredEnumId());
    keyContNextIdx.setOptionalNextId(existing.getOptionalNextId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamEnumTagBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByEnumIdx.get(keyEnumIdx);
    subdict.remove(pkey);

    subdict = dictByPrevIdx.get(keyPrevIdx);
    subdict.remove(pkey);

    subdict = dictByNextIdx.get(keyNextIdx);
    subdict.remove(pkey);

    subdict = dictByContPrevIdx.get(keyContPrevIdx);
    subdict.remove(pkey);

    subdict = dictByContNextIdx.get(keyContNextIdx);
    subdict.remove(pkey);

}

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

public void updateHostNode(MSSBamAuthorization Authorization, MSSBamHostNodeBuff Buff) {
    MSSBamHostNodePKey pkey = schema.getFactoryHostNode().newPKey();
    pkey.setRequiredHostNodeId(Buff.getRequiredHostNodeId());
    MSSBamHostNodeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateHostNode",
                "Existing record not found", "HostNode", pkey);
    }/*from w w w  .  j  a va2  s.c o m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateHostNode",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamHostNodeByClusterIdxKey existingKeyClusterIdx = schema.getFactoryHostNode().newClusterIdxKey();
    existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    MSSBamHostNodeByClusterIdxKey newKeyClusterIdx = schema.getFactoryHostNode().newClusterIdxKey();
    newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    MSSBamHostNodeByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryHostNode().newUDescrIdxKey();
    existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    MSSBamHostNodeByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryHostNode().newUDescrIdxKey();
    newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

    MSSBamHostNodeByHostNameIdxKey existingKeyHostNameIdx = schema.getFactoryHostNode().newHostNameIdxKey();
    existingKeyHostNameIdx.setRequiredHostName(existing.getRequiredHostName());

    MSSBamHostNodeByHostNameIdxKey newKeyHostNameIdx = schema.getFactoryHostNode().newHostNameIdxKey();
    newKeyHostNameIdx.setRequiredHostName(Buff.getRequiredHostName());

    // Check unique indexes

    if (!existingKeyUDescrIdx.equals(newKeyUDescrIdx)) {
        if (dictByUDescrIdx.containsKey(newKeyUDescrIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateHostNode", "HostNodeUDescrIdx", newKeyUDescrIdx);
        }
    }

    if (!existingKeyHostNameIdx.equals(newKeyHostNameIdx)) {
        if (dictByHostNameIdx.containsKey(newKeyHostNameIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateHostNode", "HostNodeUHostNameIdx", newKeyHostNameIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableCluster().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredClusterId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateHostNode", "Container", "HostNodeCluster", "Cluster", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamHostNodePKey, MSSBamHostNodeBuff> subdict;

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

    subdict = dictByClusterIdx.get(existingKeyClusterIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByClusterIdx.containsKey(newKeyClusterIdx)) {
        subdict = dictByClusterIdx.get(newKeyClusterIdx);
    } else {
        subdict = new TreeMap<MSSBamHostNodePKey, MSSBamHostNodeBuff>();
        dictByClusterIdx.put(newKeyClusterIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUDescrIdx.remove(existingKeyUDescrIdx);
    dictByUDescrIdx.put(newKeyUDescrIdx, Buff);

    dictByHostNameIdx.remove(existingKeyHostNameIdx);
    dictByHostNameIdx.put(newKeyHostNameIdx, Buff);

}