List of usage examples for java.util List toString
public String toString()
From source file:com.aestheticsw.jobkeywords.web.html.JobController.java
/** * TODO - This method isn't integrated into the UI right now, but will be soon. *//* w w w . j ava 2 s .c om*/ // TODO replace the discrete attributes with the Thymeleaf SearchFormBean. @RequestMapping(value = "/joblist", method = RequestMethod.GET) public String getIndeedJobSummaryList(Map<String, Object> model, @RequestParam(required = false, defaultValue = "Java Spring") String query, @RequestParam(required = false, defaultValue = "2") int jobCount, @RequestParam(required = false, defaultValue = "0") int start, @RequestParam(required = false, defaultValue = "US") String country, @RequestParam(required = false) String city, @RequestParam(required = false, defaultValue = "0") int radius, @RequestParam(required = false) String sort) { Locale locale = Locale.US; if (country != null) { locale = SearchUtils.lookupLocaleByCountry(country); } SearchParameters params = new SearchParameters(new QueryKey(query, locale, city), jobCount, start, radius, sort); List<JobSummary> jobSummaryList = indeedClient.getIndeedJobSummaryList(params); model.put("joblist", jobSummaryList); return jobSummaryList.toString(); }
From source file:com.chinamobile.bcbsp.io.titan.TitanRecordReader.java
/** * get vertexID for hadoop IO/*from www .j ava2 s. c o m*/ * @param vertexID * vertexID to get * @return if get from titan,return hadoop text * else null. */ private Text getKey(long vertexID) { List<Map<String, Object>> result = null; try { result = client.execute("g.V('vertexID','" + vertexID + "').map"); if (result.toString().length() == 2) { return null; } } catch (RexProException e) { LOG.error("Client of database collapse!"); return null; } catch (IOException e) { LOG.error("Database can not read record!"); return null; } String vertex = result.toString(); String[] tmp = vertex.split(","); String value = tmp[0].split("=")[1]; String id = tmp[1].split("=")[1].split("\\}\\]")[0]; return new Text(id + ":" + value); }
From source file:com.moz.fiji.schema.FormattedEntityId.java
/** * Creates a FormattedEntityId from the specified Fiji row key. * * @param fijiRowKey An ordered <b>mutable</b> list of objects of row key components. The * contents of this list may be modified in case of any type promotions from * Integer to Long.//from w ww . j ava2s .c o m * @param format The RowKeyFormat2 as specified in the layout file. * @return a new FormattedEntityId with the specified Fiji row key. */ static FormattedEntityId getEntityId(List<Object> fijiRowKey, RowKeyFormat2 format) { Preconditions.checkNotNull(format); Preconditions.checkNotNull(format.getSalt()); Preconditions.checkNotNull(fijiRowKey); // Validity check for fiji Row Key. if (fijiRowKey.size() > format.getComponents().size()) { throw new EntityIdException("Too many components in fiji Row Key"); } if (fijiRowKey.size() < format.getComponents().size()) { int krk = fijiRowKey.size(); int fgc = format.getComponents().size(); if (LOG.isDebugEnabled()) { LOG.debug( "{} components found in {}, {} expected by row key format." + "The last {} components implicitly set to null", krk, fijiRowKey.toString(), fgc, fgc - krk); } } if (fijiRowKey.size() < format.getNullableStartIndex()) { throw new EntityIdException("Too few components in fiji Row key"); } // Validate the components passed in against the row key format such // as prevent non-null component from following null components and checking // component types against the format specified. boolean hasSeenNull = false; for (int i = 0; i < fijiRowKey.size(); i++) { // Prevent non-null components that follow null components if (hasSeenNull) { if (null == fijiRowKey.get(i)) { continue; } else { throw new EntityIdException("Non null component follows null component"); } } else if (null == fijiRowKey.get(i)) { // we found a null, check if this is at a position greater than or equal to // nullable_start_index (the position from which null values are allowed) // also set the flag indicating we've seen a null value if (format.getNullableStartIndex() <= i) { hasSeenNull = true; continue; } else { throw new EntityIdException("Unexpected null component in fiji row key." + String .format("Expected at least %d non-null components", format.getNullableStartIndex())); } } else { // for non-null components ensure that the type matches the format spec ComponentType type = getType(fijiRowKey.get(i)); if (null == type || type != format.getComponents().get(i).getType()) { if (type == ComponentType.INTEGER && format.getComponents().get(i).getType() == ComponentType.LONG) { fijiRowKey.set(i, ((Integer) fijiRowKey.get(i)).longValue()); } else { throw new EntityIdException( String.format("Invalid type for component %s at index %d in fijiRowKey", fijiRowKey.get(i).toString(), i)); } } } } byte[] hbaseRowKey = null; hbaseRowKey = makeHbaseRowKey(format, fijiRowKey); return new FormattedEntityId(format, hbaseRowKey, fijiRowKey); }
From source file:org.o3project.ocnrm.lib.JSONParserTest.java
/** * Test method for//from w ww.j a v a2 s.co m * {@link org.o3project.ocnrm.lib.JSONParser#convertToList()} */ @Test public void testConvertToList() throws JSONException, JsonProcessingException { testData = "[{\"test1\":\"1\"},{\"test2\":\"2\"}]"; JSONArray json = new JSONArray(testData); logger.debug(json.toString()); JSONParser parser = new JSONParser(); List<String> result = parser.convertToList(json, SEQUENCE_NO); assertThat(result.toString(), is("[{\"test1\":\"1\"}, {\"test2\":\"2\"}]")); }
From source file:eionet.gdem.web.struts.qasandbox.AddToWorkqueueAction.java
@Override public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { ActionErrors errors = new ActionErrors(); ActionMessages messages = new ActionMessages(); QASandboxForm cForm = (QASandboxForm) actionForm; String sourceUrl = cForm.getSourceUrl(); String content = cForm.getScriptContent(); String scriptType = cForm.getScriptType(); String schemaUrl = cForm.getSchemaUrl(); if (Utils.isNullStr(sourceUrl)) { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.qasandbox.missingUrl")); saveErrors(httpServletRequest, errors); return actionMapping.findForward("error"); }/*from www . j a v a 2 s. c o m*/ if (Utils.isNullStr(content) && !cForm.isShowScripts()) { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.qasandbox.missingContent")); saveErrors(httpServletRequest, errors); return actionMapping.findForward("error"); } if (Utils.isNullStr(schemaUrl) && cForm.isShowScripts()) { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.qasandbox.error.qasandbox.missingSchemaUrl")); saveErrors(httpServletRequest, errors); return actionMapping.findForward("error"); } if (!Utils.isURL(sourceUrl)) { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.qasandbox.notUrl")); saveErrors(httpServletRequest, errors); return actionMapping.findForward("error"); } try { String userName = (String) httpServletRequest.getSession().getAttribute("user"); WorkqueueManager wqm = new WorkqueueManager(); if (cForm.isShowScripts()) { List<String> jobIds = wqm.addSchemaScriptsToWorkqueue(userName, sourceUrl, schemaUrl); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("message.qasandbox.jobsAdded", jobIds.toString())); } else { String jobId = wqm.addQAScriptToWorkqueue(userName, sourceUrl, content, scriptType); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("message.qasandbox.jobAdded", jobId)); } } catch (DCMException e) { // e.printStackTrace(); LOGGER.error("Error saving script content", e); saveErrors(httpServletRequest, errors); return actionMapping.findForward("error"); } catch (Exception e) { // e.printStackTrace(); LOGGER.error("Error saving script content", e); saveErrors(httpServletRequest, errors); return actionMapping.findForward("error"); } saveMessages(httpServletRequest, messages); return actionMapping.findForward("success"); }
From source file:org.o3project.ocnrm.lib.JSONParserTest.java
/** * Test method for// ww w.j av a 2 s. c o m * {@link org.o3project.ocnrm.lib.JSONParser#convertToList()} */ @Test public void testConvertToListWithEmptyList() throws JSONException, JsonProcessingException { testData = "[]"; JSONArray json = spy(new JSONArray(testData)); logger.debug(json.toString()); JSONParser parser = new JSONParser(); List<String> result = parser.convertToList(json, SEQUENCE_NO); assertThat(result.toString(), is("[]")); verify(json, never()).getJSONObject(anyInt()); }
From source file:com.ebay.maven.cli.CliWrapper.java
public void downloadDependencies() { // read the pom.xml // TODO: get the pom.xml path from -f argument Model model = PomUtils.readModel("pom.xml"); // collect the repositories in the correct order List<Repository> repositories = model.getRepositories(); // collect the dependencies List<Dependency> dependencies = model.getDependencies(); System.out.println(repositories.toString() + dependencies.toString()); // TODO: read the settings.xml to collect the repositories // construct the JSON request // call nexus repository with JSON post // download the dependencies // invoke maven with dependencies }
From source file:gool.executor.csharp.CSharpCompiler.java
@Override public File compileToExecutable(List<File> files, File mainFile, List<File> classPath, List<String> args) throws FileNotFoundException { List<String> params = new ArrayList<String>(); if (mainFile == null) { Log.i(files.toString()); mainFile = files.get(0);/* w w w . j a va 2s . c om*/ } String execFileName = mainFile.getName().replace(".cs", ".exe"); params.addAll( Arrays.asList(Settings.get("csharp_compiler_cmd"), "-debug+", "/t:exe", "/out:" + execFileName)); /* * Add the needed dependencies to be able to compile programs. */ if (classPath != null) { for (File dependency : classPath) { params.add("/r:" + dependency.getAbsolutePath()); } } for (File dependency : getDependencies()) { params.add("/r:" + dependency.getAbsolutePath()); } for (File file : files) { params.add(file.toString()); } Command.exec(getOutputDir(), params); return new File(getOutputDir(), execFileName); }
From source file:org.openbaton.nse.core.ConnectivityManagerHandler.java
public boolean addQos(List<QoSAllocation> queues, FlowAllocation flows, String nsrId) { logger.info("[CONNECTIVITY-MANAGER-HANDLER] allocating slice for " + nsrId + " at time " + new Date().getTime()); logger.debug("Start creating QOS for " + nsrId + " with queues " + queues.toString() + " and flows " + flows.toString());/* www .ja v a 2s . c o m*/ this.updateHost(); List<Server> servers = queueHandler.createQueues(hostMap, queues, nsrId); internalData.put(nsrId, servers); logger.debug("MAP VALUE IS " + nsrId + " -> " + servers.toString()); flowsHandler.addFlow(hostMap, servers, flows, nsrId); logger.info( "[CONNECTIVITY-MANAGER-HANDLER] allocated slice for " + nsrId + " at time " + new Date().getTime()); return true; }
From source file:gool.executor.csharp.CSharpCompiler.java
@Override public File compileToObjectFile(List<File> files, File mainFile, List<File> classPath, List<String> args) throws FileNotFoundException { // TODO Duplicate code in compile and compileAll if (mainFile == null) { Log.i(files.toString()); mainFile = files.get(0);/*from w ww .j a va 2 s . c om*/ } String execFileName = mainFile.getName().replace(".cs", ".dll"); List<String> params = new ArrayList<String>(); params.addAll(Arrays.asList(Settings.get("csharp_compiler_cmd"), "-debug+", "/t:library")); /* * Add the needed dependencies to be able to compile programs. */ if (classPath != null) { for (File dependency : classPath) { params.add("/r:" + dependency.getAbsolutePath()); } } for (File dependency : getDependencies()) { params.add("/r:" + dependency.getAbsolutePath()); } for (File file : files) { params.add(file.toString()); } Command.exec(getOutputDir(), params); return new File(getOutputDir(), execFileName); }