Example usage for java.util Map toString

List of usage examples for java.util Map toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.apigee.edge.config.mavenplugin.AppMojo.java

/** 
 * Entry point for the mojo./*from   w w  w  . ja v a2s  .  co m*/
 */
public void execute() throws MojoExecutionException, MojoFailureException {

    if (super.isSkip()) {
        getLog().info("Skipping");
        return;
    }

    Logger logger = LoggerFactory.getLogger(AppMojo.class);

    try {

        init();

        if (buildOption == OPTIONS.none) {
            logger.info("Skipping Apps (default action)");
            return;
        }

        if (serverProfile.getEnvironment() == null) {
            throw new MojoExecutionException("Apigee environment not found in profile");
        }

        Map<String, List<String>> apps = getOrgConfigWithId(logger, "developerApps");
        if (apps == null || apps.size() == 0) {
            logger.info("No developers apps found.");
            return;
        }

        logger.debug(apps.toString());
        doUpdate(apps);

    } catch (MojoFailureException e) {
        throw e;
    } catch (RuntimeException e) {
        throw e;
    }
}

From source file:nl.surfnet.coin.janus.JanusRestClient.java

@Override
public ARP getArp(String entityId) {
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("entityid", entityId);
    URI signedUri = null;//from w ww.j  a  v  a  2 s .c o m
    try {
        signedUri = sign("arp", parameters);
        if (LOG.isTraceEnabled()) {
            LOG.trace("Signed Janus-request is: {}", signedUri);
        }
    } catch (IOException e) {
        LOG.error("Could not do ARP request to Janus", e);
    }

    final Map restResponse = restTemplate.getForObject(signedUri, Map.class);
    if (LOG.isTraceEnabled()) {
        LOG.trace("Janus-request returned: {}", restResponse.toString());
    }

    return (restResponse == null) ? null : ARP.fromRestResponse(restResponse);
}

From source file:org.finra.herd.dao.impl.BaseJpaDaoImpl.java

@Override
public <T> T findUniqueByNamedProperties(Class<T> entityClass, Map<String, ?> params) {
    Validate.notNull(entityClass);//from w ww . ja va2s.  c om
    Validate.notEmpty(params);
    List<T> resultList = findByNamedProperties(entityClass, params);
    Validate.isTrue(resultList.size() < 2, "Found more than one persistent instance of type "
            + StringUtils.unqualify(entityClass.getName() + " with parameters " + params.toString()));
    return resultList.size() == 1 ? resultList.get(0) : null;
}

From source file:com.all.facebook.impl.FacebookServiceImpl.java

@Override
public String authorizeUrl(String responseUrl) throws FacebookServiceException {
    URL url;/*from www  .  ja  va2  s. c  o  m*/

    try {
        url = new URL(responseUrl);
    } catch (MalformedURLException e) {
        throw new FacebookServiceException(e);
    }

    if (!responseUrl.contains(REDIRECT_URI)) {
        throw new FacebookServiceException(
                "The url does not correpond with the redirect_uri parameter: " + responseUrl);
    }

    String ref = url.getRef();
    if (ref == null) {
        Map<String, String> error = extractKeyValuePairs(url.getQuery());
        String errorType = error.get("error");
        throw new FacebookServiceException(error.toString(), errorType);
    }

    Map<String, String> keyValuePairs = extractKeyValuePairs(ref);

    if (!keyValuePairs.containsKey("access_token")) {
        throw new FacebookServiceException(
                "Could not find the access token in the responseUrl: " + responseUrl);
    }

    authorize(keyValuePairs.get("access_token"));

    return accessToken;
}

From source file:org.datacleaner.monitor.server.controllers.ResultModificationControllerTest.java

public void testModifyDate() throws Exception {
    ResultModificationPayload input = new ResultModificationPayload();
    input.setDate("2012-12-17");

    // reproduce the date, to make unittest locale-independent
    Date date = ConvertToDateTransformer.getInternalInstance().transformValue("2012-12-17");

    Map<String, String> response = resultModificationController.modifyResult("tenant1", "product_profiling-3",
            input);/*from w w  w . j  a  va 2 s. com*/
    assertEquals("{new_result_name=product_profiling-" + date.getTime() + ".analysis.result.dat, "
            + "old_result_name=product_profiling-3.analysis.result.dat, "
            + "repository_url=/tenant1/results/product_profiling-" + date.getTime() + ".analysis.result.dat}",
            response.toString());

    RepositoryNode executionLogFile = repository.getRepositoryNode(
            "/tenant1/results/product_profiling-" + date.getTime() + ".analysis.execution.log.xml");
    assertNotNull(executionLogFile);
}

