Example usage for java.lang Boolean valueOf

List of usage examples for java.lang Boolean valueOf

Introduction

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

Prototype

public static Boolean valueOf(String s) 

Source Link

Document

Returns a Boolean with a value represented by the specified string.

Usage

From source file:com.amazon.janusgraph.TestGraphUtil.java

TestGraphUtil() {
    dynamoDBPartitions = Integer.valueOf(System.getProperty("dynamodb-partitions", String.valueOf(1)));
    Preconditions.checkArgument(dynamoDBPartitions > 0);
    provisionedReadAndWriteTps = 750 * dynamoDBPartitions;
    unlimitedIops = Boolean
            .valueOf(System.getProperty("dynamodb-unlimited-iops", String.valueOf(Boolean.TRUE)));
    controlPlaneRate = Integer.valueOf(System.getProperty("dynamodb-control-plane-rate", String.valueOf(100)));
    Preconditions.checkArgument(controlPlaneRate > 0);
    //This is a configuration file for test code. not part of production applications.
    //no validation necessary.
    propertiesFile = new File(
            System.getProperty("properties-file", "src/test/resources/dynamodb-local.properties"));
    Preconditions.checkArgument(propertiesFile.exists());
    Preconditions.checkArgument(propertiesFile.isFile());
    Preconditions.checkArgument(propertiesFile.canRead());
}

From source file:com.yqboots.web.thymeleaf.processor.element.OptionsElementProcessor.java

/**
 * {@inheritDoc}/*  ww w . j  a  v a  2 s .  c  o m*/
 */
@Override
protected List<Node> getMarkupSubstitutes(final Arguments arguments, final Element element) {
    final List<Node> nodes = new ArrayList<>();

    final SpringWebContext context = (SpringWebContext) arguments.getContext();
    @SuppressWarnings({ "uncheck" })
    final HtmlElementResolvers htmlElementResolvers = context.getApplicationContext()
            .getBean(HtmlElementResolvers.class);

    final String nameAttrValue = element.getAttributeValue(ATTR_NAME);
    if (StringUtils.isBlank(nameAttrValue)) {
        throw new IllegalArgumentException("name attribute should be set");
    }

    final boolean valueIncluded = Boolean.valueOf(element.getAttributeValue(ATTR_VALUE_INCLUDED));

    final Configuration configuration = arguments.getConfiguration();
    // Obtain the Thymeleaf Standard Expression parser
    final IStandardExpressionParser parser = StandardExpressions.getExpressionParser(configuration);
    String attributes = element.getAttributeValue(ATTR_ATTRIBUTES);
    if (StringUtils.isNotBlank(attributes)) {
        final IStandardExpression expression = parser.parseExpression(configuration, arguments, attributes);
        attributes = (String) expression.execute(configuration, arguments);
    }

    Element option;

    List<HtmlOption> items = null;
    for (final HtmlOptionsResolver resolver : htmlElementResolvers.getHtmlOptionsResolvers()) {
        if (resolver.supports(nameAttrValue)) {
            items = resolver.getHtmlOptions(nameAttrValue, attributes);
            break;
        }
    }

    if (items != null) {
        for (HtmlOption item : items) {
            option = new Element("option");
            option.setAttribute("value", item.getValue());
            if (valueIncluded) {
                option.addChild(
                        new Text(StringUtils.join(new String[] { item.getValue(), item.getText() }, " - ")));
            } else {
                option.addChild(new Text(item.getText()));
            }

            nodes.add(option);
        }
    }

    return nodes;
}

From source file:org.jasypt.spring31.xml.encryption.EncryptablePropertyPlaceholderBeanDefinitionParser.java

@Override
protected void doParse(final Element element, final BeanDefinitionBuilder builder) {

    super.doParse(element, builder);

    builder.addPropertyValue("ignoreUnresolvablePlaceholders",
            Boolean.valueOf(element.getAttribute("ignore-unresolvable")));

    String systemPropertiesModeName = element.getAttribute("system-properties-mode");
    if (StringUtils.hasLength(systemPropertiesModeName)
            && !systemPropertiesModeName.equals(SYSTEM_PROPERTIES_MODE_DEFAULT)) {
        builder.addPropertyValue("systemPropertiesModeName",
                "SYSTEM_PROPERTIES_MODE_" + systemPropertiesModeName);
    }/*from ww w  .  j  a  v a 2  s.  c  om*/

    final String encryptorBeanName = element.getAttribute(ENCRYPTOR_ATTRIBUTE);
    if (StringUtils.hasText(encryptorBeanName)) {
        builder.addConstructorArgReference(encryptorBeanName);
    }

}

From source file:gobblin.runtime.EmailNotificationJobListener.java

@Override
public void onJobCancellation(JobState jobState) {
    boolean notificationEmailEnabled = Boolean.valueOf(
            jobState.getProp(ConfigurationKeys.NOTIFICATION_EMAIL_ENABLED_KEY, Boolean.toString(false)));

    if (notificationEmailEnabled) {
        try {/*from   www  .  j  a  va 2 s  .com*/
            EmailUtils.sendJobCancellationEmail(jobState.getJobId(), jobState.toString(), jobState);
        } catch (EmailException ee) {
            LOGGER.error("Failed to send job cancellation notification email for job " + jobState.getJobId(),
                    ee);
        }
    }
}

From source file:com.okta.scim.UsersController.java

/**
 * Support pagination and filtering by username
 *
 * @param params Payload from HTTP request
 * @return JSON {@link Map} {@link ListResponse}
 *///ww w.j av  a 2s  . co  m
