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:com.cerebro.gorgone.commons.SendConfEmail.java

public SendConfEmail(String address, String confCode) {

    logger.info("Invio della mail di conferma");
    // Leggo i parametri di invio
    Properties props = new Properties();
    InputStream config = VaadinServlet.getCurrent().getServletContext()
            .getResourceAsStream("/WEB-INF/config.properties");
    if (config != null) {
        try {//  w  w  w .j  a  v  a2  s  . c om
            logger.info("Carico il file .properties");
            props.load(config);
        } catch (Exception ex) {
            logger.error("Errore nel caricamento del file .properties: " + ex.getMessage());
        }
    }
    smtp_host = props.getProperty(ConfigProperties.SMTP_HOST);
    smtp_port = Integer.getInteger(props.getProperty(ConfigProperties.SMTP_PORT));
    smtp_user = props.getProperty(ConfigProperties.SMTP_USER);
    smtp_pwd = props.getProperty(ConfigProperties.SMTP_PWD);
    smtp_security = Boolean.parseBoolean(ConfigProperties.SMTP_SECURITY);
    // Creo la mail
    HtmlEmail email = new HtmlEmail();
    try {
        email.setHostName(smtp_host);
        email.setSmtpPort(smtp_port);
        email.setSSLOnConnect(smtp_security);
        email.setAuthentication(smtp_user, smtp_pwd);
        email.setFrom("gioco@gioco.com", "Gioco");
        email.setSubject("Conferma il tuo indirizzo email " + confCode);
        email.addTo(address);
        email.setMsg("Messaggio della mail");
        email.send();
        logger.info("Email inviata");
    } catch (EmailException ex) {
        logger.error("Errore nell'invio della mail");
        logger.error(ex.getMessage());
    }
}

From source file:org.openmrs.module.kenyacore.metadata.MetadataManager.java

/**
 * @see org.openmrs.module.kenyacore.ContentManager#refresh()
 *//*w  w w .  ja  v  a  2  s .com*/
@Override
public synchronized void refresh() {
    // Allow skipping of metadata refresh - useful for developers
    if (Boolean.parseBoolean(System.getProperty(SYSTEM_PROPERTY_SKIP_REFRESH))) {
        log.warn("Skipping metadata refresh");
        return;
    }

    // Install bundle components
    deployService.installBundles(Context.getRegisteredComponents(MetadataBundle.class));
}

From source file:com.odoo.orm.ODataRow.java

public Boolean getBoolean(String key) {
    return Boolean.parseBoolean(_data.get(key).toString());
}

From source file:io.vit.vitio.Managers.Parsers.ParseGeneral.java

