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

public void deleteHostNode(MSSBamAuthorization Authorization, MSSBamHostNodeBuff Buff) {
    final String S_ProcName = "MSSBamRamHostNodeTable.deleteHostNode() ";
    MSSBamHostNodePKey pkey = schema.getFactoryHostNode().newPKey();

    pkey.setRequiredHostNodeId(schema.nextHostNodeIdGen());
    MSSBamHostNodeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteHostNode",
                "Existing record not found", "HostNode", pkey);
    }//from  w  w  w.  j  ava2 s . co m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteHostNode",
                pkey);
    }
    MSSBamHostNodeByClusterIdxKey keyClusterIdx = schema.getFactoryHostNode().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

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

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

    // Validate reverse foreign keys

    if (schema.getTableService().readDerivedByHostIdx(Authorization,
            existing.getRequiredHostNodeId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteHostNode",
                "Container", "ServiceHost", "Service", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamHostNodePKey, MSSBamHostNodeBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByClusterIdx.get(keyClusterIdx);
    subdict.remove(pkey);

    dictByUDescrIdx.remove(keyUDescrIdx);

    dictByHostNameIdx.remove(keyHostNameIdx);

}

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

public void updateId16GenDef(MSSBamAuthorization Authorization, MSSBamId16GenDefBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamId16GenDefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateId16GenDef",
                "Existing record not found", "Id16GenDef", pkey);
    }/*  ww  w  .  j  a  v  a 2s.  c om*/
    MSSBamId16GenDefByDispIdxKey existingKeyDispIdx = schema.getFactoryId16GenDef().newDispIdxKey();
    existingKeyDispIdx.setOptionalDispenserId(existing.getOptionalDispenserId());

    MSSBamId16GenDefByDispIdxKey newKeyDispIdx = schema.getFactoryId16GenDef().newDispIdxKey();
    newKeyDispIdx.setOptionalDispenserId(Buff.getOptionalDispenserId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamId16GenDefBuff> subdict;

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

    subdict = dictByDispIdx.get(existingKeyDispIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByDispIdx.containsKey(newKeyDispIdx)) {
        subdict = dictByDispIdx.get(newKeyDispIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamId16GenDefBuff>();
        dictByDispIdx.put(newKeyDispIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteId16GenDef(MSSBamAuthorization Authorization, MSSBamId16GenDefBuff Buff) {
    final String S_ProcName = "MSSBamRamId16GenDefTable.deleteId16GenDef() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamId16GenDefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteId16GenDef",
                "Existing record not found", "Id16GenDef", pkey);
    }/*from  w  w  w  .  j  a  v a2 s .  c  om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteId16GenDef",
                pkey);
    }
    MSSBamId16GenDefByDispIdxKey keyDispIdx = schema.getFactoryId16GenDef().newDispIdxKey();
    keyDispIdx.setOptionalDispenserId(existing.getOptionalDispenserId());

    // Validate reverse foreign keys

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

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

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamId16GenDefBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByDispIdx.get(keyDispIdx);
    subdict.remove(pkey);

}

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

public void updateId32GenDef(MSSBamAuthorization Authorization, MSSBamId32GenDefBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamId32GenDefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateId32GenDef",
                "Existing record not found", "Id32GenDef", pkey);
    }/*from w  w  w.  j a  v a2 s  . c om*/
    MSSBamId32GenDefByDispIdxKey existingKeyDispIdx = schema.getFactoryId32GenDef().newDispIdxKey();
    existingKeyDispIdx.setOptionalDispenserId(existing.getOptionalDispenserId());

    MSSBamId32GenDefByDispIdxKey newKeyDispIdx = schema.getFactoryId32GenDef().newDispIdxKey();
    newKeyDispIdx.setOptionalDispenserId(Buff.getOptionalDispenserId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamId32GenDefBuff> subdict;

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

    subdict = dictByDispIdx.get(existingKeyDispIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByDispIdx.containsKey(newKeyDispIdx)) {
        subdict = dictByDispIdx.get(newKeyDispIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamId32GenDefBuff>();
        dictByDispIdx.put(newKeyDispIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteId32GenDef(MSSBamAuthorization Authorization, MSSBamId32GenDefBuff Buff) {
    final String S_ProcName = "MSSBamRamId32GenDefTable.deleteId32GenDef() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamId32GenDefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteId32GenDef",
                "Existing record not found", "Id32GenDef", pkey);
    }/*from   ww  w . j  a  v  a2 s  .c  om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteId32GenDef",
                pkey);
    }
    MSSBamId32GenDefByDispIdxKey keyDispIdx = schema.getFactoryId32GenDef().newDispIdxKey();
    keyDispIdx.setOptionalDispenserId(existing.getOptionalDispenserId());

    // Validate reverse foreign keys

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

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

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamId32GenDefBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByDispIdx.get(keyDispIdx);
    subdict.remove(pkey);

}

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

public void updateId64GenDef(MSSBamAuthorization Authorization, MSSBamId64GenDefBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamId64GenDefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateId64GenDef",
                "Existing record not found", "Id64GenDef", pkey);
    }/* w  w w .ja  v a  2  s . c  om*/
    MSSBamId64GenDefByDispIdxKey existingKeyDispIdx = schema.getFactoryId64GenDef().newDispIdxKey();
    existingKeyDispIdx.setOptionalDispenserId(existing.getOptionalDispenserId());

    MSSBamId64GenDefByDispIdxKey newKeyDispIdx = schema.getFactoryId64GenDef().newDispIdxKey();
    newKeyDispIdx.setOptionalDispenserId(Buff.getOptionalDispenserId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamId64GenDefBuff> subdict;

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

    subdict = dictByDispIdx.get(existingKeyDispIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByDispIdx.containsKey(newKeyDispIdx)) {
        subdict = dictByDispIdx.get(newKeyDispIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamId64GenDefBuff>();
        dictByDispIdx.put(newKeyDispIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteId64GenDef(MSSBamAuthorization Authorization, MSSBamId64GenDefBuff Buff) {
    final String S_ProcName = "MSSBamRamId64GenDefTable.deleteId64GenDef() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamId64GenDefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteId64GenDef",
                "Existing record not found", "Id64GenDef", pkey);
    }/*from  w  ww .  j a v a  2s.c o  m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteId64GenDef",
                pkey);
    }
    MSSBamId64GenDefByDispIdxKey keyDispIdx = schema.getFactoryId64GenDef().newDispIdxKey();
    keyDispIdx.setOptionalDispenserId(existing.getOptionalDispenserId());

    // Validate reverse foreign keys

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

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

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamId64GenDefBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByDispIdx.get(keyDispIdx);
    subdict.remove(pkey);

}

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

public void updateIndexCol(MSSBamAuthorization Authorization, MSSBamIndexColBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamIndexColBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateIndexCol",
                "Existing record not found", "IndexCol", pkey);
    }/*from  w  w w .  j  a  v  a  2  s  . c om*/
    MSSBamIndexColByIndexIdxKey existingKeyIndexIdx = schema.getFactoryIndexCol().newIndexIdxKey();
    existingKeyIndexIdx.setRequiredIndexId(existing.getRequiredIndexId());

    MSSBamIndexColByIndexIdxKey newKeyIndexIdx = schema.getFactoryIndexCol().newIndexIdxKey();
    newKeyIndexIdx.setRequiredIndexId(Buff.getRequiredIndexId());

    MSSBamIndexColByColIdxKey existingKeyColIdx = schema.getFactoryIndexCol().newColIdxKey();
    existingKeyColIdx.setRequiredColumnId(existing.getRequiredColumnId());

    MSSBamIndexColByColIdxKey newKeyColIdx = schema.getFactoryIndexCol().newColIdxKey();
    newKeyColIdx.setRequiredColumnId(Buff.getRequiredColumnId());

    MSSBamIndexColByPrevIdxKey existingKeyPrevIdx = schema.getFactoryIndexCol().newPrevIdxKey();
    existingKeyPrevIdx.setOptionalPrevId(existing.getOptionalPrevId());

    MSSBamIndexColByPrevIdxKey newKeyPrevIdx = schema.getFactoryIndexCol().newPrevIdxKey();
    newKeyPrevIdx.setOptionalPrevId(Buff.getOptionalPrevId());

    MSSBamIndexColByNextIdxKey existingKeyNextIdx = schema.getFactoryIndexCol().newNextIdxKey();
    existingKeyNextIdx.setOptionalNextId(existing.getOptionalNextId());

    MSSBamIndexColByNextIdxKey newKeyNextIdx = schema.getFactoryIndexCol().newNextIdxKey();
    newKeyNextIdx.setOptionalNextId(Buff.getOptionalNextId());

    MSSBamIndexColByIdxPrevIdxKey existingKeyIdxPrevIdx = schema.getFactoryIndexCol().newIdxPrevIdxKey();
    existingKeyIdxPrevIdx.setRequiredIndexId(existing.getRequiredIndexId());
    existingKeyIdxPrevIdx.setOptionalPrevId(existing.getOptionalPrevId());

    MSSBamIndexColByIdxPrevIdxKey newKeyIdxPrevIdx = schema.getFactoryIndexCol().newIdxPrevIdxKey();
    newKeyIdxPrevIdx.setRequiredIndexId(Buff.getRequiredIndexId());
    newKeyIdxPrevIdx.setOptionalPrevId(Buff.getOptionalPrevId());

    MSSBamIndexColByIdxNextIdxKey existingKeyIdxNextIdx = schema.getFactoryIndexCol().newIdxNextIdxKey();
    existingKeyIdxNextIdx.setRequiredIndexId(existing.getRequiredIndexId());
    existingKeyIdxNextIdx.setOptionalNextId(existing.getOptionalNextId());

    MSSBamIndexColByIdxNextIdxKey newKeyIdxNextIdx = schema.getFactoryIndexCol().newIdxNextIdxKey();
    newKeyIdxNextIdx.setRequiredIndexId(Buff.getRequiredIndexId());
    newKeyIdxNextIdx.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(),
                        "updateIndexCol", "Superclass", "SuperClass", "AnyObj", null);
            }
        }
    }

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableIndex().readDerivedByIdIdx(Authorization, Buff.getRequiredIndexId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateIndexCol", "Container", "Index", "Index", null);
            }
        }
    }

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableValue().readDerivedByIdIdx(Authorization, Buff.getRequiredColumnId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateIndexCol", "Lookup", "Column", "Value", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamIndexColBuff> subdict;

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

    subdict = dictByIndexIdx.get(existingKeyIndexIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByIndexIdx.containsKey(newKeyIndexIdx)) {
        subdict = dictByIndexIdx.get(newKeyIndexIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamIndexColBuff>();
        dictByIndexIdx.put(newKeyIndexIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByColIdx.get(existingKeyColIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByColIdx.containsKey(newKeyColIdx)) {
        subdict = dictByColIdx.get(newKeyColIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamIndexColBuff>();
        dictByColIdx.put(newKeyColIdx, 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, MSSBamIndexColBuff>();
        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, MSSBamIndexColBuff>();
        dictByNextIdx.put(newKeyNextIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByIdxPrevIdx.get(existingKeyIdxPrevIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByIdxPrevIdx.containsKey(newKeyIdxPrevIdx)) {
        subdict = dictByIdxPrevIdx.get(newKeyIdxPrevIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamIndexColBuff>();
        dictByIdxPrevIdx.put(newKeyIdxPrevIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByIdxNextIdx.get(existingKeyIdxNextIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByIdxNextIdx.containsKey(newKeyIdxNextIdx)) {
        subdict = dictByIdxNextIdx.get(newKeyIdxNextIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamIndexColBuff>();
        dictByIdxNextIdx.put(newKeyIdxNextIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteIndexCol(MSSBamAuthorization Authorization, MSSBamIndexColBuff Buff) {
    final String S_ProcName = "MSSBamRamIndexColTable.deleteIndexCol() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamIndexColBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteIndexCol",
                "Existing record not found", "IndexCol", pkey);
    }/*www.  j ava  2 s. c o  m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteIndexCol",
                pkey);
    }
    MSSBamIndexColByIndexIdxKey keyIndexIdx = schema.getFactoryIndexCol().newIndexIdxKey();
    keyIndexIdx.setRequiredIndexId(existing.getRequiredIndexId());

    MSSBamIndexColByColIdxKey keyColIdx = schema.getFactoryIndexCol().newColIdxKey();
    keyColIdx.setRequiredColumnId(existing.getRequiredColumnId());

    MSSBamIndexColByPrevIdxKey keyPrevIdx = schema.getFactoryIndexCol().newPrevIdxKey();
    keyPrevIdx.setOptionalPrevId(existing.getOptionalPrevId());

    MSSBamIndexColByNextIdxKey keyNextIdx = schema.getFactoryIndexCol().newNextIdxKey();
    keyNextIdx.setOptionalNextId(existing.getOptionalNextId());

    MSSBamIndexColByIdxPrevIdxKey keyIdxPrevIdx = schema.getFactoryIndexCol().newIdxPrevIdxKey();
    keyIdxPrevIdx.setRequiredIndexId(existing.getRequiredIndexId());
    keyIdxPrevIdx.setOptionalPrevId(existing.getOptionalPrevId());

    MSSBamIndexColByIdxNextIdxKey keyIdxNextIdx = schema.getFactoryIndexCol().newIdxNextIdxKey();
    keyIdxNextIdx.setRequiredIndexId(existing.getRequiredIndexId());
    keyIdxNextIdx.setOptionalNextId(existing.getOptionalNextId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamIndexColBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByIndexIdx.get(keyIndexIdx);
    subdict.remove(pkey);

    subdict = dictByColIdx.get(keyColIdx);
    subdict.remove(pkey);

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

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

    subdict = dictByIdxPrevIdx.get(keyIdxPrevIdx);
    subdict.remove(pkey);

    subdict = dictByIdxNextIdx.get(keyIdxNextIdx);
    subdict.remove(pkey);

}

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

public void updateIndex(MSSBamAuthorization Authorization, MSSBamIndexBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamIndexBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateIndex",
                "Existing record not found", "Index", pkey);
    }/*from  w ww .  ja v a 2 s  .c  o m*/
    MSSBamIndexBySchemaIdxKey existingKeySchemaIdx = schema.getFactoryIndex().newSchemaIdxKey();
    existingKeySchemaIdx.setRequiredSchemaId(existing.getRequiredSchemaId());

    MSSBamIndexBySchemaIdxKey newKeySchemaIdx = schema.getFactoryIndex().newSchemaIdxKey();
    newKeySchemaIdx.setRequiredSchemaId(Buff.getRequiredSchemaId());

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

    MSSBamIndexByTableIdxKey newKeyTableIdx = schema.getFactoryIndex().newTableIdxKey();
    newKeyTableIdx.setRequiredTableId(Buff.getRequiredTableId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableTable().readDerivedByIdIdx(Authorization, Buff.getRequiredTableId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateIndex", "Container", "Table", "Table", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff> subdict;

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

    subdict = dictBySchemaIdx.get(existingKeySchemaIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictBySchemaIdx.containsKey(newKeySchemaIdx)) {
        subdict = dictBySchemaIdx.get(newKeySchemaIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamIndexBuff>();
        dictBySchemaIdx.put(newKeySchemaIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByTableIdx.get(existingKeyTableIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByTableIdx.containsKey(newKeyTableIdx)) {
        subdict = dictByTableIdx.get(newKeyTableIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamIndexBuff>();
        dictByTableIdx.put(newKeyTableIdx, subdict);
    }
    subdict.put(pkey, Buff);

}