Example usage for java.util Hashtable get

List of usage examples for java.util Hashtable get

Introduction

In this page you can find the example usage for java.util Hashtable get.

Prototype

@SuppressWarnings("unchecked")
public synchronized V get(Object key) 

Source Link

Document

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

Usage

From source file:net.nosleep.superanalyzer.analysis.views.PlayCountView.java

private void refreshDataset() {

    Stat itemStats = null;/*from   w w  w .j av a 2s  .c  om*/

    if (_comboBox == null) {
        itemStats = _analysis.getStats(Analysis.KIND_TRACK, null);
    } else {
        ComboItem item = (ComboItem) _comboBox.getSelectedItem();
        itemStats = _analysis.getStats(item.getKind(), item.getValue());
    }

    Vector playCountList = new Vector();

    Hashtable playCounts = itemStats.getPlayCounts();
    Enumeration e = playCounts.keys();
    while (e.hasMoreElements()) {
        Integer playCount = (Integer) e.nextElement();
        Integer count = (Integer) playCounts.get(playCount);
        if (count.intValue() > 0)
            playCountList.addElement(new PlayCountItem(playCount.intValue(), count.intValue()));
    }
    Collections.sort(playCountList, new PlayCountComparator());

    XYSeries series = new XYSeries(Misc.getString("PLAY_COUNT"));

    for (int i = 0; i < playCountList.size(); i++) {
        PlayCountItem item = (PlayCountItem) playCountList.elementAt(i);
        series.add(item.PlayCount, item.Count);
    }

    collection.removeAllSeries();

    collection.addSeries(series);

}

From source file:net.sourceforge.floggy.persistence.fr2852335.single.FR2852335MigrationTest.java

/**
 * DOCUMENT ME!//from   ww  w . ja  va 2s  . c o  m
*
* @throws Exception DOCUMENT ME!
*/
public void testMigrationOfUpdatedToAbstractJoinedClass() throws Exception {
    PersistableMetadata rmsBasedMetadata = PersistableMetadataManager
            .getRMSBasedMetadata(CSCOfAbstractJoinedStrategy.class.getName());
    PersistableMetadata classBasedMetadata = PersistableMetadataManager
            .getClassBasedMetadata(CSCOfAbstractJoinedStrategy.class.getName());

    assertEquals(PersistableMetadata.JOINED_STRATEGY, rmsBasedMetadata.getPersistableStrategy());
    assertEquals(PersistableMetadata.SINGLE_STRATEGY, classBasedMetadata.getPersistableStrategy());

    MigrationManager mm = MigrationManager.getInstance();
    Enumeration enumeration = mm.start(CSCOfAbstractJoinedStrategy.class, null);

    assertEquals(JoinedStrategyEnumerationImpl.class, enumeration.getClass());

    try {
        assertEquals(1, enumeration.getSize());

        while (enumeration.hasMoreElements()) {
            Hashtable data = enumeration.nextElement();
            assertEquals(name, data.get("name"));
            assertEquals(birthDate, data.get("birthDate"));
        }
    } finally {
        mm.finish(CSCOfAbstractJoinedStrategy.class);
    }

    rmsBasedMetadata = PersistableMetadataManager
            .getRMSBasedMetadata(CSCOfAbstractJoinedStrategy.class.getName());
    classBasedMetadata = PersistableMetadataManager
            .getClassBasedMetadata(CSCOfAbstractJoinedStrategy.class.getName());

    assertEquals(PersistableMetadata.SINGLE_STRATEGY, rmsBasedMetadata.getPersistableStrategy());
    assertEquals(PersistableMetadata.SINGLE_STRATEGY, classBasedMetadata.getPersistableStrategy());
}

From source file:net.sourceforge.floggy.persistence.fr2852335.single.FR2852335MigrationTest.java

/**
 * DOCUMENT ME!/*from w ww  . ja  v a  2 s .c  o  m*/
