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

public void updateSecForm(CFAccAuthorization Authorization, CFAccSecFormBuff Buff) {
    CFAccSecFormPKey pkey = schema.getFactorySecForm().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecFormId(Buff.getRequiredSecFormId());
    CFAccSecFormBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecForm",
                "Existing record not found", "SecForm", pkey);
    }/*w ww .j  av a 2  s .c om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecForm",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAccSecFormByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecForm().newClusterIdxKey();
    existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFAccSecFormByClusterIdxKey newKeyClusterIdx = schema.getFactorySecForm().newClusterIdxKey();
    newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    CFAccSecFormBySecAppIdxKey existingKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey();
    existingKeySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId());

    CFAccSecFormBySecAppIdxKey newKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey();
    newKeySecAppIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeySecAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId());

    CFAccSecFormByUJEEServletIdxKey existingKeyUJEEServletIdx = schema.getFactorySecForm()
            .newUJEEServletIdxKey();
    existingKeyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId());
    existingKeyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName());

    CFAccSecFormByUJEEServletIdxKey newKeyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey();
    newKeyUJEEServletIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUJEEServletIdx.setRequiredSecAppId(Buff.getRequiredSecAppId());
    newKeyUJEEServletIdx.setRequiredJEEServletMapName(Buff.getRequiredJEEServletMapName());

    // Check unique indexes

    if (!existingKeyUJEEServletIdx.equals(newKeyUJEEServletIdx)) {
        if (dictByUJEEServletIdx.containsKey(newKeyUJEEServletIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateSecForm", "SecFormUJEEServletIdx", newKeyUJEEServletIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableSecApp().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId(),
                    Buff.getRequiredSecAppId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateSecForm", "Container", "SecFormApplication", "SecApp", null);
            }
        }
    }

    // Update is valid

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

    subdict = dictBySecAppIdx.get(existingKeySecAppIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictBySecAppIdx.containsKey(newKeySecAppIdx)) {
        subdict = dictBySecAppIdx.get(newKeySecAppIdx);
    } else {
        subdict = new TreeMap<CFAccSecFormPKey, CFAccSecFormBuff>();
        dictBySecAppIdx.put(newKeySecAppIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUJEEServletIdx.remove(existingKeyUJEEServletIdx);
    dictByUJEEServletIdx.put(newKeyUJEEServletIdx, Buff);

}

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

public void updateSecForm(CFAstAuthorization Authorization, CFAstSecFormBuff Buff) {
    CFAstSecFormPKey pkey = schema.getFactorySecForm().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecFormId(Buff.getRequiredSecFormId());
    CFAstSecFormBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecForm",
                "Existing record not found", "SecForm", pkey);
    }/*  w  ww.j  ava2s  .c  o  m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecForm",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAstSecFormByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecForm().newClusterIdxKey();
    existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFAstSecFormByClusterIdxKey newKeyClusterIdx = schema.getFactorySecForm().newClusterIdxKey();
    newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    CFAstSecFormBySecAppIdxKey existingKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey();
    existingKeySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId());

    CFAstSecFormBySecAppIdxKey newKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey();
    newKeySecAppIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeySecAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId());

    CFAstSecFormByUJEEServletIdxKey existingKeyUJEEServletIdx = schema.getFactorySecForm()
            .newUJEEServletIdxKey();
    existingKeyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId());
    existingKeyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName());

    CFAstSecFormByUJEEServletIdxKey newKeyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey();
    newKeyUJEEServletIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUJEEServletIdx.setRequiredSecAppId(Buff.getRequiredSecAppId());
    newKeyUJEEServletIdx.setRequiredJEEServletMapName(Buff.getRequiredJEEServletMapName());

    // Check unique indexes

    if (!existingKeyUJEEServletIdx.equals(newKeyUJEEServletIdx)) {
        if (dictByUJEEServletIdx.containsKey(newKeyUJEEServletIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateSecForm", "SecFormUJEEServletIdx", newKeyUJEEServletIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableSecApp().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId(),
                    Buff.getRequiredSecAppId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateSecForm", "Container", "SecFormApplication", "SecApp", null);
            }
        }
    }

    // Update is valid

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

    subdict = dictBySecAppIdx.get(existingKeySecAppIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictBySecAppIdx.containsKey(newKeySecAppIdx)) {
        subdict = dictBySecAppIdx.get(newKeySecAppIdx);
    } else {
        subdict = new TreeMap<CFAstSecFormPKey, CFAstSecFormBuff>();
        dictBySecAppIdx.put(newKeySecAppIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUJEEServletIdx.remove(existingKeyUJEEServletIdx);
    dictByUJEEServletIdx.put(newKeyUJEEServletIdx, Buff);

}

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

public void deleteSecGroupInclude(CFAccAuthorization Authorization, CFAccSecGroupIncludeBuff Buff) {
    final String S_ProcName = "CFAccRamSecGroupIncludeTable.deleteSecGroupInclude() ";
    CFAccSecGroupIncludePKey pkey = schema.getFactorySecGroupInclude().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecGroupIncludeId(Buff.getRequiredSecGroupIncludeId());
    CFAccSecGroupIncludeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;//from  ww  w.ja  va 2s.com
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteSecGroupInclude", pkey);
    }
    CFAccSecGroupIncludeByClusterIdxKey keyClusterIdx = schema.getFactorySecGroupInclude().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFAccSecGroupIncludeByGroupIdxKey keyGroupIdx = schema.getFactorySecGroupInclude().newGroupIdxKey();
    keyGroupIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());

    CFAccSecGroupIncludeByIncludeIdxKey keyIncludeIdx = schema.getFactorySecGroupInclude().newIncludeIdxKey();
    keyIncludeIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId());

    CFAccSecGroupIncludeByUIncludeIdxKey keyUIncludeIdx = schema.getFactorySecGroupInclude()
            .newUIncludeIdxKey();
    keyUIncludeIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyUIncludeIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());
    keyUIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<CFAccSecGroupIncludePKey, CFAccSecGroupIncludeBuff> subdict;

    dictByPKey.remove(pkey);

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

    subdict = dictByGroupIdx.get(keyGroupIdx);
    subdict.remove(pkey);

    subdict = dictByIncludeIdx.get(keyIncludeIdx);
    subdict.remove(pkey);

    dictByUIncludeIdx.remove(keyUIncludeIdx);

}

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

public void deleteTSecGroupInclude(CFAccAuthorization Authorization, CFAccTSecGroupIncludeBuff Buff) {
    final String S_ProcName = "CFAccRamTSecGroupIncludeTable.deleteTSecGroupInclude() ";
    CFAccTSecGroupIncludePKey pkey = schema.getFactoryTSecGroupInclude().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredTSecGroupIncludeId(Buff.getRequiredTSecGroupIncludeId());
    CFAccTSecGroupIncludeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;//from ww  w.  j ava  2s  .  c o  m
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteTSecGroupInclude", pkey);
    }
    CFAccTSecGroupIncludeByTenantIdxKey keyTenantIdx = schema.getFactoryTSecGroupInclude().newTenantIdxKey();
    keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFAccTSecGroupIncludeByGroupIdxKey keyGroupIdx = schema.getFactoryTSecGroupInclude().newGroupIdxKey();
    keyGroupIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyGroupIdx.setRequiredTSecGroupId(existing.getRequiredTSecGroupId());

    CFAccTSecGroupIncludeByIncludeIdxKey keyIncludeIdx = schema.getFactoryTSecGroupInclude().newIncludeIdxKey();
    keyIncludeIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId());

    CFAccTSecGroupIncludeByUIncludeIdxKey keyUIncludeIdx = schema.getFactoryTSecGroupInclude()
            .newUIncludeIdxKey();
    keyUIncludeIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyUIncludeIdx.setRequiredTSecGroupId(existing.getRequiredTSecGroupId());
    keyUIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<CFAccTSecGroupIncludePKey, CFAccTSecGroupIncludeBuff> subdict;

    dictByPKey.remove(pkey);

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

    subdict = dictByGroupIdx.get(keyGroupIdx);
    subdict.remove(pkey);

    subdict = dictByIncludeIdx.get(keyIncludeIdx);
    subdict.remove(pkey);

    dictByUIncludeIdx.remove(keyUIncludeIdx);

}

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

public void deleteSecGroupInclude(CFAstAuthorization Authorization, CFAstSecGroupIncludeBuff Buff) {
    final String S_ProcName = "CFAstRamSecGroupIncludeTable.deleteSecGroupInclude() ";
    CFAstSecGroupIncludePKey pkey = schema.getFactorySecGroupInclude().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecGroupIncludeId(Buff.getRequiredSecGroupIncludeId());
    CFAstSecGroupIncludeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;/*w ww  .ja  v  a  2 s  . co m*/
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteSecGroupInclude", pkey);
    }
    CFAstSecGroupIncludeByClusterIdxKey keyClusterIdx = schema.getFactorySecGroupInclude().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFAstSecGroupIncludeByGroupIdxKey keyGroupIdx = schema.getFactorySecGroupInclude().newGroupIdxKey();
    keyGroupIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());

    CFAstSecGroupIncludeByIncludeIdxKey keyIncludeIdx = schema.getFactorySecGroupInclude().newIncludeIdxKey();
    keyIncludeIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId());

    CFAstSecGroupIncludeByUIncludeIdxKey keyUIncludeIdx = schema.getFactorySecGroupInclude()
            .newUIncludeIdxKey();
    keyUIncludeIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyUIncludeIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());
    keyUIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<CFAstSecGroupIncludePKey, CFAstSecGroupIncludeBuff> subdict;

    dictByPKey.remove(pkey);

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

    subdict = dictByGroupIdx.get(keyGroupIdx);
    subdict.remove(pkey);

    subdict = dictByIncludeIdx.get(keyIncludeIdx);
    subdict.remove(pkey);

    dictByUIncludeIdx.remove(keyUIncludeIdx);

}

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

