Example usage for java.lang String toString

List of usage examples for java.lang String toString

Introduction

In this page you can find the example usage for java.lang String toString.

Prototype

public String toString() 

Source Link

Document

This object (which is already a string!) is itself returned.

Usage

From source file:ambit.data.qmrf.QMRFAttachment.java

public void fromXML(Element xml) throws XMLException {
    setFiletype(xml.getAttribute(attribute_filetype));
    setUrl(xml.getAttribute(attribute_url));
    setDescription(xml.getAttribute(attribute_description));
    String s = xml.getAttribute(attribute_embedded);

    if (s == null)
        setEmbedded(false);// ww  w .  j a  v a 2 s. c o m
    else
        setEmbedded("YES".equals(s.toString()));
    if (getEmbedded()) {
        try {
            String c = xml.getTextContent();
            content = new String(Base64.decodeBase64(c.getBytes(UTF8charset)), UTF8charset);
        } catch (Exception x) {
            throw new XMLException(x);

        }

    } else
        setContent(null);
}

From source file:fr.eurecom.nerd.core.proxy.LupediaClient.java

private List<TEntity> parse(String json, String text, OntologyType otype) {
    List<TEntity> result = new LinkedList<TEntity>();
    try {/*  www.  j a  v  a 2s .  co m*/
        JSONArray jsonarray = new JSONArray(json);

        for (int i = 0; i < jsonarray.length(); i++) {
            JSONObject jo = jsonarray.getJSONObject(i);
            int startOffset = jo.getInt("startOffset");
            int endOffset = jo.getInt("endOffset");
            String label = text.substring(startOffset, endOffset);

            String type = null;
            String uriType = jo.getString("instanceClass").replace("\\", "");
            if (uriType != null) {
                String[] tree_type = uriType.split("/");
                type = tree_type[tree_type.length - 1];
            }
            String nerdType = OntoFactory.mapper.getNerdType(otype, label, SOURCE, type).toString();

            String uri = jo.getString("instanceUri").replace("\\", "");
            double confidence = jo.getDouble("weight");

            TEntity extraction = new TEntity(label, type, uri, nerdType.toString(), startOffset, endOffset,
                    confidence, SOURCE);
            result.add(extraction);
        }

    } catch (JSONException e) {
        e.printStackTrace();
    }
    return result;
}

From source file:net.mindengine.oculus.frontend.service.customization.CustomizationUtils.java

/**
 * Fetches the unit customization value from the post request
 * //from   w  w w.  j  a v  a2  s  .  c o m
 * @param request
 * @param customization
 * @return
 */
public static UnitCustomizationValue getUnitCustomizationValue(Long unitId, HttpServletRequest request,
        Customization customization, List<CustomizationPossibleValue> possibleValues) {
    if (customization.getType().equals(Customization.TYPE_CHECKBOX)) {
        String value = request.getParameter("customization_" + customization.getId());
        if (value == null)
            value = "false";
        if (value.equals("on"))
            value = "true";
        return new UnitCustomizationValue(unitId, customization.getId(), value);
    } else if (customization.getType().equals(Customization.TYPE_CHECKLIST)) {
        StringBuffer value = new StringBuffer();
        /*
         * The possible value ids are represented in the following format:
         * (34234)(34235)(5345)(5345) Important that each id should be
         * placed in the brackets
         */
        for (CustomizationPossibleValue cpv : possibleValues) {
            if ("on".equals(
                    request.getParameter("customization_" + customization.getId() + "_pv_" + cpv.getId()))) {
                value.append("(");
                value.append(cpv.getId());
                value.append(")");
            }
        }
        return new UnitCustomizationValue(unitId, customization.getId(), value.toString());
    } else {
        String value = request.getParameter("customization_" + customization.getId());
        if (value == null)
            value = "";
        return new UnitCustomizationValue(unitId, customization.getId(), value);
    }
}

From source file:com.adisayoga.earthquake.ui.SocialConnectActivity.java

/**
 * Tampilkan informasi Facebook sebagai tanda user telah login.
 *///from w  ww.  j  a  v  a 2 s  .c o  m
private void showFacebookInfo() {
    facebookLoginStatus.setText(R.string.loading);

    // Tampilkan nama user yang login
    runner.request("me", new BaseRequestListener() {
        @Override
        public void onComplete(String response, Object state) {
            try {
                Log.d(TAG, "Response: " + response.toString());
                JSONObject json = Util.parseJson(response);
                final String name = json.getString("name");

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        facebookLoginStatus.setText(getText(R.string.welcome) + " " + name);
                    }
                });

            } catch (JSONException e) {
                Log.w(TAG, "JSON Error pada response");

            } catch (FacebookError e) {
                Log.w(TAG, "Facebook Error: " + e.getMessage());
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        facebookLoginStatus.setText(R.string.facebook_error);
                    }
                });
            }
        }

        @Override
        public void onIOException(IOException e, Object state) {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    facebookLoginStatus.setText(R.string.network_error);
                }
            });
            super.onIOException(e, state);
        }
    });
}

From source file:xx.tream.chengxin.ms.service.TrainServiceImpl.java

