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.prey.net.PreyRestHttpClient.java

public PreyHttpResponse methodAsParameter(String url, String methodAsString, Map<String, String> params,
        PreyConfig preyConfig, String user, String pass) throws IOException {
    HttpPost method = new HttpPost(url);
    params.put("_method", methodAsString);
    method.setEntity(new UrlEncodedFormEntity(getHttpParamsFromMap(params), HTTP.UTF_8));
    // method.setQueryString(getHttpParamsFromMap(params));
    PreyLogger.d("Sending using user,pass " + methodAsString + "(using _method) - URI: " + url
            + " - parameters: " + params.toString());
    return sendUsingMethodUsingCredentials(method, preyConfig, user, pass);
}

From source file:org.apache.atlas.repository.store.graph.v1.AtlasEntityStoreV1.java

@Override
@GraphTransaction/*from   w w w . j av a2s .c  o m*/
public EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType,
        Map<String, Object> uniqAttributes) throws AtlasBaseException {

    if (MapUtils.isEmpty(uniqAttributes)) {
        throw new AtlasBaseException(AtlasErrorCode.INSTANCE_BY_UNIQUE_ATTRIBUTE_NOT_FOUND,
                uniqAttributes.toString());
    }

    final AtlasVertex vertex = AtlasGraphUtilsV1.findByUniqueAttributes(entityType, uniqAttributes);
    Collection<AtlasVertex> deletionCandidates = new ArrayList<>();

    if (vertex != null) {
        deletionCandidates.add(vertex);
    } else {
        if (LOG.isDebugEnabled()) {
            // Entity does not exist - treat as non-error, since the caller
            // wanted to delete the entity and it's already gone.
            LOG.debug(
                    "Deletion request ignored for non-existent entity with uniqueAttributes " + uniqAttributes);
        }
    }

    EntityMutationResponse ret = deleteVertices(deletionCandidates);

    // Notify the change listeners
    entityChangeNotifier.onEntitiesMutated(ret, false);

    return ret;
}

From source file:carmen.LocationResolver.java

protected Location resolveLocationUsingPlace(Map<String, Object> tweet) {
    Map<String, Object> place = Utils.getPlaceFromTweet(tweet);
    if (place == null)
        return null;

    String url = (String) place.get("url");
    String id = (String) place.get("id");
    String country = (String) place.get("country");
    if (country == null) {
        logger.warn("Found place with no country: " + place.toString());
        return null;
    }/*  www . j av a 2s.  com*/

    if (this.placeNameToNormalizedPlaceName.containsKey(country.toLowerCase())) {
        country = placeNameToNormalizedPlaceName.get(country.toLowerCase());
    }

    String placeType = (String) place.get("place_type");
    if (placeType.equalsIgnoreCase("city")) {
        String city = (String) place.get("name");

        if (country.equalsIgnoreCase("united states")) {
            String fullName = (String) place.get("full_name");
            String state = null;

            if (fullName == null) {
                logger.warn("Found place with no full_name: " + place.toString());
                return null;
            }

            Matcher matcher = this.statePattern.matcher(fullName);
            if (matcher.matches()) {
                // extracting the state name
                String matchedString = matcher.group(1).toLowerCase();
                if (stateAbbreviationToFullName.containsKey(matchedString)) {
                    state = stateAbbreviationToFullName.get(matchedString);
                }
            }

            return getLocationForPlace(country, state, null, city, url, id);
        } else {
            return getLocationForPlace(country, null, null, city, url, id);
        }
    } else if (placeType.equalsIgnoreCase("admin")) {
        String state = (String) place.get("name");
        return getLocationForPlace(country, state, null, null, url, id);
    } else if (placeType.equalsIgnoreCase("country")) {
        return getLocationForPlace(country, null, null, null, url, id);
    } else if (placeType.equalsIgnoreCase("neighborhood") || placeType.equalsIgnoreCase("poi")) {
        String fullName = (String) place.get("full_name");
        if (fullName == null) {
            logger.warn("Found place with no full_name: " + place.toString());
            return null;
        }
        String[] splitFullName = fullName.split(",");
        String city = null;
        if (splitFullName.length > 1) {
            city = splitFullName[1];
        }
        return getLocationForPlace(country, null, null, city, url, id);
    } else {
        logger.warn("Unknown place type: " + placeType);
    }

    return null;
}

From source file:azad.hallaji.farzad.com.masirezendegi.PageVirayesh.java

