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:com.huateng.struts.base.action.T10500Action.java

public String add() {

    TblCompanyStepment tblCompanyStepment = new TblCompanyStepment();

    if (StringUtils.isEmpty(id))
        return "??";

    id = StringEscapeUtils.escapeSql(id);

    //???// ww  w  .ja  va  2 s  .com
    String sql = "select ID from TBL_COMPANY_STEPMENT where STEP_ID= '" + id + "'";
    List list = commQueryDAO.findBySQLQuery(sql.toString());
    if (list != null && list.size() > 0) {
        return "??";
    }

    sql = "select count(1) from tbl_company_stepment where name='" + name + "' and brh_id='" + brhId + "'";
    String count = commQueryDAO.findCountBySQLQuery(sql);
    if (!StringUtils.equals("0", count)) {
        return "???";
    }

    String pid = GenerateNextId.getNextSequence("TBL_COMPANY_STEPMENT");
    if (pid == null)
        return "??.";
    tblCompanyStepment.setId(pid);
    tblCompanyStepment.setName(name);
    tblCompanyStepment.setStepId(id);
    tblCompanyStepment.setBrhId(brhId);
    t10500BO.add(tblCompanyStepment);

    log("????" + operator.getOprId());

    return Constants.SUCCESS_CODE;
}

From source file:com.microsoft.services.odata.unittests.WireMockTestClient.java

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

From source file:com.phonty.improved.Rates.java

private ArrayList<PriceItem> parse(String response) {
    try {//w  ww. ja v a2s .co  m
        if (type.equals("SMS:"))
            VALUES.add(new PriceItem(" ", " "));
        VALUES.add(new PriceItem(type, ""));
        JSONArray jsonArray = new JSONArray(response.toString());
        for (int i = 0; i < jsonArray.length(); ++i) {
            JSONObject rec = jsonArray.getJSONObject(i);
            VALUES.add(new PriceItem(rec.getString("name"), rec.getString("amount")));
        }
        Log.e("RESPONSE", jsonArray.length() + "");
    } catch (Exception e) {
        e.printStackTrace();
    }

    return VALUES;
}

From source file:org.openmrs.event.EventEngine.java

/**
 * @see Event#getDestination(Class, String)
 *///from  w w  w .  j a  va  2  s.  c  o m
public Destination getDestination(final Class<?> clazz, final String action) {
    return getDestination(action.toString() + DELIMITER + clazz.getName());
}

From source file:com.pluribus.vcf.helper.TestSetup.java

public String getBSLogs(String bsUserId, String bsKey) {
    String sessId = driver.getSessionId().toString();
    String url = "https://browserstack.com/automate/sessions/" + sessId + ".json";
    System.out.println("url:" + url.toString());
    String authUser = bsUserId + ":" + bsKey;
    String encoding = Base64.encodeBase64String(authUser.getBytes());
    Client restClient = Client.create();
    WebResource webResource = restClient.resource(url);
    ClientResponse resp = webResource.accept("application/json").header("Authorization", "Basic " + encoding)
            .get(ClientResponse.class);
    if (resp.getStatus() != 200) {
        System.err.println("Unable to connect to the server");
    }/*w  w w.  j  a  va 2 s . c o m*/
    String output = resp.getEntity(String.class);
    JSONObject obj = new JSONObject(output);
    JSONObject bsLogs = (JSONObject) obj.get("automation_session");
    String publicUrl = bsLogs.get("public_url").toString();
    return publicUrl;
}

From source file:com.wso2telco.gsma.authenticators.DBUtils.java

public static void insertHashKeyContextIdentifierMapping(String hashKey, String contextIdentifier)
        throws AuthenticatorException {
    String sql = "insert into sms_hashkey_contextid_mapping(hashkey, contextid) values  (?,?);";

    if (log.isDebugEnabled()) {
        log.debug("Executing the query " + sql + " for hash key " + hashKey + " and context identifier "
                + contextIdentifier);/*from  w w w .j a v  a  2s.com*/
    }

    Connection connection = null;
    PreparedStatement ps = null;
    try {
        connection = getConnectDBConnection();
        ps = connection.prepareStatement(sql.toString());
        ps.setString(1, hashKey);
        ps.setString(2, contextIdentifier);
        ps.executeUpdate();
    } catch (SQLException e) {
        handleException(e.getMessage(), e);
    } finally {
        IdentityDatabaseUtil.closeAllConnections(connection, null, ps);
    }
}

From source file:io.ucoin.ucoinj.core.client.model.bma.gson.JoinerTypeAdapter.java

@Override
public JsonElement serialize(BlockchainBlock.Joiner member, Type type, JsonSerializationContext context) {
    String result = new StringBuilder().append(member.getPubkey()).append(":").append(member.getSignature())
            .append(":").append(member.getNumber()).append(":").append(member.getHash()).append(":")
            .append(member.getTimestamp()).append(":").append(member.getUid()).toString();

    return context.serialize(result.toString(), String.class);
}

From source file:org.fcrepo.migration.f4clients.StatelessFedora4Client.java

@Override
public void createOrUpdateRedirectNonRDFResource(final String path, final String url) {
    try {/* www  . j a v  a2 s.c  o m*/
        assertSuccess(getClient().put(pathToURI(path), null,
                "message/external-body; access-type=URL; URL=\"" + url.toString() + "\""));
    } catch (FcrepoOperationFailedException | URISyntaxException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.bs.beans.SalesBean.java

public void createPurForm() {
    modelPurForm.clear();//from  ww w . j  a  v a  2s .  c  o  m
    Connection con = null;
    PreparedStatement stm = null;
    ResultSet rs = null;
    try {
        con = DB.getConnection();
        String sql = "SELECT Pro_Id FROM product WHERE Pro_Name=?;";
        stm = con.prepareStatement(sql);
        for (String p : selectedPoduct) {
            stm.setString(1, p.toString());
            rs = stm.executeQuery();
            //System.out.println(p);
            while (rs.next()) {
                modelPurForm.add(new ModelProduct(rs.getInt(1), p));
                System.out.println(rs.getInt(1));
            }

        }
        // selectedPoduct.clear();

        //setDoAct(true);
    } catch (Exception e) {
    } finally {
        try {
            rs.close();
            con.close();
        } catch (SQLException ex) {
            Logger.getLogger(PurchasesMB.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:fr.natoine.model_annotation.Annotation.java

/**
 * To store the status of each annotated resource to be compliant with the descriptor of the annotationStatus
 * @param indicesStatus// ww w  .j  a  v  a2s .com
 */
public void setIndicesStatus(String indicesStatus) {
    this.setIndicesStatus(indicesStatus.toString());
}