List of usage examples for java.util ArrayList toString
public String toString()
From source file:com.linkedin.harisekhon.Utils.java
public static final ArrayList<String> validateNodeList(ArrayList<String> nodes) { ArrayList<String> final_nodes = new ArrayList<String>(); ArrayList<String> nodes2 = uniqArraylistOrdered(nodes); if (nodes2.size() < 1) { throw new IllegalArgumentException("node(s) not defined"); }//from ww w . j a v a2s. c om for (String node : nodes2) { //node = node.trim(); for (String node2 : node.split("[,\\s]+")) { node2 = node2.trim(); if (!isHost(node2)) { throw new IllegalArgumentException( "invalid node name '" + node2 + "': must be hostname/FQDN or IP address"); } final_nodes.add(node2); } } if (final_nodes.size() < 1) { throw new IllegalArgumentException("node(s) not defined (empty nodes given)"); } vlogOption("node list", final_nodes.toString()); return final_nodes; }
From source file:net.i2cat.csade.life2.backoffice.bl.StatisticsManager.java
public String getDatosEventsPost(int numDays) { ArrayList<Pair> datos = new ArrayList<Pair>(); int num;// ww w .j av a2s . co m Pair p; Calendar c = Calendar.getInstance(); SimpleDateFormat americano = new SimpleDateFormat("MM/dd/yyyy"); try { for (int i = (-1 * numDays); i <= 0; i++) { c = Calendar.getInstance(); c.add(Calendar.DATE, i); num = sd.countActivities(" adddate(date(curdate())," + i + ") = date(deadline)"); //num+=(int)(10.0* Math.random()); p = new Pair(americano.format(c.getTime()), num); datos.add(p); } } catch (Exception ex) { } return datos.toString(); }
From source file:com.krawler.spring.crm.dashboard.CrmDashboardController.java
private String getReportWidgetLinks(HttpServletRequest request) throws ServiceException { String jdata = ""; try {/* ww w . j a v a2 s .c om*/ ArrayList li = new ArrayList(); crmdashboardHandler.getLeadsReportsLink(sessionHandlerImpl.getPerms(request, "Lead Report"), li, RequestContextUtils.getLocale(request)); crmdashboardHandler.getAccountReportsLink(sessionHandlerImpl.getPerms(request, "AccountReport"), li, RequestContextUtils.getLocale(request)); crmdashboardHandler.getContactReportsLink(sessionHandlerImpl.getPerms(request, "ContactReport"), li, RequestContextUtils.getLocale(request)); crmdashboardHandler.getOpportunityReportsLink(sessionHandlerImpl.getPerms(request, "OpportunityReport"), li, RequestContextUtils.getLocale(request)); crmdashboardHandler.getActivityReportsLink(sessionHandlerImpl.getPerms(request, "ActivityReport"), li, RequestContextUtils.getLocale(request)); crmdashboardHandler.getCaseReportsLink(sessionHandlerImpl.getPerms(request, "CaseReport"), li, RequestContextUtils.getLocale(request)); crmdashboardHandler.getProductReportsLink(sessionHandlerImpl.getPerms(request, "ProductReport"), li, RequestContextUtils.getLocale(request)); crmdashboardHandler.getOpportunityProductReportsLink(request, li, RequestContextUtils.getLocale(request)); crmdashboardHandler.getSalesReportsLink(sessionHandlerImpl.getPerms(request, "SalesReport"), li, RequestContextUtils.getLocale(request)); crmdashboardHandler.getCampaignReportsLink(sessionHandlerImpl.getPerms(request, "CampaignReport"), li, RequestContextUtils.getLocale(request)); crmdashboardHandler.getTargetReportsLink(request, li, RequestContextUtils.getLocale(request)); crmdashboardHandler.getGoalReportsLink(request, li, RequestContextUtils.getLocale(request)); li = getBubbleSortList(li); int start = Integer.parseInt(request.getParameter("start")); int limit = Integer.parseInt(request.getParameter("limit")); String limitReport = request.getParameter("limitReport"); if (!StringUtil.isNullOrEmpty(limitReport)) { limit = Integer.parseInt(limitReport); } limit = (start + limit) > li.size() ? li.size() : (start + limit); List currli = (List) li.subList(start, limit); Iterator it = currli.iterator(); ArrayList newArr = new ArrayList(); while (it.hasNext()) { newArr.add(it.next()); } JSONObject jobj = new JSONObject("{\"count\":" + li.size() + ",\"data\":" + newArr.toString() + "}"); jdata = jobj.toString(); } catch (JSONException ex) { logger.warn(ex.getMessage(), ex); throw ServiceException.FAILURE(ex.getMessage(), ex); } catch (Exception ex) { logger.warn(ex.getMessage(), ex); throw ServiceException.FAILURE(ex.getMessage(), ex); } return jdata; }
From source file:ee.ioc.phon.android.speak.RecognizerIntentActivity.java
/** * <p>Returns the transcription results (matches) to the caller, * or sends them to the pending intent, or performs a web search.</p> * * <p>If a pending intent was specified then use it. This is the case with * applications that use the standard search bar (e.g. Google Maps and YouTube).</p> * * <p>Otherwise. If there was no caller (i.e. we cannot return the results), or * the caller asked us explicitly to perform "web search", then do that, possibly * disambiguating the results or redoing the recognition. * This is the case when K6nele was launched from its launcher icon (i.e. no caller), * or from a browser app.//from ww w .ja v a2 s. c om * (Note that trying to return the results to Google Chrome does not seem to work.)</p> * * <p>Otherwise. Just return the results to the caller.</p> * * <p>Note that we assume that the given list of matches contains at least one * element.</p> * * @param handler message handler * @param matches transcription results (one or more hypotheses) */ private void returnOrForwardMatches(final Handler handler, ArrayList<String> matches) { // Throw away matches that the user is not interested in int maxResults = mExtras.getInt(RecognizerIntent.EXTRA_MAX_RESULTS); if (maxResults > 0 && matches.size() > maxResults) { matches.subList(maxResults, matches.size()).clear(); } if (mExtraResultsPendingIntent == null) { if (getCallingActivity() == null || RecognizerIntent.ACTION_WEB_SEARCH.equals(getIntent().getAction()) || mExtras.getBoolean(RecognizerIntent.EXTRA_WEB_SEARCH_ONLY)) { handleResultsByWebSearch(this, handler, matches); return; } else { setResultIntent(handler, matches); } } else { Bundle bundle = mExtras.getBundle(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT_BUNDLE); if (bundle == null) { bundle = new Bundle(); } String match = matches.get(0); //mExtraResultsPendingIntentBundle.putString(SearchManager.QUERY, match); Intent intent = new Intent(); intent.putExtras(bundle); // This is for Google Maps, YouTube, ... intent.putExtra(SearchManager.QUERY, match); // This is for SwiftKey X, ... intent.putStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS, matches); String message = ""; if (matches.size() == 1) { message = match; } else { message = matches.toString(); } // Display a toast with the transcription. handler.sendMessage( createMessage(MSG_TOAST, String.format(getString(R.string.toastForwardedMatches), message))); try { mExtraResultsPendingIntent.send(this, Activity.RESULT_OK, intent); } catch (CanceledException e) { handler.sendMessage(createMessage(MSG_TOAST, e.getMessage())); } } finish(); }
From source file:org.hfoss.posit.android.web.Communicator.java
/** * Get an image from the server using the guid as Key. * // w ww .j av a 2 s . c om * @param guid * the Find's globally unique Id */ public ArrayList<HashMap<String, String>> getRemoteFindImages(String guid) { ArrayList<HashMap<String, String>> imagesMap = null; // ArrayList<HashMap<String, String>> imagesMap = null; String imageUrl = server + "/api/getPicturesByFind?findId=" + guid + "&authKey=" + authKey; HashMap<String, String> sendMap = new HashMap<String, String>(); Log.i(TAG, "getRemoteFindImages, sendMap=" + sendMap.toString()); sendMap.put(PositDbHelper.FINDS_GUID, guid); addRemoteIdentificationInfo(sendMap); try { String imageResponseString = doHTTPPost(imageUrl, sendMap); Log.i(TAG, "getRemoteFindImages, response=" + imageResponseString); if (!imageResponseString.equals(RESULT_FAIL)) { JSONArray jsonArr = new JSONArray(imageResponseString); imagesMap = new ArrayList<HashMap<String, String>>(); for (int i = 0; i < jsonArr.length(); i++) { JSONObject jsonObj = jsonArr.getJSONObject(i); if (Utils.debug) Log.i(TAG, "JSON Image Response String: " + jsonObj.toString()); Iterator<String> iterKeys = jsonObj.keys(); HashMap<String, String> map = new HashMap<String, String>(); while (iterKeys.hasNext()) { String key = iterKeys.next(); map.put(key, jsonObj.getString(key)); } imagesMap.add(map); } } } catch (Exception e) { Log.i(TAG, e.getMessage()); e.printStackTrace(); } if (imagesMap != null && Utils.debug) Log.i(TAG, "getRemoteFindImages, imagesMap=" + imagesMap.toString()); else Log.i(TAG, "getRemoteFindImages, imagesMap= null"); return imagesMap; }
From source file:org.hfoss.posit.web.Communicator.java
/** * Get an image from the server using the guid as Key. * @param guid the Find's globally unique Id *///from ww w. ja v a2 s.co m public ArrayList<HashMap<String, String>> getRemoteFindImages(String guid) { ArrayList<HashMap<String, String>> imagesMap = null; // ArrayList<HashMap<String, String>> imagesMap = null; String imageUrl = server + "/api/getPicturesByFind?findId=" + guid + "&authKey=" + authKey; HashMap<String, String> sendMap = new HashMap<String, String>(); Log.i(TAG, "getRemoteFindImages, sendMap=" + sendMap.toString()); sendMap.put(PositDbHelper.FINDS_GUID, guid); addRemoteIdentificationInfo(sendMap); try { String imageResponseString = doHTTPPost(imageUrl, sendMap); Log.i(TAG, "getRemoteFindImages, response=" + imageResponseString); if (!imageResponseString.equals(RESULT_FAIL)) { JSONArray jsonArr = new JSONArray(imageResponseString); imagesMap = new ArrayList<HashMap<String, String>>(); // imagesMap = new ArrayList<HashMap<String, String>>(); for (int i = 0; i < jsonArr.length(); i++) { JSONObject jsonObj = jsonArr.getJSONObject(i); if (Utils.debug) Log.i(TAG, "JSON Image Response String: " + jsonObj.toString()); // imagesMap.add((HashMap<String, String>) jsonArr.get(i)); Iterator<String> iterKeys = jsonObj.keys(); HashMap<String, String> map = new HashMap<String, String>(); while (iterKeys.hasNext()) { String key = iterKeys.next(); map.put(key, jsonObj.getString(key)); } imagesMap.add(map); } } } catch (Exception e) { Log.i(TAG, e.getMessage()); e.printStackTrace(); } if (imagesMap != null && Utils.debug) Log.i(TAG, "getRemoteFindImages, imagesMap=" + imagesMap.toString()); else Log.i(TAG, "getRemoteFindImages, imagesMap= null"); return imagesMap; }
From source file:com.vmware.bdd.cli.commands.ClusterCommands.java
private String validateInstantCloneWithHA(String specFilePath, ClusterCreate cluster) { String warningMsg = null;// w w w . java 2 s . c om ArrayList<String> ngs = new ArrayList<String>(); if (null != specFilePath) { NodeGroupCreate[] nodeGroups = cluster.getNodeGroups(); if (null != nodeGroups) { for (NodeGroupCreate ngc : nodeGroups) { String haFlag = ngc.getHaFlag(); if (null != haFlag && !haFlag.equals(com.vmware.bdd.utils.Constants.HA_FLAG_OFF)) { ngs.add(ngc.getName()); } } } } else { // currently if user does not provide spec file, the default HA option for master group is // set to 'on' ngs.add("master"); } if (ngs.size() > 0) { warningMsg = String.format(Constants.WARNING_INSTANT_CLONE_WITH_HA, ngs.toString()); } return warningMsg; }
From source file:org.ejbca.util.CertTools.java
/** * Gets a specified parts of a DN. Returns all occurences as an ArrayList, also works if DN contains several * instances of a part (i.e. cn=x, cn=y returns {x, y, null}). * * @param dn String containing DN, The DN string has the format "C=SE, O=xx, OU=yy, CN=zz". * @param dnpart String specifying which part of the DN to get, should be "CN" or "OU" etc. * * @return ArrayList containing dnparts or empty list if dnpart is not present *///from w w w . j a v a2 s . co m public static ArrayList<String> getPartsFromDN(String dn, String dnpart) { if (log.isTraceEnabled()) { log.trace(">getPartsFromDN: dn:'" + dn + "', dnpart=" + dnpart); } ArrayList<String> parts = new ArrayList<String>(); if ((dn != null) && (dnpart != null)) { String o; dnpart += "="; // we search for 'CN=' etc. X509NameTokenizer xt = new X509NameTokenizer(dn); while (xt.hasMoreTokens()) { o = xt.nextToken(); if ((o.length() > dnpart.length()) && o.substring(0, dnpart.length()).equalsIgnoreCase(dnpart)) { parts.add(o.substring(dnpart.length())); } } } if (log.isTraceEnabled()) { log.trace("<getpartsFromDN: resulting DN part=" + parts.toString()); } return parts; }
From source file:net.i2cat.csade.life2.backoffice.bl.StatisticsManager.java
/** * Returns number of connections thru different hours in one day * @return//from w w w .j a va 2 s . c o m */ public String getDatosConexiones() { ObjStats[] st = null; ArrayList<Pair> datos = new ArrayList<Pair>(); try { String sql = "SELECT Hour(t2.dTime) as idStat,count(*) as Event,\"\" as User_login,\"\" as dTime,0 as duration,\"\" as lat,\"\" as lon,\"\" as device,\"\" as query,0 as lng FROM (SELECT * FROM `Stat` WHERE event=" + StatsDAO.LOGIN_EVENT + ") AS t2 GROUP BY Hour(t2.dTime) ORDER BY Hour(t2.dTime)"; st = sd.listStatsSQL(sql); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } for (int i = 0; i < st.length; i++) { datos.add(new Pair("" + st[i].getIdStat(), st[i].getIEvent())); } return datos.toString(); }
From source file:org.ecocean.MarkedIndividual.java
public String getAllAlternateIDs() { ArrayList<String> allIDs = new ArrayList<String>(); //add any alt IDs for the individual itself if (alternateid != null) { allIDs.add(alternateid);/*w w w. j a v a2s. c om*/ } //add an alt IDs for the individual's encounters int numEncs = encounters.size(); for (int c = 0; c < numEncs; c++) { Encounter temp = (Encounter) encounters.get(c); if ((temp.getAlternateID() != null) && (!temp.getAlternateID().equals("None")) && (!allIDs.contains(temp.getAlternateID()))) { allIDs.add(temp.getAlternateID()); } } return allIDs.toString(); }