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_11.MSSBamRam.MSSBamRamPopTopDepTable.java

public void deletePopTopDep(MSSBamAuthorization Authorization, MSSBamPopTopDepBuff Buff) {
    final String S_ProcName = "MSSBamRamPopTopDepTable.deletePopTopDep() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamPopTopDepBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deletePopTopDep",
                "Existing record not found", "PopTopDep", pkey);
    }//from w w  w.  j  a  v  a  2s . com
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deletePopTopDep",
                pkey);
    }
    MSSBamPopTopDepByContRelIdxKey keyContRelIdx = schema.getFactoryPopTopDep().newContRelIdxKey();
    keyContRelIdx.setRequiredContRelationId(existing.getRequiredContRelationId());

    // Validate reverse foreign keys

    if (schema.getTablePopSubDep1().readDerivedByContPopTopIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deletePopTopDep",
                "Container", "ContPopTopDep", "PopSubDep1", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamPopTopDepBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByContRelIdx.get(keyContRelIdx);
    subdict.remove(pkey);

}

From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamRelationTable.java

public void deleteRelation(MSSBamAuthorization Authorization, MSSBamRelationBuff Buff) {
    final String S_ProcName = "MSSBamRamRelationTable.deleteRelation() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamRelationBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteRelation",
                "Existing record not found", "Relation", pkey);
    }//  w w  w  .  j  av  a  2s  .com
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteRelation",
                pkey);
    }
    MSSBamRelationByRTypeKeyIdxKey keyRTypeKeyIdx = schema.getFactoryRelation().newRTypeKeyIdxKey();
    keyRTypeKeyIdx.setRequiredRelationTypeId(existing.getRequiredRelationTypeId());

    MSSBamRelationByFromTblIdxKey keyFromTblIdx = schema.getFactoryRelation().newFromTblIdxKey();
    keyFromTblIdx.setRequiredFromTableId(existing.getRequiredFromTableId());

    MSSBamRelationByFromKeyIdxKey keyFromKeyIdx = schema.getFactoryRelation().newFromKeyIdxKey();
    keyFromKeyIdx.setRequiredFromIndexId(existing.getRequiredFromIndexId());

    MSSBamRelationByToTblIdxKey keyToTblIdx = schema.getFactoryRelation().newToTblIdxKey();
    keyToTblIdx.setRequiredToTableId(existing.getRequiredToTableId());

    MSSBamRelationByToKeyIdxKey keyToKeyIdx = schema.getFactoryRelation().newToKeyIdxKey();
    keyToKeyIdx.setRequiredToIndexId(existing.getRequiredToIndexId());

    MSSBamRelationByNarrowedIdxKey keyNarrowedIdx = schema.getFactoryRelation().newNarrowedIdxKey();
    keyNarrowedIdx.setOptionalNarrowedId(existing.getOptionalNarrowedId());

    // Validate reverse foreign keys

    if (schema.getTablePopDep().readDerivedByRelationIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteRelation",
                "Lookup", "Relation", "PopDep", pkey);
    }

    if (schema.getTablePopTopDep().readDerivedByContRelIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteRelation",
                "Container", "ContRelation", "PopTopDep", pkey);
    }

    if (schema.getTableRelationCol().readDerivedByRelationIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteRelation",
                "Container", "Relation", "RelationCol", pkey);
    }

    if (schema.getTableRelGroupValue().readDerivedByRelationIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteRelation",
                "Container", "Relation", "RelGroupValue", pkey);
    }

    if (schema.getTableChain().readDerivedByPrevRelIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteRelation",
                "Lookup", "PrevRelation", "Chain", pkey);
    }

    if (schema.getTableChain().readDerivedByNextRelIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteRelation",
                "Lookup", "NextRelation", "Chain", pkey);
    }

    if (schema.getTableDelDep().readDerivedByTableIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteRelation",
                "Lookup", "Relation", "DelDep", pkey);
    }

    if (schema.getTableClearDep().readDerivedByTableIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteRelation",
                "Lookup", "Relation", "ClearDep", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamRelationBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByRTypeKeyIdx.get(keyRTypeKeyIdx);
    subdict.remove(pkey);

    subdict = dictByFromTblIdx.get(keyFromTblIdx);
    subdict.remove(pkey);

    subdict = dictByFromKeyIdx.get(keyFromKeyIdx);
    subdict.remove(pkey);

    subdict = dictByToTblIdx.get(keyToTblIdx);
    subdict.remove(pkey);

    subdict = dictByToKeyIdx.get(keyToKeyIdx);
    subdict.remove(pkey);

    subdict = dictByNarrowedIdx.get(keyNarrowedIdx);
    subdict.remove(pkey);

}

From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamRelGroupValueTable.java

