Example usage for java.util SortedMap put

List of usage examples for java.util SortedMap put

Introduction

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

Prototype

V put(K key, V value);

Source Link

Document

Associates the specified value with the specified key in this map (optional operation).

Usage

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

public void createHostNode(CFAstAuthorization Authorization, CFAstHostNodeBuff Buff) {
    CFAstHostNodePKey pkey = schema.getFactoryHostNode().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredHostNodeId(((CFAstRamClusterTable) schema.getTableCluster())
            .nextHostNodeIdGen(Authorization, Buff.getRequiredClusterId()));
    Buff.setRequiredClusterId(pkey.getRequiredClusterId());
    Buff.setRequiredHostNodeId(pkey.getRequiredHostNodeId());
    CFAstHostNodeByClusterIdxKey keyClusterIdx = schema.getFactoryHostNode().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

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

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

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
        throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createHostNode",
                pkey);/*from   w  w  w  . ja  v a2s.c  o m*/
    }

    if (dictByUDescrIdx.containsKey(keyUDescrIdx)) {
        throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "createHostNode",
                "HostNodeUDescrIdx", keyUDescrIdx);
    }

    if (dictByHostNameIdx.containsKey(keyHostNameIdx)) {
        throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "createHostNode",
                "HostNodeUHostNameIdx", keyHostNameIdx);
    }

    // Validate foreign keys

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

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFAstHostNodePKey, CFAstHostNodeBuff> subdictClusterIdx;
    if (dictByClusterIdx.containsKey(keyClusterIdx)) {
        subdictClusterIdx = dictByClusterIdx.get(keyClusterIdx);
    } else {
        subdictClusterIdx = new TreeMap<CFAstHostNodePKey, CFAstHostNodeBuff>();
        dictByClusterIdx.put(keyClusterIdx, subdictClusterIdx);
    }
    subdictClusterIdx.put(pkey, Buff);

    dictByUDescrIdx.put(keyUDescrIdx, Buff);

    dictByHostNameIdx.put(keyHostNameIdx, Buff);

}

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

public void createMinorVersion(CFAccAuthorization Authorization, CFAccMinorVersionBuff Buff) {
    schema.getTableVersion().createVersion(Authorization, Buff);
    CFAccDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAccMinorVersionByMajorIdxKey keyMajorIdx = schema.getFactoryMinorVersion().newMajorIdxKey();
    keyMajorIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyMajorIdx.setRequiredMajorId(Buff.getRequiredMajorId());

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

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
        throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createMinorVersion",
                pkey);//from  w  ww .  j a  v  a  2s.c om
    }

    if (dictByNameIdx.containsKey(keyNameIdx)) {
        throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                "createMinorVersion", "MinorVersionNameIdx", keyNameIdx);
    }

    // Validate foreign keys

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

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

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFAccDomainBasePKey, CFAccMinorVersionBuff> subdictMajorIdx;
    if (dictByMajorIdx.containsKey(keyMajorIdx)) {
        subdictMajorIdx = dictByMajorIdx.get(keyMajorIdx);
    } else {
        subdictMajorIdx = new TreeMap<CFAccDomainBasePKey, CFAccMinorVersionBuff>();
        dictByMajorIdx.put(keyMajorIdx, subdictMajorIdx);
    }
    subdictMajorIdx.put(pkey, Buff);

    dictByNameIdx.put(keyNameIdx, Buff);

}

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

