List of usage examples for java.util List toString
public String toString()
From source file:fragment.web.AbstractConnectorControllerTest.java
@Test public void testShowCloudServicesAsServiceProvider() throws Exception { try {//w ww . j a va 2 s . c o m map = new ModelMap(); String[] profiles = { "3", "4", "5", "6", "7" }; for (String profile : profiles) { User user = userDAO.find("3"); Tenant tenant = tenantDAO.find(3L); user.setProfile(profileDAO.find(profile)); userDAO.save(user); asUser(user); setValidServiceAndServiceInstance(); request.setAttribute("isSurrogatedTenant", true); String viewService = controller.showCloudServices(tenant.getUuid(), null, null, map, request); Assert.assertEquals(tenant, map.get("tenant")); List<Service> services = connectorConfigurationManager.getAllServicesByType(CssdkConstants.CLOUD); Assert.assertEquals(tenant.getOwner(), map.get("effectiveUser")); Assert.assertEquals("company_setup.connector_cs_admin", viewService); Assert.assertEquals(services.toString(), map.get("services").toString()); } } catch (Exception e) { e.printStackTrace(); Assert.fail(); } }
From source file:io.cloudslang.lang.compiler.validator.PreCompileValidatorImpl.java
@Override public void validateResultsWithWhitelist(List<Result> results, List<String> allowedResults, String artifactName, List<RuntimeException> errors) { final Set<String> artifactResultNames = results.stream().map(Result::getName).collect(toSet()); if ((artifactResultNames.size() != results.size()) || !artifactResultNames.equals(new HashSet<>(allowedResults))) { errors.add(new RuntimeException("Sequential operation: '" + artifactName + "' syntax is illegal. " + FLOW_RESULTS_NOT_ALLOWED_EXPRESSIONS_MESSAGE + allowedResults.toString() + ".")); }//from ww w . jav a 2 s.c o m }
From source file:com.glaf.chart.web.springmvc.KendouiChartController.java
@RequestMapping("/showChart") public ModelAndView chart(HttpServletRequest request, ModelMap modelMap) { RequestUtils.setRequestParameterToAttribute(request); Map<String, Object> params = RequestUtils.getParameterMap(request); String chartId = ParamUtils.getString(params, "chartId"); String mapping = ParamUtils.getString(params, "mapping"); String mapping_enc = ParamUtils.getString(params, "mapping_enc"); String name = ParamUtils.getString(params, "name"); String name_enc = ParamUtils.getString(params, "name_enc"); Chart chart = null;//from w w w .j av a 2s . c om if (StringUtils.isNotEmpty(chartId)) { chart = chartService.getChart(chartId); } else if (StringUtils.isNotEmpty(name)) { chart = chartService.getChartByName(name); } else if (StringUtils.isNotEmpty(name_enc)) { String str = RequestUtils.decodeString(name_enc); chart = chartService.getChartByName(str); } else if (StringUtils.isNotEmpty(mapping)) { chart = chartService.getChartByMapping(mapping); } else if (StringUtils.isNotEmpty(mapping_enc)) { String str = RequestUtils.decodeString(mapping_enc); chart = chartService.getChartByMapping(str); } if (chart != null) { ChartDataManager manager = new ChartDataManager(); chart = manager.getChartAndFetchDataById(chart.getId(), params, RequestUtils.getActorId(request)); logger.debug("chart rows size:" + chart.getColumns().size()); request.setAttribute("chart", chart); request.setAttribute("chartId", chart.getId()); request.setAttribute("name", chart.getChartName()); JSONArray result = new JSONArray(); List<ColumnModel> columns = chart.getColumns(); if (columns != null && !columns.isEmpty()) { double total = 0D; List<String> categories = new ArrayList<String>(); if (StringUtils.equalsIgnoreCase(chart.getChartType(), "pie")) { for (ColumnModel cm : columns) { total += cm.getDoubleValue(); } } for (ColumnModel cm : columns) { if (cm.getCategory() != null && !categories.contains("'" + cm.getCategory() + "'")) { categories.add("'" + cm.getCategory() + "'"); } } request.setAttribute("categories", categories); request.setAttribute("categories_scripts", categories.toString()); logger.debug("categories=" + categories); Map<String, List<Double>> seriesMap = new HashMap<String, List<Double>>(); for (ColumnModel cm : columns) { String series = cm.getSeries(); if (series != null) { List<Double> valueList = seriesMap.get(series); if (valueList == null) { valueList = new ArrayList<Double>(); } if (cm.getDoubleValue() != null) { valueList.add(cm.getDoubleValue()); } else { valueList.add(0D); } seriesMap.put(series, valueList); } } request.setAttribute("seriesMap", seriesMap); if (!seriesMap.isEmpty()) { JSONArray array = new JSONArray(); Set<Entry<String, List<Double>>> entrySet = seriesMap.entrySet(); for (Entry<String, List<Double>> entry : entrySet) { String key = entry.getKey(); List<Double> valueList = entry.getValue(); JSONObject json = new JSONObject(); json.put("name", key); json.put("data", valueList); array.add(json); } logger.debug("seriesDataJson:" + array.toJSONString()); request.setAttribute("seriesDataJson", array.toJSONString()); } for (ColumnModel cm : columns) { JSONObject json = new JSONObject(); json.put("category", cm.getCategory()); json.put("series", cm.getSeries()); json.put("doublevalue", cm.getDoubleValue()); if (StringUtils.equalsIgnoreCase(chart.getChartType(), "pie")) { json.put("category", cm.getSeries()); json.put("value", Math.round(cm.getDoubleValue() / total * 10000) / 100.0D); } else { json.put("value", cm.getDoubleValue()); } result.add(json); } } request.setAttribute("jsonArray", result.toJSONString()); if (StringUtils.equalsIgnoreCase(chart.getChartType(), "pie")) { return new ModelAndView("/bi/chart/kendo/pie", modelMap); } else if (StringUtils.equalsIgnoreCase(chart.getChartType(), "line")) { return new ModelAndView("/bi/chart/kendo/line", modelMap); } else if (StringUtils.equalsIgnoreCase(chart.getChartType(), "radarLine")) { return new ModelAndView("/bi/chart/kendo/radarLine", modelMap); } else if (StringUtils.equalsIgnoreCase(chart.getChartType(), "bar")) { return new ModelAndView("/bi/chart/kendo/bar", modelMap); } else if (StringUtils.equalsIgnoreCase(chart.getChartType(), "stacked_area")) { return new ModelAndView("/bi/chart/kendo/stacked_area", modelMap); } else if (StringUtils.equalsIgnoreCase(chart.getChartType(), "stackedbar")) { return new ModelAndView("/bi/chart/kendo/stackedbar", modelMap); } } String x_view = ViewProperties.getString("kendo.chart"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/bi/chart/kendo/chart", modelMap); }
From source file:com.moviejukebox.tools.OverrideTools.java
/** * Generic method for updating the priority map * * @param priorityMap The map to update//from w w w .ja v a2 s . com * @param pluginName The name of the plugin to replace * @param videoType The type of the video: TV/Movie - used for the log message * @param overrideFlag The flag to override * @param sources The list of sources */ private static void putPriorities(Map<OverrideFlag, List<String>> priorityMap, String pluginName, String videoType, OverrideFlag overrideFlag, String sources) { List<String> priorities; if (StringUtils.isBlank(sources)) { priorities = Collections.emptyList(); } else { String newSources = sources.toUpperCase(); if (newSources.contains(TYPE_PLUGIN) && !newSources.contains(pluginName)) { // replace pattern with database plugin newSources = newSources.replace(TYPE_PLUGIN, pluginName); } if (newSources.contains(TYPE_ALTERNATE)) { if (StringTools.isValidString(ALTERNATE_PLUGIN) && !newSources.contains(ALTERNATE_PLUGIN)) { // replace pattern with alternate plugin newSources = newSources.replace(TYPE_ALTERNATE, ALTERNATE_PLUGIN); } else if (!newSources.contains(IMDB_PLUGIN)) { // cause: most plugins extend the IMDB plugin newSources = newSources.replace(TYPE_ALTERNATE, IMDB_PLUGIN); } } priorities = new ArrayList<>(Arrays.asList(newSources.split(","))); priorities.remove(TYPE_PLUGIN); priorities.remove(TYPE_ALTERNATE); LOG.debug("{} ({}) priorities {}", overrideFlag.name(), videoType, priorities.toString().toLowerCase()); } priorityMap.put(overrideFlag, priorities); }
From source file:com.funambol.LDAP.engine.source.AbstractLDAPSyncSource.java
/** * @param List <syncItem> syncItems * @return/*from w w w . j av a 2s . c o m*/ */ private SyncItemKey[] extractKeys(List<SyncItem> syncItems) { logger.info("extractKeys(" + syncItems.toString() + ")"); SyncItemKey[] keys = new SyncItemKey[syncItems.size()]; /* Iterator<SyncItem> it = syncItems.iterator(); int i = 0; while( it.hasNext() ) { keys[i] = it.next().getKey(); i++; } */ for (int i = 0; i < syncItems.size(); i++) { keys[i] = syncItems.get(i).getKey(); } if (logger.isTraceEnabled()) logger.trace("keys=" + keys.toString()); return keys; }
From source file:gtu._work.ui.ObnfInsertCreaterUI.java
private void processSqlBtnAction() { Map<String, String> wkDataObjectMapCopy = new LinkedHashMap<String, String>(); Map<String, String> wkKeyMapCopy = new LinkedHashMap<String, String>(); DefaultListModel dbFieldListModel = (DefaultListModel) dbFieldList.getModel(); for (Enumeration<?> enu = dbFieldListModel.elements(); enu.hasMoreElements();) { KeyValue kv = (KeyValue) enu.nextElement(); if (kv.pk == false) { wkDataObjectMapCopy.put(kv.key, kv.value); } else {//www . j av a2 s. co m wkKeyMapCopy.put(kv.key, kv.value); } } if (useDomainJarDefineChkBox.isSelected()) { loadJarConfig(); StringBuffer sb = new StringBuffer(); sb.append("PK=>\n"); this.keepKey(wkKeyMapCopy, test.getPkColumns(), sb); sb.append("COLUMN=>\n"); this.keepKey(wkDataObjectMapCopy, test.getColumns(), sb); JCommonUtil._jOptionPane_showMessageDialog_info(sb); for (String key : wkKeyMapCopy.keySet()) { if (StringUtils.isBlank(wkKeyMapCopy.get(key)) && // wkDataObjectMapCopy.containsKey(key) && // StringUtils.isNotBlank(wkDataObjectMapCopy.get(key))) { System.out.println("##pk = " + key + " = " + wkDataObjectMapCopy.get(key)); wkKeyMapCopy.put(key, wkDataObjectMapCopy.get(key)); } } } System.out.println("wkKeyMapCopy = " + wkKeyMapCopy); System.out.println("wkDataObjectMapCopy = " + wkDataObjectMapCopy); String whereCondition = ""; if (!wkKeyMapCopy.isEmpty()) { System.out.println("====> wkKeyMapCopy ? !!!!!!"); whereCondition = wkKeyMapCopy.toString(); } else { whereCondition = wkDataObjectMapCopy.toString(); } whereCondition = whereCondition.replaceAll(",", "' and "); whereCondition = whereCondition.replaceAll("=", "='"); whereCondition = whereCondition.substring(1); whereCondition = whereCondition.substring(0, whereCondition.length() - 1); whereCondition = whereCondition + "'"; String selectSQL = "select * from " + tableName + " where " + whereCondition + ";\n\n"; String updateSetStr = wkDataObjectMapCopy.toString(); updateSetStr = updateSetStr.replaceAll(",", "' ,"); updateSetStr = updateSetStr.replaceAll("=", "='"); updateSetStr = updateSetStr.substring(1); updateSetStr = updateSetStr.substring(0, updateSetStr.length() - 1); updateSetStr = updateSetStr + "'"; String updateSQL = "update " + tableName + " set " + updateSetStr + " where " + whereCondition + ";\n\n"; List<String> insertFieldList = new ArrayList<String>(); List<String> insertValueList = new ArrayList<String>(); for (String key : wkDataObjectMapCopy.keySet()) { insertFieldList.add(key); insertValueList.add(wkDataObjectMapCopy.get(key)); } String inf = insertFieldList.toString(); inf = inf.replaceAll(" ", ""); inf = inf.substring(1, inf.length() - 1); String inv = insertValueList.toString(); inv = inv.replaceAll(" ", ""); inv = inv.replaceAll(",", "','"); inv = inv.substring(1, inv.length() - 1); inv = "'" + inv + "'"; String insertSQL = "insert into " + tableName + " (" + inf + ") values (" + inv + ");\n\n"; insertSqlArea.setText(selectSQL + updateSQL + insertSQL); }
From source file:com.hortonworks.streamline.streams.security.service.SecurityCatalogResource.java
@GET @Path("/acls") @Timed//from w ww .j a v a 2s .c o m public Response listAcls(@Context UriInfo uriInfo, @Context SecurityContext securityContext) throws Exception { Collection<AclEntry> acls; MultivaluedMap<String, String> params = uriInfo.getQueryParameters(); List<QueryParam> queryParams = WSUtils.buildQueryParameters(params); if (params == null || params.isEmpty()) { acls = catalogService.listAcls(); } else { acls = catalogService.listAcls(queryParams); } if (acls != null) { return WSUtils.respondEntities(filter(acls, securityContext), OK); } throw EntityNotFoundException.byFilter(queryParams.toString()); }
From source file:com.seleniumtests.core.aspects.LogAction.java
private String buildReplyValues(Object reply) { List<String> replyList = new ArrayList<>(); if (reply == null) { return "null"; }//from ww w . j a va 2 s. c o m if (reply instanceof CharSequence[]) { for (Object obj : (CharSequence[]) reply) { replyList.add(obj.toString()); } } else if (reply instanceof List) { for (Object obj : (List<?>) reply) { replyList.add(obj.toString()); } } else { replyList.add(reply.toString()); } return replyList.toString(); }
From source file:edu.cornell.mannlib.vitro.webapp.tboxreasoner.impl.jfact.JFactTBoxReasoner.java
private void clearEmptyAxiomStatements() { //Check and see if the model has any empty axiom statements and if so, remove them StmtIterator axiomStatements = filteredAssertionsModel.listStatements(null, RDF.type, ResourceFactory.createResource(OWL.AXIOM)); List<Statement> removeStatements = new ArrayList<Statement>(); while (axiomStatements.hasNext()) { Statement axiomStatement = axiomStatements.nextStatement(); List<Statement> axiomSubjectStatements = filteredAssertionsModel .listStatements(axiomStatement.getSubject(), null, (RDFNode) null).toList(); //if no statements associated with axiom, then add for removal //TODO: Check to make sure the axiom statement is actually CORRECTLY formed as per the OWL api requirements if (axiomSubjectStatements.size() == 1) { removeStatements.add(axiomStatement); }//ww w. j av a2 s .co m } if (removeStatements.size() > 0) { log.warn("The following statements are empty axiom statements and have been removed" + removeStatements.toString()); //Remove the statements from the filtered model filteredAssertionsModel.remove(removeStatements); } else { log.debug("No empty axiom statements were found"); } }
From source file:edu.wpi.margrave.MCommunicator.java
private static MExploreCondition handleAtomicFormula(Node n, List<String> bound) { List<String> relationNameComponents = getRelationNameFromAtomicFmla(n); List<MTerm> terms = getTermsFromAtomicFmla(n, bound); ///////////////////////////////////////////////////// // Could be:/* w ww . j av a 2 s. co m*/ // (1) compound relation name, e.g. pol.idbname // (2) EDB name // (3) view name (really an idb!) writeToLog("\nAtomic-Formula: \nrelationNameComponents: " + relationNameComponents + "\nterms: " + terms.toString()); if (relationNameComponents.size() < 1) throw new MUserException("Unable to obtain relation name in atomic formula."); String relationName = relationNameComponents.get(relationNameComponents.size() - 1); if (relationNameComponents.size() == 1) { MIDBCollection pol = MEnvironment.getPolicyOrView(relationName); writeToLog("\n relationName: " + relationName + "\npol: " + pol + "\n\n"); ///////////////////////////////////////////////////// // (3) view? if (pol != null) { Formula idbf = MEnvironment.getOnlyIDB(relationName); if (idbf != null) { // Perform variable substitution writeToLog("\nView IDB before substitution: " + idbf); idbf = performSubstitution(relationName, pol, idbf, terms); // Assemble MExploreCondition object writeToLog("\nNew Explore condition (view): " + idbf); return new MExploreCondition(idbf, pol, relationName, terms); } } ///////////////////////////////////////////////////// // (2) EDB, then! // We don't have a vocabulary yet. So just make the relation. // The manager will prevent duplicates. Relation rel = MFormulaManager.makeRelation(relationName, terms.size()); Expression termvector; Formula f = null; termvector = MFormulaManager.makeTermTuple(terms); f = MFormulaManager.makeAtom(termvector, rel); // No variable substitution needed! writeToLog("\nNew Explore condition (EDB): " + f); return new MExploreCondition(f, rel, terms); } ///////////////////////////////////////////////////// // (1) compound relation name (reference to a policy, etc.) String collName = ""; for (int ii = 0; ii < relationNameComponents.size() - 1; ii++) { collName += relationNameComponents.get(ii); } MIDBCollection pol = MEnvironment.getPolicyOrView(collName); if (pol == null) throw new MUserException("Unknown policy: " + collName); // throws exception rather than returning null Formula idbf = validateDBIdentifier(collName, relationName); // Substitute variables in policy's IDB for terms in query writeToLog("\nNon-view IDB before substitution: " + idbf); idbf = performSubstitution(relationName, pol, idbf, terms); MCommunicator.writeToLog("\nSAW TERMS: " + terms); writeToLog("\nNew Explore condition (non-view IDB): " + idbf); return new MExploreCondition(idbf, pol, relationName, terms); }