public void updateRelGroupValue(MSSBamAuthorization Authorization, MSSBamRelGroupValueBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamRelGroupValueBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "updateRelGroupValue", "Existing record not found", "RelGroupValue", pkey);
    }/*ww w  .  ja v a2 s. c  o  m*/
    MSSBamRelGroupValueByUAltIdxKey existingKeyUAltIdx = schema.getFactoryRelGroupValue().newUAltIdxKey();
    existingKeyUAltIdx.setRequiredRelationId(existing.getRequiredRelationId());
    existingKeyUAltIdx.setRequiredGroupOperatorId(existing.getRequiredGroupOperatorId());
    existingKeyUAltIdx.setRequiredToColId(existing.getRequiredToColId());

    MSSBamRelGroupValueByUAltIdxKey newKeyUAltIdx = schema.getFactoryRelGroupValue().newUAltIdxKey();
    newKeyUAltIdx.setRequiredRelationId(Buff.getRequiredRelationId());
    newKeyUAltIdx.setRequiredGroupOperatorId(Buff.getRequiredGroupOperatorId());
    newKeyUAltIdx.setRequiredToColId(Buff.getRequiredToColId());

    MSSBamRelGroupValueByRelationIdxKey existingKeyRelationIdx = schema.getFactoryRelGroupValue()
            .newRelationIdxKey();
    existingKeyRelationIdx.setRequiredRelationId(existing.getRequiredRelationId());

    MSSBamRelGroupValueByRelationIdxKey newKeyRelationIdx = schema.getFactoryRelGroupValue()
            .newRelationIdxKey();
    newKeyRelationIdx.setRequiredRelationId(Buff.getRequiredRelationId());

    MSSBamRelGroupValueByGrpOpIdxKey existingKeyGrpOpIdx = schema.getFactoryRelGroupValue().newGrpOpIdxKey();
    existingKeyGrpOpIdx.setRequiredGroupOperatorId(existing.getRequiredGroupOperatorId());

    MSSBamRelGroupValueByGrpOpIdxKey newKeyGrpOpIdx = schema.getFactoryRelGroupValue().newGrpOpIdxKey();
    newKeyGrpOpIdx.setRequiredGroupOperatorId(Buff.getRequiredGroupOperatorId());

    MSSBamRelGroupValueByToColIdxKey existingKeyToColIdx = schema.getFactoryRelGroupValue().newToColIdxKey();
    existingKeyToColIdx.setRequiredToColId(existing.getRequiredToColId());

    MSSBamRelGroupValueByToColIdxKey newKeyToColIdx = schema.getFactoryRelGroupValue().newToColIdxKey();
    newKeyToColIdx.setRequiredToColId(Buff.getRequiredToColId());

    // Check unique indexes

    if (!existingKeyUAltIdx.equals(newKeyUAltIdx)) {
        if (dictByUAltIdx.containsKey(newKeyUAltIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateRelGroupValue", "RelGroupValueUAltIdx", newKeyUAltIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableRelation().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredRelationId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateRelGroupValue", "Container", "Relation", "Relation", null);
            }
        }
    }

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableGroupOperator().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredGroupOperatorId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateRelGroupValue", "Lookup", "LookupGroupOperator", "GroupOperator", null);
            }
        }
    }

    {
        boolean allNull = true;

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

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamRelGroupValueBuff> subdict;

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

    dictByUAltIdx.remove(existingKeyUAltIdx);
    dictByUAltIdx.put(newKeyUAltIdx, Buff);

    subdict = dictByRelationIdx.get(existingKeyRelationIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByRelationIdx.containsKey(newKeyRelationIdx)) {
        subdict = dictByRelationIdx.get(newKeyRelationIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamRelGroupValueBuff>();
        dictByRelationIdx.put(newKeyRelationIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByGrpOpIdx.get(existingKeyGrpOpIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByGrpOpIdx.containsKey(newKeyGrpOpIdx)) {
        subdict = dictByGrpOpIdx.get(newKeyGrpOpIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamRelGroupValueBuff>();
        dictByGrpOpIdx.put(newKeyGrpOpIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByToColIdx.get(existingKeyToColIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByToColIdx.containsKey(newKeyToColIdx)) {
        subdict = dictByToColIdx.get(newKeyToColIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamRelGroupValueBuff>();
        dictByToColIdx.put(newKeyToColIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamRelGroupValueTable.java

public void deleteRelGroupValue(MSSBamAuthorization Authorization, MSSBamRelGroupValueBuff Buff) {
    final String S_ProcName = "MSSBamRamRelGroupValueTable.deleteRelGroupValue() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamRelGroupValueBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "deleteRelGroupValue", "Existing record not found", "RelGroupValue", pkey);
    }//  www .j a  v a 2  s  . com
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteRelGroupValue", pkey);
    }
    MSSBamRelGroupValueByUAltIdxKey keyUAltIdx = schema.getFactoryRelGroupValue().newUAltIdxKey();
    keyUAltIdx.setRequiredRelationId(existing.getRequiredRelationId());
    keyUAltIdx.setRequiredGroupOperatorId(existing.getRequiredGroupOperatorId());
    keyUAltIdx.setRequiredToColId(existing.getRequiredToColId());

    MSSBamRelGroupValueByRelationIdxKey keyRelationIdx = schema.getFactoryRelGroupValue().newRelationIdxKey();
    keyRelationIdx.setRequiredRelationId(existing.getRequiredRelationId());

    MSSBamRelGroupValueByGrpOpIdxKey keyGrpOpIdx = schema.getFactoryRelGroupValue().newGrpOpIdxKey();
    keyGrpOpIdx.setRequiredGroupOperatorId(existing.getRequiredGroupOperatorId());

    MSSBamRelGroupValueByToColIdxKey keyToColIdx = schema.getFactoryRelGroupValue().newToColIdxKey();
    keyToColIdx.setRequiredToColId(existing.getRequiredToColId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamRelGroupValueBuff> subdict;

    dictByPKey.remove(pkey);

    dictByUAltIdx.remove(keyUAltIdx);

    subdict = dictByRelationIdx.get(keyRelationIdx);
    subdict.remove(pkey);

    subdict = dictByGrpOpIdx.get(keyGrpOpIdx);
    subdict.remove(pkey);

    subdict = dictByToColIdx.get(keyToColIdx);
    subdict.remove(pkey);

}

From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamSchemaDefTable.java

public void deleteSchemaDef(MSSBamAuthorization Authorization, MSSBamSchemaDefBuff Buff) {
    final String S_ProcName = "MSSBamRamSchemaDefTable.deleteSchemaDef() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamSchemaDefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteSchemaDef",
                "Existing record not found", "SchemaDef", pkey);
    }/*from w w w.  j  ava  2 s  .  co m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSchemaDef",
                pkey);
    }
    MSSBamSchemaDefByVersionIdxKey keyVersionIdx = schema.getFactorySchemaDef().newVersionIdxKey();
    keyVersionIdx.setRequiredVersionId(existing.getRequiredVersionId());

    MSSBamSchemaDefByDefLcnIdxKey keyDefLcnIdx = schema.getFactorySchemaDef().newDefLcnIdxKey();
    keyDefLcnIdx.setOptionalDefaultLicenseId(existing.getOptionalDefaultLicenseId());

    MSSBamSchemaDefByDataScopeIdxKey keyDataScopeIdx = schema.getFactorySchemaDef().newDataScopeIdxKey();
    keyDataScopeIdx.setOptionalDataScopeId(existing.getOptionalDataScopeId());

    MSSBamSchemaDefByVAccSecIdxKey keyVAccSecIdx = schema.getFactorySchemaDef().newVAccSecIdxKey();
    keyVAccSecIdx.setOptionalViewAccessSecurityId(existing.getOptionalViewAccessSecurityId());

    MSSBamSchemaDefByVAccFreqIdxKey keyVAccFreqIdx = schema.getFactorySchemaDef().newVAccFreqIdxKey();
    keyVAccFreqIdx.setOptionalViewAccessFrequencyId(existing.getOptionalViewAccessFrequencyId());

    MSSBamSchemaDefByEAccSecIdxKey keyEAccSecIdx = schema.getFactorySchemaDef().newEAccSecIdxKey();
    keyEAccSecIdx.setOptionalEditAccessSecurityId(existing.getOptionalEditAccessSecurityId());

    MSSBamSchemaDefByEAccFreqIdxKey keyEAccFreqIdx = schema.getFactorySchemaDef().newEAccFreqIdxKey();
    keyEAccFreqIdx.setOptionalEditAccessFrequencyId(existing.getOptionalEditAccessFrequencyId());

    // Validate reverse foreign keys

    if (schema.getTableSchemaRef().readDerivedBySchemaIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "Schema", "SchemaRef", pkey);
    }

    if (schema.getTableTable().readDerivedBySchemaIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "Schema", "Table", pkey);
    }

    if (schema.getTableSchemaBlob().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaBlob", pkey);
    }

    if (schema.getTableSchemaBool().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaBool", pkey);
    }

    if (schema.getTableSchemaDate().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaDate", pkey);
    }

    if (schema.getTableSchemaDouble().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaDouble", pkey);
    }

    if (schema.getTableSchemaNumber().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaNumber", pkey);
    }

    if (schema.getTableSchemaFloat().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaFloat", pkey);
    }

    if (schema.getTableSchemaInt16().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaInt16", pkey);
    }

    if (schema.getTableSchemaEnum().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaEnum", pkey);
    }

    if (schema.getTableSchemaId16Gen().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaId16Gen", pkey);
    }

    if (schema.getTableSchemaUInt16().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaUInt16", pkey);
    }

    if (schema.getTableSchemaInt32().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaInt32", pkey);
    }

    if (schema.getTableSchemaId32Gen().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaId32Gen", pkey);
    }

    if (schema.getTableSchemaUInt32().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaUInt32", pkey);
    }

    if (schema.getTableSchemaInt64().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaInt64", pkey);
    }

    if (schema.getTableSchemaId64Gen().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaId64Gen", pkey);
    }

    if (schema.getTableSchemaUInt64().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaUInt64", pkey);
    }

    if (schema.getTableSchemaNmToken().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaNmToken", pkey);
    }

    if (schema.getTableSchemaNmTokens().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaNmTokens", pkey);
    }

    if (schema.getTableSchemaString().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaString", pkey);
    }

    if (schema.getTableSchemaTZDate().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaTZDate", pkey);
    }

    if (schema.getTableSchemaTZTime().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaTZTime", pkey);
    }

    if (schema.getTableSchemaTZTimestamp().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaTZTimestamp", pkey);
    }

    if (schema.getTableSchemaText().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaText", pkey);
    }

    if (schema.getTableSchemaTime().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaTime", pkey);
    }

    if (schema.getTableSchemaTimestamp().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaTimestamp", pkey);
    }

    if (schema.getTableSchemaToken().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaToken", pkey);
    }

    if (schema.getTableSchemaUuid().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaUuid", pkey);
    }

    if (schema.getTableSchemaUuidGen().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef",
                "Container", "CSchema", "SchemaUuidGen", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByVersionIdx.get(keyVersionIdx);
    subdict.remove(pkey);

    subdict = dictByDefLcnIdx.get(keyDefLcnIdx);
    subdict.remove(pkey);

    subdict = dictByDataScopeIdx.get(keyDataScopeIdx);
    subdict.remove(pkey);

    subdict = dictByVAccSecIdx.get(keyVAccSecIdx);
    subdict.remove(pkey);

    subdict = dictByVAccFreqIdx.get(keyVAccFreqIdx);
    subdict.remove(pkey);

    subdict = dictByEAccSecIdx.get(keyEAccSecIdx);
    subdict.remove(pkey);

    subdict = dictByEAccFreqIdx.get(keyEAccFreqIdx);
    subdict.remove(pkey);

}

From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamSchemaRefTable.java

public void updateSchemaRef(MSSBamAuthorization Authorization, MSSBamSchemaRefBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamSchemaRefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSchemaRef",
                "Existing record not found", "SchemaRef", pkey);
    }//from w w w. j a  v a  2  s . c  o  m
    MSSBamSchemaRefBySchemaIdxKey existingKeySchemaIdx = schema.getFactorySchemaRef().newSchemaIdxKey();
    existingKeySchemaIdx.setRequiredSchemaId(existing.getRequiredSchemaId());

    MSSBamSchemaRefBySchemaIdxKey newKeySchemaIdx = schema.getFactorySchemaRef().newSchemaIdxKey();
    newKeySchemaIdx.setRequiredSchemaId(Buff.getRequiredSchemaId());

    MSSBamSchemaRefByRefSchemaIdxKey existingKeyRefSchemaIdx = schema.getFactorySchemaRef()
            .newRefSchemaIdxKey();
    existingKeyRefSchemaIdx.setOptionalRefSchemaId(existing.getOptionalRefSchemaId());

    MSSBamSchemaRefByRefSchemaIdxKey newKeyRefSchemaIdx = schema.getFactorySchemaRef().newRefSchemaIdxKey();
    newKeyRefSchemaIdx.setOptionalRefSchemaId(Buff.getOptionalRefSchemaId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableSchemaDef().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredSchemaId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateSchemaRef", "Container", "Schema", "SchemaDef", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamSchemaRefBuff> 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, MSSBamSchemaRefBuff>();
        dictBySchemaIdx.put(newKeySchemaIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByRefSchemaIdx.get(existingKeyRefSchemaIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByRefSchemaIdx.containsKey(newKeyRefSchemaIdx)) {
        subdict = dictByRefSchemaIdx.get(newKeyRefSchemaIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamSchemaRefBuff>();
        dictByRefSchemaIdx.put(newKeyRefSchemaIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamSchemaRefTable.java

public void deleteSchemaRef(MSSBamAuthorization Authorization, MSSBamSchemaRefBuff Buff) {
    final String S_ProcName = "MSSBamRamSchemaRefTable.deleteSchemaRef() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamSchemaRefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteSchemaRef",
                "Existing record not found", "SchemaRef", pkey);
    }//from   ww w.j a  v a2 s .co m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSchemaRef",
                pkey);
    }
    MSSBamSchemaRefBySchemaIdxKey keySchemaIdx = schema.getFactorySchemaRef().newSchemaIdxKey();
    keySchemaIdx.setRequiredSchemaId(existing.getRequiredSchemaId());

    MSSBamSchemaRefByRefSchemaIdxKey keyRefSchemaIdx = schema.getFactorySchemaRef().newRefSchemaIdxKey();
    keyRefSchemaIdx.setOptionalRefSchemaId(existing.getOptionalRefSchemaId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamSchemaRefBuff> subdict;

    dictByPKey.remove(pkey);

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

    subdict = dictByRefSchemaIdx.get(keyRefSchemaIdx);
    subdict.remove(pkey);

}

From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamTableTable.java

public void updateTable(MSSBamAuthorization Authorization, MSSBamTableBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamTableBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTable",
                "Existing record not found", "Table", pkey);
    }//from w  ww  .  ja  v a2  s .  c o  m
    MSSBamTableBySchemaIdxKey existingKeySchemaIdx = schema.getFactoryTable().newSchemaIdxKey();
    existingKeySchemaIdx.setRequiredSchemaId(existing.getRequiredSchemaId());

    MSSBamTableBySchemaIdxKey newKeySchemaIdx = schema.getFactoryTable().newSchemaIdxKey();
    newKeySchemaIdx.setRequiredSchemaId(Buff.getRequiredSchemaId());

    MSSBamTableBySchemaCdIdxKey existingKeySchemaCdIdx = schema.getFactoryTable().newSchemaCdIdxKey();
    existingKeySchemaCdIdx.setRequiredSchemaId(existing.getRequiredSchemaId());
    existingKeySchemaCdIdx.setRequiredTableClassCode(existing.getRequiredTableClassCode());

    MSSBamTableBySchemaCdIdxKey newKeySchemaCdIdx = schema.getFactoryTable().newSchemaCdIdxKey();
    newKeySchemaCdIdx.setRequiredSchemaId(Buff.getRequiredSchemaId());
    newKeySchemaCdIdx.setRequiredTableClassCode(Buff.getRequiredTableClassCode());

    MSSBamTableByPrimaryIndexIdxKey existingKeyPrimaryIndexIdx = schema.getFactoryTable()
            .newPrimaryIndexIdxKey();
    existingKeyPrimaryIndexIdx.setOptionalPrimaryIndexId(existing.getOptionalPrimaryIndexId());

    MSSBamTableByPrimaryIndexIdxKey newKeyPrimaryIndexIdx = schema.getFactoryTable().newPrimaryIndexIdxKey();
    newKeyPrimaryIndexIdx.setOptionalPrimaryIndexId(Buff.getOptionalPrimaryIndexId());

    MSSBamTableByLookupIndexIdxKey existingKeyLookupIndexIdx = schema.getFactoryTable().newLookupIndexIdxKey();
    existingKeyLookupIndexIdx.setOptionalLookupIndexId(existing.getOptionalLookupIndexId());

    MSSBamTableByLookupIndexIdxKey newKeyLookupIndexIdx = schema.getFactoryTable().newLookupIndexIdxKey();
    newKeyLookupIndexIdx.setOptionalLookupIndexId(Buff.getOptionalLookupIndexId());

    MSSBamTableByAltIndexIdxKey existingKeyAltIndexIdx = schema.getFactoryTable().newAltIndexIdxKey();
    existingKeyAltIndexIdx.setOptionalAltIndexId(existing.getOptionalAltIndexId());

    MSSBamTableByAltIndexIdxKey newKeyAltIndexIdx = schema.getFactoryTable().newAltIndexIdxKey();
    newKeyAltIndexIdx.setOptionalAltIndexId(Buff.getOptionalAltIndexId());

    MSSBamTableByQualTableIdxKey existingKeyQualTableIdx = schema.getFactoryTable().newQualTableIdxKey();
    existingKeyQualTableIdx.setOptionalQualifyingTableId(existing.getOptionalQualifyingTableId());

    MSSBamTableByQualTableIdxKey newKeyQualTableIdx = schema.getFactoryTable().newQualTableIdxKey();
    newKeyQualTableIdx.setOptionalQualifyingTableId(Buff.getOptionalQualifyingTableId());

    MSSBamTableByLoadBehaveIdxKey existingKeyLoadBehaveIdx = schema.getFactoryTable().newLoadBehaveIdxKey();
    existingKeyLoadBehaveIdx.setRequiredLoaderBehaviourId(existing.getRequiredLoaderBehaviourId());

    MSSBamTableByLoadBehaveIdxKey newKeyLoadBehaveIdx = schema.getFactoryTable().newLoadBehaveIdxKey();
    newKeyLoadBehaveIdx.setRequiredLoaderBehaviourId(Buff.getRequiredLoaderBehaviourId());

    MSSBamTableByDataScopeIdxKey existingKeyDataScopeIdx = schema.getFactoryTable().newDataScopeIdxKey();
    existingKeyDataScopeIdx.setOptionalDataScopeId(existing.getOptionalDataScopeId());

    MSSBamTableByDataScopeIdxKey newKeyDataScopeIdx = schema.getFactoryTable().newDataScopeIdxKey();
    newKeyDataScopeIdx.setOptionalDataScopeId(Buff.getOptionalDataScopeId());

    MSSBamTableBySecScopeIdxKey existingKeySecScopeIdx = schema.getFactoryTable().newSecScopeIdxKey();
    existingKeySecScopeIdx.setRequiredSecurityScopeId(existing.getRequiredSecurityScopeId());

    MSSBamTableBySecScopeIdxKey newKeySecScopeIdx = schema.getFactoryTable().newSecScopeIdxKey();
    newKeySecScopeIdx.setRequiredSecurityScopeId(Buff.getRequiredSecurityScopeId());

    MSSBamTableByVAccSecIdxKey existingKeyVAccSecIdx = schema.getFactoryTable().newVAccSecIdxKey();
    existingKeyVAccSecIdx.setOptionalViewAccessSecurityId(existing.getOptionalViewAccessSecurityId());

    MSSBamTableByVAccSecIdxKey newKeyVAccSecIdx = schema.getFactoryTable().newVAccSecIdxKey();
    newKeyVAccSecIdx.setOptionalViewAccessSecurityId(Buff.getOptionalViewAccessSecurityId());

    MSSBamTableByVAccFreqIdxKey existingKeyVAccFreqIdx = schema.getFactoryTable().newVAccFreqIdxKey();
    existingKeyVAccFreqIdx.setOptionalViewAccessFrequencyId(existing.getOptionalViewAccessFrequencyId());

    MSSBamTableByVAccFreqIdxKey newKeyVAccFreqIdx = schema.getFactoryTable().newVAccFreqIdxKey();
    newKeyVAccFreqIdx.setOptionalViewAccessFrequencyId(Buff.getOptionalViewAccessFrequencyId());

    MSSBamTableByEAccSecIdxKey existingKeyEAccSecIdx = schema.getFactoryTable().newEAccSecIdxKey();
    existingKeyEAccSecIdx.setOptionalEditAccessSecurityId(existing.getOptionalEditAccessSecurityId());

    MSSBamTableByEAccSecIdxKey newKeyEAccSecIdx = schema.getFactoryTable().newEAccSecIdxKey();
    newKeyEAccSecIdx.setOptionalEditAccessSecurityId(Buff.getOptionalEditAccessSecurityId());

    MSSBamTableByEAccFreqIdxKey existingKeyEAccFreqIdx = schema.getFactoryTable().newEAccFreqIdxKey();
    existingKeyEAccFreqIdx.setOptionalEditAccessFrequencyId(existing.getOptionalEditAccessFrequencyId());

    MSSBamTableByEAccFreqIdxKey newKeyEAccFreqIdx = schema.getFactoryTable().newEAccFreqIdxKey();
    newKeyEAccFreqIdx.setOptionalEditAccessFrequencyId(Buff.getOptionalEditAccessFrequencyId());

    // Check unique indexes

    if (!existingKeySchemaCdIdx.equals(newKeySchemaCdIdx)) {
        if (dictBySchemaCdIdx.containsKey(newKeySchemaCdIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateTable",
                    "TableSchemaCodeIdx", newKeySchemaCdIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableSchemaDef().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredSchemaId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateTable", "Container", "Schema", "SchemaDef", null);
            }
        }
    }

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableLoaderBehaviour().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredLoaderBehaviourId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateTable", "Lookup", "LoaderBehaviour", "LoaderBehaviour", null);
            }
        }
    }

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableSecurityScope().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredSecurityScopeId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateTable", "Lookup", "SecurityScope", "SecurityScope", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamTableBuff> 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, MSSBamTableBuff>();
        dictBySchemaIdx.put(newKeySchemaIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictBySchemaCdIdx.remove(existingKeySchemaCdIdx);
    dictBySchemaCdIdx.put(newKeySchemaCdIdx, Buff);

    subdict = dictByPrimaryIndexIdx.get(existingKeyPrimaryIndexIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByPrimaryIndexIdx.containsKey(newKeyPrimaryIndexIdx)) {
        subdict = dictByPrimaryIndexIdx.get(newKeyPrimaryIndexIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableBuff>();
        dictByPrimaryIndexIdx.put(newKeyPrimaryIndexIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByLookupIndexIdx.get(existingKeyLookupIndexIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByLookupIndexIdx.containsKey(newKeyLookupIndexIdx)) {
        subdict = dictByLookupIndexIdx.get(newKeyLookupIndexIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableBuff>();
        dictByLookupIndexIdx.put(newKeyLookupIndexIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByAltIndexIdx.get(existingKeyAltIndexIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByAltIndexIdx.containsKey(newKeyAltIndexIdx)) {
        subdict = dictByAltIndexIdx.get(newKeyAltIndexIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableBuff>();
        dictByAltIndexIdx.put(newKeyAltIndexIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByQualTableIdx.get(existingKeyQualTableIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByQualTableIdx.containsKey(newKeyQualTableIdx)) {
        subdict = dictByQualTableIdx.get(newKeyQualTableIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableBuff>();
        dictByQualTableIdx.put(newKeyQualTableIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByLoadBehaveIdx.get(existingKeyLoadBehaveIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByLoadBehaveIdx.containsKey(newKeyLoadBehaveIdx)) {
        subdict = dictByLoadBehaveIdx.get(newKeyLoadBehaveIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableBuff>();
        dictByLoadBehaveIdx.put(newKeyLoadBehaveIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByDataScopeIdx.get(existingKeyDataScopeIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByDataScopeIdx.containsKey(newKeyDataScopeIdx)) {
        subdict = dictByDataScopeIdx.get(newKeyDataScopeIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableBuff>();
        dictByDataScopeIdx.put(newKeyDataScopeIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictBySecScopeIdx.get(existingKeySecScopeIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictBySecScopeIdx.containsKey(newKeySecScopeIdx)) {
        subdict = dictBySecScopeIdx.get(newKeySecScopeIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableBuff>();
        dictBySecScopeIdx.put(newKeySecScopeIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByVAccSecIdx.get(existingKeyVAccSecIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByVAccSecIdx.containsKey(newKeyVAccSecIdx)) {
        subdict = dictByVAccSecIdx.get(newKeyVAccSecIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableBuff>();
        dictByVAccSecIdx.put(newKeyVAccSecIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByVAccFreqIdx.get(existingKeyVAccFreqIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByVAccFreqIdx.containsKey(newKeyVAccFreqIdx)) {
        subdict = dictByVAccFreqIdx.get(newKeyVAccFreqIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableBuff>();
        dictByVAccFreqIdx.put(newKeyVAccFreqIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByEAccSecIdx.get(existingKeyEAccSecIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByEAccSecIdx.containsKey(newKeyEAccSecIdx)) {
        subdict = dictByEAccSecIdx.get(newKeyEAccSecIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableBuff>();
        dictByEAccSecIdx.put(newKeyEAccSecIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByEAccFreqIdx.get(existingKeyEAccFreqIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByEAccFreqIdx.containsKey(newKeyEAccFreqIdx)) {
        subdict = dictByEAccFreqIdx.get(newKeyEAccFreqIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableBuff>();
        dictByEAccFreqIdx.put(newKeyEAccFreqIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamTableTable.java

public void deleteTable(MSSBamAuthorization Authorization, MSSBamTableBuff Buff) {
    final String S_ProcName = "MSSBamRamTableTable.deleteTable() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamTableBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteTable",
                "Existing record not found", "Table", pkey);
    }/*from w  w  w.j  a  va 2 s . com*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteTable", pkey);
    }
    MSSBamTableBySchemaIdxKey keySchemaIdx = schema.getFactoryTable().newSchemaIdxKey();
    keySchemaIdx.setRequiredSchemaId(existing.getRequiredSchemaId());

    MSSBamTableBySchemaCdIdxKey keySchemaCdIdx = schema.getFactoryTable().newSchemaCdIdxKey();
    keySchemaCdIdx.setRequiredSchemaId(existing.getRequiredSchemaId());
    keySchemaCdIdx.setRequiredTableClassCode(existing.getRequiredTableClassCode());

    MSSBamTableByPrimaryIndexIdxKey keyPrimaryIndexIdx = schema.getFactoryTable().newPrimaryIndexIdxKey();
    keyPrimaryIndexIdx.setOptionalPrimaryIndexId(existing.getOptionalPrimaryIndexId());

    MSSBamTableByLookupIndexIdxKey keyLookupIndexIdx = schema.getFactoryTable().newLookupIndexIdxKey();
    keyLookupIndexIdx.setOptionalLookupIndexId(existing.getOptionalLookupIndexId());

    MSSBamTableByAltIndexIdxKey keyAltIndexIdx = schema.getFactoryTable().newAltIndexIdxKey();
    keyAltIndexIdx.setOptionalAltIndexId(existing.getOptionalAltIndexId());

    MSSBamTableByQualTableIdxKey keyQualTableIdx = schema.getFactoryTable().newQualTableIdxKey();
    keyQualTableIdx.setOptionalQualifyingTableId(existing.getOptionalQualifyingTableId());

    MSSBamTableByLoadBehaveIdxKey keyLoadBehaveIdx = schema.getFactoryTable().newLoadBehaveIdxKey();
    keyLoadBehaveIdx.setRequiredLoaderBehaviourId(existing.getRequiredLoaderBehaviourId());

    MSSBamTableByDataScopeIdxKey keyDataScopeIdx = schema.getFactoryTable().newDataScopeIdxKey();
    keyDataScopeIdx.setOptionalDataScopeId(existing.getOptionalDataScopeId());

    MSSBamTableBySecScopeIdxKey keySecScopeIdx = schema.getFactoryTable().newSecScopeIdxKey();
    keySecScopeIdx.setRequiredSecurityScopeId(existing.getRequiredSecurityScopeId());

    MSSBamTableByVAccSecIdxKey keyVAccSecIdx = schema.getFactoryTable().newVAccSecIdxKey();
    keyVAccSecIdx.setOptionalViewAccessSecurityId(existing.getOptionalViewAccessSecurityId());

    MSSBamTableByVAccFreqIdxKey keyVAccFreqIdx = schema.getFactoryTable().newVAccFreqIdxKey();
    keyVAccFreqIdx.setOptionalViewAccessFrequencyId(existing.getOptionalViewAccessFrequencyId());

    MSSBamTableByEAccSecIdxKey keyEAccSecIdx = schema.getFactoryTable().newEAccSecIdxKey();
    keyEAccSecIdx.setOptionalEditAccessSecurityId(existing.getOptionalEditAccessSecurityId());

    MSSBamTableByEAccFreqIdxKey keyEAccFreqIdx = schema.getFactoryTable().newEAccFreqIdxKey();
    keyEAccFreqIdx.setOptionalEditAccessFrequencyId(existing.getOptionalEditAccessFrequencyId());

    // Validate reverse foreign keys

    if (schema.getTableIndex().readDerivedByTableIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "Table", "Index", pkey);
    }

    if (schema.getTableRelation().readDerivedByFromTblIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "FromTable", "Relation", pkey);
    }

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

    if (schema.getTableChain().readDerivedByTableIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "Table", "Chain", pkey);
    }

    if (schema.getTableDelTopDep().readDerivedByContTblIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "ContTable", "DelTopDep", pkey);
    }

    if (schema.getTableClearTopDep().readDerivedByContTblIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "ContTable", "ClearTopDep", pkey);
    }

    if (schema.getTableTableBlob().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableBlob", pkey);
    }

    if (schema.getTableTableBool().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableBool", pkey);
    }

    if (schema.getTableTableDate().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableDate", pkey);
    }

    if (schema.getTableTableDouble().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "Table", "TableDouble", pkey);
    }

    if (schema.getTableTableNumber().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "Table", "TableNumber", pkey);
    }

    if (schema.getTableTableFloat().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableFloat", pkey);
    }

    if (schema.getTableTableInt16().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableInt16", pkey);
    }

    if (schema.getTableTableEnum().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableEnum", pkey);
    }

    if (schema.getTableTableId16Gen().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableId16Gen", pkey);
    }

    if (schema.getTableTableUInt16().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableUInt16", pkey);
    }

    if (schema.getTableTableInt32().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableInt32", pkey);
    }

    if (schema.getTableTableId32Gen().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableId32Gen", pkey);
    }

    if (schema.getTableTableUInt32().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableUInt32", pkey);
    }

    if (schema.getTableTableInt64().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableInt64", pkey);
    }

    if (schema.getTableTableId64Gen().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableId64Gen", pkey);
    }

    if (schema.getTableTableUInt64().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableUInt64", pkey);
    }

    if (schema.getTableTableNmToken().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableNmToken", pkey);
    }

    if (schema.getTableTableNmTokens().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableNmTokens", pkey);
    }

    if (schema.getTableTableString().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableString", pkey);
    }

    if (schema.getTableTableTZDate().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableTZDate", pkey);
    }

    if (schema.getTableTableTZTime().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableTZTime", pkey);
    }

    if (schema.getTableTableTZTimestamp().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableTZTimestamp", pkey);
    }

    if (schema.getTableTableText().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableText", pkey);
    }

    if (schema.getTableTableTime().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableTime", pkey);
    }

    if (schema.getTableTableTimestamp().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableTimestamp", pkey);
    }

    if (schema.getTableTableToken().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableToken", pkey);
    }

    if (schema.getTableTableUuid().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableUuid", pkey);
    }

    if (schema.getTableTableUuidGen().readDerivedByContainerIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableUuidGen", pkey);
    }

    if (schema.getTableTableCol().readDerivedByCTableIdx(Authorization, existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteTable",
                "Container", "CTable", "TableCol", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamTableBuff> subdict;

    dictByPKey.remove(pkey);

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

    dictBySchemaCdIdx.remove(keySchemaCdIdx);

    subdict = dictByPrimaryIndexIdx.get(keyPrimaryIndexIdx);
    subdict.remove(pkey);

    subdict = dictByLookupIndexIdx.get(keyLookupIndexIdx);
    subdict.remove(pkey);

    subdict = dictByAltIndexIdx.get(keyAltIndexIdx);
    subdict.remove(pkey);

    subdict = dictByQualTableIdx.get(keyQualTableIdx);
    subdict.remove(pkey);

    subdict = dictByLoadBehaveIdx.get(keyLoadBehaveIdx);
    subdict.remove(pkey);

    subdict = dictByDataScopeIdx.get(keyDataScopeIdx);
    subdict.remove(pkey);

    subdict = dictBySecScopeIdx.get(keySecScopeIdx);
    subdict.remove(pkey);

    subdict = dictByVAccSecIdx.get(keyVAccSecIdx);
    subdict.remove(pkey);

    subdict = dictByVAccFreqIdx.get(keyVAccFreqIdx);
    subdict.remove(pkey);

    subdict = dictByEAccSecIdx.get(keyEAccSecIdx);
    subdict.remove(pkey);

    subdict = dictByEAccFreqIdx.get(keyEAccFreqIdx);
    subdict.remove(pkey);

}