void setAlage() {

    ProgressBar progressbarsandaha = (ProgressBar) findViewById(R.id.progressbarsandaha);
    progressbarsandaha.setVisibility(View.VISIBLE);

    MyRequestQueue = Volley.newRequestQueue(this);
    String url = "http://telyar.dmedia.ir/webservice/Get_profile/";
    StringRequest MyStringRequest = new StringRequest(Request.Method.POST, url,
            new Response.Listener<String>() {
                @Override/*from www  .java 2s . c o m*/
                public void onResponse(String response) {
                    //This code is executed if the server responds, whether or not the response contains data.
                    //The String 'response' contains the server's response.
                    Log.i("dfvflgnkjdfd", response);
                    //Toast.makeText(getApplicationContext(), response , Toast.LENGTH_LONG).show();
                    //Toast.makeText(getApplicationContext(), response , Toast.LENGTH_LONG).show();

                    try {
                        JSONObject jsonObject = new JSONObject(response);
                        GlobalVar.setUserID(jsonObject.getString("UID"));
                        try {
                            namexanivadeEdit.setText(
                                    jsonObject.getString("Name") + " " + jsonObject.getString("FamilyName"));
                        } catch (Exception ignored) {
                        }

                        try {
                            emailEdit.setText(jsonObject.getString("Email"));
                        } catch (Exception ignored) {
                        }
                        try {
                            sexEdit.setText(jsonObject.getString("Gender"));
                        } catch (Exception ignored) {
                        }
                        try {
                            shomareteleEdit.setText(jsonObject.getString("Telephone"));
                        } catch (Exception ignored) {
                        }
                        try {
                            selectedImage = Uri.parse(jsonObject.getString("PicAddress"));
                            imageviewuserVirayesh.setImageURI(selectedImage);
                        } catch (Exception ignored) {
                        }
                        try {
                            aboutmeEdit.setText(jsonObject.getString("AboutMe"));
                        } catch (Exception ignored) {
                        }
                        try {
                            costperminEdit.setText(jsonObject.getString("CostPerMin"));
                        } catch (Exception ignored) {
                        }
                        try {
                            dialtecEdit.setText(jsonObject.getString("Dialect"));
                        } catch (Exception ignored) {
                        }
                        try {
                            maxtimeEdit.setText(jsonObject.getString("AdviserMaxTime"));
                        } catch (Exception ignored) {
                        }

                    } catch (JSONException e) {
                        //e.printStackTrace();
                    }

                    ProgressBar progressbarsandaha = (ProgressBar) findViewById(R.id.progressbarsandaha);
                    progressbarsandaha.setVisibility(View.INVISIBLE);

                }
            }, new Response.ErrorListener() { //Create an error listener to handle errors appropriately.
                @Override
                public void onErrorResponse(VolleyError error) {
                    //This code is executed if there is an error.
                }
            }) {
        protected Map<String, String> getParams() {
            Map<String, String> MyData = new HashMap<String, String>();
            //Log.i("asasasasasasa",adviseridm+"/"+GlobalVar.getDeviceID());
            MyData.put("userid", GlobalVar.getUserID()); //Add the data you'd like to send to the server.
            Log.i("dfvflgnkjdfd", MyData.toString());
            return MyData;
        }
    };
    MyRequestQueue.add(MyStringRequest);
}

From source file:com.prey.net.PreyRestHttpClient.java

public PreyHttpResponse postAutentication(String url, Map<String, String> params, PreyConfig preyConfig)
        throws IOException {
    HttpPost method = new HttpPost(url);

    method.setHeader("Accept", "*/*");
    method.setEntity(new UrlEncodedFormEntity(getHttpParamsFromMap(params), HTTP.UTF_8));
    method.addHeader("Authorization", "Basic " + getCredentials(preyConfig.getApiKey(), "X"));

    // method.setParams(getHttpParamsFromMap(params));
    PreyLogger.d("Sending using 'POST' - URI: " + url + " - parameters: " + params.toString());
    httpclient.setRedirectHandler(new NotRedirectHandler());
    HttpResponse httpResponse = httpclient.execute(method);
    PreyHttpResponse response = new PreyHttpResponse(httpResponse);
    //PreyLogger.d("Response from server: " + response.toString());
    return response;
}

From source file:com.flozano.socialauth.provider.YammerImpl.java

/**
 * Makes HTTP request to a given URL.It attaches access token in URL.
 * /*from w w w. j a va  2s  .c om*/
 * @param url
 *            URL to make HTTP request.
 * @param methodType
 *            Method type can be GET, POST or PUT
 * @param params
 * @param headerParams
 *            Parameters need to pass as Header Parameters
 * @param body
 *            Request Body
 * @return Response object
 * @throws Exception
 */
