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.opensearchserver.extractor.parser.Eml.java

@Override
protected void parseContent(InputStream inputStream, String extension, String mimeType) throws Exception {
    Session session = Session.getDefaultInstance(JAVAMAIL_PROPS);

    MimeMessage mimeMessage = new MimeMessage(session, inputStream);
    MimeMessageParser mimeMessageParser = new MimeMessageParser(mimeMessage).parse();

    ParserDocument document = getNewParserDocument();
    String from = mimeMessageParser.getFrom();
    if (from != null)
        document.add(FROM, from.toString());
    for (Address address : mimeMessageParser.getTo())
        document.add(RECIPIENT_TO, address.toString());
    for (Address address : mimeMessageParser.getCc())
        document.add(RECIPIENT_CC, address.toString());
    for (Address address : mimeMessageParser.getBcc())
        document.add(RECIPIENT_BCC, address.toString());
    document.add(SUBJECT, mimeMessageParser.getSubject());
    document.add(HTML_CONTENT, mimeMessageParser.getHtmlContent());
    document.add(PLAIN_CONTENT, mimeMessageParser.getPlainContent());
    document.add(SENT_DATE, mimeMessage.getSentDate());
    document.add(RECEIVED_DATE, mimeMessage.getReceivedDate());

    for (DataSource dataSource : mimeMessageParser.getAttachmentList()) {
        document.add(ATTACHMENT_NAME, dataSource.getName());
        document.add(ATTACHMENT_TYPE, dataSource.getContentType());
        // TODO Extract content from attachmend
        // if (parserSelector != null) {
        // Parser attachParser = parserSelector.parseStream(
        // getSourceDocument(), dataSource.getName(),
        // dataSource.getContentType(), null,
        // dataSource.getInputStream(), null, null, null);
        // if (attachParser != null) {
        // List<ParserResultItem> parserResults = attachParser
        // .getParserResults();
        // if (parserResults != null)
        // for (ParserResultItem parserResult : parserResults)
        // result.addField(
        // ParserFieldEnum.email_attachment_content,
        // parserResult);
        // }//from   ww w . j a v  a 2  s.c  om
        // }
    }
    if (StringUtils.isEmpty(mimeMessageParser.getHtmlContent()))
        document.add(LANG_DETECTION, languageDetection(document, PLAIN_CONTENT, 10000));
    else
        document.add(LANG_DETECTION, languageDetection(document, HTML_CONTENT, 10000));
}

From source file:com.hybris.integration.handler.ReceiveMessagesHandler.java

/**
 * @param items/*from  w w  w  .  j  ava  2  s .c o m*/
 */
@Autowired
public void setMessageItem(List<MessageItem> items) {
    for (MessageItem item : items) {
        String messageTopic = item.getMessageTopic();
        this.items.put(messageTopic.toString(), item);
    }
}

From source file:nz.net.orcon.kanban.controllers.UserController.java

@RequestMapping(value = "", method = RequestMethod.POST)
public @ResponseBody User createUser(@RequestBody User user) throws Exception {
    if (user.getPath() != null) {
        logger.warn("Attempt to update user using POST");
        throw new Exception("Attempt to Update User using POST. Use PUT instead");
    }//from ww  w . j  ava  2 s  .  c o m

    ObjectContentManager ocm = ocmFactory.getOcm();
    try {
        String newId = IdentifierTools.getIdFromNamedModelClass(user);
        user.setPath(String.format(URI.USER_URI, newId.toString()));
        user.setKey(null);
        ocm.insert(user);
        ocm.save();
    } finally {
        ocm.logout();
    }
    return user;
}

From source file:net.sourceforge.jaulp.lang.ClassUtilsTest.java

@Test
public void testGetManifestURL() {
    String actual = ClassUtils.getManifestUrl(Object.class);
    AssertJUnit.assertTrue(actual.toString().startsWith("jar:file:"));
    AssertJUnit.assertTrue(actual.toString().endsWith("/jre/lib/rt.jar!/META-INF/MANIFEST.MF"));

    actual = ClassUtils.getManifestUrl(ClassUtils.class);
    AssertJUnit.assertNull(actual);/*from   ww w.  j a  v a2 s.c o m*/
}

From source file:com.axelor.apps.account.service.AccountChartService.java

public void importAccountChartData(String configPath, String dataDir, HashMap<String, Object> context)
        throws IOException {
    CSVImporter importer = new CSVImporter(configPath.toString(), dataDir);
    importer.addListener(new Listener() {
        @Override/*  w ww.j  a  v a  2  s . c  o m*/
        public void handle(Model bean, Exception e) {
        }

        @Override
        public void imported(Model arg0) {
        }

        @Override
        public void imported(Integer total, Integer count) {
            log.debug("Total records: {}", total);
            log.debug("Success records: {}", count);
        }

    });
    importer.setContext(context);
    importer.run();
}

