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

public void deleteAttachmentTag(MSSBamAuthorization Authorization, MSSBamAttachmentTagBuff Buff) {
    final String S_ProcName = "MSSBamRamAttachmentTagTable.deleteAttachmentTag() ";
    MSSBamAttachmentTagPKey pkey = schema.getFactoryAttachmentTag().newPKey();

    pkey.setRequiredAttachmentId(Buff.getRequiredAttachmentId());
    pkey.setRequiredTagId(Buff.getRequiredTagId());
    MSSBamAttachmentTagBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "deleteAttachmentTag", "Existing record not found", "AttachmentTag", pkey);
    }/*  www  .  j ava2s.co  m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteAttachmentTag", pkey);
    }
    MSSBamAttachmentTagByAttachmentIdxKey keyAttachmentIdx = schema.getFactoryAttachmentTag()
            .newAttachmentIdxKey();
    keyAttachmentIdx.setRequiredAttachmentId(existing.getRequiredAttachmentId());

    MSSBamAttachmentTagByTagIdxKey keyTagIdx = schema.getFactoryAttachmentTag().newTagIdxKey();
    keyTagIdx.setRequiredTagId(existing.getRequiredTagId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamAttachmentTagPKey, MSSBamAttachmentTagBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByAttachmentIdx.get(keyAttachmentIdx);
    subdict.remove(pkey);

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

}

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

public void updateChain(MSSBamAuthorization Authorization, MSSBamChainBuff Buff) {
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    MSSBamChainBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateChain",
                "Existing record not found", "Chain", pkey);
    }/*from  www  .  jav a  2s .  c om*/
    MSSBamChainByTableIdxKey existingKeyTableIdx = schema.getFactoryChain().newTableIdxKey();
    existingKeyTableIdx.setRequiredTableId(existing.getRequiredTableId());

    MSSBamChainByTableIdxKey newKeyTableIdx = schema.getFactoryChain().newTableIdxKey();
    newKeyTableIdx.setRequiredTableId(Buff.getRequiredTableId());

    MSSBamChainByPrevRelIdxKey existingKeyPrevRelIdx = schema.getFactoryChain().newPrevRelIdxKey();
    existingKeyPrevRelIdx.setOptionalPrevRelationId(existing.getOptionalPrevRelationId());

    MSSBamChainByPrevRelIdxKey newKeyPrevRelIdx = schema.getFactoryChain().newPrevRelIdxKey();
    newKeyPrevRelIdx.setOptionalPrevRelationId(Buff.getOptionalPrevRelationId());

    MSSBamChainByNextRelIdxKey existingKeyNextRelIdx = schema.getFactoryChain().newNextRelIdxKey();
    existingKeyNextRelIdx.setOptionalNextRelationId(existing.getOptionalNextRelationId());

    MSSBamChainByNextRelIdxKey newKeyNextRelIdx = schema.getFactoryChain().newNextRelIdxKey();
    newKeyNextRelIdx.setOptionalNextRelationId(Buff.getOptionalNextRelationId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;
        if (Buff.getOptionalPrevRelationId() != null) {
            allNull = false;
        }
        if (allNull) {
            if (null == schema.getTableRelation().readDerivedByIdIdx(Authorization,
                    Buff.getOptionalPrevRelationId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateChain", "Lookup", "PrevRelation", "Relation", null);
            }
        }
    }

    {
        boolean allNull = true;
        if (Buff.getOptionalNextRelationId() != null) {
            allNull = false;
        }
        if (allNull) {
            if (null == schema.getTableRelation().readDerivedByIdIdx(Authorization,
                    Buff.getOptionalNextRelationId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateChain", "Lookup", "NextRelation", "Relation", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamChainBuff> subdict;

    dictByPKey.remove(pkey);
    dictByPKey.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, MSSBamChainBuff>();
        dictByTableIdx.put(newKeyTableIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByPrevRelIdx.get(existingKeyPrevRelIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByPrevRelIdx.containsKey(newKeyPrevRelIdx)) {
        subdict = dictByPrevRelIdx.get(newKeyPrevRelIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamChainBuff>();
        dictByPrevRelIdx.put(newKeyPrevRelIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByNextRelIdx.get(existingKeyNextRelIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByNextRelIdx.containsKey(newKeyNextRelIdx)) {
        subdict = dictByNextRelIdx.get(newKeyNextRelIdx);
    } else {
        subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamChainBuff>();
        dictByNextRelIdx.put(newKeyNextRelIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteChain(MSSBamAuthorization Authorization, MSSBamChainBuff Buff) {
    final String S_ProcName = "MSSBamRamChainTable.deleteChain() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamChainBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteChain",
                "Existing record not found", "Chain", pkey);
    }/*from  w  w w  . ja v  a2 s.  co m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteChain", pkey);
    }
    MSSBamChainByTableIdxKey keyTableIdx = schema.getFactoryChain().newTableIdxKey();
    keyTableIdx.setRequiredTableId(existing.getRequiredTableId());

    MSSBamChainByPrevRelIdxKey keyPrevRelIdx = schema.getFactoryChain().newPrevRelIdxKey();
    keyPrevRelIdx.setOptionalPrevRelationId(existing.getOptionalPrevRelationId());

    MSSBamChainByNextRelIdxKey keyNextRelIdx = schema.getFactoryChain().newNextRelIdxKey();
    keyNextRelIdx.setOptionalNextRelationId(existing.getOptionalNextRelationId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamChainBuff> subdict;

    dictByPKey.remove(pkey);

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

    subdict = dictByPrevRelIdx.get(keyPrevRelIdx);
    subdict.remove(pkey);

    subdict = dictByNextRelIdx.get(keyNextRelIdx);
    subdict.remove(pkey);

}

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

public void updateContactList(MSSBamAuthorization Authorization, MSSBamContactListBuff Buff) {
    MSSBamContactListPKey pkey = schema.getFactoryContactList().newPKey();
    pkey.setRequiredContactListId(Buff.getRequiredContactListId());
    MSSBamContactListBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateContactList",
                "Existing record not found", "ContactList", pkey);
    }//from  w  ww.  j av  a2 s.  co  m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateContactList",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamContactListByTenantIdxKey existingKeyTenantIdx = schema.getFactoryContactList().newTenantIdxKey();
    existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    MSSBamContactListByTenantIdxKey newKeyTenantIdx = schema.getFactoryContactList().newTenantIdxKey();
    newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId());

    MSSBamContactListByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryContactList().newUDescrIdxKey();
    existingKeyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    MSSBamContactListByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryContactList().newUDescrIdxKey();
    newKeyUDescrIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

    // Check unique indexes

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

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableTenant().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateContactList", "Container", "ContactListTenant", "Tenant", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamContactListPKey, MSSBamContactListBuff> subdict;

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

    subdict = dictByTenantIdx.get(existingKeyTenantIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByTenantIdx.containsKey(newKeyTenantIdx)) {
        subdict = dictByTenantIdx.get(newKeyTenantIdx);
    } else {
        subdict = new TreeMap<MSSBamContactListPKey, MSSBamContactListBuff>();
        dictByTenantIdx.put(newKeyTenantIdx, subdict);
    }
    subdict.put(pkey, Buff);

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

}

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

public void deleteContactList(MSSBamAuthorization Authorization, MSSBamContactListBuff Buff) {
    final String S_ProcName = "MSSBamRamContactListTable.deleteContactList() ";
    MSSBamContactListPKey pkey = schema.getFactoryContactList().newPKey();

    pkey.setRequiredContactListId(schema.nextContactListIdGen());
    MSSBamContactListBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteContactList",
                "Existing record not found", "ContactList", pkey);
    }/*w ww .  j  a  v a 2 s .c  om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteContactList",
                pkey);
    }
    MSSBamContactListByTenantIdxKey keyTenantIdx = schema.getFactoryContactList().newTenantIdxKey();
    keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    MSSBamContactListByUDescrIdxKey keyUDescrIdx = schema.getFactoryContactList().newUDescrIdxKey();
    keyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    // Validate reverse foreign keys

    if (schema.getTableContact().readDerivedByContactListIdx(Authorization,
            existing.getRequiredContactListId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteContactList",
                "Container", "ContactList", "Contact", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamContactListPKey, MSSBamContactListBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByTenantIdx.get(keyTenantIdx);
    subdict.remove(pkey);

    dictByUDescrIdx.remove(keyUDescrIdx);

}

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

public void updateContact(MSSBamAuthorization Authorization, MSSBamContactBuff Buff) {
    MSSBamContactPKey pkey = schema.getFactoryContact().newPKey();
    pkey.setRequiredContactId(Buff.getRequiredContactId());
    MSSBamContactBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateContact",
                "Existing record not found", "Contact", pkey);
    }//from  www.j  a  v a 2  s.co m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateContact",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamContactByContactListIdxKey existingKeyContactListIdx = schema.getFactoryContact()
            .newContactListIdxKey();
    existingKeyContactListIdx.setRequiredContactListId(existing.getRequiredContactListId());

    MSSBamContactByContactListIdxKey newKeyContactListIdx = schema.getFactoryContact().newContactListIdxKey();
    newKeyContactListIdx.setRequiredContactListId(Buff.getRequiredContactListId());

    MSSBamContactByISOTimezoneIdxKey existingKeyISOTimezoneIdx = schema.getFactoryContact()
            .newISOTimezoneIdxKey();
    existingKeyISOTimezoneIdx.setOptionalISOTimezoneId(existing.getOptionalISOTimezoneId());

    MSSBamContactByISOTimezoneIdxKey newKeyISOTimezoneIdx = schema.getFactoryContact().newISOTimezoneIdxKey();
    newKeyISOTimezoneIdx.setOptionalISOTimezoneId(Buff.getOptionalISOTimezoneId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableContactList().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredContactListId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateContact", "Container", "ContactList", "ContactList", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamContactPKey, MSSBamContactBuff> subdict;

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

    subdict = dictByContactListIdx.get(existingKeyContactListIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByContactListIdx.containsKey(newKeyContactListIdx)) {
        subdict = dictByContactListIdx.get(newKeyContactListIdx);
    } else {
        subdict = new TreeMap<MSSBamContactPKey, MSSBamContactBuff>();
        dictByContactListIdx.put(newKeyContactListIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByISOTimezoneIdx.get(existingKeyISOTimezoneIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByISOTimezoneIdx.containsKey(newKeyISOTimezoneIdx)) {
        subdict = dictByISOTimezoneIdx.get(newKeyISOTimezoneIdx);
    } else {
        subdict = new TreeMap<MSSBamContactPKey, MSSBamContactBuff>();
        dictByISOTimezoneIdx.put(newKeyISOTimezoneIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteContact(MSSBamAuthorization Authorization, MSSBamContactBuff Buff) {
    final String S_ProcName = "MSSBamRamContactTable.deleteContact() ";
    MSSBamContactPKey pkey = schema.getFactoryContact().newPKey();

    pkey.setRequiredContactId(schema.nextContactIdGen());
    MSSBamContactBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteContact",
                "Existing record not found", "Contact", pkey);
    }//from   ww  w .j ava  2 s  .c o m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteContact",
                pkey);
    }
    MSSBamContactByContactListIdxKey keyContactListIdx = schema.getFactoryContact().newContactListIdxKey();
    keyContactListIdx.setRequiredContactListId(existing.getRequiredContactListId());

    MSSBamContactByISOTimezoneIdxKey keyISOTimezoneIdx = schema.getFactoryContact().newISOTimezoneIdxKey();
    keyISOTimezoneIdx.setOptionalISOTimezoneId(existing.getOptionalISOTimezoneId());

    // Validate reverse foreign keys

    if (schema.getTableAddress().readDerivedByContactIdx(Authorization,
            existing.getRequiredContactId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteContact",
                "Container", "Contact", "Address", pkey);
    }

    if (schema.getTableAttachment().readDerivedByContactIdx(Authorization,
            existing.getRequiredContactId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteContact",
                "Container", "Contact", "Attachment", pkey);
    }

    if (schema.getTableContactTag().readDerivedByContactIdx(Authorization,
            existing.getRequiredContactId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteContact",
                "Container", "ContactTagContact", "ContactTag", pkey);
    }

    if (schema.getTableMemo().readDerivedByMemoContactIdx(Authorization,
            existing.getRequiredContactId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteContact",
                "Container", "MemoContact", "Memo", pkey);
    }

    if (schema.getTablePhone().readDerivedByContactIdx(Authorization,
            existing.getRequiredContactId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteContact",
                "Container", "Contact", "Phone", pkey);
    }

    if (schema.getTableContactURL().readDerivedByContactIdx(Authorization,
            existing.getRequiredContactId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteContact",
                "Container", "Contact", "ContactURL", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamContactPKey, MSSBamContactBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByContactListIdx.get(keyContactListIdx);
    subdict.remove(pkey);

    subdict = dictByISOTimezoneIdx.get(keyISOTimezoneIdx);
    subdict.remove(pkey);

}

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

public void updateContactTag(MSSBamAuthorization Authorization, MSSBamContactTagBuff Buff) {
    MSSBamContactTagPKey pkey = schema.getFactoryContactTag().newPKey();
    pkey.setRequiredContactId(Buff.getRequiredContactId());
    pkey.setRequiredTagId(Buff.getRequiredTagId());
    MSSBamContactTagBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateContactTag",
                "Existing record not found", "ContactTag", pkey);
    }/*from   w  w w  .  j  a  v a2s . c  o m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateContactTag",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamContactTagByContactIdxKey existingKeyContactIdx = schema.getFactoryContactTag().newContactIdxKey();
    existingKeyContactIdx.setRequiredContactId(existing.getRequiredContactId());

    MSSBamContactTagByContactIdxKey newKeyContactIdx = schema.getFactoryContactTag().newContactIdxKey();
    newKeyContactIdx.setRequiredContactId(Buff.getRequiredContactId());

    MSSBamContactTagByTagIdxKey existingKeyTagIdx = schema.getFactoryContactTag().newTagIdxKey();
    existingKeyTagIdx.setRequiredTagId(existing.getRequiredTagId());

    MSSBamContactTagByTagIdxKey newKeyTagIdx = schema.getFactoryContactTag().newTagIdxKey();
    newKeyTagIdx.setRequiredTagId(Buff.getRequiredTagId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

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

    // Update is valid

    SortedMap<MSSBamContactTagPKey, MSSBamContactTagBuff> 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<MSSBamContactTagPKey, MSSBamContactTagBuff>();
        dictByContactIdx.put(newKeyContactIdx, 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<MSSBamContactTagPKey, MSSBamContactTagBuff>();
        dictByTagIdx.put(newKeyTagIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteContactTag(MSSBamAuthorization Authorization, MSSBamContactTagBuff Buff) {
    final String S_ProcName = "MSSBamRamContactTagTable.deleteContactTag() ";
    MSSBamContactTagPKey pkey = schema.getFactoryContactTag().newPKey();

    pkey.setRequiredContactId(Buff.getRequiredContactId());
    pkey.setRequiredTagId(Buff.getRequiredTagId());
    MSSBamContactTagBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteContactTag",
                "Existing record not found", "ContactTag", pkey);
    }/*from ww  w  .  j a  v  a 2  s  . c o m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteContactTag",
                pkey);
    }
    MSSBamContactTagByContactIdxKey keyContactIdx = schema.getFactoryContactTag().newContactIdxKey();
    keyContactIdx.setRequiredContactId(existing.getRequiredContactId());

    MSSBamContactTagByTagIdxKey keyTagIdx = schema.getFactoryContactTag().newTagIdxKey();
    keyTagIdx.setRequiredTagId(existing.getRequiredTagId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamContactTagPKey, MSSBamContactTagBuff> subdict;

    dictByPKey.remove(pkey);

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

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

}

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

public void updateContactURL(MSSBamAuthorization Authorization, MSSBamContactURLBuff Buff) {
    MSSBamContactURLPKey pkey = schema.getFactoryContactURL().newPKey();
    pkey.setRequiredContactURLId(Buff.getRequiredContactURLId());
    MSSBamContactURLBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateContactURL",
                "Existing record not found", "ContactURL", pkey);
    }//from   w ww  .  j  ava2s  .  co m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateContactURL",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamContactURLByContactIdxKey existingKeyContactIdx = schema.getFactoryContactURL().newContactIdxKey();
    existingKeyContactIdx.setRequiredContactId(existing.getRequiredContactId());

    MSSBamContactURLByContactIdxKey newKeyContactIdx = schema.getFactoryContactURL().newContactIdxKey();
    newKeyContactIdx.setRequiredContactId(Buff.getRequiredContactId());

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

    MSSBamContactURLByProtocolIdxKey newKeyProtocolIdx = schema.getFactoryContactURL().newProtocolIdxKey();
    newKeyProtocolIdx.setOptionalURLProtocolId(Buff.getOptionalURLProtocolId());

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

    MSSBamContactURLByUNameIdxKey newKeyUNameIdx = schema.getFactoryContactURL().newUNameIdxKey();
    newKeyUNameIdx.setRequiredContactId(Buff.getRequiredContactId());
    newKeyUNameIdx.setRequiredName(Buff.getRequiredName());

    // Check unique indexes

    if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) {
        if (dictByUNameIdx.containsKey(newKeyUNameIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateContactURL", "ContactURLUNameIdx", newKeyUNameIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;
        if (Buff.getOptionalURLProtocolId() != null) {
            allNull = false;
        }
        if (allNull) {
            if (null == schema.getTableURLProtocol().readDerivedByIdIdx(Authorization,
                    Buff.getOptionalURLProtocolId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateContactURL", "Lookup", "URLProtocol", "URLProtocol", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamContactURLPKey, MSSBamContactURLBuff> 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<MSSBamContactURLPKey, MSSBamContactURLBuff>();
        dictByContactIdx.put(newKeyContactIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByProtocolIdx.get(existingKeyProtocolIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByProtocolIdx.containsKey(newKeyProtocolIdx)) {
        subdict = dictByProtocolIdx.get(newKeyProtocolIdx);
    } else {
        subdict = new TreeMap<MSSBamContactURLPKey, MSSBamContactURLBuff>();
        dictByProtocolIdx.put(newKeyProtocolIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUNameIdx.remove(existingKeyUNameIdx);
    dictByUNameIdx.put(newKeyUNameIdx, Buff);

}