*
* @throws Exception DOCUMENT ME!
*/
public void testMigrationOfUpdatedToConcreteJoinedClass() throws Exception {
    PersistableMetadata rmsBasedMetadata = PersistableMetadataManager
            .getRMSBasedMetadata(CSCOfConcreteJoinedStrategy.class.getName());
    PersistableMetadata classBasedMetadata = PersistableMetadataManager
            .getClassBasedMetadata(CSCOfConcreteJoinedStrategy.class.getName());

    assertEquals(PersistableMetadata.JOINED_STRATEGY, rmsBasedMetadata.getPersistableStrategy());
    assertEquals(PersistableMetadata.SINGLE_STRATEGY, classBasedMetadata.getPersistableStrategy());

    MigrationManager mm = MigrationManager.getInstance();
    Enumeration enumeration = mm.start(CSCOfConcreteJoinedStrategy.class, null);

    assertEquals(JoinedStrategyEnumerationImpl.class, enumeration.getClass());

    try {
        assertEquals(1, enumeration.getSize());

        while (enumeration.hasMoreElements()) {
            Hashtable data = enumeration.nextElement();
            assertEquals(name, data.get("name"));
            assertEquals(birthDate, data.get("birthDate"));
        }
    } finally {
        mm.finish(CSCOfConcreteJoinedStrategy.class);
    }

    rmsBasedMetadata = PersistableMetadataManager
            .getRMSBasedMetadata(CSCOfConcreteJoinedStrategy.class.getName());
    classBasedMetadata = PersistableMetadataManager
            .getClassBasedMetadata(CSCOfConcreteJoinedStrategy.class.getName());

    assertEquals(PersistableMetadata.SINGLE_STRATEGY, rmsBasedMetadata.getPersistableStrategy());
    assertEquals(PersistableMetadata.SINGLE_STRATEGY, classBasedMetadata.getPersistableStrategy());
}

From source file:graficos.GraficoBarras.java

private void actualizarConjuntoDatos(Hashtable<Integer, Integer> datos_tabla, Integer rec_max_disp) {
    String serie_u = "Utilizados";
    String serie_d = "No utilizados";
    double num_u, num_d;
    Integer dias_totales = new Integer(datos_tabla.size());
    for (Integer dia = 1; dia <= dias_totales; dia++) {
        num_d = rec_max_disp - datos_tabla.get(dia);
        ((DefaultCategoryDataset) cjto_datos).addValue(num_d, serie_d, dia);
        num_u = datos_tabla.get(dia);/*from  w  ww.jav a  2s  .c  o m*/
        ((DefaultCategoryDataset) cjto_datos).addValue(num_u, serie_u, dia);
    }
}

From source file:de.suse.swamp.core.util.BugzillaTools.java

private Hashtable getCacheEntry(int bugId, List excludefields) {
    synchronized (bugzillaCache) {
        cacheMaintenance();//from w  ww.  j  a  v a2 s  . c  om
        Hashtable cacheEntry = (Hashtable) bugzillaCache.get(new Integer(bugId));
        if (cacheEntry != null && (cacheEntry.get("excludefields").equals(excludefields)
                || cacheEntry.get("excludefields") == null
                || ((List) cacheEntry.get("excludefields")).size() == 0)) {
            return (Hashtable) bugzillaCache.get(new Integer(bugId));
        }
    }
    return null;
}

From source file:com.seer.datacruncher.profiler.spring.NumberAnalyticsController.java

