Example usage for java.lang Boolean parseBoolean

List of usage examples for java.lang Boolean parseBoolean

Introduction

In this page you can find the example usage for java.lang Boolean parseBoolean.

Prototype

public static boolean parseBoolean(String s) 

Source Link

Document

Parses the string argument as a boolean.

Usage

From source file:io.github.swagger2markup.internal.component.TableComponent.java

@Override
public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, Parameters params) {
    DataFrame dataFrame = params.dataFrame;
    java.util.List<MarkupTableColumn> columnSpecs = dataFrame.getColumns().map(column -> {
        Integer widthRatio = Integer.valueOf(column.getMetaData().get(WIDTH_RATIO).getOrElse("0"));
        return new MarkupTableColumn(column.getId().getName()).withWidthRatio(widthRatio)
                .withHeaderColumn(/*from   w w w  .jav a 2 s  .c o m*/
                        Boolean.parseBoolean(column.getMetaData().get(HEADER_COLUMN).getOrElse("false")))
                .withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^" + widthRatio);
    }).toJavaList();

    IndexedSeq<IndexedSeq<String>> columnValues = dataFrame.getColumns()
            .map(column -> ((StringColumn) column).getValues());

    java.util.List<java.util.List<String>> cells = Array.range(0, dataFrame.getRowCount())
            .map(rowNumber -> columnValues.map(values -> values.get(rowNumber)).toJavaList()).toJavaList();

    return markupDocBuilder.tableWithColumnSpecs(columnSpecs, cells);
}

From source file:edu.harvard.i2b2.fhir.server.ServerConfigs.java