From source file:org.apache.drill.exec.store.http.HttpSubScanSpec.java

private String getOrderBy() {
    StringBuilder sb = new StringBuilder("");
    if (orderByCols != null && orderByCols.size() > 0) {
        sb.append(" order by ");
        int size = orderByCols.size();
        for (int i = 0; i < size; i++) {
            String orderByField = orderByCols.get(i);
            sb.append(orderByField.toString());
            if (i < (size - 1)) {
                sb.append(", ");
            }/*from   w w  w .j  a  v  a2 s.  c  om*/
        }
    }
    return sb.toString();
}

From source file:org.wso2.carbon.tryit.WADLTryItRequestProcessor.java

@Override
public void process(CarbonHttpRequest request, CarbonHttpResponse response,
        ConfigurationContext configurationContext) throws Exception {
    OutputStream outputStream = response.getOutputStream();
    response.addHeader(HTTP.CONTENT_TYPE, "text/html; charset=utf-8");
    response.addHeader("Access-Control-Allow-Origin", "*");

    Result result = new StreamResult(outputStream);
    String url = request.getParameter("resourceurl");
    url = URLEncoder.encode(url.toString(), "UTF-8");
    String contextRoot = CarbonUtils.getServerConfiguration().getFirstProperty("WebContextRoot");

    outputStream.write(("<meta content=\"text/html;charset=utf-8\" http-equiv=\"Content-Type\">\n"
            + "<meta content=\"utf-8\" http-equiv=\"encoding\">").getBytes());
    outputStream.write(/*from w  ww.j  a v  a2 s.  c o m*/
            ("<script type='text/javascript' src='?wadl2form&contentType=text/javascript&resource=js/jquery-1.8.0.min.js'></script>")
                    .getBytes());
    outputStream.write(
            ("<script type='text/javascript' src='?wadl2form&contentType=text/javascript&resource=js/jquery.slideto.min.js'></script>")
                    .getBytes());
    outputStream.write(
            ("<script type='text/javascript' src='?wadl2form&contentType=text/javascript&resource=js/jquery.wiggle.min.js'></script>")
                    .getBytes());
    outputStream.write(
            ("<script type='text/javascript' src='?wadl2form&contentType=text/javascript&resource=js/jquery.ba-bbq.min.js'></script>")
                    .getBytes());
    outputStream.write(
            ("<script type='text/javascript' src='?wadl2form&contentType=text/javascript&resource=js/handlebars-1.0.rc.1.js'></script>")
                    .getBytes());
    outputStream.write(
            ("<script type='text/javascript' src='?wadl2form&contentType=text/javascript&resource=js/underscore-min.js'></script>")
                    .getBytes());
    outputStream.write(
            ("<script type='text/javascript' src='?wadl2form&contentType=text/javascript&resource=js/backbone-min.js'></script>")
                    .getBytes());
    outputStream.write(
            ("<script type='text/javascript' src='?wadl2form&contentType=text/javascript&resource=js/swagger.js'></script>")
                    .getBytes());
    outputStream.write(
            ("<script type='text/javascript' src='?wadl2form&contentType=text/javascript&resource=js/swagger-ui.js'></script>")
                    .getBytes());
    outputStream.write(
            ("<script type='text/javascript' src='?wadl2form&contentType=text/javascript&resource=js/jquery.base64.js'></script>")
                    .getBytes());
    outputStream.write(
            ("<link rel='stylesheet' type='text/css' href='?wadl2form&contentType=text/css&resource=css/screen.css'/>")
                    .getBytes());

    outputStream.write(("\n" + "<style type='text/css'>\n" + "    .swagger-ui-wrap {\n"
            + "        max-width: 960px;\n" + "        margin-left: auto;\n" + "        margin-right: auto;\n"
            + "    }\n" + "\n" + "    .icon-btn {\n" + "        cursor: pointer;\n" + "    }\n" + "\n"
            + "    #message-bar {\n" + "        min-height: 30px;\n" + "        text-align: center;\n"
            + "        padding-top: 10px;\n" + "    }\n" + "\n" + "    .message-success {\n"
            + "        color: #89BF04;\n" + "    }\n" + "\n" + "    .message-fail {\n"
            + "        color: #cc0000;\n" + "    }\n" + "</style>\n" + "\n"
            + "<script type='text/javascript'>\n" + "    $(function () {\n"
            + "        window.swaggerUi = new SwaggerUi({\n"
            + "            discoveryUrl: '?wadl2form&contentType=application/json&resource=swaggerurl&wadldocurl="
            + url + "',\n" + "            dom_id: 'swagger-ui-container',\n"
            + "            apiKeyName: 'authorization',\n" + "            supportHeaderParams: true,\n"
            + "            supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'options'],\n"
            + "            onComplete: function (swaggerApi, swaggerUi) {\n"
            + "                if (console) {\n" + "                    console.log('Loaded SwaggerUI');\n"
            + "                    console.log(swaggerApi);\n" + "                    console.log(swaggerUi);\n"
            + "                }\n" + "                $('ul.endpoints').show();\n" + "            },\n"
            + "            onFailure: function (data) {\n" + "                if (console) {\n"
            + "                    console.log('Unable to Load SwaggerUI');\n"
            + "                    console.log(data);\n" + "                }\n" + "            },\n"
            + "            docExpansion: 'none'\n" + "        });\n" + "        window.swaggerUi.load();\n"
            + "    });\n" + "</script>\n"
            + "<div id='swagger-ui-container'>Please wait while loading try it page....</div>\n" + "<style>\n"
            + "    html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {\n"
            + "        font-family: Arial, Helvetica, Verdana, monospace, san-serif;\n"
            + "        font-size: 12px;\n" + "        line-height: 20px;\n" + "    }\n" + "\n"
            + "    div#overview ul {\n" + "        list-style: disc;\n" + "        margin: 5px 5px 5px 18px;\n"
            + "    }\n" + "\n" + "    div#overview li {\n" + "        padding-bottom: 5px;\n" + "    }\n" + "\n"
            + "    h2 {\n" + "        font-size: 24px;\n" + "        line-height: normal;\n"
            + "        font-weight: bold;\n" + "    }\n" + "\n" + "    .search-back body {\n"
            + "        line-hieight: 18px;\n" + "    }\n" + "\n"
            + "    body ul#resources li.resource div.heading h2 a {\n" + "        color: #111111;\n" + "    }\n"
            + "\n" + "    .search-back {\n" + "        padding: 0 0 0 20px;\n" + "    }\n" + "\n"
            + "    ul.endpoints {\n" + "        padding: 10px;\n" + "        border: solid 1px #efefef;\n"
            + "    }\n" + "\n" + "    body ul#resources li.resource div.heading {\n"
            + "        background: #EFEFEF;\n" + "        padding: 0 10px;\n" + "    }\n" + "\n"
            + "    body ul#resources li.resource div.heading ul.options {\n"
            + "        margin: 23px 10px 0 0;\n" + "    }\n" + "\n" + "    h6 {\n" + "        color: inherit;\n"
            + "        font-family: inherit;\n" + "        font-weight: bold;\n"
            + "        line-height: 20px;\n" + "        margin: 0 0 10px 0;\n"
            + "        text-rendering: optimizelegibility;\n" + "    }\n" + "\n" + "    h5 {\n"
            + "        color: inherit;\n" + "        font-family: inherit;\n" + "        font-size: 18px;\n"
            + "        font-weight: bold;\n" + "        line-height: 20px;\n" + "        margin: 10px 0;\n"
            + "        text-rendering: optimizelegibility;\n" + "    }\n" + "</style>\n").getBytes());
    outputStream.write(
            ("<input type='hidden' name='contextRoot_name' id='contextRoot' value='" + contextRoot + "'>")
                    .getBytes());
    outputStream.flush();

}

