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.cfcore.v1_11.GenKbRam.GenKbRamSecGroupTable.java

public void updateSecGroup(GenKbAuthorization Authorization, GenKbSecGroupBuff Buff) {
    GenKbSecGroupPKey pkey = schema.getFactorySecGroup().newPKey();
    pkey.setRequiredSecGroupId(Buff.getRequiredSecGroupId());
    GenKbSecGroupBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecGroup",
                "Existing record not found", "SecGroup", pkey);
    }//from w ww. ja v a 2 s  .  co m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecGroup",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    GenKbSecGroupByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecGroup().newClusterIdxKey();
    existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    GenKbSecGroupByClusterIdxKey newKeyClusterIdx = schema.getFactorySecGroup().newClusterIdxKey();
    newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    GenKbSecGroupByUNameIdxKey existingKeyUNameIdx = schema.getFactorySecGroup().newUNameIdxKey();
    existingKeyUNameIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyUNameIdx.setRequiredName(existing.getRequiredName());

    GenKbSecGroupByUNameIdxKey newKeyUNameIdx = schema.getFactorySecGroup().newUNameIdxKey();
    newKeyUNameIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUNameIdx.setRequiredName(Buff.getRequiredName());

    // Check unique indexes

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

    // Validate foreign keys

    {
        boolean allNull = true;

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

    // Update is valid

    SortedMap<GenKbSecGroupPKey, GenKbSecGroupBuff> 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<GenKbSecGroupPKey, GenKbSecGroupBuff>();
        dictByClusterIdx.put(newKeyClusterIdx, subdict);
    }
    subdict.put(pkey, Buff);

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

}

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

public void deleteTenant(CFAstAuthorization Authorization, CFAstTenantBuff Buff) {
    final String S_ProcName = "CFAstRamTenantTable.deleteTenant() ";
    CFAstTenantPKey pkey = schema.getFactoryTenant().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstTenantBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;//from  w  w  w  .j  a v  a  2s . co m
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteTenant",
                pkey);
    }
    CFAstTenantByClusterIdxKey keyClusterIdx = schema.getFactoryTenant().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFAstTenantByUNameIdxKey keyUNameIdx = schema.getFactoryTenant().newUNameIdxKey();
    keyUNameIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyUNameIdx.setRequiredTenantName(existing.getRequiredTenantName());

    // Validate reverse foreign keys

    // Delete is valid

    schema.getTableTSecGroup().deleteTSecGroupByTenantIdx(Authorization, Buff.getRequiredId());
    schema.getTableDomainBase().deleteDomainBaseByTenantIdx(Authorization, Buff.getRequiredId());
    schema.getTableTld().deleteTldByTenantIdx(Authorization, Buff.getRequiredId());
    SortedMap<CFAstTenantPKey, CFAstTenantBuff> subdict;

    dictByPKey.remove(pkey);

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

    dictByUNameIdx.remove(keyUNameIdx);

}

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

public void deleteISOCountryCurrency(CFAccAuthorization Authorization, CFAccISOCountryCurrencyBuff Buff) {
    final String S_ProcName = "CFAccRamISOCountryCurrencyTable.deleteISOCountryCurrency() ";
    CFAccISOCountryCurrencyPKey pkey = schema.getFactoryISOCountryCurrency().newPKey();
    pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
    pkey.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());
    CFAccISOCountryCurrencyBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;// w w  w .  j  a  va  2 s . c o m
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteISOCountryCurrency", pkey);
    }
    CFAccISOCountryCurrencyByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryCurrency()
            .newCountryIdxKey();
    keyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

    CFAccISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = schema.getFactoryISOCountryCurrency()
            .newCurrencyIdxKey();
    keyCurrencyIdx.setRequiredISOCurrencyId(existing.getRequiredISOCurrencyId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<CFAccISOCountryCurrencyPKey, CFAccISOCountryCurrencyBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByCountryIdx.get(keyCountryIdx);
    subdict.remove(pkey);

    subdict = dictByCurrencyIdx.get(keyCurrencyIdx);
    subdict.remove(pkey);

}

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

public void deleteISOCountryLanguage(CFAccAuthorization Authorization, CFAccISOCountryLanguageBuff Buff) {
    final String S_ProcName = "CFAccRamISOCountryLanguageTable.deleteISOCountryLanguage() ";
    CFAccISOCountryLanguagePKey pkey = schema.getFactoryISOCountryLanguage().newPKey();
    pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
    pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
    CFAccISOCountryLanguageBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;/*from  www.  j  a v a  2 s . c  om*/
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteISOCountryLanguage", pkey);
    }
    CFAccISOCountryLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryLanguage()
            .newCountryIdxKey();
    keyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

    CFAccISOCountryLanguageByLanguageIdxKey keyLanguageIdx = schema.getFactoryISOCountryLanguage()
            .newLanguageIdxKey();
    keyLanguageIdx.setRequiredISOLanguageId(existing.getRequiredISOLanguageId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByCountryIdx.get(keyCountryIdx);
    subdict.remove(pkey);

    subdict = dictByLanguageIdx.get(keyLanguageIdx);
    subdict.remove(pkey);

}

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