public void createMinorVersion(CFAstAuthorization Authorization, CFAstMinorVersionBuff Buff) {
    schema.getTableVersion().createVersion(Authorization, Buff);
    CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstMinorVersionByMajorIdxKey keyMajorIdx = schema.getFactoryMinorVersion().newMajorIdxKey();
    keyMajorIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyMajorIdx.setRequiredMajorId(Buff.getRequiredMajorId());

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

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
        throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createMinorVersion",
                pkey);//from w w  w . j  a  va 2  s. c  om
    }

    if (dictByNameIdx.containsKey(keyNameIdx)) {
        throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                "createMinorVersion", "MinorVersionNameIdx", keyNameIdx);
    }

    // Validate foreign keys

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

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

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFAstDomainBasePKey, CFAstMinorVersionBuff> subdictMajorIdx;
    if (dictByMajorIdx.containsKey(keyMajorIdx)) {
        subdictMajorIdx = dictByMajorIdx.get(keyMajorIdx);
    } else {
        subdictMajorIdx = new TreeMap<CFAstDomainBasePKey, CFAstMinorVersionBuff>();
        dictByMajorIdx.put(keyMajorIdx, subdictMajorIdx);
    }
    subdictMajorIdx.put(pkey, Buff);

    dictByNameIdx.put(keyNameIdx, Buff);

}

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

public void createSubProject(CFAccAuthorization Authorization, CFAccSubProjectBuff Buff) {
    schema.getTableRealProject().createRealProject(Authorization, Buff);
    CFAccDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAccSubProjectByParentIdxKey keyParentIdx = schema.getFactorySubProject().newParentIdxKey();
    keyParentIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyParentIdx.setRequiredParentProjectId(Buff.getRequiredParentProjectId());

    CFAccSubProjectByNameIdxKey keyNameIdx = schema.getFactorySubProject().newNameIdxKey();
    keyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyNameIdx.setRequiredParentProjectId(Buff.getRequiredParentProjectId());
    keyNameIdx.setRequiredName(Buff.getRequiredName());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
        throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createSubProject",
                pkey);/*from   w ww . j  av a  2  s  . com*/
    }

    if (dictByNameIdx.containsKey(keyNameIdx)) {
        throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                "createSubProject", "SubProjectNameIdx", keyNameIdx);
    }

    // Validate foreign keys

    {
        boolean allNull = true;
        allNull = false;
        allNull = false;
        if (!allNull) {
            if (null == schema.getTableRealProject().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "createSubProject", "Superclass", "SuperClass", "RealProject", null);
            }
        }
    }

    {
        boolean allNull = true;
        allNull = false;
        allNull = false;
        if (!allNull) {
            if (null == schema.getTableTopProject().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredParentProjectId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "createSubProject", "Container", "ParentProject", "TopProject", null);
            }
        }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFAccDomainBasePKey, CFAccSubProjectBuff> subdictParentIdx;
    if (dictByParentIdx.containsKey(keyParentIdx)) {
        subdictParentIdx = dictByParentIdx.get(keyParentIdx);
    } else {
        subdictParentIdx = new TreeMap<CFAccDomainBasePKey, CFAccSubProjectBuff>();
        dictByParentIdx.put(keyParentIdx, subdictParentIdx);
    }
    subdictParentIdx.put(pkey, Buff);

    dictByNameIdx.put(keyNameIdx, Buff);

}

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

public void createSubProject(CFAstAuthorization Authorization, CFAstSubProjectBuff Buff) {
    schema.getTableRealProject().createRealProject(Authorization, Buff);
    CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstSubProjectByParentIdxKey keyParentIdx = schema.getFactorySubProject().newParentIdxKey();
    keyParentIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyParentIdx.setRequiredParentProjectId(Buff.getRequiredParentProjectId());

    CFAstSubProjectByNameIdxKey keyNameIdx = schema.getFactorySubProject().newNameIdxKey();
    keyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyNameIdx.setRequiredParentProjectId(Buff.getRequiredParentProjectId());
    keyNameIdx.setRequiredName(Buff.getRequiredName());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
        throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createSubProject",
                pkey);/*from   w w  w  . j  av a 2s. co m*/
    }

    if (dictByNameIdx.containsKey(keyNameIdx)) {
        throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                "createSubProject", "SubProjectNameIdx", keyNameIdx);
    }

    // Validate foreign keys

    {
        boolean allNull = true;
        allNull = false;
        allNull = false;
        if (!allNull) {
            if (null == schema.getTableRealProject().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "createSubProject", "Superclass", "SuperClass", "RealProject", null);
            }
        }
    }

    {
        boolean allNull = true;
        allNull = false;
        allNull = false;
        if (!allNull) {
            if (null == schema.getTableTopProject().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredParentProjectId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "createSubProject", "Container", "ParentProject", "TopProject", null);
            }
        }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFAstDomainBasePKey, CFAstSubProjectBuff> subdictParentIdx;
    if (dictByParentIdx.containsKey(keyParentIdx)) {
        subdictParentIdx = dictByParentIdx.get(keyParentIdx);
    } else {
        subdictParentIdx = new TreeMap<CFAstDomainBasePKey, CFAstSubProjectBuff>();
        dictByParentIdx.put(keyParentIdx, subdictParentIdx);
    }
    subdictParentIdx.put(pkey, Buff);

    dictByNameIdx.put(keyNameIdx, Buff);

}

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