public void deleteTSecGroupInclude(CFAstAuthorization Authorization, CFAstTSecGroupIncludeBuff Buff) {
    final String S_ProcName = "CFAstRamTSecGroupIncludeTable.deleteTSecGroupInclude() ";
    CFAstTSecGroupIncludePKey pkey = schema.getFactoryTSecGroupInclude().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredTSecGroupIncludeId(Buff.getRequiredTSecGroupIncludeId());
    CFAstTSecGroupIncludeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;/*from   w w w .j  ava2  s. c o m*/
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteTSecGroupInclude", pkey);
    }
    CFAstTSecGroupIncludeByTenantIdxKey keyTenantIdx = schema.getFactoryTSecGroupInclude().newTenantIdxKey();
    keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFAstTSecGroupIncludeByGroupIdxKey keyGroupIdx = schema.getFactoryTSecGroupInclude().newGroupIdxKey();
    keyGroupIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyGroupIdx.setRequiredTSecGroupId(existing.getRequiredTSecGroupId());

    CFAstTSecGroupIncludeByIncludeIdxKey keyIncludeIdx = schema.getFactoryTSecGroupInclude().newIncludeIdxKey();
    keyIncludeIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId());

    CFAstTSecGroupIncludeByUIncludeIdxKey keyUIncludeIdx = schema.getFactoryTSecGroupInclude()
            .newUIncludeIdxKey();
    keyUIncludeIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyUIncludeIdx.setRequiredTSecGroupId(existing.getRequiredTSecGroupId());
    keyUIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<CFAstTSecGroupIncludePKey, CFAstTSecGroupIncludeBuff> subdict;

    dictByPKey.remove(pkey);

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

    subdict = dictByGroupIdx.get(keyGroupIdx);
    subdict.remove(pkey);

    subdict = dictByIncludeIdx.get(keyIncludeIdx);
    subdict.remove(pkey);

    dictByUIncludeIdx.remove(keyUIncludeIdx);

}

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

