Example usage for java.util SortedMap remove

List of usage examples for java.util SortedMap remove

Introduction

In this page you can find the example usage for java.util SortedMap remove.

Prototype

V remove(Object key);

Source Link

Document

Removes the mapping for a key from this map if it is present (optional operation).

Usage

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

public void deleteSchemaUuid(MSSBamAuthorization Authorization, MSSBamSchemaUuidBuff Buff) {
    final String S_ProcName = "MSSBamRamSchemaUuidTable.deleteSchemaUuid() ";
    MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

    pkey.setRequiredId(schema.nextAnyObjIdGen());
    MSSBamSchemaUuidBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteSchemaUuid",
                "Existing record not found", "SchemaUuid", pkey);
    }/* w  ww .j  a v  a2  s . c  o m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSchemaUuid",
                pkey);
    }
    MSSBamSchemaUuidByContainerIdxKey keyContainerIdx = schema.getFactorySchemaUuid().newContainerIdxKey();
    keyContainerIdx.setRequiredContainerId(existing.getRequiredContainerId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamAnyObjPKey, MSSBamSchemaUuidBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByContainerIdx.get(keyContainerIdx);
    subdict.remove(pkey);

}

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

public void updateSecApp(MSSBamAuthorization Authorization, MSSBamSecAppBuff Buff) {
    MSSBamSecAppPKey pkey = schema.getFactorySecApp().newPKey();
    pkey.setRequiredSecAppId(Buff.getRequiredSecAppId());
    MSSBamSecAppBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecApp",
                "Existing record not found", "SecApp", pkey);
    }//ww w  .  j av  a  2 s.c  o m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecApp",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamSecAppByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecApp().newClusterIdxKey();
    existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    MSSBamSecAppByClusterIdxKey newKeyClusterIdx = schema.getFactorySecApp().newClusterIdxKey();
    newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    MSSBamSecAppByUJEEMountIdxKey existingKeyUJEEMountIdx = schema.getFactorySecApp().newUJEEMountIdxKey();
    existingKeyUJEEMountIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyUJEEMountIdx.setRequiredJEEMountName(existing.getRequiredJEEMountName());

    MSSBamSecAppByUJEEMountIdxKey newKeyUJEEMountIdx = schema.getFactorySecApp().newUJEEMountIdxKey();
    newKeyUJEEMountIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUJEEMountIdx.setRequiredJEEMountName(Buff.getRequiredJEEMountName());

    // Check unique indexes

    if (!existingKeyUJEEMountIdx.equals(newKeyUJEEMountIdx)) {
        if (dictByUJEEMountIdx.containsKey(newKeyUJEEMountIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateSecApp", "SecAppUJEEMountIdx", newKeyUJEEMountIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

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

    // Update is valid

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

    dictByUJEEMountIdx.remove(existingKeyUJEEMountIdx);
    dictByUJEEMountIdx.put(newKeyUJEEMountIdx, Buff);

}

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

public void deleteSecApp(MSSBamAuthorization Authorization, MSSBamSecAppBuff Buff) {
    final String S_ProcName = "MSSBamRamSecAppTable.deleteSecApp() ";
    MSSBamSecAppPKey pkey = schema.getFactorySecApp().newPKey();

    pkey.setRequiredSecAppId(schema.nextSecAppIdGen());
    MSSBamSecAppBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteSecApp",
                "Existing record not found", "SecApp", pkey);
    }//from   w  ww  .  j  ava  2 s .c o  m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecApp",
                pkey);
    }
    MSSBamSecAppByClusterIdxKey keyClusterIdx = schema.getFactorySecApp().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    MSSBamSecAppByUJEEMountIdxKey keyUJEEMountIdx = schema.getFactorySecApp().newUJEEMountIdxKey();
    keyUJEEMountIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyUJEEMountIdx.setRequiredJEEMountName(existing.getRequiredJEEMountName());

    // Validate reverse foreign keys

    if (schema.getTableSecForm().readDerivedBySecAppIdx(Authorization,
            existing.getRequiredSecAppId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSecApp",
                "Container", "SecFormApplication", "SecForm", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamSecAppPKey, MSSBamSecAppBuff> subdict;

    dictByPKey.remove(pkey);

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

    dictByUJEEMountIdx.remove(keyUJEEMountIdx);

}

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

public void updateSecForm(MSSBamAuthorization Authorization, MSSBamSecFormBuff Buff) {
    MSSBamSecFormPKey pkey = schema.getFactorySecForm().newPKey();
    pkey.setRequiredSecFormId(Buff.getRequiredSecFormId());
    MSSBamSecFormBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecForm",
                "Existing record not found", "SecForm", pkey);
    }//from  ww  w.j a  va  2s .  c o  m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecForm",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamSecFormBySecAppIdxKey existingKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey();
    existingKeySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId());

    MSSBamSecFormBySecAppIdxKey newKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey();
    newKeySecAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId());

    MSSBamSecFormByUJEEServletIdxKey existingKeyUJEEServletIdx = schema.getFactorySecForm()
            .newUJEEServletIdxKey();
    existingKeyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId());
    existingKeyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName());

    MSSBamSecFormByUJEEServletIdxKey newKeyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey();
    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.getTableSecApp().readDerivedByIdIdx(Authorization, Buff.getRequiredSecAppId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateSecForm", "Container", "SecFormApplication", "SecApp", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamSecFormPKey, MSSBamSecFormBuff> subdict;

    dictByPKey.remove(pkey);
    dictByPKey.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<MSSBamSecFormPKey, MSSBamSecFormBuff>();
        dictBySecAppIdx.put(newKeySecAppIdx, subdict);
    }
    subdict.put(pkey, Buff);

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

}

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

public void deleteSecForm(MSSBamAuthorization Authorization, MSSBamSecFormBuff Buff) {
    final String S_ProcName = "MSSBamRamSecFormTable.deleteSecForm() ";
    MSSBamSecFormPKey pkey = schema.getFactorySecForm().newPKey();

    pkey.setRequiredSecFormId(schema.nextSecFormIdGen());
    MSSBamSecFormBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteSecForm",
                "Existing record not found", "SecForm", pkey);
    }//from  ww w.j av  a2s .  c o m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecForm",
                pkey);
    }
    MSSBamSecFormBySecAppIdxKey keySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey();
    keySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId());

    MSSBamSecFormByUJEEServletIdxKey keyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey();
    keyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId());
    keyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName());

    // Validate reverse foreign keys

    if (schema.getTableSecGroupForm().readDerivedByFormIdx(Authorization,
            existing.getRequiredSecFormId()).length > 0) {
        throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSecForm",
                "Lookup", "SecGroupFormForm", "SecGroupForm", pkey);
    }

    // Delete is valid

    SortedMap<MSSBamSecFormPKey, MSSBamSecFormBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictBySecAppIdx.get(keySecAppIdx);
    subdict.remove(pkey);

    dictByUJEEServletIdx.remove(keyUJEEServletIdx);

}

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

public void updateSecGroupForm(MSSBamAuthorization Authorization, MSSBamSecGroupFormBuff Buff) {
    MSSBamSecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey();
    pkey.setRequiredSecGroupFormId(Buff.getRequiredSecGroupFormId());
    MSSBamSecGroupFormBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "updateSecGroupForm", "Existing record not found", "SecGroupForm", pkey);
    }/*from  w  w  w .j  a  v a  2  s  . com*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecGroupForm",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamSecGroupFormByGroupIdxKey existingKeyGroupIdx = schema.getFactorySecGroupForm().newGroupIdxKey();
    existingKeyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());

    MSSBamSecGroupFormByGroupIdxKey newKeyGroupIdx = schema.getFactorySecGroupForm().newGroupIdxKey();
    newKeyGroupIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());

    MSSBamSecGroupFormByFormIdxKey existingKeyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey();
    existingKeyFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId());

    MSSBamSecGroupFormByFormIdxKey newKeyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey();
    newKeyFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId());

    MSSBamSecGroupFormByUFormIdxKey existingKeyUFormIdx = schema.getFactorySecGroupForm().newUFormIdxKey();
    existingKeyUFormIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());
    existingKeyUFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId());

    MSSBamSecGroupFormByUFormIdxKey newKeyUFormIdx = schema.getFactorySecGroupForm().newUFormIdxKey();
    newKeyUFormIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());
    newKeyUFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId());

    // Check unique indexes

    if (!existingKeyUFormIdx.equals(newKeyUFormIdx)) {
        if (dictByUFormIdx.containsKey(newKeyUFormIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateSecGroupForm", "SecGroupFormUFormIdx", newKeyUFormIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableSecGroup().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredSecGroupId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateSecGroupForm", "Container", "SecGroupFormGroup", "SecGroup", null);
            }
        }
    }

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableSecForm().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredSecFormId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateSecGroupForm", "Lookup", "SecGroupFormForm", "SecForm", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff> subdict;

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

    subdict = dictByGroupIdx.get(existingKeyGroupIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByGroupIdx.containsKey(newKeyGroupIdx)) {
        subdict = dictByGroupIdx.get(newKeyGroupIdx);
    } else {
        subdict = new TreeMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff>();
        dictByGroupIdx.put(newKeyGroupIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByFormIdx.get(existingKeyFormIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByFormIdx.containsKey(newKeyFormIdx)) {
        subdict = dictByFormIdx.get(newKeyFormIdx);
    } else {
        subdict = new TreeMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff>();
        dictByFormIdx.put(newKeyFormIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUFormIdx.remove(existingKeyUFormIdx);
    dictByUFormIdx.put(newKeyUFormIdx, Buff);

}

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

public void deleteSecGroupForm(MSSBamAuthorization Authorization, MSSBamSecGroupFormBuff Buff) {
    final String S_ProcName = "MSSBamRamSecGroupFormTable.deleteSecGroupForm() ";
    MSSBamSecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey();

    pkey.setRequiredSecGroupFormId(schema.nextSecGroupFormIdGen());
    MSSBamSecGroupFormBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "deleteSecGroupForm", "Existing record not found", "SecGroupForm", pkey);
    }/*w  ww  . j ava  2s.c  om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecGroupForm",
                pkey);
    }
    MSSBamSecGroupFormByGroupIdxKey keyGroupIdx = schema.getFactorySecGroupForm().newGroupIdxKey();
    keyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());

    MSSBamSecGroupFormByFormIdxKey keyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey();
    keyFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId());

    MSSBamSecGroupFormByUFormIdxKey keyUFormIdx = schema.getFactorySecGroupForm().newUFormIdxKey();
    keyUFormIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());
    keyUFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff> subdict;

    dictByPKey.remove(pkey);

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

    subdict = dictByFormIdx.get(keyFormIdx);
    subdict.remove(pkey);

    dictByUFormIdx.remove(keyUFormIdx);

}

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

public void updateSecGroupInclude(MSSBamAuthorization Authorization, MSSBamSecGroupIncludeBuff Buff) {
    MSSBamSecGroupIncludePKey pkey = schema.getFactorySecGroupInclude().newPKey();
    pkey.setRequiredSecGroupIncludeId(Buff.getRequiredSecGroupIncludeId());
    MSSBamSecGroupIncludeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "updateSecGroupInclude", "Existing record not found", "SecGroupInclude", pkey);
    }//  ww w .j  a v  a2s  . c o m
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "updateSecGroupInclude", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamSecGroupIncludeByGroupIdxKey existingKeyGroupIdx = schema.getFactorySecGroupInclude()
            .newGroupIdxKey();
    existingKeyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());

    MSSBamSecGroupIncludeByGroupIdxKey newKeyGroupIdx = schema.getFactorySecGroupInclude().newGroupIdxKey();
    newKeyGroupIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());

    MSSBamSecGroupIncludeByIncludeIdxKey existingKeyIncludeIdx = schema.getFactorySecGroupInclude()
            .newIncludeIdxKey();
    existingKeyIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId());

    MSSBamSecGroupIncludeByIncludeIdxKey newKeyIncludeIdx = schema.getFactorySecGroupInclude()
            .newIncludeIdxKey();
    newKeyIncludeIdx.setRequiredIncludeGroupId(Buff.getRequiredIncludeGroupId());

    MSSBamSecGroupIncludeByUIncludeIdxKey existingKeyUIncludeIdx = schema.getFactorySecGroupInclude()
            .newUIncludeIdxKey();
    existingKeyUIncludeIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());
    existingKeyUIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId());

    MSSBamSecGroupIncludeByUIncludeIdxKey newKeyUIncludeIdx = schema.getFactorySecGroupInclude()
            .newUIncludeIdxKey();
    newKeyUIncludeIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());
    newKeyUIncludeIdx.setRequiredIncludeGroupId(Buff.getRequiredIncludeGroupId());

    // Check unique indexes

    if (!existingKeyUIncludeIdx.equals(newKeyUIncludeIdx)) {
        if (dictByUIncludeIdx.containsKey(newKeyUIncludeIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateSecGroupInclude", "SecGroupIncludeUIncludeIdx", newKeyUIncludeIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableSecGroup().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredSecGroupId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateSecGroupInclude", "Container", "SecGroupIncludeGroup", "SecGroup", null);
            }
        }
    }

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableSecGroup().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredIncludeGroupId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateSecGroupInclude", "Lookup", "SecGroupIncludeSubGroup", "SecGroup", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamSecGroupIncludePKey, MSSBamSecGroupIncludeBuff> subdict;

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

    subdict = dictByGroupIdx.get(existingKeyGroupIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByGroupIdx.containsKey(newKeyGroupIdx)) {
        subdict = dictByGroupIdx.get(newKeyGroupIdx);
    } else {
        subdict = new TreeMap<MSSBamSecGroupIncludePKey, MSSBamSecGroupIncludeBuff>();
        dictByGroupIdx.put(newKeyGroupIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByIncludeIdx.get(existingKeyIncludeIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByIncludeIdx.containsKey(newKeyIncludeIdx)) {
        subdict = dictByIncludeIdx.get(newKeyIncludeIdx);
    } else {
        subdict = new TreeMap<MSSBamSecGroupIncludePKey, MSSBamSecGroupIncludeBuff>();
        dictByIncludeIdx.put(newKeyIncludeIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUIncludeIdx.remove(existingKeyUIncludeIdx);
    dictByUIncludeIdx.put(newKeyUIncludeIdx, Buff);

}

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

public void deleteSecGroupInclude(MSSBamAuthorization Authorization, MSSBamSecGroupIncludeBuff Buff) {
    final String S_ProcName = "MSSBamRamSecGroupIncludeTable.deleteSecGroupInclude() ";
    MSSBamSecGroupIncludePKey pkey = schema.getFactorySecGroupInclude().newPKey();

    pkey.setRequiredSecGroupIncludeId(schema.nextSecGroupIncludeIdGen());
    MSSBamSecGroupIncludeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "deleteSecGroupInclude", "Existing record not found", "SecGroupInclude", pkey);
    }/*ww  w  . jav  a  2  s  . c  om*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "deleteSecGroupInclude", pkey);
    }
    MSSBamSecGroupIncludeByGroupIdxKey keyGroupIdx = schema.getFactorySecGroupInclude().newGroupIdxKey();
    keyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());

    MSSBamSecGroupIncludeByIncludeIdxKey keyIncludeIdx = schema.getFactorySecGroupInclude().newIncludeIdxKey();
    keyIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId());

    MSSBamSecGroupIncludeByUIncludeIdxKey keyUIncludeIdx = schema.getFactorySecGroupInclude()
            .newUIncludeIdxKey();
    keyUIncludeIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());
    keyUIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId());

    // Validate reverse foreign keys

    // Delete is valid

    SortedMap<MSSBamSecGroupIncludePKey, MSSBamSecGroupIncludeBuff> subdict;

    dictByPKey.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.v1_10.MSSBamRam.MSSBamRamSecGroupMemberTable.java

public void updateSecGroupMember(MSSBamAuthorization Authorization, MSSBamSecGroupMemberBuff Buff) {
    MSSBamSecGroupMemberPKey pkey = schema.getFactorySecGroupMember().newPKey();
    pkey.setRequiredSecGroupMemberId(Buff.getRequiredSecGroupMemberId());
    MSSBamSecGroupMemberBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                "updateSecGroupMember", "Existing record not found", "SecGroupMember", pkey);
    }/*from w  w  w  .j a  v a  2  s  .  co m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                "updateSecGroupMember", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    MSSBamSecGroupMemberByGroupIdxKey existingKeyGroupIdx = schema.getFactorySecGroupMember().newGroupIdxKey();
    existingKeyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());

    MSSBamSecGroupMemberByGroupIdxKey newKeyGroupIdx = schema.getFactorySecGroupMember().newGroupIdxKey();
    newKeyGroupIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());

    MSSBamSecGroupMemberByUserIdxKey existingKeyUserIdx = schema.getFactorySecGroupMember().newUserIdxKey();
    existingKeyUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId());

    MSSBamSecGroupMemberByUserIdxKey newKeyUserIdx = schema.getFactorySecGroupMember().newUserIdxKey();
    newKeyUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());

    MSSBamSecGroupMemberByUUserIdxKey existingKeyUUserIdx = schema.getFactorySecGroupMember().newUUserIdxKey();
    existingKeyUUserIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());
    existingKeyUUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId());

    MSSBamSecGroupMemberByUUserIdxKey newKeyUUserIdx = schema.getFactorySecGroupMember().newUUserIdxKey();
    newKeyUUserIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());
    newKeyUUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());

    // Check unique indexes

    if (!existingKeyUUserIdx.equals(newKeyUUserIdx)) {
        if (dictByUUserIdx.containsKey(newKeyUUserIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "updateSecGroupMember", "SecGroupMemberUUserIdx", newKeyUUserIdx);
        }
    }

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableSecGroup().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredSecGroupId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateSecGroupMember", "Container", "SecGroupMemberGroup", "SecGroup", null);
            }
        }
    }

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableSecUser().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredSecUserId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateSecGroupMember", "Lookup", "SecGroupMemberUser", "SecUser", null);
            }
        }
    }

    // Update is valid

    SortedMap<MSSBamSecGroupMemberPKey, MSSBamSecGroupMemberBuff> subdict;

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

    subdict = dictByGroupIdx.get(existingKeyGroupIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByGroupIdx.containsKey(newKeyGroupIdx)) {
        subdict = dictByGroupIdx.get(newKeyGroupIdx);
    } else {
        subdict = new TreeMap<MSSBamSecGroupMemberPKey, MSSBamSecGroupMemberBuff>();
        dictByGroupIdx.put(newKeyGroupIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByUserIdx.get(existingKeyUserIdx);
    if (subdict != null) {
        subdict.remove(pkey);
    }
    if (dictByUserIdx.containsKey(newKeyUserIdx)) {
        subdict = dictByUserIdx.get(newKeyUserIdx);
    } else {
        subdict = new TreeMap<MSSBamSecGroupMemberPKey, MSSBamSecGroupMemberBuff>();
        dictByUserIdx.put(newKeyUserIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUUserIdx.remove(existingKeyUUserIdx);
    dictByUUserIdx.put(newKeyUUserIdx, Buff);

}