public void createTopProject(CFAccAuthorization Authorization, CFAccTopProjectBuff Buff) {
    schema.getTableRealProject().createRealProject(Authorization, Buff);
    CFAccDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAccTopProjectByDomainIdxKey keyDomainIdx = schema.getFactoryTopProject().newDomainIdxKey();
    keyDomainIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyDomainIdx.setRequiredDomainId(Buff.getRequiredDomainId());

    CFAccTopProjectByNameIdxKey keyNameIdx = schema.getFactoryTopProject().newNameIdxKey();
    keyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyNameIdx.setRequiredDomainId(Buff.getRequiredDomainId());
    keyNameIdx.setRequiredName(Buff.getRequiredName());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
        throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createTopProject",
                pkey);//  w  w w  .  java  2 s . c o  m
    }

    if (dictByNameIdx.containsKey(keyNameIdx)) {
        throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                "createTopProject", "TopProjectNameIdx", keyNameIdx);
    }

    // Validate foreign keys

    {
        boolean allNull = true;
        allNull = false;
        allNull = false;
        if (!allNull) {
            if (null == schema.getTableRealProject().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "createTopProject", "Superclass", "SuperClass", "RealProject", null);
            }
        }
    }

    {
        boolean allNull = true;
        allNull = false;
        allNull = false;
        if (!allNull) {
            if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredDomainId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "createTopProject", "Container", "Domain", "DomainBase", null);
            }
        }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFAccDomainBasePKey, CFAccTopProjectBuff> subdictDomainIdx;
    if (dictByDomainIdx.containsKey(keyDomainIdx)) {
        subdictDomainIdx = dictByDomainIdx.get(keyDomainIdx);
    } else {
        subdictDomainIdx = new TreeMap<CFAccDomainBasePKey, CFAccTopProjectBuff>();
        dictByDomainIdx.put(keyDomainIdx, subdictDomainIdx);
    }
    subdictDomainIdx.put(pkey, Buff);

    dictByNameIdx.put(keyNameIdx, Buff);

}

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

public void createTopProject(CFAstAuthorization Authorization, CFAstTopProjectBuff Buff) {
    schema.getTableRealProject().createRealProject(Authorization, Buff);
    CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstTopProjectByDomainIdxKey keyDomainIdx = schema.getFactoryTopProject().newDomainIdxKey();
    keyDomainIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyDomainIdx.setRequiredDomainId(Buff.getRequiredDomainId());

    CFAstTopProjectByNameIdxKey keyNameIdx = schema.getFactoryTopProject().newNameIdxKey();
    keyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyNameIdx.setRequiredDomainId(Buff.getRequiredDomainId());
    keyNameIdx.setRequiredName(Buff.getRequiredName());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
        throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createTopProject",
                pkey);// w ww  . j  av a2s .c om
    }

    if (dictByNameIdx.containsKey(keyNameIdx)) {
        throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                "createTopProject", "TopProjectNameIdx", keyNameIdx);
    }

    // Validate foreign keys

    {
        boolean allNull = true;
        allNull = false;
        allNull = false;
        if (!allNull) {
            if (null == schema.getTableRealProject().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "createTopProject", "Superclass", "SuperClass", "RealProject", null);
            }
        }
    }

    {
        boolean allNull = true;
        allNull = false;
        allNull = false;
        if (!allNull) {
            if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization,
                    Buff.getRequiredTenantId(), Buff.getRequiredDomainId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "createTopProject", "Container", "Domain", "DomainBase", null);
            }
        }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFAstDomainBasePKey, CFAstTopProjectBuff> subdictDomainIdx;
    if (dictByDomainIdx.containsKey(keyDomainIdx)) {
        subdictDomainIdx = dictByDomainIdx.get(keyDomainIdx);
    } else {
        subdictDomainIdx = new TreeMap<CFAstDomainBasePKey, CFAstTopProjectBuff>();
        dictByDomainIdx.put(keyDomainIdx, subdictDomainIdx);
    }
    subdictDomainIdx.put(pkey, Buff);

    dictByNameIdx.put(keyNameIdx, Buff);

}

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

