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

public void deleteMemoTag(MSSBamAuthorization Authorization, MSSBamMemoTagBuff Buff) {
    final String S_ProcName = "MSSBamRamMemoTagTable.deleteMemoTag() ";
    MSSBamMemoTagPKey pkey = schema.getFactoryMemoTag().newPKey();

    pkey.setRequiredMemoId(Buff.getRequiredMemoId());
    pkey.setRequiredTagId(Buff.getRequiredTagId());
    MSSBamMemoTagBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteMemoTag",
                "Existing record not found", "MemoTag", pkey);
    }/*from  www  . j  a v  a  2s .  c  om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteMemoTag",
                pkey);
    }
    MSSBamMemoTagByMemoIdxKey keyMemoIdx = schema.getFactoryMemoTag().newMemoIdxKey();
    keyMemoIdx.setRequiredMemoId(existing.getRequiredMemoId());

    MSSBamMemoTagByTagIdxKey keyTagIdx = schema.getFactoryMemoTag().newTagIdxKey();
    keyTagIdx.setRequiredTagId(existing.getRequiredTagId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamMemoTagPKey, MSSBamMemoTagBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByMemoIdx.get(keyMemoIdx);
    subdict.remove(pkey);

    subdict = dictByTagIdx.get(keyTagIdx);
    subdict.remove(pkey);

}

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

public void updateMinorVersion(MSSBamAuthorization Authorization, MSSBamMinorVersionBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamMinorVersionBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "updateMinorVersion", "Existing record not found", "MinorVersion", pkey);
    }//from   w  ww .  j  a v a  2  s.c o m
    MSSBamMinorVersionByMainVerIdxKey existingKeyMainVerIdx = schema.getFactoryMinorVersion()
            .newMainVerIdxKey();
    existingKeyMainVerIdx.setRequiredMainVersionId(existing.getRequiredMainVersionId());

    MSSBamMinorVersionByMainVerIdxKey newKeyMainVerIdx = schema.getFactoryMinorVersion().newMainVerIdxKey();
    newKeyMainVerIdx.setRequiredMainVersionId(Buff.getRequiredMainVersionId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableVersion().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredMainVersionId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateMinorVersion", "Container", "MainVersion", "Version", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamMinorVersionBuff> subdict;

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

    subdict = dictByMainVerIdx.get(existingKeyMainVerIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByMainVerIdx.containsKey(newKeyMainVerIdx)) {
        subdict = dictByMainVerIdx.get(newKeyMainVerIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamMinorVersionBuff>();
        dictByMainVerIdx.put(newKeyMainVerIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteMinorVersion(MSSBamAuthorization Authorization, MSSBamMinorVersionBuff Buff) {
    final String S_ProcName = "MSSBamRamMinorVersionTable.deleteMinorVersion() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamMinorVersionBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "deleteMinorVersion", "Existing record not found", "MinorVersion", pkey);
    }//w  ww. j  a  v a2  s .co  m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteMinorVersion",
                pkey);
    }
    MSSBamMinorVersionByMainVerIdxKey keyMainVerIdx = schema.getFactoryMinorVersion().newMainVerIdxKey();
    keyMainVerIdx.setRequiredMainVersionId(existing.getRequiredMainVersionId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamMinorVersionBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByMainVerIdx.get(keyMainVerIdx);
    subdict.remove(pkey);

}

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

public void updatePhone(MSSBamAuthorization Authorization, MSSBamPhoneBuff Buff) {
    MSSBamPhonePKey pkey = schema.getFactoryPhone().newPKey();
    pkey.setRequiredPhoneId(Buff.getRequiredPhoneId());
    MSSBamPhoneBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updatePhone",
                "Existing record not found", "Phone", pkey);
    }/*  w  w  w  .j av  a  2s .  co m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updatePhone", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamPhoneByContactIdxKey existingKeyContactIdx = schema.getFactoryPhone().newContactIdxKey();
    existingKeyContactIdx.setRequiredContactId(existing.getRequiredContactId());

    MSSBamPhoneByContactIdxKey newKeyContactIdx = schema.getFactoryPhone().newContactIdxKey();
    newKeyContactIdx.setRequiredContactId(Buff.getRequiredContactId());

    MSSBamPhoneByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryPhone().newUDescrIdxKey();
    existingKeyUDescrIdx.setRequiredContactId(existing.getRequiredContactId());
    existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    MSSBamPhoneByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryPhone().newUDescrIdxKey();
    newKeyUDescrIdx.setRequiredContactId(Buff.getRequiredContactId());
    newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

    MSSBamPhoneByUPhoneNumberIdxKey existingKeyUPhoneNumberIdx = schema.getFactoryPhone()
            .newUPhoneNumberIdxKey();
    existingKeyUPhoneNumberIdx.setRequiredContactId(existing.getRequiredContactId());
    existingKeyUPhoneNumberIdx.setRequiredPhoneNumber(existing.getRequiredPhoneNumber());

    MSSBamPhoneByUPhoneNumberIdxKey newKeyUPhoneNumberIdx = schema.getFactoryPhone().newUPhoneNumberIdxKey();
    newKeyUPhoneNumberIdx.setRequiredContactId(Buff.getRequiredContactId());
    newKeyUPhoneNumberIdx.setRequiredPhoneNumber(Buff.getRequiredPhoneNumber());

    // Check unique indexes

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

    if (!existingKeyUPhoneNumberIdx.equals(newKeyUPhoneNumberIdx)) {
        if (dictByUPhoneNumberIdx.containsKey(newKeyUPhoneNumberIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updatePhone",
                    "PhoneUPhoneNumberIdx", newKeyUPhoneNumberIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableContact().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredContactId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updatePhone", "Container", "Contact", "Contact", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamPhonePKey, MSSBamPhoneBuff> subdict;

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

    subdict = dictByContactIdx.get(existingKeyContactIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByContactIdx.containsKey(newKeyContactIdx)) {
        subdict = dictByContactIdx.get(newKeyContactIdx);
    } else {
        subdict = new TreeMap<MSSBamPhonePKey, MSSBamPhoneBuff>();
        dictByContactIdx.put(newKeyContactIdx, subdict);
    }
    subdict.put(pkey, Buff);

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

    dictByUPhoneNumberIdx.remove(existingKeyUPhoneNumberIdx);
    dictByUPhoneNumberIdx.put(newKeyUPhoneNumberIdx, Buff);

}

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

public void deletePhone(MSSBamAuthorization Authorization, MSSBamPhoneBuff Buff) {
    final String S_ProcName = "MSSBamRamPhoneTable.deletePhone() ";
    MSSBamPhonePKey pkey = schema.getFactoryPhone().newPKey();

    pkey.setRequiredPhoneId(schema.nextPhoneIdGen());
    MSSBamPhoneBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deletePhone",
                "Existing record not found", "Phone", pkey);
    }//  ww  w . j a v a2s .  com
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deletePhone", pkey);
    }
    MSSBamPhoneByContactIdxKey keyContactIdx = schema.getFactoryPhone().newContactIdxKey();
    keyContactIdx.setRequiredContactId(existing.getRequiredContactId());

    MSSBamPhoneByUDescrIdxKey keyUDescrIdx = schema.getFactoryPhone().newUDescrIdxKey();
    keyUDescrIdx.setRequiredContactId(existing.getRequiredContactId());
    keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    MSSBamPhoneByUPhoneNumberIdxKey keyUPhoneNumberIdx = schema.getFactoryPhone().newUPhoneNumberIdxKey();
    keyUPhoneNumberIdx.setRequiredContactId(existing.getRequiredContactId());
    keyUPhoneNumberIdx.setRequiredPhoneNumber(existing.getRequiredPhoneNumber());

    // Validate reverse foreign keys

    if (schema.getTablePhoneTag().readDerivedByPhoneIdx(Authorization,
            existing.getRequiredPhoneId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deletePhone",
                "Container", "ContactPhone", "PhoneTag", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamPhonePKey, MSSBamPhoneBuff> subdict;

    dictByPKey.remove(pkey);

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

    dictByUDescrIdx.remove(keyUDescrIdx);

    dictByUPhoneNumberIdx.remove(keyUPhoneNumberIdx);

}

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

public void updatePhoneTag(MSSBamAuthorization Authorization, MSSBamPhoneTagBuff Buff) {
    MSSBamPhoneTagPKey pkey = schema.getFactoryPhoneTag().newPKey();
    pkey.setRequiredPhoneId(Buff.getRequiredPhoneId());
    pkey.setRequiredTagId(Buff.getRequiredTagId());
    MSSBamPhoneTagBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updatePhoneTag",
                "Existing record not found", "PhoneTag", pkey);
    }/*from   ww w .  j a  v  a 2  s .c om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updatePhoneTag",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamPhoneTagByPhoneIdxKey existingKeyPhoneIdx = schema.getFactoryPhoneTag().newPhoneIdxKey();
    existingKeyPhoneIdx.setRequiredPhoneId(existing.getRequiredPhoneId());

    MSSBamPhoneTagByPhoneIdxKey newKeyPhoneIdx = schema.getFactoryPhoneTag().newPhoneIdxKey();
    newKeyPhoneIdx.setRequiredPhoneId(Buff.getRequiredPhoneId());

    MSSBamPhoneTagByTagIdxKey existingKeyTagIdx = schema.getFactoryPhoneTag().newTagIdxKey();
    existingKeyTagIdx.setRequiredTagId(existing.getRequiredTagId());

    MSSBamPhoneTagByTagIdxKey newKeyTagIdx = schema.getFactoryPhoneTag().newTagIdxKey();
    newKeyTagIdx.setRequiredTagId(Buff.getRequiredTagId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTablePhone().readDerivedByIdIdx(Authorization, Buff.getRequiredPhoneId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updatePhoneTag", "Container", "ContactPhone", "Phone", null);
            }
        }
    }

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableTag().readDerivedByIdIdx(Authorization, Buff.getRequiredTagId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updatePhoneTag", "Lookup", "Tag", "Tag", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamPhoneTagPKey, MSSBamPhoneTagBuff> subdict;

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

    subdict = dictByPhoneIdx.get(existingKeyPhoneIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByPhoneIdx.containsKey(newKeyPhoneIdx)) {
        subdict = dictByPhoneIdx.get(newKeyPhoneIdx);
    } else {
        subdict = new TreeMap<MSSBamPhoneTagPKey, MSSBamPhoneTagBuff>();
        dictByPhoneIdx.put(newKeyPhoneIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByTagIdx.get(existingKeyTagIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByTagIdx.containsKey(newKeyTagIdx)) {
        subdict = dictByTagIdx.get(newKeyTagIdx);
    } else {
        subdict = new TreeMap<MSSBamPhoneTagPKey, MSSBamPhoneTagBuff>();
        dictByTagIdx.put(newKeyTagIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deletePhoneTag(MSSBamAuthorization Authorization, MSSBamPhoneTagBuff Buff) {
    final String S_ProcName = "MSSBamRamPhoneTagTable.deletePhoneTag() ";
    MSSBamPhoneTagPKey pkey = schema.getFactoryPhoneTag().newPKey();

    pkey.setRequiredPhoneId(Buff.getRequiredPhoneId());
    pkey.setRequiredTagId(Buff.getRequiredTagId());
    MSSBamPhoneTagBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deletePhoneTag",
                "Existing record not found", "PhoneTag", pkey);
    }/*from w  w w  .j av  a  2s. c  om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deletePhoneTag",
                pkey);
    }
    MSSBamPhoneTagByPhoneIdxKey keyPhoneIdx = schema.getFactoryPhoneTag().newPhoneIdxKey();
    keyPhoneIdx.setRequiredPhoneId(existing.getRequiredPhoneId());

    MSSBamPhoneTagByTagIdxKey keyTagIdx = schema.getFactoryPhoneTag().newTagIdxKey();
    keyTagIdx.setRequiredTagId(existing.getRequiredTagId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamPhoneTagPKey, MSSBamPhoneTagBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByPhoneIdx.get(keyPhoneIdx);
    subdict.remove(pkey);

    subdict = dictByTagIdx.get(keyTagIdx);
    subdict.remove(pkey);

}

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

public void updateProject(MSSBamAuthorization Authorization, MSSBamProjectBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamProjectBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateProject",
                "Existing record not found", "Project", pkey);
    }//from  w  ww  .jav  a  2s. c  o m
    MSSBamProjectByOwnerIdxKey existingKeyOwnerIdx = schema.getFactoryProject().newOwnerIdxKey();
    existingKeyOwnerIdx.setOptionalOwnerId(existing.getOptionalOwnerId());

    MSSBamProjectByOwnerIdxKey newKeyOwnerIdx = schema.getFactoryProject().newOwnerIdxKey();
    newKeyOwnerIdx.setOptionalOwnerId(Buff.getOptionalOwnerId());

    MSSBamProjectBySubProjIdxKey existingKeySubProjIdx = schema.getFactoryProject().newSubProjIdxKey();
    existingKeySubProjIdx.setOptionalContainerProjectId(existing.getOptionalContainerProjectId());

    MSSBamProjectBySubProjIdxKey newKeySubProjIdx = schema.getFactoryProject().newSubProjIdxKey();
    newKeySubProjIdx.setOptionalContainerProjectId(Buff.getOptionalContainerProjectId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff> subdict;

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

    subdict = dictByOwnerIdx.get(existingKeyOwnerIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByOwnerIdx.containsKey(newKeyOwnerIdx)) {
        subdict = dictByOwnerIdx.get(newKeyOwnerIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamProjectBuff>();
        dictByOwnerIdx.put(newKeyOwnerIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictBySubProjIdx.get(existingKeySubProjIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictBySubProjIdx.containsKey(newKeySubProjIdx)) {
        subdict = dictBySubProjIdx.get(newKeySubProjIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamProjectBuff>();
        dictBySubProjIdx.put(newKeySubProjIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteProject(MSSBamAuthorization Authorization, MSSBamProjectBuff Buff) {
    final String S_ProcName = "MSSBamRamProjectTable.deleteProject() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamProjectBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteProject",
                "Existing record not found", "Project", pkey);
    }/*  ww w  .j  a va  2s  .c  om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteProject",
                pkey);
    }
    MSSBamProjectByOwnerIdxKey keyOwnerIdx = schema.getFactoryProject().newOwnerIdxKey();
    keyOwnerIdx.setOptionalOwnerId(existing.getOptionalOwnerId());

    MSSBamProjectBySubProjIdxKey keySubProjIdx = schema.getFactoryProject().newSubProjIdxKey();
    keySubProjIdx.setOptionalContainerProjectId(existing.getOptionalContainerProjectId());

    // Validate reverse foreign keys

    if (schema.getTableMajorVersion().readDerivedByProjIdx(Authorization,
            existing.getRequiredId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteProject",
                "Container", "Project", "MajorVersion", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByOwnerIdx.get(keyOwnerIdx);
    subdict.remove(pkey);

    subdict = dictBySubProjIdx.get(keySubProjIdx);
    subdict.remove(pkey);

}

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

public void updateRelationCol(MSSBamAuthorization Authorization, MSSBamRelationColBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamRelationColBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateRelationCol",
                "Existing record not found", "RelationCol", pkey);
    }/*w  ww  .  ja v  a 2s  .  c o  m*/
    MSSBamRelationColByRelationIdxKey existingKeyRelationIdx = schema.getFactoryRelationCol()
            .newRelationIdxKey();
    existingKeyRelationIdx.setRequiredRelationId(existing.getRequiredRelationId());

    MSSBamRelationColByRelationIdxKey newKeyRelationIdx = schema.getFactoryRelationCol().newRelationIdxKey();
    newKeyRelationIdx.setRequiredRelationId(Buff.getRequiredRelationId());

    MSSBamRelationColByFromColIdxKey existingKeyFromColIdx = schema.getFactoryRelationCol().newFromColIdxKey();
    existingKeyFromColIdx.setRequiredFromColId(existing.getRequiredFromColId());

    MSSBamRelationColByFromColIdxKey newKeyFromColIdx = schema.getFactoryRelationCol().newFromColIdxKey();
    newKeyFromColIdx.setRequiredFromColId(Buff.getRequiredFromColId());

    MSSBamRelationColByToColIdxKey existingKeyToColIdx = schema.getFactoryRelationCol().newToColIdxKey();
    existingKeyToColIdx.setRequiredToColId(existing.getRequiredToColId());

    MSSBamRelationColByToColIdxKey newKeyToColIdx = schema.getFactoryRelationCol().newToColIdxKey();
    newKeyToColIdx.setRequiredToColId(Buff.getRequiredToColId());

    MSSBamRelationColByPrevIdxKey existingKeyPrevIdx = schema.getFactoryRelationCol().newPrevIdxKey();
    existingKeyPrevIdx.setOptionalPrevId(existing.getOptionalPrevId());

    MSSBamRelationColByPrevIdxKey newKeyPrevIdx = schema.getFactoryRelationCol().newPrevIdxKey();
    newKeyPrevIdx.setOptionalPrevId(Buff.getOptionalPrevId());

    MSSBamRelationColByNextIdxKey existingKeyNextIdx = schema.getFactoryRelationCol().newNextIdxKey();
    existingKeyNextIdx.setOptionalNextId(existing.getOptionalNextId());

    MSSBamRelationColByNextIdxKey newKeyNextIdx = schema.getFactoryRelationCol().newNextIdxKey();
    newKeyNextIdx.setOptionalNextId(Buff.getOptionalNextId());

    MSSBamRelationColByRelPrevIdxKey existingKeyRelPrevIdx = schema.getFactoryRelationCol().newRelPrevIdxKey();
    existingKeyRelPrevIdx.setRequiredRelationId(existing.getRequiredRelationId());
    existingKeyRelPrevIdx.setOptionalPrevId(existing.getOptionalPrevId());

    MSSBamRelationColByRelPrevIdxKey newKeyRelPrevIdx = schema.getFactoryRelationCol().newRelPrevIdxKey();
    newKeyRelPrevIdx.setRequiredRelationId(Buff.getRequiredRelationId());
    newKeyRelPrevIdx.setOptionalPrevId(Buff.getOptionalPrevId());

    MSSBamRelationColByRelNextIdxKey existingKeyRelNextIdx = schema.getFactoryRelationCol().newRelNextIdxKey();
    existingKeyRelNextIdx.setRequiredRelationId(existing.getRequiredRelationId());
    existingKeyRelNextIdx.setOptionalNextId(existing.getOptionalNextId());

    MSSBamRelationColByRelNextIdxKey newKeyRelNextIdx = schema.getFactoryRelationCol().newRelNextIdxKey();
    newKeyRelNextIdx.setRequiredRelationId(Buff.getRequiredRelationId());
    newKeyRelNextIdx.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(),
                        "updateRelationCol", "Superclass", "SuperClass", "AnyObj", null);
            }
        }
    }

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

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

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamRelationColBuff> subdict;

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

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

    subdict = dictByFromColIdx.get(existingKeyFromColIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByFromColIdx.containsKey(newKeyFromColIdx)) {
        subdict = dictByFromColIdx.get(newKeyFromColIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamRelationColBuff>();
        dictByFromColIdx.put(newKeyFromColIdx, 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, MSSBamRelationColBuff>();
        dictByToColIdx.put(newKeyToColIdx, 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, MSSBamRelationColBuff>();
        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, MSSBamRelationColBuff>();
        dictByNextIdx.put(newKeyNextIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByRelPrevIdx.get(existingKeyRelPrevIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByRelPrevIdx.containsKey(newKeyRelPrevIdx)) {
        subdict = dictByRelPrevIdx.get(newKeyRelPrevIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamRelationColBuff>();
        dictByRelPrevIdx.put(newKeyRelPrevIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByRelNextIdx.get(existingKeyRelNextIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByRelNextIdx.containsKey(newKeyRelNextIdx)) {
        subdict = dictByRelNextIdx.get(newKeyRelNextIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamRelationColBuff>();
        dictByRelNextIdx.put(newKeyRelNextIdx, subdict);
    }
    subdict.put(pkey, Buff);

}