public boolean hasPayoutCommonAudti() {
    String sql = "select count(*) num from tb_payoutcommon where status = 0 ";
    List<Map<String, Object>> list = this.dao.queryForList(sql.toString());
    if (list != null && list.size() > 0) {
        Long num = (Long) list.get(0).get("num");
        if (num > 0) {
            return true;
        }/*ww  w. j  a v  a 2 s.  c o  m*/
    }
    sql = "select count(*) num from tb_incomecommon where status = 0 ";
    list = this.dao.queryForList(sql.toString());
    if (list != null && list.size() > 0) {
        Long num = (Long) list.get(0).get("num");
        if (num > 0) {
            return true;
        }
    }
    return false;
}

From source file:com.github.tomakehurst.wiremock.testsupport.WireMockTestClient.java

private int postJsonAndReturnStatus(String url, String json) {
    HttpPost post = new HttpPost(url);
    try {//from   www  . j  av a  2s.  c  o  m
        if (json != null) {
            post.setEntity(new StringEntity(json, ContentType.create(JSON.toString(), "utf-8")));
        }
        HttpResponse httpResponse = httpClient().execute(post);
        return httpResponse.getStatusLine().getStatusCode();
    } catch (RuntimeException re) {
        throw re;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:de.alpharogroup.lang.ClassExtensionsTest.java

@Test
public void testGetJarPath() {
    String actual = ClassExtensions.getJarPath(Object.class);
    AssertJUnit.assertTrue(actual.toString().endsWith("/jre/lib/rt.jar"));

    actual = ClassExtensions.getJarPath(ClassExtensions.class);
    AssertJUnit.assertNull(actual);/* w  ww .java 2 s. c o m*/
    // Get manifest file from zip4j-*.jar
    // actual = ClassExtensions.getJarPath(ZipFile.class);
    // AssertJUnit.assertNotNull(actual);
    // AssertJUnit.assertTrue(actual.toString().endsWith("/net/lingala/zip4j/zip4j/1.3.2/zip4j-1.3.2.jar"));
}

From source file:fr.inria.corese.rdftograph.driver.OrientDbDriver.java

@Override
public Function<GraphTraversalSource, GraphTraversal<? extends org.apache.tinkerpop.gremlin.structure.Element, org.apache.tinkerpop.gremlin.structure.Edge>> getFilter(
        String key, String s, String p, String o, String g) {
    Function<GraphTraversalSource, GraphTraversal<? extends org.apache.tinkerpop.gremlin.structure.Element, org.apache.tinkerpop.gremlin.structure.Edge>> filter;
    switch (key.toString()) {
    case "?g?sPO":
        filter = t -> {//from   w  w  w  .  j  av a2s  .  c  o m
            return t.E().has(EDGE_P, p).has(EDGE_O, o);
        };
        break;
    case "?g?sP?o":
        filter = t -> {
            return t.E().has(EDGE_P, p);
        };
        break;
    case "?g?s?pO":
        filter = t -> {
            return t.E().has(EDGE_O, o);
        };
        break;
    case "?gSPO":
        filter = t -> {
            return t.E().has(EDGE_P, p).has(EDGE_S, s).has(EDGE_O, o);
        };
        break;
    case "?gSP?o":
        filter = t -> {
            return t.E().has(EDGE_P, p).has(EDGE_S, s);
        };
        break;
    case "?gS?pO":
        filter = t -> {
            return t.E().has(EDGE_S, s).has(EDGE_O, o);
        };
        break;
    case "?gS?p?o":
        filter = t -> {
            return t.E().has(EDGE_S, s);
        };
        break;
    case "G?sP?o":
        filter = t -> {
            return t.E().has(EDGE_P, p).has(EDGE_G, g);
        };
        break;
    case "?g?s?p?o":
    default:
        filter = t -> {
            return t.E();
        };
    }
    return filter;
}

From source file:eu.europa.ec.markt.dss.validation102853.xades.OfflineResolver.java

@Override
public boolean engineCanResolveURI(final ResourceResolverContext context) {

    final Attr uriAttr = context.attr;
    final String baseUriString = context.baseUri;

    String documentUri = uriAttr.getNodeValue();
    if (documentUri.equals("") || documentUri.startsWith("#")) {
        return false;
    }//w w  w  .  j a  v  a 2s .c  om
    try {

        if (isKnown(documentUri) != null) {

            LOG.debug("I state that I can resolve '" + documentUri.toString() + "' (external document)");
            return true;
        }
        final URI baseUri = new URI(baseUriString);
        URI uriNew = new URI(baseUri, documentUri);
        if (uriNew.getScheme().equals("http")) {

            LOG.debug("I state that I can resolve '" + uriNew.toString() + "'");
            return true;
        }
        LOG.debug("I state that I can't resolve '" + uriNew.toString() + "'");
    } catch (URI.MalformedURIException ex) {
        if (documents == null || documents.size() == 0) {
            LOG.warn("OfflineResolver: WARNING: ", ex);
        }
    }
    if (doesContainOnlyOneDocument()) {

        return true;
    }
    return false;
}