Example usage for java.util LinkedHashMap keySet

List of usage examples for java.util LinkedHashMap keySet

Introduction

In this page you can find the example usage for java.util LinkedHashMap keySet.

Prototype

public Set<K> keySet() 

Source Link

Document

Returns a Set view of the keys contained in this map.

Usage

From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java

public TreeMap<String, String> getLookupFields() {
    TreeMap<String, String> writeAccesses = new TreeMap<String, String>();
    LinkedHashMap<String, String> appInfos = getAppInfos("X_Lookup_Field");//$NON-NLS-1$
    Set<String> keys = appInfos.keySet();
    for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
        String key = iter.next();
        writeAccesses.put(key, appInfos.get(key));
    }/*from   ww w.  j a va  2 s  .  co m*/
    return writeAccesses;
}

From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java

public TreeMap<String, String> getTargetSystems() {
    TreeMap<String, String> targetSystems = new TreeMap<String, String>();
    LinkedHashMap<String, String> appInfos = getAppInfos("X_TargetSystem");//$NON-NLS-1$
    Set<String> keys = appInfos.keySet();
    for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
        String key = iter.next();
        targetSystems.put(key, appInfos.get(key));
    }/*from   www  .  jav  a 2 s. c  o  m*/
    return targetSystems;
}

From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java

public TreeMap<String, String> getWorkflows() {
    TreeMap<String, String> targetSystems = new TreeMap<String, String>();
    LinkedHashMap<String, String> appInfos = getAppInfos(ICoreConstants.X_Workflow);
    Set<String> keys = appInfos.keySet();
    for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
        String key = iter.next();
        String v = appInfos.get(key);
        if (v == null || v.trim().length() == 0) {
            continue;
        }//from   w  w w. java 2  s .c  o  m
        targetSystems.put(key, appInfos.get(key));
    }
    return targetSystems;
}

From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java

public boolean setLabels(LinkedHashMap<String, String> labels) {
    boolean somethingChanged = false;
    Set<String> isoCodes = labels.keySet();
    for (Iterator<String> iter = isoCodes.iterator(); iter.hasNext();) {
        String code = iter.next();
        String label = labels.get(code);
        somethingChanged = somethingChanged | setLabel(code, label);
    }/*from w ww  . ja va  2s .c  om*/
    hasChanged = hasChanged | somethingChanged;
    return somethingChanged;
}

From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java

public LinkedHashMap<String, String> getDescriptions() {
    LinkedHashMap<String, String> descriptions = new LinkedHashMap<String, String>();
    LinkedHashMap<String, String> appInfos = getAppInfos("X_Description_.*");//$NON-NLS-1$
    Set<String> keys = appInfos.keySet();
    for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
        String key = iter.next();
        descriptions.put(key.substring(14).toLowerCase(), appInfos.get(key));
    }//from  w  ww . java 2 s .  c  o m
    return descriptions;
}

From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java

public TreeMap<String, String> getForeignKeyInfos() {
    TreeMap<String, String> foreignKeyInfos = new TreeMap<String, String>();
    LinkedHashMap<String, String> appInfos = getAppInfos("X_ForeignKeyInfo");//$NON-NLS-1$
    Set<String> keys = appInfos.keySet();
    for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
        String key = iter.next();
        foreignKeyInfos.put(key, appInfos.get(key));
    }//from   w ww  .j  a  v  a 2 s  . com
    return foreignKeyInfos;
}

From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java

public TreeMap<String, String> getPrimaryKeyInfos() {
    TreeMap<String, String> writeAccesses = new TreeMap<String, String>();
    LinkedHashMap<String, String> appInfos = getAppInfos("X_PrimaryKeyInfo");//$NON-NLS-1$
    Set<String> keys = appInfos.keySet();
    for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
        String key = iter.next();
        writeAccesses.put(key, appInfos.get(key));
    }/*w w  w.jav a  2  s . c  om*/
    return writeAccesses;
}

From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java

public TreeMap<String, String> getSchematrons() {
    TreeMap<String, String> targetSystems = new TreeMap<String, String>();
    LinkedHashMap<String, String> appInfos = getAppInfos(ICoreConstants.X_Schematron);
    Set<String> keys = appInfos.keySet();
    for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
        String key = iter.next();
        String v = appInfos.get(key);
        if (v == null || v.trim().length() == 0) {
            continue;
        }//  w  w  w . j a  v  a2s  . c o  m
        targetSystems.put(key, appInfos.get(key));
    }
    return targetSystems;
}

From source file:gate.util.reporting.PRTimeReporter.java

/**
 * Sorts LinkedHashMap by its values(natural descending order). keeps the
 * duplicates as it is./*from w  ww. jav  a 2s  . com*/
 *
 * @param passedMap
 *          An Object of type LinkedHashMap to be sorted by its values.
 *
 * @return An Object containing the sorted LinkedHashMap.
 */
private LinkedHashMap<String, String> sortHashMapByValues(LinkedHashMap<String, String> passedMap) {
    List<String> mapKeys = new ArrayList<String>(passedMap.keySet());
    List<String> mapValues = new ArrayList<String>(passedMap.values());

    Collections.sort(mapValues, new ValueComparator());
    Collections.sort(mapKeys);
    Collections.reverse(mapValues);
    LinkedHashMap<String, String> sortedMap = new LinkedHashMap<String, String>();

    Iterator<String> valueIt = mapValues.iterator();
    while (valueIt.hasNext()) {
        String val = valueIt.next();
        Iterator<String> keyIt = mapKeys.iterator();
        while (keyIt.hasNext()) {
            String key = keyIt.next();
            String comp1 = passedMap.get(key).toString();
            String comp2 = val.toString();

            if (comp1.equals(comp2)) {
                passedMap.remove(key);
                mapKeys.remove(key);
                sortedMap.put(key, val);
                break;
            }
        }
    }
    return sortedMap;
}

From source file:org.kepler.objectmanager.cache.LocalRepositoryManager.java

/**
 * Synchronize the KAR_LOCAL_REPOS table with the _localRepositories private variable list.
 * This method only removes rows from the table that are not in the list.
 * It does not add rows to the table for extra entries that are in the list.
 *//*w  w  w  .  java  2 s  .  c  o m*/
public void synchronizeDB() {

    LinkedHashMap<LocalRepository, String> localRepos = selectReposFromDB();
    for (LocalRepository repo : localRepos.keySet()) {
        if (!_localRepositories.containsKey(repo)) {
            try {
                // this will cascade deletion of KARs and KAR contents
                // from the tables
                _deletePrepStmt.setString(1, repo.toString());
                _deletePrepStmt.executeUpdate();
                _conn.commit();
            } catch (SQLException sqle) {
                sqle.printStackTrace();
            }
        }
    }
}