Example usage for java.util List toString

List of usage examples for java.util List toString

Introduction

In this page you can find the example usage for java.util List toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.nuxeo.directory.connector.json.akeneo.AkeneoInMemoryConnector.java

@Override
public List<String> queryEntryIds(Map<String, Serializable> filter, Set<String> fulltext) {

    List<String> ids = new ArrayList<String>();

    String valueToFind = "";

    log.info("filter " + filter.toString());
    if (filter.containsKey("label")) {
        valueToFind = (String) filter.get("label");
        log.info("valueToFind [" + valueToFind + "]");
        if (valueToFind != null) {
            valueToFind = valueToFind.toLowerCase();
        }//from  w w w  .ja va2  s  .c o  m
    }
    log.info("mapping [" + mapping.get("label") + "]");
    String fieldName = mapping.get("label");
    // do the search
    data_loop: for (String id : getEntryIds()) {

        Map<String, Object> map = getEntryMap(id);
        Object value = map.get(fieldName);

        if (value == null) {
            continue data_loop;
        }

        if (value.toString().toLowerCase().indexOf(valueToFind) < 0) {
            continue data_loop;
        }

        ids.add(id);
    }
    log.info("ids size [" + ids.size() + "]");
    log.info("ids [" + ids.toString() + "]");
    return ids;
}

From source file:net.heroicefforts.viable.android.rep.jira.JIRARepository.java

public int postIssueComment(Issue issue, Comment comment) throws ServiceException {
    try {/*from ww w. j  a v a2s  . c  o m*/
        HttpPost post = new HttpPost(rootURL + "/issue/" + issue.getIssueId() + "/comments.json");
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(12);
        nameValuePairs.add(new BasicNameValuePair("app_name", issue.getAppName()));
        nameValuePairs.add(new BasicNameValuePair("body", comment.getBody()));

        if (issue.getStacktrace() != null) {
            nameValuePairs.add(new BasicNameValuePair("phone_model", Build.MODEL));
            nameValuePairs.add(new BasicNameValuePair("phone_device", Build.DEVICE));
            nameValuePairs.add(new BasicNameValuePair("phone_version", String.valueOf(Build.VERSION.SDK_INT)));
        }

        if (Config.LOGD)
            Log.d(TAG, "post params:  " + nameValuePairs.toString());
        post.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Execute HTTP Post Request  
        HttpResponse response = execute(post);
        int responseCode = response.getStatusLine().getStatusCode();
        if (HttpStatus.SC_OK == responseCode || HttpStatus.SC_CREATED == responseCode) {
            JSONObject obj = readJSON(response);
            if (Config.LOGV)
                Log.v(TAG, "postIssueComment response:  \n" + obj.toString(4));
            //TODO pull dates from response
            Comment newComment = new Comment(obj);
            comment.copy(newComment);
        } else
            throw new ServiceException(MSG_REMOTE_ERROR + responseCode);

        if (Config.LOGD)
            Log.d(TAG, "postIssueComment code " + responseCode);

        return responseCode;
    } catch (UnsupportedEncodingException e) {
        throw new ServiceException("Encoding error occurred parsing JIRA response", e);
    } catch (IOException e) {
        throw new ServiceException(MSG_CONNECT_ERROR, e);
    } catch (JSONException e) {
        throw new ServiceException(MSG_PARSE_ERROR, e);
    }
}

From source file:com.jayway.maven.plugins.android.phase08preparepackage.DexMojo.java

private Set<File> preDex(CommandExecutor executor, Set<File> inputFiles) throws MojoExecutionException {
    Set<File> filtered = new HashSet<File>();
    getLog().info("Pre dex-ing libraries for faster dex-ing of the final application.");

    for (File inputFile : inputFiles) {
        if (inputFile.getName().matches(".*\\.jar$")) {
            List<String> commands = dexDefaultCommands();

            File predexJar = predexJarPath(inputFile);
            commands.add("--output=" + predexJar.getAbsolutePath());
            commands.add(inputFile.getAbsolutePath());
            filtered.add(predexJar);/*  w  w  w . j a  va  2s  . co  m*/

            if (!predexJar.isFile() || predexJar.lastModified() < inputFile.lastModified()) {
                getLog().info("Pre-dex ing jar: " + inputFile.getAbsolutePath());

                final String javaExecutable = getJavaExecutable().getAbsolutePath();
                getLog().debug(javaExecutable + " " + commands.toString());
                try {
                    executor.setCaptureStdOut(true);
                    executor.executeCommand(javaExecutable, commands, project.getBasedir(), false);
                } catch (ExecutionException e) {
                    throw new MojoExecutionException("", e);
                }
            }

        } else {
            filtered.add(inputFile);
        }
    }

    return filtered;
}

