List of usage examples for java.lang String toString
public String toString()
From source file:edu.cornell.kfs.coa.document.validation.impl.AccountExtensionRule.java
protected Collection<IndirectCostRecoveryRateDetail> findIndirectCostRecoveryRateDetails(String fiscalYear, String icrSeriesId) {//from w w w . j a v a 2 s. com Map<String, String> criteria = new HashMap<>(); criteria.put(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, fiscalYear.toString()); criteria.put(KFSPropertyConstants.FINANCIAL_ICR_SERIES_IDENTIFIER, icrSeriesId); return getBoService().findMatching(IndirectCostRecoveryRateDetail.class, criteria); }
From source file:com.square.core.dao.implementations.PersonnePhysiqueDaoImplementation.java
@SuppressWarnings("unchecked") @Override/* ww w . j ava 2 s. c o m*/ public List<PersonnePhysique> recherchePersonneParRequete(String requete) { final org.hibernate.Query query = createQuery(requete.toString()); return (List<PersonnePhysique>) query.list(); }
From source file:edu.harvard.i2b2.analysis.dataModel.TimelineFactory.java
public static String generateTimelineData(String result, ArrayList<TimelineRow> rows, boolean writeFile, boolean displayAll, boolean displayDemographics) { try {//w ww . j a v a 2s .c om PDOResponseMessageModel pdoresponsefactory = new PDOResponseMessageModel(); StatusType statusType = pdoresponsefactory.getStatusFromResponseXML(result); if (!statusType.getType().equalsIgnoreCase("DONE")) { return "error"; } StringBuilder resultFile = new StringBuilder(); resultFile.append(GetTimelineHeader()); PatientSet patientDimensionSet = pdoresponsefactory.getPatientSetFromResponseXML(result); if (patientDimensionSet != null) { log.debug("Total patient: " + patientDimensionSet.getPatient().size()); // for(int i=0; // i<patientDimensionSet.getPatientDimension().size();i++) { // PatientDimensionType patientType = // patientDimensionSet.getPatientDimension().get(i); // System.out.println("PatientNum: " + // patientType.getPatientNum()); // } } else { return "error"; } // / testing the visit set // PatientDataType.VisitDimensionSet visitSet = // pdoresponsefactory.getVisitSetFromResponseXML(result); // System.out.println("Total visits: "+visitSet.getVisitDimension(). // size()); List<ObservationSet> factSets = pdoresponsefactory.getFactSetsFromResponseXML(result); log.debug("\nGenerate lld:"); for (int i = 0; i < patientDimensionSet.getPatient().size(); i++) { PatientType patientType = patientDimensionSet.getPatient().get(i); String pnum = patientType.getPatientId().getValue(); // Integer pnum = new Integer(snum); // log.debug("PatientNum: " + snum); if (displayDemographics) { resultFile.append(getTimelinePatientString(pnum.toString(), patientType)); } else { resultFile.append(getTimelinePatientString(pnum.toString())); } String path = null; TimelineRow currentRow = null; ObservationSet observationFactSet = null; for (int j = 0; j < rows.size(); j++) { TimelineRow row = rows.get(j); int total = 0; StringBuilder resultString = new StringBuilder(); // loop thru all the pdo sets for this row here for (int s = 0; s < row.pdoItems.size(); s++) { PDOItem pset = row.pdoItems.get(s); observationFactSet = null; for (int m = 0; m < factSets.size(); m++) { ObservationSet tmpFactSet = factSets.get(m); if (tmpFactSet.getPanelName().equalsIgnoreCase(pset.fullPath)) { observationFactSet = tmpFactSet; path = observationFactSet.getPanelName(); currentRow = row; break; } } if (observationFactSet == null) { continue; } XMLGregorianCalendar curStartDate = null; for (int k = 0; k < observationFactSet.getObservation().size(); k++) { ObservationType obsFactType = observationFactSet.getObservation().get(k); if (pnum.equals(obsFactType.getPatientId().getValue())) { /* if ((curStartDate != null) && (obsFactType.getStartDate().compare( curStartDate) == DatatypeConstants.EQUAL)) { continue; } */ String sStart_date = obsFactType.getStartDate().getMonth() + "-" + obsFactType.getStartDate().getDay() + "-" + obsFactType.getStartDate().getYear() + " 12:00"; String sEnd_date; if (obsFactType.getEndDate() == null) { sEnd_date = sStart_date; } else { sEnd_date = obsFactType.getEndDate().getMonth() + "-" + obsFactType.getEndDate().getDay() + "-" + obsFactType.getEndDate().getYear() + " 12:00"; } double nval = -1; if (obsFactType.getNvalNum().getValue() != null) { nval = obsFactType.getNvalNum().getValue().doubleValue(); } PDOValueData valdp = null; if (pset.hasValueDisplayProperty) { for (int n = 0; n < pset.valDisplayProperties.size(); n++) { PDOValueData tmpvaldp = pset.valDisplayProperties.get(n); // if (tmpvaldp.inRange(nval)) { valdp = tmpvaldp; // break; // } } String sValue = getSValue(row.displayName, obsFactType, true); if ((curStartDate != null) && (obsFactType.getStartDate() .compare(curStartDate) == DatatypeConstants.EQUAL)) { resultString.append(getTimelineDateStringHeight(sStart_date, sEnd_date, "slateblue", valdp.height, sValue)); } else { resultString.append(getTimelineDateStringHeight(sStart_date, sEnd_date, valdp.color, valdp.height, sValue)); } } else { String sValue = getSValue(row.displayName, obsFactType, false); if ((curStartDate != null) && (obsFactType.getStartDate() .compare(curStartDate) == DatatypeConstants.EQUAL)) { resultString.append(getTimelineDateStringHeight(sStart_date, sEnd_date, "slateblue", pset.height, sValue)); } else { resultString.append(getTimelineDateStringHeight(sStart_date, sEnd_date, pset.color, pset.height, sValue)); } } total++; curStartDate = obsFactType.getStartDate(); } } } if (total > 0) { // log.debug("-- "+path+" has "+total+" events"); resultFile.append(getTimelineConceptString(row.displayName, total)); // log.debug(resultString.toString()); resultFile.append(resultString); } else { // display all if (displayAll) { // log.debug("-- "+path+" has "+total+" events"); resultFile.append(getTimelineConceptString(row.displayName, 1)); // log.debug(getTimelineEmptyDateString()); resultFile.append(getTimelineEmptyDateString()); } } } } resultFile.append(GetTimelineFooter()); if (writeFile) { String i2b2File = System.getProperty("user.dir") + "/temp/" + "i2b2xml.lld"; File oDelete = new File(i2b2File); if (oDelete != null) oDelete.delete(); RandomAccessFile f = new RandomAccessFile(i2b2File, "rw"); append(f, resultFile.toString()); f.close(); } // log.debug("\nThe lld file: \n"+resultFile.toString()); return resultFile.toString(); } catch (org.apache.axis2.AxisFault e) { e.printStackTrace(); log.error(e.getMessage()); return null; } catch (Exception e) { log.error(e.getMessage()); e.printStackTrace(); return "error"; } }
From source file:com.github.jknack.handlebars.TemplateLoader.java
/** * Load the template from a template repository. * * @param uri The resource's uri. Required. * @return The requested resource./*from ww w. j a va2 s . c o m*/ * @throws IOException If the resource cannot be loaded. */ public Reader load(final URI uri) throws IOException { notNull(uri, "The uri is required."); notEmpty(uri.toString(), "The uri is required."); String location = resolve(normalize(uri.toString())); Handlebars.debug("Loading resource: %s", location); Reader reader = read(location); if (reader == null) { throw new FileNotFoundException(location.toString()); } Handlebars.debug("Resource found: %s", location); return reader; }
From source file:com.opensoc.test.AbstractConfigTest.java
protected String[] readTestDataFromFile(String test_data_url) throws Exception { BufferedReader br = new BufferedReader(new FileReader(new File(test_data_url))); ArrayList<String> inputDataLines = new ArrayList<String>(); String line; while ((line = br.readLine()) != null) { System.out.println(line); inputDataLines.add(line.toString().replaceAll("\n", "")); }//from w w w . j av a 2s .c o m br.close(); String[] inputData = new String[inputDataLines.size()]; inputData = inputDataLines.toArray(inputData); return inputData; }
From source file:fi.helsinki.cs.iot.hub.api.handlers.feeds.FeedGetRequestHandler.java
@Override public Response handleRequest(IotHubRequest uri) { Log.d(TAG, "Received a request for feeds, uri: " + uri.getFullUri()); switch (uri.getIdentifiers().size()) { case 0:/* w w w. jav a 2s .co m*/ // Case where we just want to list the meta of all the feeds // TODO make the possibility of filtering the feeds JSONArray jFeedList = getFeedList(); if (jFeedList != null) { Log.d(TAG, "Returns a list of feeds"); return getResponseOk(jFeedList.toString()); } else { return getResponseKo(ERROR, "The list of feeds could not be retrieved"); } // Case of a particular feed (we can return) case 1: String feedname = uri.getIdentifiers().get(0); Feed feed = IotHubDataAccess.getInstance().getFeed(feedname); boolean doMeta = uri.getOptions().containsKey("meta"); if (feed == null) { return super.getResponseKo(ERROR, "The feed " + feedname + " could not be retrieved"); } else if (doMeta) { String jResponse = feed.getDescription(); if (jResponse != null) { Log.d(TAG, "Returns the feed's meta"); return getResponseOk(jResponse.toString()); } else { Log.e(TAG, "The feed's meta could not be retrieved"); return getResponseKo(ERROR, "The feed's meta could not be retrieved"); } } else { switch (feed.getFeedType()) { case COMPOSED: boolean doStorage = uri.getOptions().containsKey("storage"); return handleComposedFeed(feed, doStorage); case EXECUTABLE: return handleExecutableFeed(feed); case ATOMIC: return handleAtomicFeed(feed); default: return super.getResponseKo(ERROR, "The feed type is not supported yet"); } } default: return super.getResponseKo(WRONG_URI, "The uri is inappropriate"); } }
From source file:net.padlocksoftware.padlock.DefaultMacAddressProvider.java
private Set<String> useShellToFindAddresses() { logger.fine("Platform: " + PLATFORM); if (PLATFORM == Platform.Unknown) { logger.fine("Could not determine host platform, no Network Interfaces found."); return null; }/*from w w w . j av a 2s. c o m*/ BufferedReader reader = null; try { Process conf = Runtime.getRuntime().exec(PLATFORM.command); reader = new BufferedReader(new InputStreamReader(conf.getInputStream())); Set<String> macs = new HashSet<String>(4); String regex = "[a-f0-9]{2}([:-][a-f0-9]{2}){5}"; Pattern pattern = Pattern.compile(regex.toString(), Pattern.CASE_INSENSITIVE); String line = reader.readLine(); do { logger.finer("Found line: " + line); Matcher matcher = pattern.matcher(line); while (matcher.find()) { String address = matcher.group(0); address = address.trim().replaceAll("[:-]", ""); logger.fine("Found address: " + address); if (address.length() == 11) address = "0" + address; if (address.length() == 12) { byte[] hex = Hex.decodeHex(address.toCharArray()); if (permitVMAddresses || !isVirtualAddress(hex)) { macs.add(address); } else logger.fine("Found blacklisted address: " + address); } else logger.fine("Found bogus address: " + address); } line = reader.readLine(); } while (line != null); return Collections.unmodifiableSet(macs); } catch (Throwable t) { logger.log(Level.FINE, null, t); return Collections.emptySet(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { logger.log(Level.FINE, null, e); } } } }
From source file:com.ery.estorm.cluster.tracker.BackMasterTracker.java
@Override public void nodeDeleted(String path) { if (path.startsWith(watcher.estormBackupMasterAddressesZNode + "/")) { String serverName = ZKUtil.getNodeName(path); LOG.info("MasterServer ephemeral node deleted, processing expiration [" + serverName + "]"); ServerInfo sn = this.masterServers.remove(serverName); if (!serverManager.isMasterServerOnline(sn)) { LOG.warn(serverName.toString() + " is not online or isn't known to the master." + "The latter could be caused by a DNS misconfiguration."); return; }// w ww . j a v a 2 s . c o m if (!sn.equals(master.getActiveMaster())) { this.serverManager.expireServer(sn); } } }
From source file:com.globalsight.everest.webapp.pagehandler.qachecks.DitaQaReportsHandler.java
@ActionHandler(action = ACTION_DOWNLOAD, formClass = "") public void downloadReports(HttpServletRequest p_request, HttpServletResponse p_response, Object form) throws Exception { String taskIdStr = p_request.getParameter("taskId"); long taskId = Long.parseLong(taskIdStr); String selReports = p_request.getParameter(SELECT_REPORTS); Set<File> reports = getSelectedReports(selReports, false); if (reports.size() == 1) { ReportHelper.sendFiles(reports, null, p_response, false); } else {//from ww w .j a va 2s . c o m File zipFile = new File(ZIP_FILENAME + ".zip"); Task task = TaskHelper.getTask(taskId); File folder = DITAQACheckerHelper.getReportFileDir(task); if (folder.exists()) { folder = folder.getParentFile(); } String excludePath = folder.getAbsolutePath(); ZipIt.addEntriesToZipFile(zipFile, reports, excludePath.toString(), ""); File[] files = { zipFile }; ReportHelper.sendFiles(files, null, p_response, true); } pageReturn(); }
From source file:com.redhat.rhn.manager.kickstart.KickstartUrlHelper.java
/** * Get the url path portion for this kickstart that is used * during a Kickstart Session that tracks the downloads. * * Computes://from w w w.ja va2 s. c om * /ks/dist/session/35x45fed383beaeb31a184166b4c1040633/ks-f9-x86_64 * * reformated to a tinyurl: * * /ty/xZ38 * * @param session to compute tracking URL for. * @param date for tiny url track * * @return String url to this KickstartData's media (packages, kernel * etc...) */ public String getKickstartMediaPath(KickstartSession session, Date date) { log.debug("Formatting for session use."); // /ks/dist/session/ // 94xe86321bae3cb74551d995e5eafa065c0/ks-rhel-i386-as-4-u2 String file = getLongMediaPath(session); TinyUrl turl = CommonFactory.createTinyUrl(file.toString(), date); CommonFactory.saveTinyUrl(turl); log.debug("returning: " + turl.computeTinyPath()); return turl.computeTinyPath(); }