public void createSipConf(CFAstAuthorization Authorization, CFAstSipConfBuff Buff) {
    schema.getTableConfigurationFile().createConfigurationFile(Authorization, Buff);
    CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstSipConfBySipClusterIdxKey keySipClusterIdx = schema.getFactorySipConf().newSipClusterIdxKey();
    keySipClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
        throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createSipConf",
                pkey);/*from  w  w  w  . j  av a  2 s. c  o m*/
    }

    // Validate foreign keys

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

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFAstConfigurationFilePKey, CFAstSipConfBuff> subdictSipClusterIdx;
    if (dictBySipClusterIdx.containsKey(keySipClusterIdx)) {
        subdictSipClusterIdx = dictBySipClusterIdx.get(keySipClusterIdx);
    } else {
        subdictSipClusterIdx = new TreeMap<CFAstConfigurationFilePKey, CFAstSipConfBuff>();
        dictBySipClusterIdx.put(keySipClusterIdx, subdictSipClusterIdx);
    }
    subdictSipClusterIdx.put(pkey, Buff);

}

From source file:net.shipilev.fjptrace.tasks.PrintSummaryTask.java

@Override
public void doWork() throws Exception {
    // walk the trees

    PrintWriter pw = new PrintWriter(fileName);

    LayerStatistics global = new LayerStatistics();
    SortedMap<Integer, LayerStatistics> layerStats = new TreeMap<>();

    for (Task t : subgraphs.getParents()) {

        // compute transitive closure

        Set<Task> visited = new HashSet<>();
        Set<Long> workers = new HashSet<>();
        List<Task> prev = new ArrayList<>();
        List<Task> cur = new ArrayList<>();

        int depth = 0;

        cur.add(t);//  w  w  w  . ja  v  a 2  s. c o m
        while (visited.addAll(cur)) {
            prev.clear();
            prev.addAll(cur);
            cur.clear();

            Set<Long> layerWorkers = new HashSet<>();

            LayerStatistics layerStat = layerStats.get(depth);
            if (layerStat == null) {
                layerStat = new LayerStatistics();
                layerStats.put(depth, layerStat);
            }

            for (Task c : prev) {
                Collection<Task> children = c.getChildren();
                if (!children.isEmpty()) {
                    cur.addAll(children);
                }
                layerStat.arities.addValue(children.size());
                layerStat.selfTime.addValue(c.getSelfTime() / 1_000_000.0);
                layerStat.totalTime.addValue(c.getTotalTime() / 1_000_000.0);

                global.selfTime.addValue(c.getSelfTime() / 1_000_000.0);
                global.totalTime.addValue(c.getTotalTime() / 1_000_000.0);
                global.arities.addValue(children.size());

                layerWorkers.add(c.getWorker());
            }

            layerStat.counts.addValue(prev.size());
            layerStat.threads.addValue(layerWorkers.size());
            workers.addAll(layerWorkers);

            depth++;
        }

        global.depths.addValue(depth);
        global.counts.addValue(visited.size());
        global.threads.addValue(workers.size());
    }

    pw.println("Summary statistics:");
    pw.printf("  total external tasks = %.0f\n", layerStats.get(0).counts.getSum());
    pw.printf("  total subtasks = %.0f\n", global.counts.getSum());
    pw.printf("  total threads = %.0f\n", global.threads.getMean());

    pw.println();

    pw.println("Per task statistics:");
    pw.printf("  tasks:   sum = %10.0f, min = %5.2f, avg = %5.2f, max = %5.2f\n", global.counts.getSum(),
            global.counts.getMin(), global.counts.getMean(), global.counts.getMax());
    pw.printf("  depth:                     min = %5.2f, avg = %5.2f, max = %5.2f\n", global.depths.getMin(),
            global.depths.getMean(), global.depths.getMax());
    pw.printf("  arity:                     min = %5.2f, avg = %5.2f, max = %5.2f\n", global.arities.getMin(),
            global.arities.getMean(), global.arities.getMax());
    pw.printf("  threads:                   min = %5.2f, avg = %5.2f, max = %5.2f\n", global.threads.getMin(),
            global.threads.getMean(), global.threads.getMax());

    pw.println();
    pw.println("Per task + per depth statistics:");
    for (Integer depth : layerStats.keySet()) {
        LayerStatistics s = layerStats.get(depth);
        pw.printf("  Depth = %d: \n", depth);
        pw.printf("    tasks:           sum = %10.0f, min = %5.2f, avg = %5.2f, max = %5.2f\n",
                s.counts.getSum(), s.counts.getMin(), s.counts.getMean(), s.counts.getMax());
        pw.printf("    self time (ms):  sum = %10.0f, min = %5.2f, avg = %5.2f, max = %5.2f\n",
                s.selfTime.getSum(), s.selfTime.getMin(), s.selfTime.getMean(), s.selfTime.getMax());
        pw.printf("    total time (ms): sum = %10.0f, min = %5.2f, avg = %5.2f, max = %5.2f\n",
                s.totalTime.getSum(), s.totalTime.getMin(), s.totalTime.getMean(), s.totalTime.getMax());
        pw.printf("    arity:                             min = %5.2f, avg = %5.2f, max = %5.2f\n",
                s.arities.getMin(), s.arities.getMean(), s.arities.getMax());
        pw.printf("    threads:                           min = %5.2f, avg = %5.2f, max = %5.2f\n",
                s.threads.getMin(), s.threads.getMean(), s.threads.getMax());
    }

    summarizeEvents(pw, events);

    pw.flush();
    pw.close();
}

