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:de.micromata.genome.gwiki.umgmt.GWikiUserAuthorization.java

public void getUsersRights(GWikiContext wikiContext, SortedMap<String, GWikiRight> rights) {
    List<GWikiElementInfo> users = wikiContext.getElementFinder()
            .getPageInfos(new GWikiPageIdMatcher(wikiContext, new StartWithMatcher<String>("admin/user/")));
    for (GWikiElementInfo el : users) {
        GWikiSimpleUser user = findUser(wikiContext, FileNameUtils.getNamePart(el.getId()));
        String rules = user.getRightsMatcherRule();
        List<String> roles = getRoleListFromUserRoleString(rules);
        for (String r : roles) {
            if (rights.containsKey(r) == false) {
                rights.put(r, new GWikiRight(r, GWikiRight.RIGHT_CAT_OTHER_RIGHT, ""));
            }//w  w w.  ja v a  2  s  .c  om
        }
    }
}

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

public void createTopDomain(CFAccAuthorization Authorization, CFAccTopDomainBuff Buff) {
    schema.getTableDomainBase().createDomainBase(Authorization, Buff);
    CFAccDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAccTopDomainByTLDIdxKey keyTLDIdx = schema.getFactoryTopDomain().newTLDIdxKey();
    keyTLDIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyTLDIdx.setRequiredTLDId(Buff.getRequiredTLDId());

    CFAccTopDomainByNameIdxKey keyNameIdx = schema.getFactoryTopDomain().newNameIdxKey();
    keyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyNameIdx.setRequiredTLDId(Buff.getRequiredTLDId());
    keyNameIdx.setRequiredName(Buff.getRequiredName());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
        throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createTopDomain",
                pkey);//w  w w.  ja va  2  s  .  co m
    }

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

    // Validate foreign keys

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

    {
        boolean allNull = true;
        allNull = false;
        allNull = false;
        if (!allNull) {
            if (null == schema.getTableTld().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(),
                    Buff.getRequiredTLDId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "createTopDomain", "Container", "TLD", "Tld", null);
            }
        }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFAccDomainBasePKey, CFAccTopDomainBuff> subdictTLDIdx;
    if (dictByTLDIdx.containsKey(keyTLDIdx)) {
        subdictTLDIdx = dictByTLDIdx.get(keyTLDIdx);
    } else {
        subdictTLDIdx = new TreeMap<CFAccDomainBasePKey, CFAccTopDomainBuff>();
        dictByTLDIdx.put(keyTLDIdx, subdictTLDIdx);
    }
    subdictTLDIdx.put(pkey, Buff);

    dictByNameIdx.put(keyNameIdx, Buff);

}

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

public void createTopDomain(CFAstAuthorization Authorization, CFAstTopDomainBuff Buff) {
    schema.getTableDomainBase().createDomainBase(Authorization, Buff);
    CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFAstTopDomainByTLDIdxKey keyTLDIdx = schema.getFactoryTopDomain().newTLDIdxKey();
    keyTLDIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyTLDIdx.setRequiredTLDId(Buff.getRequiredTLDId());

    CFAstTopDomainByNameIdxKey keyNameIdx = schema.getFactoryTopDomain().newNameIdxKey();
    keyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyNameIdx.setRequiredTLDId(Buff.getRequiredTLDId());
    keyNameIdx.setRequiredName(Buff.getRequiredName());

    // Validate unique indexes

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

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

    // Validate foreign keys

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

    {
        boolean allNull = true;
        allNull = false;
        allNull = false;
        if (!allNull) {
            if (null == schema.getTableTld().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(),
                    Buff.getRequiredTLDId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "createTopDomain", "Container", "TLD", "Tld", null);
            }
        }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFAstDomainBasePKey, CFAstTopDomainBuff> subdictTLDIdx;
    if (dictByTLDIdx.containsKey(keyTLDIdx)) {
        subdictTLDIdx = dictByTLDIdx.get(keyTLDIdx);
    } else {
        subdictTLDIdx = new TreeMap<CFAstDomainBasePKey, CFAstTopDomainBuff>();
        dictByTLDIdx.put(keyTLDIdx, subdictTLDIdx);
    }
    subdictTLDIdx.put(pkey, Buff);

    dictByNameIdx.put(keyNameIdx, Buff);

}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_0.CFFswRam.CFFswRamTopDomainTable.java

