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.cfacc.v2_0.CFAccRam.CFAccRamMemoTagTable.java

public void deleteMemoTag(CFAccAuthorization Authorization, CFAccMemoTagBuff Buff) {
    final String S_ProcName = "CFAccRamMemoTagTable.deleteMemoTag() ";
    CFAccMemoTagPKey pkey = schema.getFactoryMemoTag().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredMemoId(Buff.getRequiredMemoId());
    pkey.setRequiredTagId(Buff.getRequiredTagId());
    CFAccMemoTagBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;//from w w w . j  a  v a2  s. c o  m
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteMemoTag",
                pkey);
    }
    CFAccMemoTagByTenantIdxKey keyTenantIdx = schema.getFactoryMemoTag().newTenantIdxKey();
    keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFAccMemoTagByMemoIdxKey keyMemoIdx = schema.getFactoryMemoTag().newMemoIdxKey();
    keyMemoIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyMemoIdx.setRequiredMemoId(existing.getRequiredMemoId());

    CFAccMemoTagByTagIdxKey keyTagIdx = schema.getFactoryMemoTag().newTagIdxKey();
    keyTagIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyTagIdx.setRequiredTagId(existing.getRequiredTagId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<CFAccMemoTagPKey, CFAccMemoTagBuff> subdict;

    dictByPKey.remove(pkey);

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

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

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

}

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

public void deletePhoneTag(CFAccAuthorization Authorization, CFAccPhoneTagBuff Buff) {
    final String S_ProcName = "CFAccRamPhoneTagTable.deletePhoneTag() ";
    CFAccPhoneTagPKey pkey = schema.getFactoryPhoneTag().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredPhoneId(Buff.getRequiredPhoneId());
    pkey.setRequiredTagId(Buff.getRequiredTagId());
    CFAccPhoneTagBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;//from  w  w  w . ja v a 2s.c om
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deletePhoneTag",
                pkey);
    }
    CFAccPhoneTagByTenantIdxKey keyTenantIdx = schema.getFactoryPhoneTag().newTenantIdxKey();
    keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFAccPhoneTagByPhoneIdxKey keyPhoneIdx = schema.getFactoryPhoneTag().newPhoneIdxKey();
    keyPhoneIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyPhoneIdx.setRequiredPhoneId(existing.getRequiredPhoneId());

    CFAccPhoneTagByTagIdxKey keyTagIdx = schema.getFactoryPhoneTag().newTagIdxKey();
    keyTagIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyTagIdx.setRequiredTagId(existing.getRequiredTagId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<CFAccPhoneTagPKey, CFAccPhoneTagBuff> subdict;

    dictByPKey.remove(pkey);

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

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

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

}

From source file:org.squale.squalecommon.enterpriselayer.facade.quality.MeasureFacade.java

/**
 * Affichage des facteurs du Kiviat : tous les facteurs ou seulement ceux ayant une note
 * //w w  w.j  a  v a2 s  .c om
 * @param pValues les donnes  afficher : facteur + note
 * @param pNullValuesList la liste des facteurs dont la note est nulle
 * @param pAllFactors tous les facteurs (="true") ou seulement les facteurs ayant une note
 * @param pFactorsMin nombre de facteurs minimal que l'on doit afficher sur le Kiviat
 * @return values les donnes rellement  afficher : facteur + note
 */
private static SortedMap deleteFactors(SortedMap pValues, ArrayList pNullValuesList, String pAllFactors,
        int pFactorsMin) {
    SortedMap values = new TreeMap();
    // Seulement les facteurs ayant une note ? ==> suppression des facteurs ayant une note nulle.
    // Mais trois facteurs doivent au moins s'afficher (nuls ou pas !)
    if (pValues.size() > pFactorsMin && !pAllFactors.equals("true")) {
        // Nombre de suppressions possible
        int nbTotalDeletions = pValues.size() - pFactorsMin;
        // Nombre de suppressions effectu
        int nbCurrentDeletions = 0;
        // Parcours de la liste des facteurs avec une note nulle, pour les supprimer de l'affichage
        Iterator itList = pNullValuesList.iterator();
        while (itList.hasNext() && nbCurrentDeletions < nbTotalDeletions) {
            String keyListe = (String) itList.next();
            pValues.remove(keyListe);
            nbCurrentDeletions += 1;
        }
    }
    values.putAll(pValues);
    return values;
}

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