public void updateMemoTag(CFAccAuthorization Authorization, CFAccMemoTagBuff Buff) {
    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) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateMemoTag",
                "Existing record not found", "MemoTag", pkey);
    }/*from  w ww . ja va2s .  c om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateMemoTag",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAccMemoTagByTenantIdxKey existingKeyTenantIdx = schema.getFactoryMemoTag().newTenantIdxKey();
    existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFAccMemoTagByTenantIdxKey newKeyTenantIdx = schema.getFactoryMemoTag().newTenantIdxKey();
    newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId());

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

    CFAccMemoTagByMemoIdxKey newKeyMemoIdx = schema.getFactoryMemoTag().newMemoIdxKey();
    newKeyMemoIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyMemoIdx.setRequiredMemoId(Buff.getRequiredMemoId());

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

    CFAccMemoTagByTagIdxKey newKeyTagIdx = schema.getFactoryMemoTag().newTagIdxKey();
    newKeyTagIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyTagIdx.setRequiredTagId(Buff.getRequiredTagId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableMemo().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(),
                    Buff.getRequiredMemoId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateMemoTag", "Container", "MemoTagMemo", "Memo", null);
            }
        }
    }

    // Update is valid

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

    subdict = dictByMemoIdx.get(existingKeyMemoIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByMemoIdx.containsKey(newKeyMemoIdx)) {
        subdict = dictByMemoIdx.get(newKeyMemoIdx);
    } else {
        subdict = new TreeMap<CFAccMemoTagPKey, CFAccMemoTagBuff>();
        dictByMemoIdx.put(newKeyMemoIdx, 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<CFAccMemoTagPKey, CFAccMemoTagBuff>();
        dictByTagIdx.put(newKeyTagIdx, subdict);
    }
    subdict.put(pkey, Buff);

}

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

public void updatePhoneTag(CFAccAuthorization Authorization, CFAccPhoneTagBuff Buff) {
    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) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updatePhoneTag",
                "Existing record not found", "PhoneTag", pkey);
    }//from   w w w .ja  va  2s .  com
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updatePhoneTag",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAccPhoneTagByTenantIdxKey existingKeyTenantIdx = schema.getFactoryPhoneTag().newTenantIdxKey();
    existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFAccPhoneTagByTenantIdxKey newKeyTenantIdx = schema.getFactoryPhoneTag().newTenantIdxKey();
    newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId());

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

    CFAccPhoneTagByPhoneIdxKey newKeyPhoneIdx = schema.getFactoryPhoneTag().newPhoneIdxKey();
    newKeyPhoneIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyPhoneIdx.setRequiredPhoneId(Buff.getRequiredPhoneId());

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

    CFAccPhoneTagByTagIdxKey newKeyTagIdx = schema.getFactoryPhoneTag().newTagIdxKey();
    newKeyTagIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyTagIdx.setRequiredTagId(Buff.getRequiredTagId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

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

    // Update is valid

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

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

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

}

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

public void deleteConfigurationFile(CFAstAuthorization Authorization, CFAstConfigurationFileBuff Buff) {
    final String S_ProcName = "CFAstRamConfigurationFileTable.deleteConfigurationFile() ";
    CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstConfigurationFileBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        return;//from   w  w w  . ja v a 2 s  . c o  m
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteConfigurationFile", pkey);
    }
    CFAstConfigurationFileByClusterIdxKey keyClusterIdx = schema.getFactoryConfigurationFile()
            .newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFAstConfigurationFileByHostIdxKey keyHostIdx = schema.getFactoryConfigurationFile().newHostIdxKey();
    keyHostIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyHostIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId());

    CFAstConfigurationFileByUNameIdxKey keyUNameIdx = schema.getFactoryConfigurationFile().newUNameIdxKey();
    keyUNameIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyUNameIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId());
    keyUNameIdx.setRequiredFileFullName(existing.getRequiredFileFullName());

    // Validate reverse foreign keys

    if (schema.getTableAsteriskConf().readDerivedByIdIdx(Authorization, existing.getRequiredClusterId(),
            existing.getRequiredId()) != null) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(),
                "deleteConfigurationFile", "Superclass", "SuperClass", "AsteriskConf", pkey);
    }

    if (schema.getTableSipConf().readDerivedByIdIdx(Authorization, existing.getRequiredClusterId(),
            existing.getRequiredId()) != null) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(),
                "deleteConfigurationFile", "Superclass", "SuperClass", "SipConf", pkey);
    }

    if (schema.getTableExtensionsConf().readDerivedByIdIdx(Authorization, existing.getRequiredClusterId(),
            existing.getRequiredId()) != null) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(),
                "deleteConfigurationFile", "Superclass", "SuperClass", "ExtensionsConf", pkey);
    }

    if (schema.getTableVoicemailConf().readDerivedByIdIdx(Authorization, existing.getRequiredClusterId(),
            existing.getRequiredId()) != null) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(),
                "deleteConfigurationFile", "Superclass", "SuperClass", "VoicemailConf", pkey);
    }

    if (schema.getTableExtConfigConf().readDerivedByIdIdx(Authorization, existing.getRequiredClusterId(),
            existing.getRequiredId()) != null) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(),
                "deleteConfigurationFile", "Superclass", "SuperClass", "ExtConfigConf", pkey);
    }

    // Delete is valid

    SortedMap<CFAstConfigurationFilePKey, CFAstConfigurationFileBuff> subdict;

    dictByPKey.remove(pkey);

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

    subdict = dictByHostIdx.get(keyHostIdx);
    subdict.remove(pkey);

    dictByUNameIdx.remove(keyUNameIdx);

}

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

public void updateAddressTag(CFAccAuthorization Authorization, CFAccAddressTagBuff Buff) {
    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) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateAddressTag",
                "Existing record not found", "AddressTag", pkey);
    }//from  w  ww  . j av  a 2 s. co  m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateAddressTag",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFAccAddressTagByTenantIdxKey existingKeyTenantIdx = schema.getFactoryAddressTag().newTenantIdxKey();
    existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFAccAddressTagByTenantIdxKey newKeyTenantIdx = schema.getFactoryAddressTag().newTenantIdxKey();
    newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId());

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

    CFAccAddressTagByAddressIdxKey newKeyAddressIdx = schema.getFactoryAddressTag().newAddressIdxKey();
    newKeyAddressIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyAddressIdx.setRequiredAddressId(Buff.getRequiredAddressId());

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

    CFAccAddressTagByTagIdxKey newKeyTagIdx = schema.getFactoryAddressTag().newTagIdxKey();
    newKeyTagIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyTagIdx.setRequiredTagId(Buff.getRequiredTagId());

    // Check unique indexes

    // Validate foreign keys

    {
        boolean allNull = true;

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

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableAddress().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(),
                    Buff.getRequiredAddressId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateAddressTag", "Container", "AddressTagAddress", "Address", null);
            }
        }
    }

    // Update is valid

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

    subdict = dictByAddressIdx.get(existingKeyAddressIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByAddressIdx.containsKey(newKeyAddressIdx)) {
        subdict = dictByAddressIdx.get(newKeyAddressIdx);
    } else {
        subdict = new TreeMap<CFAccAddressTagPKey, CFAccAddressTagBuff>();
        dictByAddressIdx.put(newKeyAddressIdx, 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<CFAccAddressTagPKey, CFAccAddressTagBuff>();
        dictByTagIdx.put(newKeyTagIdx, subdict);
    }
    subdict.put(pkey, Buff);

}