List of usage examples for java.lang Boolean toString
public static String toString(boolean b)
From source file:com.lexicalintelligence.admin.add.AddEntryRequest.java
public AddResponse execute() { List<BasicNameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("name", entry.getName())); params.add(new BasicNameValuePair("synonym", entry.getSynonym())); params.add(new BasicNameValuePair("matchWordOrder", Boolean.toString(entry.isOrderSensitive()))); params.add(new BasicNameValuePair("caseSensitive", Boolean.toString(entry.isCaseSensitive()))); params.add(new BasicNameValuePair("matchStopwords", Boolean.toString(entry.isMatchStopwords()))); params.add(new BasicNameValuePair("matchPunctuation", Boolean.toString(entry.isMatchPunctuation()))); params.add(new BasicNameValuePair("stem", Boolean.toString(entry.isStemmed()))); AddResponse addResponse;/*from ww w . ja va 2s . c om*/ Reader reader = null; try { HttpResponse response = client.getHttpClient().execute(new HttpGet(client.getUrl() + PATH + getPath() + "?" + URLEncodedUtils.format(params, StandardCharsets.UTF_8))); reader = new InputStreamReader(response.getEntity().getContent(), StandardCharsets.UTF_8); addResponse = new AddResponse(Boolean.valueOf(IOUtils.toString(reader))); } catch (Exception e) { addResponse = new AddResponse(false); log.error(e); } finally { try { reader.close(); } catch (Exception e) { log.error(e); } } return addResponse; }
From source file:com.trackplus.ddl.DataReader.java
public static void writeDataToSql(DatabaseInfo databaseInfo, String dirName) throws DDLException { LOGGER.info("Exporting SQL data from \"" + databaseInfo.getUrl() + "\" ..."); Map<String, String> info = new TreeMap<String, String>(); java.util.Date d1 = new java.util.Date(); info.put("start", d1.toString()); info.put("driver", databaseInfo.getDriver()); info.put("url", databaseInfo.getUrl()); info.put("user", databaseInfo.getUser()); info.put("user", databaseInfo.getUser()); info.put("usePassword", Boolean.toString(databaseInfo.getPassword() != null)); String databaseType = MetaDataBL.getDatabaseType(databaseInfo.getUrl()); info.put(DATABASE_TYPE, databaseType); Connection connection = getConnection(databaseInfo); //log the database meta data information's logDatabaseMetaDataInfo(databaseInfo, connection); String[] versions = MetaDataBL.getVersions(connection); info.put(SYSTEM_VERSION, versions[0]); info.put(DB_VERSION, versions[1]);//from ww w . j av a 2s. c om StringValueConverter stringValueConverter = new GenericStringValueConverter(); BufferedWriter writer = createBufferedWriter(dirName + File.separator + FILE_NAME_DATA); BufferedWriter writerUpdate = createBufferedWriter(dirName + File.separator + FILE_NAME_DATA_UPDATE); BufferedWriter writerClean = createBufferedWriter(dirName + File.separator + FILE_NAME_DATA_CLEAN); BufferedWriter writerUpdateClean = createBufferedWriter( dirName + File.separator + FILE_NAME_DATA_UPDATE_CLEAN); BufferedWriter writerBlob = createBufferedWriter(dirName + File.separator + FILE_NAME_BLOB); int idx = 0; String[] tableNames = MetaDataBL.getTableNames(); for (String tableName : tableNames) { LOGGER.debug("Processing table: " + tableName + "...."); int count = getTableData(writer, writerClean, writerUpdate, writerUpdateClean, connection, tableName, stringValueConverter); info.put("_" + tableName, count + ""); LOGGER.debug("Records exported:" + count + "\n"); idx = idx + count; } LOGGER.debug("Processing blob data ...."); int count = getBlobTableData(writerBlob, connection); LOGGER.debug(" Blob record exported:" + count + "\n"); info.put("table_BLOB", count + ""); idx = idx + count; try { char dataSeparator = (char) ASCII_DATA_SEPARATOR; writerBlob.write(dataSeparator); writerBlob.newLine(); writerBlob.newLine(); writerBlob.write("--TMSPROJECTEXCHANGE"); writerBlob.newLine(); } catch (IOException e) { LOGGER.error("Error on close blob stream file :" + e.getMessage()); throw new DDLException(e.getMessage(), e); } LOGGER.debug("Processing clob data ...."); count = getClobTableData(writerBlob, connection); LOGGER.debug(" Clob record exported:" + count + "\n"); info.put("table_TMSPROJECTEXCHANGE", count + ""); idx = idx + count; info.put("allData", idx + ""); try { writer.flush(); writer.close(); writerClean.flush(); writerClean.close(); writerUpdate.flush(); writerUpdate.close(); writerUpdateClean.flush(); writerUpdateClean.close(); writerBlob.flush(); writerBlob.close(); } catch (IOException e) { LOGGER.error("Error on close stream file: " + e.getMessage()); throw new DDLException(e.getMessage(), e); } try { connection.close(); } catch (SQLException e) { throw new DDLException(e.getMessage(), e); } java.util.Date d2 = new java.util.Date(); long timeSpend = d2.getTime() - d1.getTime(); info.put("timeSpend", Long.toString(timeSpend)); writeInfoToFile(info, dirName + File.separator + FILE_NAME_INFO); LOGGER.info("Data generated. All records found: " + idx + ". Time spend: " + timeSpend + " ms!"); }
From source file:com.adeptj.modules.data.jpa.core.JpaProperties.java
public static Map<String, Object> from(EntityManagerFactoryConfig config) { Map<String, Object> jpaProperties = new HashMap<>(); jpaProperties.put(DDL_GENERATION, config.ddlGeneration()); jpaProperties.put(DDL_GENERATION_MODE, config.ddlGenerationOutputMode()); // DEPLOY_ON_STARTUP must be a string value jpaProperties.put(DEPLOY_ON_STARTUP, Boolean.toString(config.deployOnStartup())); jpaProperties.put(LOGGING_LEVEL, config.loggingLevel()); jpaProperties.put(TRANSACTION_TYPE, config.persistenceUnitTransactionType()); jpaProperties.put(ECLIPSELINK_PERSISTENCE_XML, config.persistenceXmlLocation()); jpaProperties.put(SHARED_CACHE_MODE, config.sharedCacheMode()); jpaProperties.put(VALIDATION_MODE, config.validationMode()); jpaProperties.put(PERSISTENCE_PROVIDER, config.persistenceProviderClassName()); if (config.useExceptionHandler()) { jpaProperties.put(EXCEPTION_HANDLER_CLASS, JpaExceptionHandler.class.getName()); }// www . j a v a 2s . c om // Extra properties are in [key=value] format. jpaProperties.putAll(Stream.of(config.jpaProperties()).filter(StringUtils::isNotEmpty) .map(row -> row.split(EQ)).filter(mapping -> ArrayUtils.getLength(mapping) == 2) .collect(Collectors.toMap(elem -> elem[0], elem -> elem[1]))); return jpaProperties; }
From source file:no.digipost.api.interceptors.Wss4jHandler.java
void setOption(final String key, final boolean value) { options.setProperty(key, Boolean.toString(value)); }
From source file:de.micromata.genome.gwiki.page.search.expr.SearchExpressionContentSearcher.java
@Override public void rebuildIndex(GWikiContext wikiContext, String pageId, boolean full) { Map<String, String> args = new HashMap<String, String>(); args.put("pageId", pageId == null ? "" : pageId); args.put("full", Boolean.toString(full)); wikiContext.getWikiWeb().getSchedulerProvider().execAsyncOne(wikiContext, SearchExpressionIndexerCallback.class, args); }
From source file:eu.itesla_project.offline.tools.ListOfflineWorkflowsTool.java
@Override public void run(CommandLine line) throws Exception { try (OfflineApplication app = new RemoteOfflineApplicationImpl()) { Map<String, OfflineWorkflowStatus> statuses = app.listWorkflows(); Table table = new Table(4, BorderStyle.CLASSIC_WIDE); table.addCell("ID"); table.addCell("Running"); table.addCell("Step"); table.addCell("Time"); for (Map.Entry<String, OfflineWorkflowStatus> entry : statuses.entrySet()) { String workflowId = entry.getKey(); OfflineWorkflowStatus status = entry.getValue(); Duration remaining = null; if (status.getStartTime() != null) { remaining = Duration.millis(status.getStartParameters().getDuration() * 60 * 1000) .minus(new Duration(status.getStartTime(), DateTime.now())); }/*from w ww . j av a 2s .c o m*/ table.addCell(workflowId); table.addCell(Boolean.toString(status.isRunning())); table.addCell(status.getStep() != null ? status.getStep().toString() : ""); table.addCell(remaining != null ? PeriodFormat.getDefault().print(remaining.toPeriod()) : ""); } System.out.println(table.render()); } }
From source file:net.bpelunit.framework.ui.ant.BPELUnit.java
@Override public void execute() { checkAttributes();// www .jav a2s . com HashMap<String, String> options = new HashMap<String, String>(); options.put(BPELUnitRunner.HALT_ON_ERROR, Boolean.toString(fHaltOnError)); options.put(BPELUnitRunner.HALT_ON_FAILURE, Boolean.toString(fHaltOnFailure)); BPELUnitAntRunner runner = new BPELUnitAntRunner(fBPELUnitDir, fLoggingList, fOutputList); try { runner.initialize(options); runner.run(fTestSuiteFile); } catch (Exception e) { throw new BuildException(e.getMessage(), e); } }
From source file:br.com.great.resource.ServidorResource.java
/** * Stop no servidor dos jogos/*from w w w .ja va 2s . c om*/ * @return String Informando se True ou False */ @GET @Path("/stopServidor") @Produces("application/json") public String stopServidor() { return Boolean.toString(ServidorJogo.getInstance().StopServidor()); }
From source file:Main.java
/** * Takes an array of booleans and returns all elements assembled in * a {@link String} joined by the defined separator. * <br>/*from www . ja v a 2 s. c o m*/ * Example: Create a {@link String} using an {@link boolean[]} * separated by ", ": * <br> * <code> * boolean[] array = {true, true, false}; * <br> * String output = CollectionUtils.join(array, ", "); * <br> * </code> * * @param collection a {@link boolean[]} of objects to join. * @param separator the {@link String} separator used to join the collection. * @return {@link String} joined string. */ public static String join(boolean[] collection, String separator) { String output = ""; for (int i = 0; i < collection.length - 1; i++) { String o = Boolean.toString(collection[i]); output += o + separator; } if (collection.length > 0) output += Boolean.toString(collection[collection.length - 1]); return output; }
From source file:com.soulgalore.crawler.run.AbstractCrawl.java
/** * Create a crawl object, will fetch the args that is needed. * /*from w ww . j a v a 2s. c om*/ * @param args containing needed args * @throws ParseException if the input parameter couldn't be parsed */ public AbstractCrawl(String[] args) throws ParseException { super(args); configuration = CrawlerConfiguration.builder() .setMaxLevels(Integer.parseInt(getLine().getOptionValue(LEVEL, Integer.toString(CrawlerConfiguration.DEFAULT_CRAWL_LEVEL)))) .setVerifyUrls(Boolean.parseBoolean(getLine().getOptionValue(VERIFY, Boolean.toString(CrawlerConfiguration.DEFAULT_SHOULD_VERIFY_URLS)))) .setOnlyOnPath(getLine().getOptionValue(FOLLOW_PATH, "")) .setNotOnPath(getLine().getOptionValue(NO_FOLLOW_PATH, "")) .setRequestHeaders(getLine().getOptionValue(REQUEST_HEADERS, "")) .setStartUrl(getLine().getOptionValue(URL)).build(); }