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:edu.wpi.margrave.MCommunicator.java

private static List<String> getUnderList(Node n) {
    // The under node is the "list" node, so need to be passed the EXPLORE node,
    // not the UNDER node for getListElements to work.
    List<String> result = getListElements(n, "UNDER", "pname");
    writeToLog("UNDER LIST: " + result.toString());
    return result;
}

From source file:com.nubits.nubot.RPC.NuRPCClient.java

public JSONObject submitLiquidityInfo(String currencyChar, double buyamount, double sellamount, int tier) {

    /*//from  w  w  w.  j  av  a 2 s  .c  om
     * String[] params = { USDchar,buyamount,sellamount,custodianPublicAddress, identifier* };
     * identifier default empty string
     */

    List params;
    if (useIdentifier) {
        params = Arrays.asList(currencyChar, buyamount, sellamount, custodianPublicAddress,
                generateIdentifier(tier));
    } else {
        params = Arrays.asList(currencyChar, buyamount, sellamount, custodianPublicAddress);
    }

    LOG.debug("RPC parameters " + params.toString());

    JSONObject json = invokeRPC(UUID.randomUUID().toString(), COMMAND_LIQUIDITYINFO, params);
    if (json != null) {

        if (json.get("null") == null) {
            //Correct answer, try to getliquidityinfo
            LOG.debug("RPC : Liquidity info submitted correctly.");
            JSONObject jo = new JSONObject();
            jo.put("submitted", true);
            return jo;
        } else if ((JSONObject) json.get("result") != null) {
            return (JSONObject) json.get("result"); //Correct answer
        } else {
            return (JSONObject) json.get("error");
        }

    } else {
        return new JSONObject();
    }
}

From source file:de.ingrid.interfaces.csw.server.cswt.ServerFacadeCSWT.java

/**
 * Generic request method/*w  ww .j  a  va 2  s.  c om*/
 * 
 * @param type
 * @param request
 * @throws CSWException
 */
protected void handleRequest(RequestType type, HttpServletRequest request, HttpServletResponse response)
        throws Exception {

    CSWMessageEncoding encodingImpl = null;
    try {
        // initialize the CSWMessageEncoding
        encodingImpl = this.getMessageEncodingInstance(type);
        encodingImpl.initialize(request, response);
        if (log.isDebugEnabled()) {
            log.debug("Handle " + type + " request");
        }

        // validate the request message non-operation-specific
        encodingImpl.validateRequest();

        // check if the operation is supported
        Operation operation = encodingImpl.getOperation();
        List<Operation> supportedOperations = encodingImpl.getSupportedOperations(Type.CSWT);
        if (!supportedOperations.contains(operation)) {
            StringBuffer errorMsg = new StringBuffer();
            errorMsg.append("The operation '" + operation + "' is not supported in a " + type + " request.\n");
            errorMsg.append("Supported values:\n");
            errorMsg.append(supportedOperations.toString() + "\n");
            throw new CSWOperationNotSupportedException(errorMsg.toString(), String.valueOf(operation));
        }
        if (log.isDebugEnabled()) {
            log.debug("Operation: " + encodingImpl.getOperation());
        }

        // initialize the CSWRequest instance
        CSWRequest requestImpl = this.getRequestInstance(operation);
        requestImpl.initialize(encodingImpl);

        // validate the request message operation-specific
        requestImpl.validate();

        // check the CSWServer instance
        if (this.cswtServerImpl == null) {
            throw new RuntimeException("ServerFacade is not configured properly: cswServerImpl is not set.");
        }

        // perform the requested operation
        Document result = null;
        if (operation == Operation.TRANSACTION) {
            result = this.cswtServerImpl.process((TransactionRequest) requestImpl);
        }
        if (log.isDebugEnabled()) {
            log.debug("Result: " + StringUtils.nodeToString(result));
        }

        // serialize the response
        encodingImpl.writeResponse(result);

    } catch (Exception e) {
        try {
            log.debug(e.getMessage(), e);
            if (encodingImpl != null) {
                encodingImpl.reportError(e);
            }
        } catch (IOException ioe) {
            log.error("Unable to send error message to client: " + ioe.getMessage());
        }
    }
}

From source file:net.cpollet.jixture.asserts.JixtureAssert.java

public JixtureAssert containsAtLeast(List<Fixture> fixtures) {
    List<Map<String, ?>> expectedMaps = new LinkedList<Map<String, ?>>();

    for (Fixture fixture : fixtures) {
        expectedMaps.addAll(getExpectedMaps(fixture));
    }/*from w  w w  . ja v a 2  s. com*/

    List<Map<String, ?>> actualMaps = getActualMaps();

    if (!actualMaps.containsAll(expectedMaps)) {
        expectedMaps.removeAll(actualMaps);
        throw new AssertionError("Expected but missing elements " + expectedMaps.toString());
    }

    return this;
}

From source file:schemacrawler.integration.test.SpringIntegrationTest.java

@Test
public void testExecutables() throws Exception {
    final List<String> failures = new ArrayList<>();
    for (final String beanDefinitionName : appContext.getBeanDefinitionNames()) {
        if (beanDefinitionName.equals("executableForXMLSerialization")) {
            continue;
        }//  ww w. j  a va2  s .co m
        final Object bean = appContext.getBean(beanDefinitionName);
        if (bean instanceof Executable) {
            final Executable executable = (Executable) bean;
            executeAndCheckForOutputFile(beanDefinitionName, executable, failures, false);
        }
    }
    if (failures.size() > 0) {
        fail(failures.toString());
    }
}

From source file:com.hp.ov.sdk.rest.client.InterconnectsClientImpl.java