public void createTopDomain(CFFswAuthorization Authorization, CFFswTopDomainBuff Buff) {
    schema.getTableDomainBase().createDomainBase(Authorization, Buff);
    CFFswDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFFswTopDomainByTLDIdxKey keyTLDIdx = schema.getFactoryTopDomain().newTLDIdxKey();
    keyTLDIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyTLDIdx.setRequiredTLDId(Buff.getRequiredTLDId());

    CFFswTopDomainByNameIdxKey keyNameIdx = schema.getFactoryTopDomain().newNameIdxKey();
    keyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyNameIdx.setRequiredTLDId(Buff.getRequiredTLDId());
    keyNameIdx.setRequiredName(Buff.getRequiredName());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
        throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createTopDomain",
                pkey);/*w  w  w  .j a v  a2  s.  c  o  m*/
    }

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

    // Validate foreign keys

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

    {
        boolean allNull = true;
        allNull = false;
        allNull = false;
        if (!allNull) {
            if (null == schema.getTableTld().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(),
                    Buff.getRequiredTLDId())) {
                throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                        "createTopDomain", "Container", "TLD", "Tld", null);
            }
        }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFFswDomainBasePKey, CFFswTopDomainBuff> subdictTLDIdx;
    if (dictByTLDIdx.containsKey(keyTLDIdx)) {
        subdictTLDIdx = dictByTLDIdx.get(keyTLDIdx);
    } else {
        subdictTLDIdx = new TreeMap<CFFswDomainBasePKey, CFFswTopDomainBuff>();
        dictByTLDIdx.put(keyTLDIdx, subdictTLDIdx);
    }
    subdictTLDIdx.put(pkey, Buff);

    dictByNameIdx.put(keyNameIdx, Buff);

}

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

public void createISOTimezone(CFAccAuthorization Authorization, CFAccISOTimezoneBuff Buff) {
    CFAccISOTimezonePKey pkey = schema.getFactoryISOTimezone().newPKey();
    pkey.setRequiredISOTimezoneId(Buff.getRequiredISOTimezoneId());
    Buff.setRequiredISOTimezoneId(pkey.getRequiredISOTimezoneId());
    CFAccISOTimezoneByOffsetIdxKey keyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey();
    keyOffsetIdx.setRequiredTZHourOffset(Buff.getRequiredTZHourOffset());
    keyOffsetIdx.setRequiredTZMinOffset(Buff.getRequiredTZMinOffset());

    CFAccISOTimezoneByUTZNameIdxKey keyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey();
    keyUTZNameIdx.setRequiredTZName(Buff.getRequiredTZName());

    CFAccISOTimezoneByIso8601IdxKey keyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey();
    keyIso8601Idx.setRequiredIso8601(Buff.getRequiredIso8601());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
        throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createISOTimezone",
                pkey);// ww  w. j  a v  a2  s .  co m
    }

    if (dictByUTZNameIdx.containsKey(keyUTZNameIdx)) {
        throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                "createISOTimezone", "ISOTimezoneUTZNameIdx", keyUTZNameIdx);
    }

    // Validate foreign keys

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff> subdictOffsetIdx;
    if (dictByOffsetIdx.containsKey(keyOffsetIdx)) {
        subdictOffsetIdx = dictByOffsetIdx.get(keyOffsetIdx);
    } else {
        subdictOffsetIdx = new TreeMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff>();
        dictByOffsetIdx.put(keyOffsetIdx, subdictOffsetIdx);
    }
    subdictOffsetIdx.put(pkey, Buff);

    dictByUTZNameIdx.put(keyUTZNameIdx, Buff);

    SortedMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff> subdictIso8601Idx;
    if (dictByIso8601Idx.containsKey(keyIso8601Idx)) {
        subdictIso8601Idx = dictByIso8601Idx.get(keyIso8601Idx);
    } else {
        subdictIso8601Idx = new TreeMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff>();
        dictByIso8601Idx.put(keyIso8601Idx, subdictIso8601Idx);
    }
    subdictIso8601Idx.put(pkey, Buff);

}

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

public void createISOTimezone(CFAstAuthorization Authorization, CFAstISOTimezoneBuff Buff) {
    CFAstISOTimezonePKey pkey = schema.getFactoryISOTimezone().newPKey();
    pkey.setRequiredISOTimezoneId(Buff.getRequiredISOTimezoneId());
    Buff.setRequiredISOTimezoneId(pkey.getRequiredISOTimezoneId());
    CFAstISOTimezoneByOffsetIdxKey keyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey();
    keyOffsetIdx.setRequiredTZHourOffset(Buff.getRequiredTZHourOffset());
    keyOffsetIdx.setRequiredTZMinOffset(Buff.getRequiredTZMinOffset());

    CFAstISOTimezoneByUTZNameIdxKey keyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey();
    keyUTZNameIdx.setRequiredTZName(Buff.getRequiredTZName());

    CFAstISOTimezoneByIso8601IdxKey keyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey();
    keyIso8601Idx.setRequiredIso8601(Buff.getRequiredIso8601());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
        throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createISOTimezone",
                pkey);//from   ww  w .j  a  v a2s . co m
    }

    if (dictByUTZNameIdx.containsKey(keyUTZNameIdx)) {
        throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                "createISOTimezone", "ISOTimezoneUTZNameIdx", keyUTZNameIdx);
    }

    // Validate foreign keys

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff> subdictOffsetIdx;
    if (dictByOffsetIdx.containsKey(keyOffsetIdx)) {
        subdictOffsetIdx = dictByOffsetIdx.get(keyOffsetIdx);
    } else {
        subdictOffsetIdx = new TreeMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>();
        dictByOffsetIdx.put(keyOffsetIdx, subdictOffsetIdx);
    }
    subdictOffsetIdx.put(pkey, Buff);

    dictByUTZNameIdx.put(keyUTZNameIdx, Buff);

    SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff> subdictIso8601Idx;
    if (dictByIso8601Idx.containsKey(keyIso8601Idx)) {
        subdictIso8601Idx = dictByIso8601Idx.get(keyIso8601Idx);
    } else {
        subdictIso8601Idx = new TreeMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>();
        dictByIso8601Idx.put(keyIso8601Idx, subdictIso8601Idx);
    }
    subdictIso8601Idx.put(pkey, Buff);

}