From source file:com.netflix.turbine.monitor.instance.InstanceMonitor.java

/**
 * Init resources required/*  w w  w  .  ja  v a 2 s  .c  o m*/
 * @throws Exception
 */
private void init() throws Exception {

    HttpGet httpget = new HttpGet(url);

    HttpResponse response = gatewayHttpClient.getHttpClient().execute(httpget);

    HttpEntity entity = response.getEntity();
    InputStream is = entity.getContent();
    reader = new BufferedReader(new InputStreamReader(is));

    int statusCode = response.getStatusLine().getStatusCode();
    if (statusCode != 200) {
        // this is unexpected. We probably have the wrong endpoint. Print the response out for debugging and give up here.
        List<String> responseMessage = IOUtils.readLines(reader);
        logger.error("Could not initiate connection to host, giving up: " + responseMessage);
        throw new MisconfiguredHostException(responseMessage.toString());
    }
}

From source file:org.apache.solr.handler.TestSolrConfigHandlerConcurrent.java

@Test
public void test() throws Exception {
    Map editable_prop_map = (Map) Utils.fromJSONResource("EditableSolrConfigAttributes.json");
    Map caches = (Map) editable_prop_map.get("query");

    setupHarnesses();/*from w  ww . j a v a 2  s . c om*/
    List<Thread> threads = new ArrayList<>(caches.size());
    final List<List> collectErrors = new ArrayList<>();

    for (Object o : caches.entrySet()) {
        final Map.Entry e = (Map.Entry) o;
        Thread t = new Thread() {
            @Override
            public void run() {
                try {
                    ArrayList errs = new ArrayList();
                    collectErrors.add(errs);
                    invokeBulkCall((String) e.getKey(), errs, (Map) e.getValue());
                } catch (Exception e) {
                    e.printStackTrace();
                }

            }
        };
        threads.add(t);
        t.start();
    }

    for (Thread thread : threads)
        thread.join();

    boolean success = true;

    for (List e : collectErrors) {
        if (!e.isEmpty()) {
            success = false;
            log.error(e.toString());
        }

    }

    assertTrue(collectErrors.toString(), success);

}

From source file:com.odoo.core.rpc.wrapper.OdooWrapper.java

private void unlinkRecord(String model, List<Integer> ids, IOdooResponse callback,
        OdooSyncResponse backResponse) {
    try {/*  w  w  w  .jav a2s . c o  m*/
        OArguments args = new OArguments();
        args.add(new JSONArray(ids.toString()));
        HashMap<String, Object> map = new HashMap<>();
        map.put("context", gson.fromJson(odooSession.getUserContext() + "", HashMap.class));
        callMethod(model, "unlink", args, map, null, callback, backResponse);
    } catch (Exception e) {
        OdooLog.e(e, e.getMessage());
    }
}

From source file:com.espertech.esper.epl.db.DatabasePollingViewableFactory.java