@Override
public Response api(final String url, final String methodType, final Map<String, String> params,
        final Map<String, String> headerParams, final String body) throws Exception {
    if (!isVerify || accessToken == null) {
        throw new SocialAuthException("Please call verifyResponse function first to get Access Token");
    }
    Map<String, String> headerParam = new HashMap<String, String>();
    headerParam.put("Content-Type", "application/json");
    headerParam.put("Accept", "application/json");
    if (headerParams != null) {
        headerParam.putAll(headerParams);
    }
    headerParam.put("Authorization", "Bearer " + accessToken);
    Response serviceResponse;
    LOG.debug("Calling URL : " + url);
    LOG.debug("Header Params : " + headerParam.toString());
    try {
        serviceResponse = HttpUtil.doHttpRequest(url, methodType, body, headerParam);
    } catch (Exception e) {
        throw new SocialAuthException("Error while making request to URL : " + url, e);
    }
    if (serviceResponse.getStatus() != 200 && serviceResponse.getStatus() != 201) {
        LOG.debug("Return statuc for URL " + url + " is " + serviceResponse.getStatus());
        throw new SocialAuthException(
                "Error while making request to URL :" + url + "Status : " + serviceResponse.getStatus());
    }
    return serviceResponse;
}

From source file:com.cloud.network.security.NetworkGroupManagerImpl.java

private String generateRulesetSignature(Map<PortAndProto, Set<String>> allowed) {
    String ruleset = allowed.toString();
    return DigestUtils.md5Hex(ruleset);
}

From source file:com.cosmosource.common.service.CAMgrManager.java

/**
 * @??: CA//from w ww  .  j ava 2 s .  c  o  m
 * @ yc
 * @2011-11-22
 * @param page 
 * @param model ?
 * @param subModel??
 * @param pMap??
 * @return
 */
public Page<TAcCaapply> findCaList(final Page<TAcCaapply> page, final TAcCaapply model, final CaModel subModel,
        final Map pMap) {
    String sql = "CommonSQL.caQryList";
    Map<String, Object> map = new HashMap<String, Object>();
    if (subModel != null) {
        map.putAll(ConvertUtils.pojoToMap(subModel));
    }
    if (model != null) {
        map.putAll(ConvertUtils.pojoToMap(model));
    }
    if (pMap != null) {
        map.putAll(pMap);
    }
    logger.info(map.toString());
    return sqlDao.findPage(page, sql, map);

}

From source file:org.ms123.common.team.TeamServiceImpl.java

public Map getTeamTree(@PName(StoreDesc.NAMESPACE) String namespace, @PName("mapping") @POptional Map mapping)
        throws RpcException {
    Map ret = null;/*from  w ww . ja  v a  2s. c  o  m*/
    StoreDesc sdesc = StoreDesc.getNamespaceData(namespace);
    SessionContext sessionContext = m_dataLayer.getSessionContext(sdesc);
    try {
        if (sessionContext.hasAdminRole()) {
            String mkey = mapping != null ? mapping.toString() : "";
            Map tree = m_adminTreeCache.get(namespace + mkey);
            System.out.println("TreeCacheSize:" + m_adminTreeCache.keySet().size());
            if (tree != null)
                return tree;
        }
        ret = this.getObjectGraph(sdesc, TEAMINTERN_ENTITY, "root", mapping);
        if (sessionContext.hasAdminRole()) {
            String mkey = mapping != null ? mapping.toString() : "";
            m_adminTreeCache.put(namespace + mkey, ret);
        }
        return ret;
    } catch (PermissionException e) {
        throw new RpcException(ERROR_FROM_METHOD, PERMISSION_DENIED, "TeamService.getTeamTree", e);
    } catch (Throwable e) {
        throw new RpcException(ERROR_FROM_METHOD, INTERNAL_SERVER_ERROR, "TeamService.getTeamTree:", e);
    }
}

From source file:org.apache.solr.core.TestLazyCores.java

private void checkStatus(CoreContainer cc, Boolean ok, String core) throws Exception {
    SolrQueryResponse resp = new SolrQueryResponse();
    final CoreAdminHandler admin = new CoreAdminHandler(cc);
    admin.handleRequestBody(req(CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.STATUS.toString(),
            CoreAdminParams.CORE, core), resp);

    Map<String, Exception> failures = (Map<String, Exception>) resp.getValues().get("initFailures");

    if (ok) {//w  w w.j  a  v a  2 s  .  co m
        if (failures.size() != 0) {
            fail("Should have cleared the error, but there are failues " + failures.toString());
        }
    } else {
        if (failures.size() == 0) {
            fail("Should have had errors here but the status return has no failures!");
        }
    }
}