public ServerConfigs() {
    if (configC == null) {
        try {//from   w w w  . j a  v  a  2  s .  c  o  m
            configC = new CompositeConfiguration();

            configC.addConfiguration(new SystemConfiguration());
            if (ServerConfigs.class.getResourceAsStream("/confidential.properties") != null) {
                logger.info("using confidential.properties");
                configC.addConfiguration(new PropertiesConfiguration("confidential.properties"));
            } else {
                logger.info("using application.properties");
                configC.addConfiguration(new PropertiesConfiguration("/application.properties"));

            }

            openAccess = Boolean.parseBoolean(GetString(ConfigParameter.openAccess));
            maxQueryThreads = Integer.parseInt(GetString(ConfigParameter.maxQueryThreads));

            logger.info("initialized:" + configC.toString());
            /*
             * logger.info("initialized:" + "\ni2b2Url:" + i2b2Url +
             * "\ndemoAccessToken:" + openAccessToken + "\n openAccess:" +
             * openAccess + "\nmaxQueryThreads" + maxQueryThreads +
             * "\ndemoConfidentialClientId:" + demoConfidentialClientId +
             * "\ndemoConfidentialClientSecret" +
             * demoConfidentialClientSecret);
             */
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
    }
}

From source file:net.rrm.ehour.EhourServer.java

private boolean isInTestMode() {
    return Boolean.parseBoolean(System.getProperty("EHOUR_TEST", "false"));
}

From source file:de.awtools.config.AbstractGlueConfig.java

public final boolean getBool(final String key, final boolean defaultValue) {
    String bool = getString(key);
    boolean result = defaultValue;
    if (StringUtils.isNotBlank(bool)) {
        result = Boolean.parseBoolean(bool);
    }//from  w  ww  .j a  va2  s  .c om
    return result;
}

From source file:com.seer.datacruncher.streams.XMLEXIStreamTest.java

@Test
public void testXMLEXIStream() {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {//  w ww  .j a va  2s .  com
        InputStream in = this.getClass().getClassLoader()
                .getResourceAsStream(stream_file_path + xml_stream_file_name);
        EXI.encodeXmlToEXI(in, baos);
    } catch (SAXException e) {
        assertTrue("SAXException while exi generation", false);
    } catch (IOException e) {
        assertTrue("IOException while exi generation", false);
    } catch (EXIException e) {
        assertTrue("EXI Exception while exi generation", false);
    }
    DatastreamsInput datastreamsInput = new DatastreamsInput();
    String res = datastreamsInput.datastreamsInput(null, (Long) schemaEntity.getIdSchema(), baos.toByteArray(),
            true);
    assertTrue("XMLEXI-Stream validation failed", Boolean.parseBoolean(res));
}

From source file:com.cerebro.provevaadin.smtp.ConfigurazioneSMTP.java

public ConfigurazioneSMTP() {

    this.setMargin(true);

    TextField smtpHost = new TextField("SMTP Host Server");
    smtpHost.setRequired(true);/*from  www.  j av  a2 s. com*/
    TextField smtpPort = new TextField("SMTP Port");
    smtpPort.setRequired(true);
    TextField smtpUser = new TextField("SMTP Username");
    smtpUser.setRequired(true);
    TextField smtpPwd = new TextField("SMTP Password");
    smtpPwd.setRequired(true);
    TextField pwdConf = new TextField("Conferma la Password");
    pwdConf.setRequired(true);
    CheckBox security = new CheckBox("Sicurezza del server");

    Properties props = new Properties();
    InputStream config = VaadinServlet.getCurrent().getServletContext()
            .getResourceAsStream("/WEB-INF/config.properties");
    if (config != null) {
        System.out.println("Carico file di configurazione");
        try {
            props.load(config);
        } catch (IOException ex) {
            Logger.getLogger(ConfigurazioneSMTP.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
    smtpHost.setValue(props.getProperty("smtp_host"));
    smtpUser.setValue(props.getProperty("smtp_user"));
    security.setValue(Boolean.parseBoolean(props.getProperty("smtp_sec")));

    Button salva = new Button("Salva i parametri");
    salva.addClickListener((Button.ClickEvent event) -> {
        System.out.println("Salvo i parametri SMTP");
        if (smtpHost.isValid() && smtpPort.isValid() && smtpUser.isValid() && smtpPwd.isValid()
                && smtpPwd.getValue().equals(pwdConf.getValue())) {
            props.setProperty("smtp_host", smtpHost.getValue());
            props.setProperty("smtp_port", smtpPort.getValue());
            props.setProperty("smtp_user", smtpUser.getValue());
            props.setProperty("smtp_pwd", smtpPwd.getValue());
            props.setProperty("smtp_sec", security.getValue().toString());
            String webInfPath = VaadinServlet.getCurrent().getServletConfig().getServletContext()
                    .getRealPath("WEB-INF");
            File f = new File(webInfPath + "/config.properties");
            try {
                OutputStream o = new FileOutputStream(f);
                try {
                    props.store(o, "Prova");
                } catch (IOException ex) {
                    Logger.getLogger(ConfigurazioneSMTP.class.getName()).log(Level.SEVERE, null, ex);
                }
            } catch (FileNotFoundException ex) {
                Logger.getLogger(ConfigurazioneSMTP.class.getName()).log(Level.SEVERE, null, ex);
            }
            Notification.show("Parametri salvati");
        } else {
            Notification.show("Ricontrolla i parametri");
        }

    });

    TextField emailTest = new TextField("Destinatario Mail di Prova");
    emailTest.setImmediate(true);
    emailTest.addValidator(new EmailValidator("Mail non valida"));

    Button test = new Button("Invia una mail di prova");
    test.addClickListener((Button.ClickEvent event) -> {
        System.out.println("Invio della mail di prova");
        if (emailTest.isValid()) {
            try {
                System.out.println("Invio mail di prova a " + emailTest.getValue());
                HtmlEmail email = new HtmlEmail();
                email.setHostName(props.getProperty("smtp_host"));
                email.setSmtpPort(Integer.parseInt(props.getProperty("smtp_port")));
                email.setSSLOnConnect(Boolean.parseBoolean(props.getProperty("smtp_sec")));
                email.setAuthentication(props.getProperty("smtp_user"), props.getProperty("smtp_pwd"));
                email.setFrom("prova@prova.it");
                email.setSubject("Mail di prova");
                email.addTo(emailTest.getValue());
                email.setHtmlMsg("This is the message");
                email.send();
            } catch (EmailException ex) {
                Logger.getLogger(ConfigurazioneSMTP.class.getName()).log(Level.SEVERE, null, ex);
            }

        } else {
            Notification.show("Controlla l'indirizzo mail del destinatario");
        }
    });

    this.addComponents(smtpHost, smtpPort, smtpUser, smtpPwd, pwdConf, security, salva, emailTest, test);

}

From source file:com.neupane.springJDBC.DAO.Impl.CustomerDAOImpl.java

@Override
public List<Customer> getAll() throws ClassNotFoundException, SQLException {
    String sql = "SELECT * FROM customer";
    return jdbcTemplet.query(sql, new RowMapper<Customer>() {

        @Override//from  w  ww  . ja v a  2  s . c  om
        public Customer mapRow(ResultSet rs, int i) throws SQLException {
            Customer cust = new Customer();
            cust.setCustomerId(rs.getInt("id"));
            cust.setFirstName(rs.getString("first_name"));
            cust.setLastName(rs.getString("last_name"));
            cust.setAddress(rs.getString("address"));
            cust.setEmail(rs.getString("email"));
            cust.setContact(rs.getInt("contact"));
            cust.setStatus(Boolean.parseBoolean(rs.getString("status")));
            return cust;
        }
    });
}

From source file:jetbrains.buildServer.projectPush.ProjectPushSettingsController.java

@Nullable
@Override/*from   ww  w.j  av a 2s .c  om*/
protected ModelAndView doHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response)
        throws Exception {
    if (!isGet(request))
        return null;

    final String disable = request.getParameter("disable");
    if (disable != null) {
        mySettings.setDisabled(Boolean.parseBoolean(disable));
    }

    final String sandboxProjectId = request.getParameter("sandboxProjectId");
    if (sandboxProjectId != null && !sandboxProjectId.isEmpty())
        mySettings.setSandboxProjectId(sandboxProjectId);

    final ModelAndView view = new ModelAndView(myPluginDescriptor.getPluginResourcesPath("admin-page.jsp"));
    view.getModel().put("settings",
            new ProjectPushSettingsBean(
                    myProjectManager.findProjectByExternalId(mySettings.getSandboxProjectId()),
                    mySettings.isDisabled()));
    view.getModel().put("projects", ProjectHierarchyBean.getProjectsFor(myProjectManager));
    return view;
}

From source file:edumsg.core.commands.list.CreateListMembersCommand.java

@Override
public void execute() {

    try {//  w  w w  . ja  va  2  s .co m
        dbConn = PostgresConnection.getDataSource().getConnection();
        dbConn.setAutoCommit(true);
        proc = dbConn.prepareCall("{call create_list_with_members(?,?,?,?,now()::TIMESTAMP ,?)}");
        proc.setPoolable(true);
        proc.registerOutParameter(1, Types.OTHER);
        proc.setString(1, map.get("name"));
        proc.setString(2, map.get("description"));
        proc.setString(3, map.get("session_id"));
        proc.setBoolean(4, Boolean.parseBoolean(map.get("private")));
        Array array = dbConn.createArrayOf("varchar", map.get("members").split(""));
        proc.setArray(5, array);

        proc.execute();

        root.put("app", map.get("app"));
        root.put("method", map.get("method"));
        root.put("status", "ok");
        root.put("code", "200");
        try {
            CommandsHelp.submit(map.get("app"), mapper.writeValueAsString(root), map.get("correlation_id"),
                    LOGGER);
        } catch (JsonGenerationException e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
        } catch (JsonMappingException e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
        }
    } catch (PSQLException e) {
        if (e.getMessage().contains("unique constraint")) {
            if (e.getMessage().contains("(name)")) {
                CommandsHelp.handleError(map.get("app"), map.get("method"), "List name already exists",
                        map.get("correlation_id"), LOGGER);
            }
        }
        if (e.getMessage().contains("value too long")) {
            CommandsHelp.handleError(map.get("app"), map.get("method"), "Too long input",
                    map.get("correlation_id"), LOGGER);
        }
        CommandsHelp.handleError(map.get("app"), map.get("method"), "List name already exists",
                map.get("correlation_id"), LOGGER);
        LOGGER.log(Level.SEVERE, e.getMessage(), e);
    } catch (SQLException e) {
        CommandsHelp.handleError(map.get("app"), map.get("method"), "List name already exists",
                map.get("correlation_id"), LOGGER);
        LOGGER.log(Level.SEVERE, e.getMessage(), e);
    } finally {
        PostgresConnection.disconnect(null, proc, dbConn);
    }
}

From source file:com.northernwall.hadrian.db.CouchDataAccess.java

public CouchDataAccess(Properties properties) {
    port = Integer.parseInt(properties.getProperty("couchdb.port", "5984"));
    host = properties.getProperty("couchdb.host", "127.0.0.1");
    CouchDbProperties dbProperties = new CouchDbProperties()
            .setDbName(properties.getProperty("couchdb.name", "soarep"))
            .setCreateDbIfNotExist(Boolean.parseBoolean(properties.getProperty("couchdb.if-not-exist", "true")))
            .setProtocol(properties.getProperty("couchdb.protocol", "http")).setHost(host).setPort(port)
            .setMaxConnections(100).setConnectionTimeout(0);
    dbClient = new CouchDbClient(dbProperties);
    logger.info("Couch access established");

    Map<String, DesignDocument.MapReduce> views = new HashMap<>();

    DesignDocument.MapReduce mapReduce = new DesignDocument.MapReduce();
    mapReduce.setMap(/*  ww w .  j  ava 2  s . co m*/
            "function(doc) {if (doc._id != \"_design/app\" && doc._id != \"SoaConfig\") {emit(doc._id, {_id: doc._id, name: doc.name, date: doc.date, team: doc.team, description: doc.description, state: doc.state, access: doc.access, type: doc.type, imageLogo: doc.imageLogo});}}");
    views.put("services", mapReduce);

    mapReduce = new DesignDocument.MapReduce();
    mapReduce.setMap(
            "function(doc) {if (doc._id != \"_design/app\" && doc._id != \"SoaConfig\") {doc.versions.forEach(function(version) {var refs = version.uses.length + version.usedby.length; emit(null, {serviceId: doc._id, name: doc.name, team: doc.team, state: doc.state, access: doc.access, type: doc.type, versionId: version.api, status: version.status, refs: refs});});}}");
    views.put("versions", mapReduce);

    mapReduce = new DesignDocument.MapReduce();
    mapReduce.setMap(
            "function(doc) {if (doc._id != \"_design/app\" && doc._id != \"SoaConfig\") {doc.versions.forEach(function(version) {version.uses.forEach(function(ref) {emit(null, {serviceId: doc._id, versionId: version.api, refServiceId: ref.service, refVersionId: ref.version, scope: ref.scope});});});}}");
    views.put("refs", mapReduce);

    DesignDocument designDoc = new DesignDocument();
    designDoc.setViews(views);
    designDoc.setId("_design/app");
    designDoc.setLanguage("javascript");
    dbClient.design().synchronizeWithDb(designDoc);

    logger.info("Couch views synced");

    configCached = null;
    configCacheReloadTime = 0;
}