private static QueryMetaData getPreparedStmtMetadata(Connection connection, String[] parameters,
        String preparedStatementText, ColumnSettings metadataSetting) throws ExprValidationException {
    PreparedStatement prepared;/*from  w  w w.  ja  va  2s.  c om*/
    try {
        if (log.isInfoEnabled()) {
            log.info(".getPreparedStmtMetadata Preparing statement '" + preparedStatementText + "'");
        }
        prepared = connection.prepareStatement(preparedStatementText);
    } catch (SQLException ex) {
        String text = "Error preparing statement '" + preparedStatementText + '\'';
        log.error(text, ex);
        throw new ExprValidationException(text + ", reason: " + ex.getMessage());
    }

    // Interrogate prepared statement - parameters and result
    List<String> inputParameters = new LinkedList<String>();
    try {
        ParameterMetaData parameterMetaData = prepared.getParameterMetaData();
        inputParameters.addAll(Arrays.asList(parameters).subList(0, parameterMetaData.getParameterCount()));
    } catch (Exception ex) {
        try {
            prepared.close();
        } catch (SQLException e) {
            // don't handle
        }
        String text = "Error obtaining parameter metadata from prepared statement, consider turning off metadata interrogation via configuration, for statement '"
                + preparedStatementText + '\'';
        log.error(text, ex);
        throw new ExprValidationException(text + ", please check the statement, reason: " + ex.getMessage());
    }

    Map<String, DBOutputTypeDesc> outputProperties;
    try {
        outputProperties = compileResultMetaData(prepared.getMetaData(), metadataSetting);
    } catch (SQLException ex) {
        try {
            prepared.close();
        } catch (SQLException e) {
            // don't handle
        }
        String text = "Error in statement '" + preparedStatementText
                + "', failed to obtain result metadata, consider turning off metadata interrogation via configuration";
        log.error(text, ex);
        throw new ExprValidationException(text + ", please check the statement, reason: " + ex.getMessage());
    }

    if (log.isDebugEnabled()) {
        log.debug(".createDBEventStream in=" + inputParameters.toString() + " out="
                + outputProperties.toString());
    }

    // Close statement
    try {
        prepared.close();
    } catch (SQLException e) {
        String text = "Error closing prepared statement";
        log.error(text, e);
        throw new ExprValidationException(text + ", reason: " + e.getMessage());
    }

    return new QueryMetaData(inputParameters, outputProperties);
}

From source file:com.odoo.core.rpc.wrapper.OdooWrapper.java

private void updateRecord(String model, ORecordValues values, List<Integer> ids, IOdooResponse callback,
        OdooSyncResponse backResponse) {
    try {/*ww w .  j a va 2 s  . c  o m*/
        OArguments args = new OArguments();
        args.add(new JSONArray(ids.toString()));
        args.add(new JSONObject(gson.toJson(values)));
        HashMap<String, Object> map = new HashMap<>();
        map.put("context", gson.fromJson(odooSession.getUserContext() + "", HashMap.class));
        callMethod(model, "write", args, map, null, callback, backResponse);
    } catch (Exception e) {
        OdooLog.e(e, e.getMessage());
    }
}

From source file:com.jvoid.products.product.service.ProductsMasterService.java

public int updateProduct(ProductsMaster productsMaster) {

    int status = 1;

    int productId = productsMaster.getId();
    Product product = new Product();
    product.setId(productId);//w  w  w .jav a  2 s.c  o  m
    product.setSku(productsMaster.getSku());
    product.setHasOptions(productsMaster.getHasMoreOption());
    product.setRequiredOptions(productsMaster.getRequiredOption());
    product.setUpdatedOn(Utilities.getCurrentDateTime());
    productService.updateproduct(product);

    List<Entities> listAttributes = this.entitiesService.listAttributes();
    HashMap<Integer, String> attrs = getAttributesList(listAttributes, "Product");
    System.out.println("LIST ATTR:" + listAttributes.toString());

    for (Entry<Integer, String> entry : attrs.entrySet()) {
        Integer attrId = entry.getKey();
        String attrValue = entry.getValue();

        ProductEntityValues productAttributeValues = this.productEntityValuesService
                .getProductAttributeValuesByProductIdAndAttributeId(productId, attrId);

        if (null != productAttributeValues) {
            System.out.println("PRODUCT ATTR VALUES:" + productAttributeValues.toString());

            ProductEntityValues prodAttrValue = new ProductEntityValues();
            prodAttrValue.setProductId(productId);
            prodAttrValue.setAttributeId(attrId);
            prodAttrValue.setLanguage("enUS");
            prodAttrValue.setId(productAttributeValues.getId());
            prodAttrValue.setValue(productsMaster.toAttributedHashMap().get(attrValue));
            productEntityValuesService.updateProductAttributeValues(prodAttrValue);
            //System.out.println("custAttrValue-->"+prodAttrValue.toString());
        }
    }
    return status;
}