@RequestMapping(method = RequestMethod.GET)
public @ResponseBody Map usersGet(@RequestParam Map<String, String> params) {
    Page<User> users;

    // If not given count, default to 100
    int count = (params.get("count") != null) ? Integer.parseInt(params.get("count")) : 100;

    // If not given startIndex, default to 1
    int startIndex = (params.get("startIndex") != null) ? Integer.parseInt(params.get("startIndex")) : 1;

    if (startIndex < 1) {
        startIndex = 1;
    }
    startIndex -= 1;

    PageRequest pageRequest = new PageRequest(startIndex, count);

    String filter = params.get("filter");
    if (filter != null && filter.contains("eq")) {
        String regex = "(\\w+) eq \"([^\"]*)\"";
        Pattern response = Pattern.compile(regex);

        Matcher match = response.matcher(filter);
        Boolean found = match.find();
        if (found) {
            String searchKeyName = match.group(1);
            String searchValue = match.group(2);
            switch (searchKeyName) {
            case "active":
                users = db.findByActive(Boolean.valueOf(searchValue), pageRequest);
                break;
            case "faimlyName":
                users = db.findByFamilyName(searchValue, pageRequest);
                break;
            case "givenName":
                users = db.findByGivenName(searchValue, pageRequest);
                break;
            default:
                // Defaults to username lookup
                users = db.findByUsername(searchValue, pageRequest);
                break;
            }
        } else {
            users = db.findAll(pageRequest);
        }
    } else {
        users = db.findAll(pageRequest);
    }

    List<User> foundUsers = users.getContent();
    int totalResults = foundUsers.size();

    // Convert optional values into Optionals for ListResponse Constructor
    ListResponse returnValue = new ListResponse(foundUsers, Optional.of(startIndex), Optional.of(count),
            Optional.of(totalResults));
    return returnValue.toScimResource();
}

From source file:org.activiti.explorer.conf.DemoDataConfiguration.java

@PostConstruct
public void init() {
    if (Boolean.valueOf(environment.getProperty("create.demo.users", "true"))) {
        LOGGER.info("Initializing demo groups");
        initDemoGroups();//from  ww  w . j a va  2  s .c  o m
        LOGGER.info("Initializing demo users");
        initDemoUsers();
    }

    if (Boolean.valueOf(environment.getProperty("create.demo.definitions", "true"))) {
        LOGGER.info("Initializing demo process definitions");
        initProcessDefinitions();
    }

    if (Boolean.valueOf(environment.getProperty("create.demo.models", "true"))) {
        LOGGER.info("Initializing demo models");
        initModelData();
    }

    if (Boolean.valueOf(environment.getProperty("create.demo.reports", "true"))) {
        LOGGER.info("Initializing demo report data");
        generateReportData();
    }
}

From source file:org.mifos.loan.repository.StandardLoanDao.java

@Override
@Transactional(readOnly = true)//from w w w  . j  ava  2 s .  com
public Boolean loansExistForLoanProduct(Integer loanProductId) {
    Query query = entityManager
            .createQuery("select count(*) from Loan loan where loan.loanProduct.id = :loanProductId");
    query.setParameter("loanProductId", loanProductId);
    return Boolean.valueOf(((Long) query.getResultList().get(0)) > 0);
}

From source file:blue.orchestra.blueSynthBuilder.BSBGraphicInterface.java

public static BSBGraphicInterface loadFromXML(Element data) throws Exception {
    BSBGraphicInterface graphicInterface = new BSBGraphicInterface();

    Elements giNodes = data.getElements();

    String editEnabledStr = data.getAttributeValue("editEnabled");
    if (editEnabledStr != null) {
        graphicInterface.setEditEnabled(Boolean.valueOf(editEnabledStr).booleanValue());
    }//from  w  w  w.  j ava  2 s.  com

    GridSettings gridSettings = null;

    while (giNodes.hasMoreElements()) {
        Element node = giNodes.next();
        String name = node.getName();

        switch (name) {
        case "bsbObject":
            Object obj = ObjectUtilities.loadFromXML(node);
            graphicInterface.addBSBObject((BSBObject) obj);
            break;
        case "gridSettings":
            gridSettings = GridSettings.loadFromXML(node);
            break;
        }
    }

    if (gridSettings == null) {
        // preserve behavior of older projects (before 2.5.8)
        graphicInterface.getGridSettings().setGridStyle(GridStyle.NONE);
        graphicInterface.getGridSettings().setSnapEnabled(false);
    } else {
        graphicInterface.setGridSettings(gridSettings);
    }

    return graphicInterface;
}

From source file:com.github.dozermapper.core.classmap.Configuration.java

public Boolean getStopOnErrors() {
    return stopOnErrors != null ? stopOnErrors : Boolean.valueOf(DozerConstants.DEFAULT_ERROR_POLICY);
}

From source file:com.haulmont.cuba.gui.components.filter.descriptor.PropertyConditionDescriptor.java

public PropertyConditionDescriptor(Element element, String messagesPack, String filterComponentName,
        CollectionDatasource datasource) {
    this(element.attributeValue("name"), element.attributeValue("caption"), messagesPack, filterComponentName,
            datasource);/*from  w  w  w  . ja va  2s  .c om*/
    inExpr = Boolean.valueOf(element.attributeValue("inExpr"));
    entityParamWhere = element.attributeValue("paramWhere");
    entityParamView = element.attributeValue("paramView");
}