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.cfasterisk.v2_0.CFAstRam.CFAstRamISOTimezoneTable.java

public void updateISOTimezone(CFAstAuthorization Authorization, CFAstISOTimezoneBuff Buff) {
    CFAstISOTimezonePKey pkey = schema.getFactoryISOTimezone().newPKey();
    pkey.setRequiredISOTimezoneId(Buff.getRequiredISOTimezoneId());
    CFAstISOTimezoneBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateISOTimezone",
                "Existing record not found", "ISOTimezone", pkey);
    }/*from w  ww  .java2 s  .c om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateISOTimezone",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAstISOTimezoneByOffsetIdxKey existingKeyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey();
    existingKeyOffsetIdx.setRequiredTZHourOffset(existing.getRequiredTZHourOffset());
    existingKeyOffsetIdx.setRequiredTZMinOffset(existing.getRequiredTZMinOffset());

    CFAstISOTimezoneByOffsetIdxKey newKeyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey();
    newKeyOffsetIdx.setRequiredTZHourOffset(Buff.getRequiredTZHourOffset());
    newKeyOffsetIdx.setRequiredTZMinOffset(Buff.getRequiredTZMinOffset());

    CFAstISOTimezoneByUTZNameIdxKey existingKeyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey();
    existingKeyUTZNameIdx.setRequiredTZName(existing.getRequiredTZName());

    CFAstISOTimezoneByUTZNameIdxKey newKeyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey();
    newKeyUTZNameIdx.setRequiredTZName(Buff.getRequiredTZName());

    CFAstISOTimezoneByIso8601IdxKey existingKeyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey();
    existingKeyIso8601Idx.setRequiredIso8601(existing.getRequiredIso8601());

    CFAstISOTimezoneByIso8601IdxKey newKeyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey();
    newKeyIso8601Idx.setRequiredIso8601(Buff.getRequiredIso8601());

    // Check unique indexes

    if (!existingKeyUTZNameIdx.equals(newKeyUTZNameIdx)) {
        if (dictByUTZNameIdx.containsKey(newKeyUTZNameIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateISOTimezone", "ISOTimezoneUTZNameIdx", newKeyUTZNameIdx);
        }
    }

    // Validate foreign keys

    // Update is valid

    SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff> subdict;

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

    subdict = dictByOffsetIdx.get(existingKeyOffsetIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByOffsetIdx.containsKey(newKeyOffsetIdx)) {
        subdict = dictByOffsetIdx.get(newKeyOffsetIdx);
    } else {
        subdict = new TreeMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>();
        dictByOffsetIdx.put(newKeyOffsetIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUTZNameIdx.remove(existingKeyUTZNameIdx);
    dictByUTZNameIdx.put(newKeyUTZNameIdx, Buff);

    subdict = dictByIso8601Idx.get(existingKeyIso8601Idx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByIso8601Idx.containsKey(newKeyIso8601Idx)) {
        subdict = dictByIso8601Idx.get(newKeyIso8601Idx);
    } else {
        subdict = new TreeMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>();
        dictByIso8601Idx.put(newKeyIso8601Idx, subdict);
    }
    subdict.put(pkey, Buff);

}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamTopDomainTable.java

public void updateTopDomain(CFAccAuthorization Authorization, CFAccTopDomainBuff Buff) {
    schema.getTableDomainBase().updateDomainBase(Authorization, Buff);
    CFAccDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAccTopDomainBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTopDomain",
                "Existing record not found", "TopDomain", pkey);
    }/*ww w . j  a  v a  2 s .co  m*/
    CFAccTopDomainByTLDIdxKey existingKeyTLDIdx = schema.getFactoryTopDomain().newTLDIdxKey();
    existingKeyTLDIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyTLDIdx.setRequiredTLDId(existing.getRequiredTLDId());

    CFAccTopDomainByTLDIdxKey newKeyTLDIdx = schema.getFactoryTopDomain().newTLDIdxKey();
    newKeyTLDIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyTLDIdx.setRequiredTLDId(Buff.getRequiredTLDId());

    CFAccTopDomainByNameIdxKey existingKeyNameIdx = schema.getFactoryTopDomain().newNameIdxKey();
    existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyNameIdx.setRequiredTLDId(existing.getRequiredTLDId());
    existingKeyNameIdx.setRequiredName(existing.getRequiredName());

    CFAccTopDomainByNameIdxKey newKeyNameIdx = schema.getFactoryTopDomain().newNameIdxKey();
    newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyNameIdx.setRequiredTLDId(Buff.getRequiredTLDId());
    newKeyNameIdx.setRequiredName(Buff.getRequiredName());

    // Check unique indexes

    if (!existingKeyNameIdx.equals(newKeyNameIdx)) {
        if (dictByNameIdx.containsKey(newKeyNameIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateTopDomain", "TopDomainNameIdx", newKeyNameIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateTopDomain", "Superclass", "SuperClass", "DomainBase", null);
            }
        }
    }

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableTld().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(),
                    Buff.getRequiredTLDId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateTopDomain", "Container", "TLD", "Tld", null);
            }
        }
    }

    // Update is valid

    SortedMap<CFAccDomainBasePKey, CFAccTopDomainBuff> subdict;

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

    subdict = dictByTLDIdx.get(existingKeyTLDIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByTLDIdx.containsKey(newKeyTLDIdx)) {
        subdict = dictByTLDIdx.get(newKeyTLDIdx);
    } else {
        subdict = new TreeMap<CFAccDomainBasePKey, CFAccTopDomainBuff>();
        dictByTLDIdx.put(newKeyTLDIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByNameIdx.remove(existingKeyNameIdx);
    dictByNameIdx.put(newKeyNameIdx, Buff);

}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamTopDomainTable.java

public void updateTopDomain(CFAstAuthorization Authorization, CFAstTopDomainBuff Buff) {
    schema.getTableDomainBase().updateDomainBase(Authorization, Buff);
    CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstTopDomainBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTopDomain",
                "Existing record not found", "TopDomain", pkey);
    }/*from   w  w  w.ja  v a 2 s .  c om*/
    CFAstTopDomainByTLDIdxKey existingKeyTLDIdx = schema.getFactoryTopDomain().newTLDIdxKey();
    existingKeyTLDIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyTLDIdx.setRequiredTLDId(existing.getRequiredTLDId());

    CFAstTopDomainByTLDIdxKey newKeyTLDIdx = schema.getFactoryTopDomain().newTLDIdxKey();
    newKeyTLDIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyTLDIdx.setRequiredTLDId(Buff.getRequiredTLDId());

    CFAstTopDomainByNameIdxKey existingKeyNameIdx = schema.getFactoryTopDomain().newNameIdxKey();
    existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyNameIdx.setRequiredTLDId(existing.getRequiredTLDId());
    existingKeyNameIdx.setRequiredName(existing.getRequiredName());

    CFAstTopDomainByNameIdxKey newKeyNameIdx = schema.getFactoryTopDomain().newNameIdxKey();
    newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyNameIdx.setRequiredTLDId(Buff.getRequiredTLDId());
    newKeyNameIdx.setRequiredName(Buff.getRequiredName());

    // Check unique indexes

    if (!existingKeyNameIdx.equals(newKeyNameIdx)) {
        if (dictByNameIdx.containsKey(newKeyNameIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateTopDomain", "TopDomainNameIdx", newKeyNameIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateTopDomain", "Superclass", "SuperClass", "DomainBase", null);
            }
        }
    }

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableTld().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(),
                    Buff.getRequiredTLDId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateTopDomain", "Container", "TLD", "Tld", null);
            }
        }
    }

    // Update is valid

    SortedMap<CFAstDomainBasePKey, CFAstTopDomainBuff> subdict;

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

    subdict = dictByTLDIdx.get(existingKeyTLDIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByTLDIdx.containsKey(newKeyTLDIdx)) {
        subdict = dictByTLDIdx.get(newKeyTLDIdx);
    } else {
        subdict = new TreeMap<CFAstDomainBasePKey, CFAstTopDomainBuff>();
        dictByTLDIdx.put(newKeyTLDIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByNameIdx.remove(existingKeyNameIdx);
    dictByNameIdx.put(newKeyNameIdx, Buff);

}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamDomainTable.java

public void updateDomain(CFAccAuthorization Authorization, CFAccDomainBuff Buff) {
    schema.getTableDomainBase().updateDomainBase(Authorization, Buff);
    CFAccDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAccDomainBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateDomain",
                "Existing record not found", "Domain", pkey);
    }/* w  ww .  j av a2s .co m*/
    CFAccDomainBySubDomIdxKey existingKeySubDomIdx = schema.getFactoryDomain().newSubDomIdxKey();
    existingKeySubDomIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeySubDomIdx.setRequiredSubDomainOfId(existing.getRequiredSubDomainOfId());

    CFAccDomainBySubDomIdxKey newKeySubDomIdx = schema.getFactoryDomain().newSubDomIdxKey();
    newKeySubDomIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeySubDomIdx.setRequiredSubDomainOfId(Buff.getRequiredSubDomainOfId());

    CFAccDomainByNameIdxKey existingKeyNameIdx = schema.getFactoryDomain().newNameIdxKey();
    existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyNameIdx.setRequiredSubDomainOfId(existing.getRequiredSubDomainOfId());
    existingKeyNameIdx.setRequiredName(existing.getRequiredName());

    CFAccDomainByNameIdxKey newKeyNameIdx = schema.getFactoryDomain().newNameIdxKey();
    newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyNameIdx.setRequiredSubDomainOfId(Buff.getRequiredSubDomainOfId());
    newKeyNameIdx.setRequiredName(Buff.getRequiredName());

    // Check unique indexes

    if (!existingKeyNameIdx.equals(newKeyNameIdx)) {
        if (dictByNameIdx.containsKey(newKeyNameIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateDomain", "DomainNameIdx", newKeyNameIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredSubDomainOfId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateDomain", "Container", "ParentDomain", "DomainBase", null);
            }
        }
    }

    // Update is valid

    SortedMap<CFAccDomainBasePKey, CFAccDomainBuff> subdict;

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

    subdict = dictBySubDomIdx.get(existingKeySubDomIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictBySubDomIdx.containsKey(newKeySubDomIdx)) {
        subdict = dictBySubDomIdx.get(newKeySubDomIdx);
    } else {
        subdict = new TreeMap<CFAccDomainBasePKey, CFAccDomainBuff>();
        dictBySubDomIdx.put(newKeySubDomIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByNameIdx.remove(existingKeyNameIdx);
    dictByNameIdx.put(newKeyNameIdx, Buff);

}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamDomainTable.java

public void updateDomain(CFAstAuthorization Authorization, CFAstDomainBuff Buff) {
    schema.getTableDomainBase().updateDomainBase(Authorization, Buff);
    CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstDomainBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateDomain",
                "Existing record not found", "Domain", pkey);
    }//  ww w  .  j  a v a  2s .  c om
    CFAstDomainBySubDomIdxKey existingKeySubDomIdx = schema.getFactoryDomain().newSubDomIdxKey();
    existingKeySubDomIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeySubDomIdx.setRequiredSubDomainOfId(existing.getRequiredSubDomainOfId());

    CFAstDomainBySubDomIdxKey newKeySubDomIdx = schema.getFactoryDomain().newSubDomIdxKey();
    newKeySubDomIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeySubDomIdx.setRequiredSubDomainOfId(Buff.getRequiredSubDomainOfId());

    CFAstDomainByNameIdxKey existingKeyNameIdx = schema.getFactoryDomain().newNameIdxKey();
    existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyNameIdx.setRequiredSubDomainOfId(existing.getRequiredSubDomainOfId());
    existingKeyNameIdx.setRequiredName(existing.getRequiredName());

    CFAstDomainByNameIdxKey newKeyNameIdx = schema.getFactoryDomain().newNameIdxKey();
    newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyNameIdx.setRequiredSubDomainOfId(Buff.getRequiredSubDomainOfId());
    newKeyNameIdx.setRequiredName(Buff.getRequiredName());

    // Check unique indexes

    if (!existingKeyNameIdx.equals(newKeyNameIdx)) {
        if (dictByNameIdx.containsKey(newKeyNameIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateDomain", "DomainNameIdx", newKeyNameIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredSubDomainOfId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateDomain", "Container", "ParentDomain", "DomainBase", null);
            }
        }
    }

    // Update is valid

    SortedMap<CFAstDomainBasePKey, CFAstDomainBuff> subdict;

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

    subdict = dictBySubDomIdx.get(existingKeySubDomIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictBySubDomIdx.containsKey(newKeySubDomIdx)) {
        subdict = dictBySubDomIdx.get(newKeySubDomIdx);
    } else {
        subdict = new TreeMap<CFAstDomainBasePKey, CFAstDomainBuff>();
        dictBySubDomIdx.put(newKeySubDomIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByNameIdx.remove(existingKeyNameIdx);
    dictByNameIdx.put(newKeyNameIdx, Buff);

}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamHostNodeTable.java

public void updateHostNode(CFAccAuthorization Authorization, CFAccHostNodeBuff Buff) {
    CFAccHostNodePKey pkey = schema.getFactoryHostNode().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredHostNodeId(Buff.getRequiredHostNodeId());
    CFAccHostNodeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateHostNode",
                "Existing record not found", "HostNode", pkey);
    }//from w w w  .  j av  a 2  s  .co  m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateHostNode",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAccHostNodeByClusterIdxKey existingKeyClusterIdx = schema.getFactoryHostNode().newClusterIdxKey();
    existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

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

    CFAccHostNodeByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryHostNode().newUDescrIdxKey();
    existingKeyUDescrIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    CFAccHostNodeByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryHostNode().newUDescrIdxKey();
    newKeyUDescrIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

    CFAccHostNodeByHostNameIdxKey existingKeyHostNameIdx = schema.getFactoryHostNode().newHostNameIdxKey();
    existingKeyHostNameIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyHostNameIdx.setRequiredHostName(existing.getRequiredHostName());

    CFAccHostNodeByHostNameIdxKey newKeyHostNameIdx = schema.getFactoryHostNode().newHostNameIdxKey();
    newKeyHostNameIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyHostNameIdx.setRequiredHostName(Buff.getRequiredHostName());

    // Check unique indexes

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

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

    // Validate foreign keys

    {
        boolean allNull = true;

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

    // Update is valid

    SortedMap<CFAccHostNodePKey, CFAccHostNodeBuff> subdict;

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

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

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

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

}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamHostNodeTable.java

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

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

    CFAstHostNodeByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryHostNode().newUDescrIdxKey();
    existingKeyUDescrIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    CFAstHostNodeByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryHostNode().newUDescrIdxKey();
    newKeyUDescrIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

    CFAstHostNodeByHostNameIdxKey existingKeyHostNameIdx = schema.getFactoryHostNode().newHostNameIdxKey();
    existingKeyHostNameIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyHostNameIdx.setRequiredHostName(existing.getRequiredHostName());

    CFAstHostNodeByHostNameIdxKey newKeyHostNameIdx = schema.getFactoryHostNode().newHostNameIdxKey();
    newKeyHostNameIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyHostNameIdx.setRequiredHostName(Buff.getRequiredHostName());

    // Check unique indexes

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

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

    // Validate foreign keys

    {
        boolean allNull = true;

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

    // Update is valid

    SortedMap<CFAstHostNodePKey, CFAstHostNodeBuff> subdict;

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

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

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

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

}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamMinorVersionTable.java