public Boolean isCached() {
    try {/*from   w  w  w. j a va2s.  c  om*/
        return Boolean.parseBoolean(mResponseObject.getString("cached"));
    } catch (JSONException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:alluxio.cli.fs.command.DeleteLineageCommand.java

@Override
public int run(CommandLine cl) throws AlluxioException, IOException {
    String[] args = cl.getArgs();
    AlluxioLineage tl = AlluxioLineage.get(LineageContext.INSTANCE);
    long lineageId = Long.parseLong(args[0]);
    boolean cascade = Boolean.parseBoolean(args[1]);
    DeleteLineageOptions options = DeleteLineageOptions.defaults().setCascade(cascade);
    tl.deleteLineage(lineageId, options);
    System.out.println("Lineage " + lineageId + " has been deleted.");
    return 0;/*from w ww  .java  2  s  .c om*/
}

From source file:code.google.nfs.rpc.netty.client.NettyClientFactory.java

protected Client createClient(String targetIP, int targetPort, int connectTimeout, String key)
        throws Exception {
    ClientBootstrap bootstrap = new ClientBootstrap(nioClient);
    bootstrap.setOption("tcpNoDelay", Boolean.parseBoolean(System.getProperty("nfs.rpc.tcp.nodelay", "true")));
    bootstrap.setOption("reuseAddress",
            Boolean.parseBoolean(System.getProperty("nfs.rpc.tcp.reuseaddress", "true")));
    if (connectTimeout < 1000) {
        bootstrap.setOption("connectTimeoutMillis", 1000);
    } else {/*from w w  w  .  java 2 s  . c  o m*/
        bootstrap.setOption("connectTimeoutMillis", connectTimeout);
    }
    NettyClientHandler handler = new NettyClientHandler(this, key);
    bootstrap.setPipelineFactory(new NettyClientPipelineFactory(handler));
    ChannelFuture future = bootstrap.connect(new InetSocketAddress(targetIP, targetPort));
    future.awaitUninterruptibly(connectTimeout);
    if (!future.isDone()) {
        LOGGER.error("Create connection to " + targetIP + ":" + targetPort + " timeout!");
        throw new Exception("Create connection to " + targetIP + ":" + targetPort + " timeout!");
    }
    if (future.isCancelled()) {
        LOGGER.error("Create connection to " + targetIP + ":" + targetPort + " cancelled by user!");
        throw new Exception("Create connection to " + targetIP + ":" + targetPort + " cancelled by user!");
    }
    if (!future.isSuccess()) {
        LOGGER.error("Create connection to " + targetIP + ":" + targetPort + " error", future.getCause());
        throw new Exception("Create connection to " + targetIP + ":" + targetPort + " error",
                future.getCause());
    }
    NettyClient client = new NettyClient(future, key, connectTimeout);
    handler.setClient(client);
    return client;
}

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

@Test
public void testXMLStream() {
    DatastreamsInput datastreamsInput = new DatastreamsInput();
    InputStream in = this.getClass().getClassLoader()
            .getResourceAsStream(stream_file_path + xml_stream_file_name);
    StringWriter writer = new StringWriter();
    try {/*w w w .ja v  a  2s .c o  m*/
        IOUtils.copy(in, writer, "UTF-8");
    } catch (IOException e) {
        assertTrue("IOException while xml parsing", false);
    }
    String dataStream = writer.toString();
    String res = datastreamsInput.datastreamsInput(dataStream, (Long) schemaEntity.getIdSchema(), null, true);
    assertTrue("XMLStream validation failed", Boolean.parseBoolean(res));
}

From source file:br.com.i9torpedos.model.service.sms.Modem1Producer.java

@Override
public SerialModemGateway getGatewayConfig() {
    SerialModemGateway gateway = null;//ww w .  j ava 2 s  .  c  o m

    if (gateway == null) {
        try {
            Properties props = new Properties();
            props.load(getClass().getResourceAsStream("/modem1.properties"));
            gateway = new SerialModemGateway(props.getProperty("sms.service.idMoldem"),
                    props.getProperty("sms.service.port"),
                    Integer.parseInt(props.getProperty("sms.service.taxaTransmissao")),
                    props.getProperty("sms.service.fabricante"), props.getProperty("sms.service.modelo"));
            gateway.setInbound(Boolean.parseBoolean(props.getProperty("sms.service.inbound")));
            gateway.setOutbound(Boolean.parseBoolean(props.getProperty("sms.service.outbound")));
            gateway.setSimPin(PIN1);
            gateway.setSimPin2(PIN2);
            gateway.setProtocol(AGateway.Protocols.PDU);

            InboundNotification inboundNotification = new InboundNotification();
            // Create the notification callback method for inbound voice calls.
            CallNotification callNotification = new CallNotification();
            //Create the notification callback method for gateway statuses.
            GatewayStatusNotification statusNotification = new GatewayStatusNotification();
            OrphanedMessageNotification orphanedMessageNotification = new OrphanedMessageNotification();
            OutboundNotification outboundNotification = new OutboundNotification();

            Service.getInstance().setOutboundMessageNotification(outboundNotification);
            Service.getInstance().setInboundMessageNotification(inboundNotification);
            Service.getInstance().setCallNotification(callNotification);
            Service.getInstance().setGatewayStatusNotification(statusNotification);
            Service.getInstance().setOrphanedMessageNotification(orphanedMessageNotification);

            return gateway;

        } catch (IOException e) {

            log.fatal("Falha ao Carregar Arquivo .properties SMSMoldem1Producer " + e.getMessage());

            return null;

        }

    }
    return gateway;

}

From source file:br.com.i9torpedos.model.service.sms.Modem2Producer.java

@Override
public SerialModemGateway getGatewayConfig() {
    SerialModemGateway gateway = null;/*from w  w  w. j  a v a2s . c o m*/

    if (gateway == null) {
        try {
            Properties props = new Properties();
            props.load(getClass().getResourceAsStream("/modem2.properties"));
            gateway = new SerialModemGateway(props.getProperty("sms.service.idMoldem"),
                    props.getProperty("sms.service.port"),
                    Integer.parseInt(props.getProperty("sms.service.taxaTransmissao")),
                    props.getProperty("sms.service.fabricante"), props.getProperty("sms.service.modelo"));
            gateway.setInbound(Boolean.parseBoolean(props.getProperty("sms.service.inbound")));
            gateway.setOutbound(Boolean.parseBoolean(props.getProperty("sms.service.outbound")));
            gateway.setSimPin(PIN1);
            gateway.setSimPin2(PIN2);
            gateway.setProtocol(AGateway.Protocols.PDU);

            InboundNotification inboundNotification = new InboundNotification();
            // Create the notification callback method for inbound voice calls.
            CallNotification callNotification = new CallNotification();
            //Create the notification callback method for gateway statuses.
            GatewayStatusNotification statusNotification = new GatewayStatusNotification();
            OrphanedMessageNotification orphanedMessageNotification = new OrphanedMessageNotification();
            OutboundNotification outboundNotification = new OutboundNotification();

            Service.getInstance().setOutboundMessageNotification(outboundNotification);
            Service.getInstance().setInboundMessageNotification(inboundNotification);
            Service.getInstance().setCallNotification(callNotification);
            Service.getInstance().setGatewayStatusNotification(statusNotification);
            Service.getInstance().setOrphanedMessageNotification(orphanedMessageNotification);

            return gateway;

        } catch (IOException e) {

            log.fatal("Falha ao Carregar Arquivo .properties SMSMoldem1Producer " + e.getMessage());

            return null;

        }

    }
    return gateway;

}

From source file:persistence.BranchDao.java

public List<Branch> search(String name, String freeAuthors, String abbrevation) {
    Criteria crit = currentSession().createCriteria(Branch.class);
    if (StringAdapter.NotNull(name)) {
        crit.add(Restrictions.like("name", "%" + name + "%"));
    }/*from   w ww  .  j  av  a2  s  . c o m*/
    if (StringAdapter.NotNull(abbrevation)) {
        crit.add(Restrictions.like("abbrevation", "%" + abbrevation + "%"));
    }
    if (StringAdapter.NotNull(freeAuthors)) {
        Boolean bool = Boolean.parseBoolean(freeAuthors);
        crit.add(Restrictions.eq("freeAuthors", bool));
    }
    crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return crit.list();
}