public void deleteISOCountryCurrency(CFAstAuthorization Authorization, CFAstISOCountryCurrencyBuff Buff) {
    final String S_ProcName = "CFAstRamISOCountryCurrencyTable.deleteISOCountryCurrency() ";
    CFAstISOCountryCurrencyPKey pkey = schema.getFactoryISOCountryCurrency().newPKey();
    pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
    pkey.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());
    CFAstISOCountryCurrencyBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;//from   ww  w .j  a  v a 2s.  c o  m
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteISOCountryCurrency", pkey);
    }
    CFAstISOCountryCurrencyByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryCurrency()
            .newCountryIdxKey();
    keyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

    CFAstISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = schema.getFactoryISOCountryCurrency()
            .newCurrencyIdxKey();
    keyCurrencyIdx.setRequiredISOCurrencyId(existing.getRequiredISOCurrencyId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<CFAstISOCountryCurrencyPKey, CFAstISOCountryCurrencyBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByCountryIdx.get(keyCountryIdx);
    subdict.remove(pkey);

    subdict = dictByCurrencyIdx.get(keyCurrencyIdx);
    subdict.remove(pkey);

}

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

public void deleteISOCountryLanguage(CFAstAuthorization Authorization, CFAstISOCountryLanguageBuff Buff) {
    final String S_ProcName = "CFAstRamISOCountryLanguageTable.deleteISOCountryLanguage() ";
    CFAstISOCountryLanguagePKey pkey = schema.getFactoryISOCountryLanguage().newPKey();
    pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
    pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
    CFAstISOCountryLanguageBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;/*from   w w w  . j a va  2s. com*/
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteISOCountryLanguage", pkey);
    }
    CFAstISOCountryLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryLanguage()
            .newCountryIdxKey();
    keyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

    CFAstISOCountryLanguageByLanguageIdxKey keyLanguageIdx = schema.getFactoryISOCountryLanguage()
            .newLanguageIdxKey();
    keyLanguageIdx.setRequiredISOLanguageId(existing.getRequiredISOLanguageId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByCountryIdx.get(keyCountryIdx);
    subdict.remove(pkey);

    subdict = dictByLanguageIdx.get(keyLanguageIdx);
    subdict.remove(pkey);

}

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

public void deleteISOLanguage(CFAccAuthorization Authorization, CFAccISOLanguageBuff Buff) {
    final String S_ProcName = "CFAccRamISOLanguageTable.deleteISOLanguage() ";
    CFAccISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFAccISOLanguageBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;/* w ww . java 2s .  co m*/
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteISOLanguage",
                pkey);
    }
    CFAccISOLanguageByBaseIdxKey keyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
    keyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode());

    CFAccISOLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey();
    keyCountryIdx.setOptionalISOCountryId(existing.getOptionalISOCountryId());

    CFAccISOLanguageByCodeIdxKey keyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey();
    keyCodeIdx.setRequiredISOCode(existing.getRequiredISOCode());

    // Validate reverse foreign keys

    // Delete is valid

    schema.getTableISOCountryLanguage().deleteISOCountryLanguageByLanguageIdx(Authorization,
            Buff.getRequiredId());
    SortedMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByBaseIdx.get(keyBaseIdx);
    subdict.remove(pkey);

    subdict = dictByCountryIdx.get(keyCountryIdx);
    subdict.remove(pkey);

    dictByCodeIdx.remove(keyCodeIdx);

}

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

public void deleteISOLanguage(CFAstAuthorization Authorization, CFAstISOLanguageBuff Buff) {
    final String S_ProcName = "CFAstRamISOLanguageTable.deleteISOLanguage() ";
    CFAstISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstISOLanguageBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;/*from  www . j a  va  2  s. co  m*/
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteISOLanguage",
                pkey);
    }
    CFAstISOLanguageByBaseIdxKey keyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
    keyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode());

    CFAstISOLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey();
    keyCountryIdx.setOptionalISOCountryId(existing.getOptionalISOCountryId());

    CFAstISOLanguageByCodeIdxKey keyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey();
    keyCodeIdx.setRequiredISOCode(existing.getRequiredISOCode());

    // Validate reverse foreign keys

    // Delete is valid

    schema.getTableISOCountryLanguage().deleteISOCountryLanguageByLanguageIdx(Authorization,
            Buff.getRequiredId());
    SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByBaseIdx.get(keyBaseIdx);
    subdict.remove(pkey);

    subdict = dictByCountryIdx.get(keyCountryIdx);
    subdict.remove(pkey);

    dictByCodeIdx.remove(keyCodeIdx);

}

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

public void updateDomainBase(CFAccAuthorization Authorization, CFAccDomainBaseBuff Buff) {
    CFAccDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAccDomainBaseBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateDomainBase",
                "Existing record not found", "DomainBase", pkey);
    }//from  www.  j  av  a 2  s  .  co  m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateDomainBase",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAccDomainBaseByTenantIdxKey existingKeyTenantIdx = schema.getFactoryDomainBase().newTenantIdxKey();
    existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFAccDomainBaseByTenantIdxKey newKeyTenantIdx = schema.getFactoryDomainBase().newTenantIdxKey();
    newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    // Update is valid

    SortedMap<CFAccDomainBasePKey, CFAccDomainBaseBuff> 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<CFAccDomainBasePKey, CFAccDomainBaseBuff>();
        dictByTenantIdx.put(newKeyTenantIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void updateDomainBase(CFAstAuthorization Authorization, CFAstDomainBaseBuff Buff) {
    CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstDomainBaseBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateDomainBase",
                "Existing record not found", "DomainBase", pkey);
    }/*from ww w .java2  s.  c  o m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateDomainBase",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAstDomainBaseByTenantIdxKey existingKeyTenantIdx = schema.getFactoryDomainBase().newTenantIdxKey();
    existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFAstDomainBaseByTenantIdxKey newKeyTenantIdx = schema.getFactoryDomainBase().newTenantIdxKey();
    newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    // Update is valid

    SortedMap<CFAstDomainBasePKey, CFAstDomainBaseBuff> 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<CFAstDomainBasePKey, CFAstDomainBaseBuff>();
        dictByTenantIdx.put(newKeyTenantIdx, subdict);
    }
    subdict.put(pkey, Buff);

}