List of usage examples for java.util Map toString
public String toString()
From source file:org.jasig.ssp.service.impl.UPortalPersonAttributesService.java
@SuppressWarnings("unchecked") @Override//from ww w .j a v a2 s . c o m public PersonAttributesResult getAttributes(final String username) throws ObjectNotFoundException { LOGGER.debug("Fetching attributes for user '{}'", username); final Map<String, String[]> params = new HashMap<String, String[]>(); params.put(PARAM_USERNAME, new String[] { username }); final CrossContextRestApiInvoker rest = new PatchedSimpleCrossContextRestApiInvoker(); final HttpServletRequest req = requestForCrossContextGet(); final HttpServletResponse res = responseForCrossContextGet(); final Object origWebAsyncManager = req.getAttribute(WebAsyncUtils.WEB_ASYNC_MANAGER_ATTRIBUTE); req.removeAttribute(WebAsyncUtils.WEB_ASYNC_MANAGER_ATTRIBUTE); RestResponse rr; try { rr = rest.invoke(req, res, REST_URI_PERSON, params); } finally { req.setAttribute(WebAsyncUtils.WEB_ASYNC_MANAGER_ATTRIBUTE, origWebAsyncManager); } final ObjectMapper mapper = new ObjectMapper(); Map<String, Map<String, Map<String, List<String>>>> value = null; try { value = mapper.readValue(rr.getWriterOutput(), Map.class); } catch (final Exception e) { final String msg = "Failed to access attributes for the specified person: " + username; throw new UPortalSecurityException(msg, e); } final Map<String, Map<String, List<String>>> person = value.get(PERSON_KEY); if (person == null) { // No match... throw new ObjectNotFoundException("The specified person is unrecognized", username); } final Map<String, List<String>> rslt = person.get(ATTRIBUTES_KEY); if (rslt == null) { throw new ObjectNotFoundException("No attributes are available for the specified person", username); } LOGGER.debug("Retrieved the following attributes for user {}: {}", username, rslt.toString()); return convertAttributes(rslt); }
From source file:com.stvn.nscreen.my.MyDibListFragment.java
private void requestGetWishList() { ((MyMainActivity) getActivity()).showProgressDialog("", getString(R.string.wait_a_moment)); String terminalKey = mPref.getWebhasTerminalKey(); String uuid = mPref.getValue(JYSharedPreferences.UUID, ""); String url = mPref.getWebhasServerUrl() + "/getWishList.json?version=1&terminalKey=" + terminalKey + "&userId=" + uuid + "&assetProfile=1"; this.mLockListView = true; JYStringRequest request = new JYStringRequest(mPref, Request.Method.GET, url, new Response.Listener<String>() { @Override/* w w w . jav a 2 s. c o m*/ public void onResponse(String response) { ((MyMainActivity) getActivity()).hideProgressDialog(); try { JSONObject responseObj = new JSONObject(response); String resultCode = responseObj.getString("resultCode"); if (Constants.CODE_WEBHAS_OK.equals(resultCode)) { JSONArray wishItemArray = responseObj.getJSONArray("wishItemList"); for (int i = 0; i < wishItemArray.length(); i++) { JSONObject jsonObj = wishItemArray.getJSONObject(i); ListViewDataObject obj = new ListViewDataObject(i, 0, jsonObj.toString()); mList.add(obj); } } else { String errorString = responseObj.getString("errorString"); StringBuilder sb = new StringBuilder(); sb.append("API: action\nresultCode: ").append(resultCode).append("\nerrorString: ") .append(errorString); CMAlertUtil.Alert(getActivity(), "", sb.toString()); } setDibListCountText(mList.size()); mAdapter.notifyDataSetChanged(); mLockListView = false; } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { ((MyMainActivity) getActivity()).hideProgressDialog(); if (mPref.isLogging()) { VolleyLog.d("", "onErrorResponse(): " + error.getMessage()); } } }) { @Override protected Map<String, String> getParams() { Map<String, String> params = new HashMap<String, String>(); params.put("version", String.valueOf(1)); if (mPref.isLogging()) { Log.d("", "getParams()" + params.toString()); } return params; } }; mRequestQueue.add(request); }
From source file:de.zib.vold.client.VolDClient.java
/** * Insert a set of keys.// w ww. j a v a2s . c om */ public void insert(String source, Map<Key, Set<String>> map, final long timeStamp) { // guard { log.trace("Insert: " + map.toString()); // nothing to do here? if (0 == map.size()) return; checkState(); if (null == map) { throw new IllegalArgumentException("null is no valid argument!"); } } // build greatest common scope String commonscope; { List<String> scopes = new ArrayList<String>(map.size()); for (Key k : map.keySet()) { scopes.add(k.get_scope()); } commonscope = getGreatestCommonPrefix(scopes); } // build variable map String url; { url = buildURL(commonscope, null); log.debug("INSERT URL: " + url); } // build request body MultiValueMap<String, String> request = new LinkedMultiValueMap<String, String>(); { for (Map.Entry<Key, Set<String>> entry : map.entrySet()) { // remove common prefix from scope String scope = entry.getKey().get_scope().substring(commonscope.length()); String type = entry.getKey().get_type(); String keyname = entry.getKey().get_keyname(); URIKey key = new URIKey(source, scope, type, keyname, false, false, enc); String urikey = key.toURIString(); for (String value : entry.getValue()) { request.add(urikey, value); } } } HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.add("TIMESTAMP", String.valueOf(timeStamp)); HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>( request, requestHeaders); final ResponseEntity<HashMap> responseEntity = rest.exchange(url, HttpMethod.PUT, requestEntity, HashMap.class); //rest.put( url, request ); }
From source file:eu.forgetit.middleware.component.Contextualizer.java
public void executeTextContextualization(Exchange exchange) { taskStep = "CONTEXTUALIZER_CONTEXTUALIZE_DOCUMENTS"; logger.debug("New message retrieved for " + taskStep); JsonObjectBuilder job = Json.createObjectBuilder(); JsonObject headers = MessageTools.getHeaders(exchange); long taskId = Long.parseLong(headers.getString("taskId")); scheduler.updateTask(taskId, TaskStatus.RUNNING, taskStep, null); JsonObject jsonBody = MessageTools.getBody(exchange); String cmisServerId = null;/* w w w . ja v a 2s . c o m*/ if (jsonBody != null) { cmisServerId = jsonBody.getString("cmisServerId"); JsonArray jsonEntities = jsonBody.getJsonArray("entities"); job.add("cmisServerId", cmisServerId); job.add("entities", jsonEntities); for (JsonValue jsonValue : jsonEntities) { JsonObject jsonObject = (JsonObject) jsonValue; String type = jsonObject.getString("type"); if (type.equals(Collection.class.getName())) continue; long pofId = jsonObject.getInt("pofId"); try { String collectorStorageFolder = ConfigurationManager.getConfiguration() .getString("collector.storage.folder"); Path sipPath = Paths.get(collectorStorageFolder + File.separator + pofId); Path metadataPath = Paths.get(sipPath.toString(), "metadata"); Path contentPath = Paths.get(sipPath.toString(), "content"); Path contextAnalysisPath = Paths.get(metadataPath.toString(), "worldContext.json"); logger.debug("Looking for text documents in folder: " + contentPath); List<File> documentList = getFilteredDocumentList(contentPath); logger.debug("Document List for Contextualization: " + documentList); if (documentList != null && !documentList.isEmpty()) { File[] documents = documentList.stream().toArray(File[]::new); context = service.contextualize(documents); logger.debug("World Context:\n"); for (String contextEntry : context) { logger.debug(contextEntry); } StringBuilder contextResult = new StringBuilder(); for (int i = 0; i < context.length; i++) { Map<String, String> jsonMap = new HashMap<>(); jsonMap.put("filename", documents[i].getName()); jsonMap.put("context", context[i]); contextResult.append(jsonMap.toString()); } FileUtils.writeStringToFile(contextAnalysisPath.toFile(), contextResult.toString()); logger.debug("Document Contextualization completed for " + documentList); } } catch (IOException | ResourceInstantiationException | ExecutionException e) { e.printStackTrace(); } } exchange.getOut().setBody(job.build().toString()); exchange.getOut().setHeaders(exchange.getIn().getHeaders()); } else { scheduler.updateTask(taskId, TaskStatus.FAILED, taskStep, null); job.add("Message", "Task " + taskId + " failed"); scheduler.sendMessage("activemq:queue:ERROR.QUEUE", exchange.getIn().getHeaders(), job.build()); } }
From source file:org.apache.zeppelin.rest.CredentialsRestApiTest.java
@Test public void testCredentialsAPIs() throws IOException { String requestData1 = "{\"entity\" : \"entityname\", \"username\" : \"myuser\", \"password\" : \"mypass\"}"; String entity = "entityname"; Map<String, UserCredentials> credentialMap; testPutUserCredentials(requestData1); credentialMap = testGetUserCredentials(); assertNotNull("CredentialMap should be null", credentialMap); testRemoveCredentialEntity(entity);//from w ww .j av a 2 s.c o m credentialMap = testGetUserCredentials(); assertNull("CredentialMap should be null", credentialMap.get("entity1")); testRemoveUserCredentials(); credentialMap = testGetUserCredentials(); assertEquals("Compare CredentialMap", credentialMap.toString(), "{}"); }
From source file:org.goobi.eadmgr.Cli.java
private int send(Document vd, String template, String doctype, String brokerUrl, Collection<String> collections, Map<String, String> userMessageFields) throws Exception { logger.info("Sending XML message to ActiveMQ server at {}", brokerUrl); logger.trace("Collections: {}", collections); logger.trace("Process template: {}", template); logger.trace("Message doctype: {}", doctype); String uuid = (isUseFolderId) ? folderId : String.valueOf(java.util.UUID.randomUUID()); Map<String, Object> m = new HashMap<String, Object>(); m.put("id", uuid); m.put("template", template); m.put("docType", doctype); m.put("collections", collections); m.put("userMessageFields", userMessageFields); m.put("xml", String.valueOf(XMLSerializer.serialize(vd))); if (isDryRun) { println(m.toString()); } else {//from w w w . j av a 2 s .c o m GoobiMQConnection conn = new GoobiMQConnection(brokerUrl, subjectQueue, topicQueue); Map<String, Object> result = conn.sendAndWaitForResult(m); conn.close(); logger.debug(String.valueOf(result)); if (!result.get("level").equals("success")) { logger.error(String.valueOf(result.get("message"))); return 1; } else { logger.info("Process for ID {} has been successfully created.", uuid); } } return 0; }
From source file:com.linuxbox.enkive.message.search.AuditLoggingMessageSearchService.java
@Override public SearchResult search(Map<String, String> fields) throws MessageSearchException { try {// w w w.j ava 2 s . c om SearchResult result = messageSearchService.search(fields); result.setExecutedBy(authenticationService.getUserName()); return result; } catch (AuthenticationException e) { throw new MessageSearchException("Could not get authenticated user for search", e); } finally { try { auditService.addEvent(AuditService.SEARCH_PERFORMED, authenticationService.getUserName(), fields.toString()); } catch (AuditServiceException e) { LOGGER.error("could not audit user search request", e); } catch (AuthenticationException e) { LOGGER.error("could not get user for audit log", e); } } }
From source file:com.stainlesscode.mediapipeline.Engine.java
@Override public void mediaPlayerEventReceived(MediaPlayerEvent evt) { if (LogUtil.isDebugEnabled()) LogUtil.debug("mediaPlayerEventReceived= " + evt); if (evt.getType() == MediaPlayerEvent.Type.MEDIA_LOADED) { Map metadata = (Map) evt.getData(); LogUtil.info(metadata.toString()); }/*from ww w .j av a2s.co m*/ if (evt.getType() == Type.CLIP_END) { this.audioDecoder.setClipEnded(true); this.videoDecoder.setClipEnded(true); this.videoPlayer.setClipEnded(true); this.audioPlayer.setClipEnded(true); // wait for threads to complete while (this.audioDecodeThread.isAlive() && this.videoDecodeThread.isAlive() && this.audioPlayThread.isAlive() && this.videoPlayThread.isAlive()) ; this.stop(); } // TODO move this behavior to player // if (evt.getType() == Type.FIRST_VIDEO_FRAME_PRESENTED // && this.stopAfterFirstFrame) { // this.pause(); // this.stopAfterFirstFrame = false; // } }
From source file:com.example.fertilizercrm.easemob.chatuidemo.activity.ContactlistFragment.java
/** * ??????// ww w . jav a2s.c o m */ private void getContactList() { Logger.d(TAG, "?? getContactList"); contactList.clear(); //?? Map<String, User> users = ((DemoHXSDKHelper) HXSDKHelper.getInstance()).getContactList(); Logger.d("users: " + users.toString()); Iterator<Entry<String, User>> iterator = users.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, User> entry = iterator.next(); if (!entry.getKey().equals(Constant.NEW_FRIENDS_USERNAME) && !entry.getKey().equals(Constant.GROUP_USERNAME) && !entry.getKey().equals(Constant.CHAT_ROOM) && !entry.getKey().equals(Constant.CHAT_ROBOT) && !blackList.contains(entry.getKey())) contactList.add(entry.getValue()); } // ? Collections.sort(contactList, new Comparator<User>() { @Override public int compare(User lhs, User rhs) { return lhs.getUsername().compareTo(rhs.getUsername()); } }); if (users.get(Constant.CHAT_ROBOT) != null) { contactList.add(0, users.get(Constant.CHAT_ROBOT)); } // "?""?" if (users.get(Constant.CHAT_ROOM) != null) contactList.add(0, users.get(Constant.CHAT_ROOM)); if (users.get(Constant.GROUP_USERNAME) != null) contactList.add(0, users.get(Constant.GROUP_USERNAME)); // ""? if (users.get(Constant.NEW_FRIENDS_USERNAME) != null) contactList.add(0, users.get(Constant.NEW_FRIENDS_USERNAME)); }
From source file:com.wasteofplastic.askyblock.schematics.IslandBlock.java
public void setBook(Map<String, Tag> tileData) { //Bukkit.getLogger().info("DEBUG: Book data "); Bukkit.getLogger().info(tileData.toString()); }