From source file:nz.net.orcon.kanban.controllers.ListController.java

@PreAuthorize("hasPermission(#boardId, 'BOARD', 'ADMIN')")
@RequestMapping(value = "", method = RequestMethod.POST)
public @ResponseBody ListResource createList(@PathVariable String boardId, @RequestBody ListResource list)
        throws Exception {

    ObjectContentManager ocm = ocmFactory.getOcm();
    try {/*from w ww .j  a va2s  .  co m*/

        listTools.ensurePresence(String.format(URI.BOARD_URI, boardId), "lists", ocm.getSession());

        String newId = IdentifierTools.getIdFromNamedModelClass(list);
        list.setPath(String.format(URI.LIST_URI, boardId, newId.toString()));
        ocm.insert(list);
        ocm.save();
    } finally {
        ocm.logout();
    }
    return list;
}

From source file:com.square.core.dao.implementations.PersonneMoraleDaoImplementation.java

@SuppressWarnings("unchecked")
@Override//from  w w  w  .  ja  va 2s  . c  o  m
public List<PersonneMorale> recherchePersonnesMoralesParRequete(String requete) {
    final org.hibernate.Query query = createQuery(requete.toString());
    return (List<PersonneMorale>) query.list();
}

From source file:com.roncoo.controller.BaseController.java

public String getString_UrlDecode_GBK(String key) {
    try {//w  w  w.  j  a v  a  2  s.  c om
        return new String(getString(key.toString()).getBytes("GBK"), "UTF-8");
    } catch (Exception e) {
        return "";
    }

}