public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    Hashtable<String, String> dbParams = (Hashtable<String, String>) request.getSession(true)
            .getAttribute("dbConnectionData");
    String dsn = "";
    if (dbParams != null) {
        dsn = CommonUtil.notNullValue(dbParams.get("Database_DSN"));
    }//w  w  w . j  av  a2s .  c  o m
    ObjectMapper mapper = new ObjectMapper();
    String condition = CommonUtil.notNullValue(request.getParameter("condition"));
    String table = CommonUtil.notNullValue(request.getParameter("table"));
    String column = CommonUtil.notNullValue(request.getParameter("column")).split("\\:")[0];
    String type = CommonUtil.notNullValue(request.getParameter("column")).split("\\:")[1];
    String action = CommonUtil.notNullValue(request.getParameter("action"));
    if (action.equals("binAnalysis")) {
        String text1 = CommonUtil.notNullValue(request.getParameter("text1"));
        String text2 = CommonUtil.notNullValue(request.getParameter("text2"));
        String text3 = CommonUtil.notNullValue(request.getParameter("text3"));
        String text4 = CommonUtil.notNullValue(request.getParameter("text4"));
        String text5 = CommonUtil.notNullValue(request.getParameter("text5"));
        String text6 = CommonUtil.notNullValue(request.getParameter("text6"));
        String text7 = CommonUtil.notNullValue(request.getParameter("text7"));
        String text8 = CommonUtil.notNullValue(request.getParameter("text8"));
        String text9 = CommonUtil.notNullValue(request.getParameter("text9"));
        String text10 = CommonUtil.notNullValue(request.getParameter("text10"));
        String text11 = CommonUtil.notNullValue(request.getParameter("text11"));

        String binNames1 = CommonUtil.notNullValue(request.getParameter("binNames1"));
        String binNames2 = CommonUtil.notNullValue(request.getParameter("binNames2"));
        String binNames3 = CommonUtil.notNullValue(request.getParameter("binNames3"));
        String binNames4 = CommonUtil.notNullValue(request.getParameter("binNames4"));
        String binNames5 = CommonUtil.notNullValue(request.getParameter("binNames5"));
        String binNames6 = CommonUtil.notNullValue(request.getParameter("binNames6"));
        String binNames7 = CommonUtil.notNullValue(request.getParameter("binNames7"));
        String binNames8 = CommonUtil.notNullValue(request.getParameter("binNames8"));
        String binNames9 = CommonUtil.notNullValue(request.getParameter("binNames9"));
        String binNames10 = CommonUtil.notNullValue(request.getParameter("binNames10"));

        String text[] = { text1, text2, text3, text4, text5, text6, text7, text8, text9, text10, text11 };

        NumberAnalyticsBL nabl = new NumberAnalyticsBL(dsn, type, condition, table, column);
        try {
            PrintWriter out = response.getWriter();
            Double[] values = nabl.fillXValues(text);
            String[] fields = { binNames1, binNames2, binNames3, binNames4, binNames5, binNames6, binNames7,
                    binNames8, binNames9, binNames10 };
            String chartData = ChartUtil.getBinAnalysisBarChart(fields, values);
            out.print("{success: true, barChartData:\"" + chartData + "\"}");
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else if (action.equals("numberProfiler")) {
        String aggr = CommonUtil.notNullValue(request.getParameter("aggr"));
        String less = CommonUtil.notNullValue(request.getParameter("less"));
        String more = CommonUtil.notNullValue(request.getParameter("more"));
        String between1 = CommonUtil.notNullValue(request.getParameter("between1"));
        String between2 = CommonUtil.notNullValue(request.getParameter("between2"));
        String text2 = CommonUtil.notNullValue(request.getParameter("text2"));
        String text3 = CommonUtil.notNullValue(request.getParameter("text3"));
        String text4 = CommonUtil.notNullValue(request.getParameter("text4"));
        String text5 = CommonUtil.notNullValue(request.getParameter("text5"));
        String text6 = CommonUtil.notNullValue(request.getParameter("text6"));
        String text7 = CommonUtil.notNullValue(request.getParameter("text7"));

        NumberAnalyticsBL nabl = new NumberAnalyticsBL(dsn, type, condition, table, column);
        nabl.setAggr(aggr);
        nabl.setLess(less);
        nabl.setMore(more);
        nabl.setBetween1(between1);
        nabl.setBetween2(between2);
        nabl.setText2(text2);
        nabl.setText3(text3);
        nabl.setText4(text4);
        nabl.setText5(text5);
        nabl.setText6(text6);
        nabl.setText7(text7);
        ServletOutputStream out = null;
        response.setContentType("application/json");
        out = response.getOutputStream();
        out.write(mapper.writeValueAsBytes(nabl.numberProfile()));
        out.flush();
        out.close();

    } else {
        String tab = CommonUtil.notNullValue(request.getParameter("tab"));
        NumberAnalyticsBL nabl = new NumberAnalyticsBL(dsn, type, condition, table, column);

        TableGridDTO tgDTO = nabl.generateStatisticGrids(new Integer(tab));
        GridUtil gridUtil = new GridUtil();
        gridUtil.generateGridData(tgDTO, false, null);
        request.setAttribute("gridColumns", gridUtil.getColumnNames());
        request.setAttribute("gridFields", gridUtil.getFieldNames());
        request.setAttribute("gridData", gridUtil.getData());
        request.setAttribute("tabId", tab);
        return new ModelAndView("jsp/profiler/advancenumberanal.jsp");

    }

    return null;
}

From source file:net.sourceforge.floggy.persistence.fr2852335.single.FR2852335MigrationTest.java

/**
 * DOCUMENT ME!//from  w w  w. j a va 2s.  c o m
*
* @throws Exception DOCUMENT ME!
*/
public void testMigrationCSCOfConcreteSuperClass() throws Exception {
    MigrationManager um = MigrationManager.getInstance();
    Enumeration enumeration = um.start(CSCOfConcreteSuperClass.class, null);

    assertEquals(1, enumeration.getSize());
    assertEquals(SingleStrategyEnumerationImpl.class, enumeration.getClass());

    try {
        while (enumeration.hasMoreElements()) {
            Hashtable fields = enumeration.nextElement();
            assertEquals(classification, ((Character) fields.get("classification")).charValue());
            assertEquals(name, fields.get("name"));
        }
    } finally {
        um.finish(CSCOfConcreteSuperClass.class);
    }
}

From source file:net.sourceforge.floggy.persistence.fr2852335.single.FR2852335MigrationTest.java

/**
 * DOCUMENT ME!//  ww  w .java2 s  . c om
*
* @throws Exception DOCUMENT ME!
*/
public void testMigrationUpdateConcreteSuperClass() throws Exception {
    ConcreteSuperClass csc = new ConcreteSuperClass();
    csc.setName(name);

    manager.save(csc);

    ConcreteSuperClass csc2 = new ConcreteSuperClass();
    csc2.setName(name);

    manager.save(csc2);

    MigrationManager um = MigrationManager.getInstance();
    Enumeration enumeration = um.start(ConcreteSuperClass.class, null);

    assertEquals(3, enumeration.getSize());
    assertEquals(SingleStrategyEnumerationImpl.class, enumeration.getClass());

    try {
        while (enumeration.hasMoreElements()) {
            Hashtable fields = enumeration.nextElement();
            assertEquals(name, fields.get("name"));

            csc = new ConcreteSuperClass();
            csc.setName((String) fields.get("name"));

            enumeration.update(csc);
        }
    } finally {
        um.finish(ConcreteSuperClass.class);
    }

    ObjectSet os = manager.find(ConcreteSuperClass.class, null, null);

    assertEquals(3, os.size());

    for (int i = 0; i < os.size(); i++) {
        csc = (ConcreteSuperClass) os.get(i);
        assertEquals(name, csc.getName());
    }
}

From source file:net.sourceforge.floggy.persistence.fr2852335.single.FR2852335MigrationTest.java

/**
 * DOCUMENT ME!/*  w ww .j  a  v a  2  s  .  co  m*/
*
* @throws Exception DOCUMENT ME!
*/
public void testMigrationCSCOfConcreteSubClass() throws Exception {
    MigrationManager um = MigrationManager.getInstance();
    Enumeration enumeration = um.start(CSCOfConcreteSubClass.class, null);

    assertEquals(1, enumeration.getSize());
    assertEquals(SingleStrategyEnumerationImpl.class, enumeration.getClass());

    try {
        while (enumeration.hasMoreElements()) {
            Hashtable fields = enumeration.nextElement();
            assertEquals(classification, ((Character) fields.get("classification")).charValue());
            assertEquals(name, fields.get("name"));
            assertEquals(checkpoint.getTime(), fields.get("start"));
        }
    } finally {
        um.finish(CSCOfConcreteSubClass.class);
    }
}

From source file:hu.sztaki.lpds.pgportal.portlet.GenericWSPgradePortlet.java

/**
 * Render kornyezetben attributumkent megjeleno objektum kifejtese a temporary session teruletrol
 * @param pReq Aktualis keres//from   w w  w  .j  a v a2 s . c  o m
 */
protected void openRequestAttribute(RenderRequest pReq) {
    Hashtable<String, Object> tmp = (Hashtable<String, Object>) pReq.getPortletSession()
            .getAttribute("requesattribute");
    if (tmp != null) {
        Enumeration<String> enm = tmp.keys();
        String key;
        while (enm.hasMoreElements()) {
            key = enm.nextElement();
            pReq.setAttribute(key, tmp.get(key));
        }
    }
}