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:edu.ku.brc.ui.skin.SkinsMgr.java

/**
 * Gets a skin.//from  w  w w  . j ava  2s  .  co m
 * @param skinName the name of the skin
 * @return the skin object
 */
public Skin setSkin(final String skinName) {
    if (hasSkins) {
        if (currentSkin == null || !currentSkin.getName().equals(skinName)) {
            if (currentSkin != null) {
                currentSkin.unregister();
            }
            currentSkin = null;
            Hashtable<String, Skin> skinsHash = load();
            if (skinsHash != null) {
                currentSkin = skinsHash.get(skinName);
                if (currentSkin != null) {
                    currentSkin.register();
                }
            }
        }
    }
    return currentSkin;
}

From source file:com.greenpepper.repository.FileSystemRepositoryTest.java

@SuppressWarnings("unchecked")
private void assertNamesInHierarchy(Hashtable branch, List<String> names) {
    for (Object o : branch.keySet()) {
        String name = (String) o;
        Vector child = (Vector) branch.get(name);
        assertTrue(names.contains(child.get(0)));
        assertNamesInHierarchy((Hashtable) child.get(3), names);
    }/*from  w  w w.  jav a  2 s . co  m*/
}

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

/**
 * DOCUMENT ME!//  w  ww .j av a2s.c  o  m
*
* @throws Exception DOCUMENT ME!
*/
public void testMIgrationOfUpdatedToAbstractJoinedClass() throws Exception {
    MigrationManager mm = MigrationManager.getInstance();
    Enumeration enumeration = mm.start(CSCOfAbstractJoinedStrategy.class, null);

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

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

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

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

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

/**
 * DOCUMENT ME!//  w ww  .  j  ava 2s  . com
*
* @throws Exception DOCUMENT ME!
*/
public void testMIgrationOfUpdatedToConcreteJoinedClass() throws Exception {
    MigrationManager mm = MigrationManager.getInstance();
    Enumeration enumeration = mm.start(CSCOfConcreteJoinedStrategy.class, null);

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

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

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

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

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

/**
 * DOCUMENT ME!//w  w  w  . j  a v  a 2  s . c  om
*
* @throws Exception DOCUMENT ME!
*/
public void testMigrationConcreteSubClassOfAbstractSuperClass() throws Exception {
    MigrationManager mm = MigrationManager.getInstance();
    Enumeration enumeration = mm.start(CSCOfAbstractSuperClass.class, null);

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

    try {
        while (enumeration.hasMoreElements()) {
            Hashtable fields = enumeration.nextElement();
            assertEquals(checkpoint, fields.get("checkpoint"));
            assertEquals(name, fields.get("name"));
        }
    } finally {
        mm.finish(CSCOfAbstractSuperClass.class);
    }
}

From source file:gdt.jgui.entity.folder.JFolderPanel.java

public static JFileOpenItem[] sort(JFileOpenItem[] foia) {
    ArrayList<String> sl = new ArrayList<String>();
    String title$;/*from w  w w .j  av  a2s  .co m*/
    Hashtable<String, JFileOpenItem> map = new Hashtable<String, JFileOpenItem>();
    if (foia == null)
        return null;
    for (JFileOpenItem foi : foia) {
        title$ = foi.getTitle();
        if (title$ == null)
            continue;
        sl.add(title$);
        map.put(title$, foi);
    }
    Collections.sort(sl);
    String[] sa = sl.toArray(new String[0]);
    ArrayList<Object> foil = new ArrayList<Object>();
    for (String aSa : sa) {
        foil.add(map.get(aSa));
    }
    return foil.toArray(new JFileOpenItem[0]);
}

From source file:com.hybris.mobile.activity.AddressDetailActivity.java

@SuppressWarnings("unchecked")
private void handleIntent(Intent intent) {
    if (intent.hasExtra("value")) {

        try {/*from w ww  .  ja  v  a2  s  . co  m*/
            JSONObject address = new JSONObject(intent.getStringExtra("value"));

            mAddressID = address.getString("id");
            for (int i = 0; i < entries.size(); i++) {
                Hashtable<String, Object> dict = (Hashtable<String, Object>) entries.get(i);
                String path = "$." + dict.get("property").toString();
                String value = "";
                try {
                    // We append a String a the end to handle the non String objects
                    value = JsonPath.read(address.toString(), path) + "";
                } catch (Exception exp) {
                    value = "";
                }
                dict.put("value", value);
            }
        } catch (JSONException e) {
            LoggingUtils.e(LOG_TAG, "Error parsing Json. " + e.getLocalizedMessage(), Hybris.getAppContext());
        }

    }
}

From source file:com.hybris.mobile.activity.ProfileDetailActivity.java

@SuppressWarnings("unchecked")
private void handleIntent(Intent intent) {
    if (intent.hasExtra("value")) {
        try {/*from w  w w .  j a v a2  s  . com*/
            JSONObject profile = new JSONObject(intent.getStringExtra("value"));
            for (int i = 0; i < entries.size(); i++) {
                Hashtable<String, Object> dict = (Hashtable<String, Object>) entries.get(i);
                String path = "$." + dict.get("property").toString();
                String value = "";
                try {
                    // We append a String a the end to handle the non String objects
                    value = JsonPath.read(profile.toString(), path) + "";
                } catch (Exception exp) {
                    value = "";
                }
                dict.put("value", value);
            }
        } catch (JSONException e) {
            LoggingUtils.e(LOG_TAG, "Error parsing json. " + e.getLocalizedMessage(), Hybris.getAppContext());
        }
    }
}

From source file:edu.csun.ecs.cs.multitouchj.ui.graphic.WindowManagerCalibratorDefault.java

@Override
protected void presentCalibrationTarget(Position position) {
    Size displaySize = getDisplaySize();
    Size controlSize = getControlSize();

    Point controlPosition = new Point();
    Point destinationPosition = new Point();
    if (Position.TopLeft.equals(position)) {
        controlPosition.set((controlSize.getWidth() / 2.0f), (controlSize.getHeight() / 2.0f));
        destinationPosition.set((controlSize.getWidth() / 2.0f), (controlSize.getHeight() / 2.0f));
    } else if (Position.TopRight.equals(position)) {
        controlPosition.set((displaySize.getWidth() - (controlSize.getWidth() / 2.0f)),
                (controlSize.getHeight() / 2.0f));
        destinationPosition.set((displaySize.getWidth() - (controlSize.getWidth() / 2.0f)),
                (controlSize.getHeight() / 2.0f));
    } else if (Position.BottomRight.equals(position)) {
        controlPosition.set((displaySize.getWidth() - (controlSize.getWidth() / 2.0f)),
                (displaySize.getHeight() - (controlSize.getHeight() / 2.0f)));
        destinationPosition.set((displaySize.getWidth() - (controlSize.getWidth() / 2.0f)),
                (displaySize.getHeight() - (controlSize.getHeight() / 2.0f)));
    } else {/*from  ww  w.j a v a 2s.  c om*/
        controlPosition.set((controlSize.getWidth() / 2.0f),
                (displaySize.getHeight() - (controlSize.getHeight() / 2.0f)));
        destinationPosition.set((controlSize.getWidth() / 2.0f),
                (displaySize.getHeight() - (controlSize.getHeight() / 2.0f)));
    }

    getDestinationPositions().put(position, new Point(destinationPosition));

    Hashtable<String, TexturedControl> targetControls = controls.get(position);
    for (TexturedControl control : targetControls.values()) {
        control.setPosition(controlPosition);
    }
    targetControls.get(URI_IMAGE_WAITING).setVisible(true);
}

From source file:com.seer.datacruncher.profiler.spring.StringAnalyticsController.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"));
    }/*from  w  w  w.  j a va 2 s.  c o  m*/

    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 noGrid = CommonUtil.notNullValue(request.getParameter("action"));
    String qp_1 = CommonUtil.notNullValue(request.getParameter("qp_1"));
    String qp_2 = CommonUtil.notNullValue(request.getParameter("qp_2"));
    String qp_3 = CommonUtil.notNullValue(request.getParameter("qp_3"));
    String qc_1 = CommonUtil.notNullValue(request.getParameter("qc_1"));
    String qc_2 = CommonUtil.notNullValue(request.getParameter("qc_2"));
    String qc_3 = CommonUtil.notNullValue(request.getParameter("qc_3"));
    String q_s = CommonUtil.notNullValue(request.getParameter("q_s"));
    String _distinct = CommonUtil.notNullValue(request.getParameter("_distinct"));

    StringAnalyticsBL sabl = new StringAnalyticsBL(dsn, type, condition, table, column);
    sabl.setQp_1(qp_1);
    sabl.setQp_2(qp_2);
    sabl.setQp_3(qp_3);
    sabl.setQ_s(q_s);
    sabl.setQc_1(qc_1);
    sabl.setQc_2(qc_2);
    sabl.setQc_3(qc_3);
    sabl.set_distinct(_distinct);

    PrintWriter out = response.getWriter();
    if (noGrid.equals("noGrid")) {
        if (q_s.equals("2")) {
            out.print(sabl.reCreateBotPane_regex(true));
        } else {
            out.print(sabl.reCreateBotPane_like(true));
        }
    } else {
        ObjectMapper mapper = new ObjectMapper();
        if (q_s.equals("2")) {
            out.print(mapper.writeValueAsBytes((GridInfoDTO) sabl.reCreateBotPane_regex(false)));
        } else {
            out.print(mapper.writeValueAsBytes((GridInfoDTO) sabl.reCreateBotPane_like(false)));
        }
    }

    return null;
}