public void updateTenant(CFAstAuthorization Authorization, CFAstTenantBuff Buff) {
    CFAstTenantPKey pkey = schema.getFactoryTenant().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstTenantBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTenant",
                "Existing record not found", "Tenant", pkey);
    }// w  w w. j a va  2s .c  o m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateTenant",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAstTenantByClusterIdxKey existingKeyClusterIdx = schema.getFactoryTenant().newClusterIdxKey();
    existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFAstTenantByClusterIdxKey newKeyClusterIdx = schema.getFactoryTenant().newClusterIdxKey();
    newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

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

    CFAstTenantByUNameIdxKey newKeyUNameIdx = schema.getFactoryTenant().newUNameIdxKey();
    newKeyUNameIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUNameIdx.setRequiredTenantName(Buff.getRequiredTenantName());

    // Check unique indexes

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

    // Validate foreign keys

    {
        boolean allNull = true;

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

    // Update is valid

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

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

}

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

public void updateISOLanguage(CFAccAuthorization Authorization, CFAccISOLanguageBuff Buff) {
    CFAccISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFAccISOLanguageBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateISOLanguage",
                "Existing record not found", "ISOLanguage", pkey);
    }//from w w w .ja  va 2s.  co m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateISOLanguage",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAccISOLanguageByBaseIdxKey existingKeyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
    existingKeyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode());

    CFAccISOLanguageByBaseIdxKey newKeyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
    newKeyBaseIdx.setRequiredBaseLanguageCode(Buff.getRequiredBaseLanguageCode());

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

    CFAccISOLanguageByCountryIdxKey newKeyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey();
    newKeyCountryIdx.setOptionalISOCountryId(Buff.getOptionalISOCountryId());

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

    CFAccISOLanguageByCodeIdxKey newKeyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey();
    newKeyCodeIdx.setRequiredISOCode(Buff.getRequiredISOCode());

    // Check unique indexes

    if (!existingKeyCodeIdx.equals(newKeyCodeIdx)) {
        if (dictByCodeIdx.containsKey(newKeyCodeIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateISOLanguage", "ISOLanguageCodeIdx", newKeyCodeIdx);
        }
    }

    // Validate foreign keys

    // Update is valid

    SortedMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff> subdict;

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

    subdict = dictByBaseIdx.get(existingKeyBaseIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByBaseIdx.containsKey(newKeyBaseIdx)) {
        subdict = dictByBaseIdx.get(newKeyBaseIdx);
    } else {
        subdict = new TreeMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff>();
        dictByBaseIdx.put(newKeyBaseIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByCountryIdx.get(existingKeyCountryIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByCountryIdx.containsKey(newKeyCountryIdx)) {
        subdict = dictByCountryIdx.get(newKeyCountryIdx);
    } else {
        subdict = new TreeMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff>();
        dictByCountryIdx.put(newKeyCountryIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByCodeIdx.remove(existingKeyCodeIdx);
    dictByCodeIdx.put(newKeyCodeIdx, Buff);

}

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

public void updateISOLanguage(CFAstAuthorization Authorization, CFAstISOLanguageBuff Buff) {
    CFAstISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstISOLanguageBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateISOLanguage",
                "Existing record not found", "ISOLanguage", pkey);
    }//from   w ww .j  a va2  s.  c  o m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateISOLanguage",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAstISOLanguageByBaseIdxKey existingKeyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
    existingKeyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode());

    CFAstISOLanguageByBaseIdxKey newKeyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
    newKeyBaseIdx.setRequiredBaseLanguageCode(Buff.getRequiredBaseLanguageCode());

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

    CFAstISOLanguageByCountryIdxKey newKeyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey();
    newKeyCountryIdx.setOptionalISOCountryId(Buff.getOptionalISOCountryId());

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

    CFAstISOLanguageByCodeIdxKey newKeyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey();
    newKeyCodeIdx.setRequiredISOCode(Buff.getRequiredISOCode());

    // Check unique indexes

    if (!existingKeyCodeIdx.equals(newKeyCodeIdx)) {
        if (dictByCodeIdx.containsKey(newKeyCodeIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateISOLanguage", "ISOLanguageCodeIdx", newKeyCodeIdx);
        }
    }

    // Validate foreign keys

    // Update is valid

    SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff> subdict;

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

    subdict = dictByBaseIdx.get(existingKeyBaseIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByBaseIdx.containsKey(newKeyBaseIdx)) {
        subdict = dictByBaseIdx.get(newKeyBaseIdx);
    } else {
        subdict = new TreeMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff>();
        dictByBaseIdx.put(newKeyBaseIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByCountryIdx.get(existingKeyCountryIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByCountryIdx.containsKey(newKeyCountryIdx)) {
        subdict = dictByCountryIdx.get(newKeyCountryIdx);
    } else {
        subdict = new TreeMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff>();
        dictByCountryIdx.put(newKeyCountryIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByCodeIdx.remove(existingKeyCodeIdx);
    dictByCodeIdx.put(newKeyCodeIdx, Buff);

}

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

public void updateSipConf(CFAstAuthorization Authorization, CFAstSipConfBuff Buff) {
    schema.getTableConfigurationFile().updateConfigurationFile(Authorization, Buff);
    CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstSipConfBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSipConf",
                "Existing record not found", "SipConf", pkey);
    }/*from  w w  w  .jav  a2  s  .  co  m*/
    CFAstSipConfBySipClusterIdxKey existingKeySipClusterIdx = schema.getFactorySipConf().newSipClusterIdxKey();
    existingKeySipClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFAstSipConfBySipClusterIdxKey newKeySipClusterIdx = schema.getFactorySipConf().newSipClusterIdxKey();
    newKeySipClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableConfigurationFile().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredClusterId(), Buff.getRequiredId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateSipConf", "Superclass", "SuperClass", "ConfigurationFile", null);
            }
        }
    }

    // Update is valid

    SortedMap<CFAstConfigurationFilePKey, CFAstSipConfBuff> subdict;

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

    subdict = dictBySipClusterIdx.get(existingKeySipClusterIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictBySipClusterIdx.containsKey(newKeySipClusterIdx)) {
        subdict = dictBySipClusterIdx.get(newKeySipClusterIdx);
    } else {
        subdict = new TreeMap<CFAstConfigurationFilePKey, CFAstSipConfBuff>();
        dictBySipClusterIdx.put(newKeySipClusterIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void deleteAddressTag(CFAccAuthorization Authorization, CFAccAddressTagBuff Buff) {
    final String S_ProcName = "CFAccRamAddressTagTable.deleteAddressTag() ";
    CFAccAddressTagPKey pkey = schema.getFactoryAddressTag().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredAddressId(Buff.getRequiredAddressId());
    pkey.setRequiredTagId(Buff.getRequiredTagId());
    CFAccAddressTagBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;/* w  ww  . jav  a  2s  . c  om*/
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteAddressTag",
                pkey);
    }
    CFAccAddressTagByTenantIdxKey keyTenantIdx = schema.getFactoryAddressTag().newTenantIdxKey();
    keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFAccAddressTagByAddressIdxKey keyAddressIdx = schema.getFactoryAddressTag().newAddressIdxKey();
    keyAddressIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyAddressIdx.setRequiredAddressId(existing.getRequiredAddressId());

    CFAccAddressTagByTagIdxKey keyTagIdx = schema.getFactoryAddressTag().newTagIdxKey();
    keyTagIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyTagIdx.setRequiredTagId(existing.getRequiredTagId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<CFAccAddressTagPKey, CFAccAddressTagBuff> subdict;

    dictByPKey.remove(pkey);

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

    subdict = dictByAddressIdx.get(keyAddressIdx);
    subdict.remove(pkey);

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

}

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

public void deleteContactTag(CFAccAuthorization Authorization, CFAccContactTagBuff Buff) {
    final String S_ProcName = "CFAccRamContactTagTable.deleteContactTag() ";
    CFAccContactTagPKey pkey = schema.getFactoryContactTag().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredContactId(Buff.getRequiredContactId());
    pkey.setRequiredTagId(Buff.getRequiredTagId());
    CFAccContactTagBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;/*from   ww  w.  j av a2 s  . com*/
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteContactTag",
                pkey);
    }
    CFAccContactTagByTenantIdxKey keyTenantIdx = schema.getFactoryContactTag().newTenantIdxKey();
    keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFAccContactTagByContactIdxKey keyContactIdx = schema.getFactoryContactTag().newContactIdxKey();
    keyContactIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyContactIdx.setRequiredContactId(existing.getRequiredContactId());

    CFAccContactTagByTagIdxKey keyTagIdx = schema.getFactoryContactTag().newTagIdxKey();
    keyTagIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyTagIdx.setRequiredTagId(existing.getRequiredTagId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<CFAccContactTagPKey, CFAccContactTagBuff> subdict;

    dictByPKey.remove(pkey);

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

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

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

}

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

public void updateISOCountryCurrency(CFAccAuthorization Authorization, CFAccISOCountryCurrencyBuff Buff) {
    CFAccISOCountryCurrencyPKey pkey = schema.getFactoryISOCountryCurrency().newPKey();
    pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
    pkey.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());
    CFAccISOCountryCurrencyBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "updateISOCountryCurrency", "Existing record not found", "ISOCountryCurrency", pkey);
    }/*w w  w  .  jav a2s  .  co m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "updateISOCountryCurrency", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAccISOCountryCurrencyByCountryIdxKey existingKeyCountryIdx = schema.getFactoryISOCountryCurrency()
            .newCountryIdxKey();
    existingKeyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

    CFAccISOCountryCurrencyByCountryIdxKey newKeyCountryIdx = schema.getFactoryISOCountryCurrency()
            .newCountryIdxKey();
    newKeyCountryIdx.setRequiredISOCountryId(Buff.getRequiredISOCountryId());

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

    CFAccISOCountryCurrencyByCurrencyIdxKey newKeyCurrencyIdx = schema.getFactoryISOCountryCurrency()
            .newCurrencyIdxKey();
    newKeyCurrencyIdx.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableISOCountry().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredISOCountryId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateISOCountryCurrency", "Container", "ISOCountryCurrencyCountry", "ISOCountry",
                        null);
            }
        }
    }

    // Update is valid

    SortedMap<CFAccISOCountryCurrencyPKey, CFAccISOCountryCurrencyBuff> subdict;

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

    subdict = dictByCountryIdx.get(existingKeyCountryIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByCountryIdx.containsKey(newKeyCountryIdx)) {
        subdict = dictByCountryIdx.get(newKeyCountryIdx);
    } else {
        subdict = new TreeMap<CFAccISOCountryCurrencyPKey, CFAccISOCountryCurrencyBuff>();
        dictByCountryIdx.put(newKeyCountryIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByCurrencyIdx.get(existingKeyCurrencyIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByCurrencyIdx.containsKey(newKeyCurrencyIdx)) {
        subdict = dictByCurrencyIdx.get(newKeyCurrencyIdx);
    } else {
        subdict = new TreeMap<CFAccISOCountryCurrencyPKey, CFAccISOCountryCurrencyBuff>();
        dictByCurrencyIdx.put(newKeyCurrencyIdx, subdict);
    }
    subdict.put(pkey, Buff);

}