From source file:com.almende.eve.transport.http.HttpService.java

@Override
public String toString() {
    final Map<String, Object> data = new HashMap<String, Object>();
    data.put("class", this.getClass().getName());
    data.put("servlet_url", servletUrl);
    data.put("protocols", protocols);
    return data.toString();
}

From source file:com.cybozu.kintone.gpsPunch.GpsPunchRequestManager.java

public String addSpot(long id, String companyName, String address, String tel) {
    String endPoint = "spots?";
    String parm = "";
    int responseStatus = 0;
    String body = "";
    String spotId = "";
    // ????/*from ww  w  .  jav a 2  s .c o  m*/
    try {
        parm = "company_id=" + URLEncoder.encode(companyId, "utf-8") + "&spot_code=" + String.valueOf(id)
                + "&spot_name=" + URLEncoder.encode(companyName, "utf-8") + "&address="
                + URLEncoder.encode(address, "utf-8") + "&tel=" + URLEncoder.encode(tel, "utf-8");
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(1);
    }

    // ??
    try {
        // POST
        HttpPost httpPost = new HttpPost(target + endPoint + parm);
        HttpResponse response = httpClient.execute(httpPost);
        responseStatus = response.getStatusLine().getStatusCode();
        body = EntityUtils.toString(response.getEntity(), "UTF-8");

        // ?200???????ID?
        if (responseStatus == 200) {
            Map map = JSON.decode(body, HashMap.class);
            spotId = (String) map.get("spot_id");
        } else {
            System.out.println(
                    "??????????");
            System.exit(1);
        }
    } catch (Exception e) {
        System.out.println(responseStatus);
        Map map = JSON.decode(body, HashMap.class);
        String err = map.toString();
        System.out.println(err);
        e.printStackTrace();
    }

    return spotId;
}

From source file:org.nuxeo.segment.io.SegmentIOComponent.java

public void identify(NuxeoPrincipal principal, Map<String, Serializable> metadata) {

    SegmentIODataWrapper wrapper = new SegmentIODataWrapper(principal, metadata);

    if (Framework.isTestModeSet()) {
        pushForTest("identify", wrapper.getUserId(), null, metadata);
    } else {/*from   w w w .  ja  va2s  . c om*/
        if (debugMode) {
            log.info("send identify for " + wrapper.getUserId() + " with meta : " + metadata.toString());
        } else {
            log.debug("send identify with " + metadata.toString());
            Traits traits = new Traits();
            traits.putAll(wrapper.getMetadata());
            Analytics.identify(wrapper.getUserId(), traits);
        }
    }
}

From source file:org.datacleaner.monitor.server.controllers.ResultModificationControllerTest.java

public void testModifyJob() throws Exception {
    ResultModificationPayload input = new ResultModificationPayload();
    input.setJob("email_standardizer");

    Map<String, String> response = resultModificationController.modifyResult("tenant1", "product_profiling-3",
            input);/* ww w  .  ja  va  2s  .c o m*/
    assertEquals(
            "{new_result_name=email_standardizer-1338990580902.analysis.result.dat, "
                    + "old_result_name=product_profiling-3.analysis.result.dat, "
                    + "repository_url=/tenant1/results/email_standardizer-1338990580902.analysis.result.dat}",
            response.toString());
}

From source file:org.apache.ranger.plugin.model.validation.RangerPolicyResourceSignature.java

String getResourceString(RangerPolicy policy) {
    // invalid/empty policy gets a deterministic signature as if it had an
    // empty resource string
    if (!isPolicyValidForResourceSignatureComputation(policy)) {
        return null;
    }//www  .j  av  a2  s.c om
    Map<String, RangerPolicyResourceView> resources = new TreeMap<String, RangerPolicyResourceView>();
    for (Map.Entry<String, RangerPolicyResource> entry : policy.getResources().entrySet()) {
        String resourceName = entry.getKey();
        RangerPolicyResourceView resourceView = new RangerPolicyResourceView(entry.getValue());
        resources.put(resourceName, resourceView);
    }
    String result = resources.toString();
    return result;
}