From source file:net.pms.dlna.protocolinfo.ProtocolInfo.java

/**
 * Creates a new instance based on a {@link DLNAProfiles} profile.
 *
 * @param protocol the {@link Protocol} for the new instance.
 * @param profile the {@link DLNAProfiles} profile for the new instance.
 *//*from   www .ja  v a  2 s .c  o m*/
public ProtocolInfo(Protocol protocol, DLNAProfiles profile) {
    this.protocol = protocol == null ? Protocol.ALL : protocol;
    this.network = WILDCARD;
    this.mimeType = createMimeType(profile.getContentFormat());
    SortedMap<ProtocolInfoAttributeName, ProtocolInfoAttribute> tmpAttributes = createEmptyAttributesMap();
    DLNAOrgProfileName profileName = DLNAOrgProfileName.FACTORY.createProfileName(profile.getCode());
    tmpAttributes.put(profileName.getName(), profileName);
    this.attributes = Collections.unmodifiableSortedMap(tmpAttributes);
    this.attributesString = generateAttributesString();
    this.additionalInfo = this.attributesString;
    this.stringValue = generateStringValue();
}

From source file:com.moded.extendedchoiceparameter.ExtendedChoiceParameterDefinition.java

private String getSvnUrlListContent(String svnUrl, String svnUserName, String svnPassword, String svnPath) {

    SVNRepository repository = null;//  ww  w .  j a v  a 2s.com
    String svn_list_content = "";
    try {
        repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(svnUrl));
        ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(svnUserName,
                svnPassword);
        repository.setAuthenticationManager(authManager);
        Collection entries = repository.getDir(svnPath, -1, null, (Collection) null);
        Iterator iterator = entries.iterator();
        SortedMap<Long, String> sortedSvnListMap = new TreeMap<Long, String>();
        while (iterator.hasNext()) {
            SVNDirEntry entry = (SVNDirEntry) iterator.next();
            sortedSvnListMap.put(entry.getRevision(), entry.getName());
        }

        entries = sortedSvnListMap.values();
        iterator = entries.iterator();

        while (iterator.hasNext()) {
            svn_list_content = (String) iterator.next() + "," + svn_list_content;
        }

        return svn_list_content;
    } catch (Exception e) {

        return "";
    }
}

From source file:de.blizzy.documentr.web.system.SystemController.java

private SortedMap<String, SortedMap<String, String>> getMacroSettingsFromRequest(WebRequest webRequest) {
    Map<String, String[]> params = webRequest.getParameterMap();
    SortedMap<String, SortedMap<String, String>> allMacroSettings = Maps.newTreeMap();
    for (Map.Entry<String, String[]> entry : params.entrySet()) {
        String key = entry.getKey();
        if (key.startsWith(MACRO_KEY_PREFIX)) {
            String[] values = entry.getValue();
            if (values.length == 0) {
                values = new String[] { StringUtils.EMPTY };
            }//  w w  w  .j  a  v  a2 s. c  o m
            key = key.substring(MACRO_KEY_PREFIX.length());
            String macroName = StringUtils.substringBefore(key, "."); //$NON-NLS-1$
            key = StringUtils.substringAfter(key, "."); //$NON-NLS-1$
            SortedMap<String, String> macroSettings = allMacroSettings.get(macroName);
            if (macroSettings == null) {
                macroSettings = Maps.newTreeMap();
                allMacroSettings.put(macroName, macroSettings);
            }
            macroSettings.put(key, values[0]);
        }
    }
    return allMacroSettings;
}

From source file:jp.zippyzip.web.ListServlet.java

/**
 * ????//from   w  w w. jav  a 2 s . c o  m
 * 
 * @return ??
 */
SortedMap<String, Pref> getPrefMap(PersistenceManager pm) {

    SortedMap<String, Pref> ret = new TreeMap<String, Pref>();

    for (String json : pm.getObjectById(ParentChild.class, "prefs").getChildren()) {

        Pref pref = Pref.fromJson(json);

        ret.put(pref.getCode(), pref);
    }

    return ret;
}