public void updateMinorVersion(CFAccAuthorization Authorization, CFAccMinorVersionBuff Buff) {
    schema.getTableVersion().updateVersion(Authorization, Buff);
    CFAccDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAccMinorVersionBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "updateMinorVersion", "Existing record not found", "MinorVersion", pkey);
    }// w  ww . j a v a2  s  . c om
    CFAccMinorVersionByMajorIdxKey existingKeyMajorIdx = schema.getFactoryMinorVersion().newMajorIdxKey();
    existingKeyMajorIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyMajorIdx.setRequiredMajorId(existing.getRequiredMajorId());

    CFAccMinorVersionByMajorIdxKey newKeyMajorIdx = schema.getFactoryMinorVersion().newMajorIdxKey();
    newKeyMajorIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyMajorIdx.setRequiredMajorId(Buff.getRequiredMajorId());

    CFAccMinorVersionByNameIdxKey existingKeyNameIdx = schema.getFactoryMinorVersion().newNameIdxKey();
    existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyNameIdx.setRequiredMajorId(existing.getRequiredMajorId());
    existingKeyNameIdx.setRequiredName(existing.getRequiredName());

    CFAccMinorVersionByNameIdxKey newKeyNameIdx = schema.getFactoryMinorVersion().newNameIdxKey();
    newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyNameIdx.setRequiredMajorId(Buff.getRequiredMajorId());
    newKeyNameIdx.setRequiredName(Buff.getRequiredName());

    // Check unique indexes

    if (!existingKeyNameIdx.equals(newKeyNameIdx)) {
        if (dictByNameIdx.containsKey(newKeyNameIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateMinorVersion", "MinorVersionNameIdx", newKeyNameIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableMajorVersion().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredMajorId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateMinorVersion", "Container", "MajorVersion", "MajorVersion", null);
            }
        }
    }

    // Update is valid

    SortedMap<CFAccDomainBasePKey, CFAccMinorVersionBuff> subdict;

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

    subdict = dictByMajorIdx.get(existingKeyMajorIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByMajorIdx.containsKey(newKeyMajorIdx)) {
        subdict = dictByMajorIdx.get(newKeyMajorIdx);
    } else {
        subdict = new TreeMap<CFAccDomainBasePKey, CFAccMinorVersionBuff>();
        dictByMajorIdx.put(newKeyMajorIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByNameIdx.remove(existingKeyNameIdx);
    dictByNameIdx.put(newKeyNameIdx, Buff);

}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamMinorVersionTable.java

public void updateMinorVersion(CFAstAuthorization Authorization, CFAstMinorVersionBuff Buff) {
    schema.getTableVersion().updateVersion(Authorization, Buff);
    CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstMinorVersionBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "updateMinorVersion", "Existing record not found", "MinorVersion", pkey);
    }/* ww  w. ja  v  a2 s  .co m*/
    CFAstMinorVersionByMajorIdxKey existingKeyMajorIdx = schema.getFactoryMinorVersion().newMajorIdxKey();
    existingKeyMajorIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyMajorIdx.setRequiredMajorId(existing.getRequiredMajorId());

    CFAstMinorVersionByMajorIdxKey newKeyMajorIdx = schema.getFactoryMinorVersion().newMajorIdxKey();
    newKeyMajorIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyMajorIdx.setRequiredMajorId(Buff.getRequiredMajorId());

    CFAstMinorVersionByNameIdxKey existingKeyNameIdx = schema.getFactoryMinorVersion().newNameIdxKey();
    existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyNameIdx.setRequiredMajorId(existing.getRequiredMajorId());
    existingKeyNameIdx.setRequiredName(existing.getRequiredName());

    CFAstMinorVersionByNameIdxKey newKeyNameIdx = schema.getFactoryMinorVersion().newNameIdxKey();
    newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyNameIdx.setRequiredMajorId(Buff.getRequiredMajorId());
    newKeyNameIdx.setRequiredName(Buff.getRequiredName());

    // Check unique indexes

    if (!existingKeyNameIdx.equals(newKeyNameIdx)) {
        if (dictByNameIdx.containsKey(newKeyNameIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateMinorVersion", "MinorVersionNameIdx", newKeyNameIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableMajorVersion().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredMajorId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateMinorVersion", "Container", "MajorVersion", "MajorVersion", null);
            }
        }
    }

    // Update is valid

    SortedMap<CFAstDomainBasePKey, CFAstMinorVersionBuff> subdict;

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

    subdict = dictByMajorIdx.get(existingKeyMajorIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByMajorIdx.containsKey(newKeyMajorIdx)) {
        subdict = dictByMajorIdx.get(newKeyMajorIdx);
    } else {
        subdict = new TreeMap<CFAstDomainBasePKey, CFAstMinorVersionBuff>();
        dictByMajorIdx.put(newKeyMajorIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByNameIdx.remove(existingKeyNameIdx);
    dictByNameIdx.put(newKeyNameIdx, Buff);

}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamMajorVersionTable.java

public void updateMajorVersion(CFAccAuthorization Authorization, CFAccMajorVersionBuff Buff) {
    schema.getTableVersion().updateVersion(Authorization, Buff);
    CFAccDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAccMajorVersionBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "updateMajorVersion", "Existing record not found", "MajorVersion", pkey);
    }/*  ww  w .jav  a  2s  .com*/
    CFAccMajorVersionByPPrjIdxKey existingKeyPPrjIdx = schema.getFactoryMajorVersion().newPPrjIdxKey();
    existingKeyPPrjIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyPPrjIdx.setRequiredParentProjectId(existing.getRequiredParentProjectId());

    CFAccMajorVersionByPPrjIdxKey newKeyPPrjIdx = schema.getFactoryMajorVersion().newPPrjIdxKey();
    newKeyPPrjIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyPPrjIdx.setRequiredParentProjectId(Buff.getRequiredParentProjectId());

    CFAccMajorVersionByNameIdxKey existingKeyNameIdx = schema.getFactoryMajorVersion().newNameIdxKey();
    existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyNameIdx.setRequiredParentProjectId(existing.getRequiredParentProjectId());
    existingKeyNameIdx.setRequiredName(existing.getRequiredName());

    CFAccMajorVersionByNameIdxKey newKeyNameIdx = schema.getFactoryMajorVersion().newNameIdxKey();
    newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyNameIdx.setRequiredParentProjectId(Buff.getRequiredParentProjectId());
    newKeyNameIdx.setRequiredName(Buff.getRequiredName());

    // Check unique indexes

    if (!existingKeyNameIdx.equals(newKeyNameIdx)) {
        if (dictByNameIdx.containsKey(newKeyNameIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateMajorVersion", "MajorVersionNameIdx", newKeyNameIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableRealProject().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredParentProjectId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateMajorVersion", "Container", "ParentProject", "RealProject", null);
            }
        }
    }

    // Update is valid

    SortedMap<CFAccDomainBasePKey, CFAccMajorVersionBuff> subdict;

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

    subdict = dictByPPrjIdx.get(existingKeyPPrjIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByPPrjIdx.containsKey(newKeyPPrjIdx)) {
        subdict = dictByPPrjIdx.get(newKeyPPrjIdx);
    } else {
        subdict = new TreeMap<CFAccDomainBasePKey, CFAccMajorVersionBuff>();
        dictByPPrjIdx.put(newKeyPPrjIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByNameIdx.remove(existingKeyNameIdx);
    dictByNameIdx.put(newKeyNameIdx, Buff);

}