@Override
public List<NameServer> getInterconnectNamedServers(RestParams params, String resourceId) {
    LOGGER.info("InterconnectsClientImpl : getInterconnectNamedServers : Start");

    // validate args
    if (null == params) {
        throw new SDKInvalidArgumentException(SDKErrorEnum.invalidArgument, null, null, null,
                SdkConstants.APPLIANCE, null);
    }//from  ww  w  .  j  av a2  s .c  om
    // set the additional params
    params.setType(HttpMethodType.GET);
    params.setUrl(UrlUtils.createRestUrl(params.getHostname(), ResourceUris.INTERCONNECT_URI, resourceId,
            SdkConstants.NAME_SERVERS));

    final String returnObj = httpClient.sendRequest(params);
    LOGGER.debug("InterconnectsClientImpl : getInterconnectNamedServers : response from OV :" + returnObj);
    if (null == returnObj || returnObj.equals("")) {
        throw new SDKNoResponseException(SDKErrorEnum.noResponseFromAppliance, null, null, null,
                SdkConstants.INTERCONNECT, null);
    }
    // Call adaptor to convert to DTO

    final List<NameServer> namedServers = adaptor.buildInterconnectNameServersCollection(returnObj);

    LOGGER.debug("InterconnectsClientImpl : getInterconnectNamedServers : Object :" + namedServers.toString());
    LOGGER.info("InterconnectsClientImpl : getInterconnectNamedServers : End");

    return namedServers;
}

From source file:com.tealcube.minecraft.bukkit.mythicdrops.items.MythicDropBuilder.java

private List<String> randomVariableReplace(List<String> list) {
    List<String> newList = new ArrayList<>();
    for (String s : list) {
        Matcher matcher = PERCENTAGE_PATTERN.matcher(s);
        while (matcher.find()) {
            String check = matcher.group();
            String replacedCheck = StringUtils.replace(StringUtils.replace(check, "%rand", ""), "%", "");
            List<String> split = Splitter.on(DASH_PATTERN).omitEmptyStrings().trimResults()
                    .splitToList(replacedCheck);
            LOGGER.debug(String.format("%s | %s | %s", s, check, split.toString()));
            int first = NumberUtils.toInt(split.get(0));
            int second = NumberUtils.toInt(split.get(1));
            int min = Math.min(first, second);
            int max = Math.max(first, second);
            int random = (int) Math.round((Math.random() * (max - min) + min));
            newList.add(s.replace(check, String.valueOf(random)));
        }//from   w  w  w . j  a v  a 2s  .c  o  m
        if (s.contains("%rand")) {
            continue;
        }
        newList.add(s);
    }
    return newList;
}

From source file:com.pureinfo.tgirls.sns.servlet.SingleInitServlet.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String picId = request.getParameter("picId");
    if (StringUtils.isEmpty(picId)) {
        picId = "-1";
    }//from w w  w  .  j  a  v a2s  .  c o m

    int npicId = -1;
    try {
        npicId = Integer.parseInt(picId);
    } catch (Exception e) {
        logger.error("int parse error.", e);
        npicId = -1;
    }
    JsonBase result = new JsonBase();
    response.setContentType("text/json; charset=utf-8");

    logger.info("single init with pic[" + npicId + "]");

    User loginUser = CookieUtils.getLoginUser(request, response);

    logger.debug("loginuser:" + loginUser);

    if (loginUser == null) {
        response.sendRedirect(request.getContextPath() + "/need-login.html");
        return;
    }

    try {
        Photo p;// = GetPic.get("", npicId);

        try {
            if (npicId > 0) {
                p = GetPic.get("", npicId);
            } else {

                List<String> viewdPicIds = new ArrayList<String>();// (List<Integer>)
                String ids = (String) CookieUtils.getRequestCookieValue(request,
                        ContinueServlet.VIEWD_PIC_IDS + loginUser.getTaobaoID());

                logger.debug("the ids:" + ids);

                if (StringUtils.isNotEmpty(ids)) {
                    viewdPicIds = new ArrayList<String>(Arrays.asList(ids.split(",")));
                }

                logger.debug("before:" + viewdPicIds.toString());

                p = GetPic.getPic("", viewdPicIds);

                ids = GetPic.idListToString(viewdPicIds);

                logger.debug("after:" + ids);

                request.getSession().setAttribute(ContinueServlet.VIEWD_PIC_IDS + loginUser.getTaobaoID(), ids);
            }
        } catch (Exception e) {
            logger.error("error when record view ids.", e);
            p = GetPic.get("", npicId);
        }

        logger.debug("the pic:" + p);

        if (p != null) {
            result.put("pic", new JSONObject(p));
        }

        List<JSONObject> infolist = GetInformationsServlet.getInformations(loginUser.getTaobaoID());
        if (infolist != null) {
            result.put("informations", infolist);
        }
        result.put("uinfo", new JSONObject(loginUser));

        try {
            RandomEvent wel = WelcomeMsgUtils.doGetWelcomEvent(request, response);
            if (wel != null) {
                result.put("event", new JSONObject(wel));
            }
        } catch (Exception e) {
            logger.error(e);
        }

    } catch (JSONException e) {
        logger.error("json error", e);
    }

    //logger.debug("result:" + result.toString());
    response.getWriter().write(result.toString());
    return;
}

From source file:com.iih5.smartorm.model.Model.java

public boolean deleteByIds(List list) {
    String st1 = list.toString();
    String arr = st1.substring(st1.indexOf("[") + 1, st1.indexOf("]"));
    StringBuilder sql = new StringBuilder();
    sql.append("delete from ");
    sql.append(table);/*from ww  w. j  av a 2 s  .com*/
    sql.append(" where id in ");
    sql.append("(");
    sql.append(arr);
    sql.append(")");
    if (jdbc.update(sql.toString()) < 0) {
        return false;
    }
    return true;
}