From source file:net.sourceforge.msscodefactory.cfcore.v1_11.GenKbRam.GenKbRamContactListTable.java

public void updateContactList(GenKbAuthorization Authorization, GenKbContactListBuff Buff) {
    GenKbContactListPKey pkey = schema.getFactoryContactList().newPKey();
    pkey.setRequiredContactListId(Buff.getRequiredContactListId());
    GenKbContactListBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
        throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateContactList",
                "Existing record not found", "ContactList", pkey);
    }/*from   ww  w .  j a va 2  s  . c  o  m*/
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
        throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateContactList",
                pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    GenKbContactListByTenantIdxKey existingKeyTenantIdx = schema.getFactoryContactList().newTenantIdxKey();
    existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    GenKbContactListByTenantIdxKey newKeyTenantIdx = schema.getFactoryContactList().newTenantIdxKey();
    newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId());

    GenKbContactListByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryContactList().newUDescrIdxKey();
    existingKeyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    GenKbContactListByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryContactList().newUDescrIdxKey();
    newKeyUDescrIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

    // Check unique indexes

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

    // Validate foreign keys

    {
        boolean allNull = true;

        if (allNull) {
            if (null == schema.getTableTenant().readDerivedByPIdx(Authorization, Buff.getRequiredTenantId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "updateContactList", "Container", "ContactListTenant", "Tenant", null);
            }
        }
    }

    // Update is valid

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

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

}