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.aurel.track.admin.customize.category.filter.tree.design.TreeFilterSaverBL.java

/**
 * Gather the original tree and the dropdowns in a new tree to be saved
 * @param qNodeOriginalRoot//from   w  ww  .j a  v  a2s. co m
 * @param filterSelectsTO
 * @return
 */
public static QNode createQNodeWithQueryListsTO(QNode qNodeOriginalRoot, FilterUpperTO filterSelectsTO,
        Locale locale) {
    QNode qNodeReportBean = createNode(QNode.AND);
    qNodeReportBean.setChildren(new ArrayList<QNode>());
    qNodeReportBean.setType(QNode.AND);
    QNode qNode = createQueryNodeExpressionWithEqualMatcher(SystemFields.INTEGER_PROJECT,
            filterSelectsTO.getSelectedProjects());
    if (qNode != null) {
        qNodeReportBean.getChildren().add(qNode);
    }
    qNode = createQueryNodeExpressionWithEqualMatcher(SystemFields.INTEGER_RELEASESCHEDULED,
            filterSelectsTO.getSelectedReleases());
    if (qNode != null) {
        qNodeReportBean.getChildren().add(qNode);
        //save the closed release flag only if release is specified, otherwise by creating the textual filter expression (for tooltip) confuses the user
        boolean showClosedReleases = filterSelectsTO.isShowClosedReleases();
        if (showClosedReleases) {
            qNode = createQueryNodeExpressionWithEqualMatcher(
                    Integer.valueOf(FilterUpperTO.PSEUDO_FIELDS.SHOW_CLOSED_RELEASES),
                    Boolean.valueOf(filterSelectsTO.isShowClosedReleases()));
            qNodeReportBean.getChildren().add(qNode);
        }
        //set the release type selector only if release is specified, otherwise by creating the textual filter expression (for tooltip) confuses the user
        Integer releaseTypeSelector = filterSelectsTO.getReleaseTypeSelector();
        if (releaseTypeSelector != null) {
            qNode = createQueryNodeExpressionWithEqualMatcher(
                    Integer.valueOf(FilterUpperTO.PSEUDO_FIELDS.RELEASE_TYPE_SELECTOR), releaseTypeSelector);
            qNodeReportBean.getChildren().add(qNode);
        }
    }
    qNode = createQueryNodeExpressionWithEqualMatcher(SystemFields.INTEGER_MANAGER,
            filterSelectsTO.getSelectedManagers());
    if (qNode != null) {
        qNodeReportBean.getChildren().add(qNode);
    }
    qNode = createQueryNodeExpressionWithEqualMatcher(SystemFields.INTEGER_RESPONSIBLE,
            filterSelectsTO.getSelectedResponsibles());
    if (qNode != null) {
        qNodeReportBean.getChildren().add(qNode);
    }
    qNode = createQueryNodeExpressionWithEqualMatcher(SystemFields.INTEGER_ORIGINATOR,
            filterSelectsTO.getSelectedOriginators());
    if (qNode != null) {
        qNodeReportBean.getChildren().add(qNode);
    }
    qNode = createQueryNodeExpressionWithEqualMatcher(SystemFields.INTEGER_CHANGEDBY,
            filterSelectsTO.getSelectedChangedBys());
    if (qNode != null) {
        qNodeReportBean.getChildren().add(qNode);
    }
    qNode = createQueryNodeExpressionWithEqualMatcher(SystemFields.INTEGER_STATE,
            filterSelectsTO.getSelectedStates());
    if (qNode != null) {
        qNodeReportBean.getChildren().add(qNode);
    }
    qNode = createQueryNodeExpressionWithEqualMatcher(SystemFields.INTEGER_ISSUETYPE,
            filterSelectsTO.getSelectedIssueTypes());
    if (qNode != null) {
        qNodeReportBean.getChildren().add(qNode);
    }
    qNode = createQueryNodeExpressionWithEqualMatcher(SystemFields.INTEGER_PRIORITY,
            filterSelectsTO.getSelectedPriorities());
    if (qNode != null) {
        qNodeReportBean.getChildren().add(qNode);
    }
    qNode = createQueryNodeExpressionWithEqualMatcher(SystemFields.INTEGER_SEVERITY,
            filterSelectsTO.getSelectedSeverities());
    if (qNode != null) {
        qNodeReportBean.getChildren().add(qNode);
    }
    //set the consultants/informants
    qNode = createQueryNodeExpressionWithEqualMatcher(
            Integer.valueOf(FilterUpperTO.PSEUDO_FIELDS.CONSULTANT_INFORMNAT_FIELD_ID),
            filterSelectsTO.getSelectedConsultantsInformants());
    if (qNode != null) {
        //at least one consultant or informant is selected
        qNodeReportBean.getChildren().add(qNode);
        //the consultant or informant selector only if any watcher is specified, otherwise by creating the textual filter expression (for tooltip) confuses the user
        Integer watcherSelector = filterSelectsTO.getWatcherSelector();
        if (watcherSelector != null) {
            qNode = createQueryNodeExpressionWithEqualMatcher(
                    Integer.valueOf(FilterUpperTO.PSEUDO_FIELDS.CONSULTANT_OR_INFORMANT_SELECTOR),
                    watcherSelector);
            qNodeReportBean.getChildren().add(qNode);
        }
    }
    //get the custom selects
    Map<Integer, String> selectedCustomSelectsMap = filterSelectsTO.getSelectedCustomSelectsStr();
    if (selectedCustomSelectsMap != null && !selectedCustomSelectsMap.isEmpty())
        for (Integer fieldID : selectedCustomSelectsMap.keySet()) {
            String selectedCustomSelects = selectedCustomSelectsMap.get(fieldID);
            if (selectedCustomSelects != null && selectedCustomSelects.length() > 0) {
                qNode = createQueryNodeExpressionWithEqualMatcher(fieldID,
                        FilterUpperTO.createIntegerArrFromString(selectedCustomSelects));
                if (qNode != null) {
                    qNodeReportBean.getChildren().add(qNode);
                }
            }
        }
    //set the keyword
    String keyword = filterSelectsTO.getKeyword();
    if (keyword != null && keyword.length() > 0) {
        //make it xml compatible
        keyword = StringEscapeUtils.escapeXml(keyword);
        qNode = createQueryNodeExpressionWithEqualMatcher(
                Integer.valueOf(FilterUpperTO.PSEUDO_FIELDS.KEYWORD_FIELD_ID), keyword);
        qNodeReportBean.getChildren().add(qNode);
    }
    Integer archived = filterSelectsTO.getArchived();
    if (archived != null) {
        qNode = createQueryNodeExpressionWithEqualMatcher(
                Integer.valueOf(FilterUpperTO.PSEUDO_FIELDS.ARCHIVED_FIELD_ID), archived);
        qNodeReportBean.getChildren().add(qNode);
    }
    Integer deleted = filterSelectsTO.getDeleted();
    if (deleted != null) {
        qNode = createQueryNodeExpressionWithEqualMatcher(
                Integer.valueOf(FilterUpperTO.PSEUDO_FIELDS.DELETED_FIELD_ID), deleted);
        qNodeReportBean.getChildren().add(qNode);
    }
    String linkTypeFilterSuperset = filterSelectsTO.getLinkTypeFilterSuperset();
    if (linkTypeFilterSuperset != null && !"".equals(linkTypeFilterSuperset)) {
        qNode = createQueryNodeExpressionWithEqualMatcher(
                Integer.valueOf(FilterUpperTO.PSEUDO_FIELDS.LINKTYPE_FILTER_SUPERSET), linkTypeFilterSuperset);
        qNodeReportBean.getChildren().add(qNode);
    }
    List<FieldExpressionSimpleTO> fieldExpressionSimpleTOList = filterSelectsTO.getFieldExpressionSimpleList();
    if (fieldExpressionSimpleTOList != null) {
        for (FieldExpressionSimpleTO fieldExpressionSimpleTO : fieldExpressionSimpleTOList) {
            QNodeExpression qNodeExpression = createNodeORsFromFilterExpression(fieldExpressionSimpleTO);
            if (qNodeExpression != null) {
                qNodeReportBean.getChildren().add(qNodeExpression);
            }
        }
    }
    QNode qNewRoot = createNode(QNode.AND);
    qNewRoot.setChildren(new ArrayList<QNode>());
    qNewRoot.getChildren().add(qNodeReportBean);
    if (qNodeOriginalRoot != null) {
        qNewRoot.getChildren().add(qNodeOriginalRoot);
    }
    return qNewRoot;
}

From source file:com.glaf.core.config.AbstractModule.java

public boolean getBoolean(String key) {
    if (hasObject(key)) {
        String value = properties.getProperty(key);
        return Boolean.valueOf(value).booleanValue();
    }//from  w w w. j a  v  a2s . com
    return false;
}

From source file:com.interopbridges.tools.windowsazure.JSONHelper.java

public static String addCache(String encCompCache, String name, int backup, int defaultTTL, int expType)
        throws WindowsAzureInvalidProjectOperationException {
    String cache = "";
    boolean isExpirable = true;
    try {//from   w w w  .jav a  2  s . c  om
        String decodedCache = decodeHTML(encCompCache);

        JSONObject oriCacheObj = new JSONObject(decodedCache);
        JSONArray cachesArr = (JSONArray) oriCacheObj.get("caches");
        JSONObject newCacheObj = new JSONObject();
        if (expType == 0) {
            isExpirable = false;
        }
        newCacheObj.put("name", name);
        newCacheObj.put("secondaries", Integer.valueOf(backup));

        JSONObject isEnbaled = new JSONObject();
        isEnbaled.put("isEnabled", false);

        JSONObject exp = new JSONObject();
        exp.put("defaultTTL", Integer.valueOf(defaultTTL));

        exp.put("isExpirable", Boolean.valueOf(isExpirable));
        exp.put("type", Integer.valueOf(expType));

        JSONObject eviction = new JSONObject();
        eviction.put("type", Integer.valueOf(0));

        JSONObject policy = new JSONObject();
        policy.put("serverNotification", isEnbaled);
        policy.put("eviction", eviction);
        policy.put("expiration", exp);
        newCacheObj.put("policy", policy);
        cachesArr.put(newCacheObj);
        oriCacheObj.put("caches", cachesArr);
        cache = encodeHTML(oriCacheObj.toString());
        return cache;
    } catch (Exception ex) {
        throw new WindowsAzureInvalidProjectOperationException(WindowsAzureConstants.EXCP, ex);
    }
}

From source file:com.aurel.track.fieldType.runtime.matchers.converter.BooleanMatcherConverter.java

/**
 * Convert the xml string to object value after load
 * @param value//from   w  w w. j a  va  2 s.co m
 * @param matcherRelation
 * @return
 */
@Override
public Object fromXMLString(String value, Integer matcherRelation) {
    if (value == null || value.trim().length() == 0) {
        return null;
    } else {
        try {
            return Boolean.valueOf(value);
        } catch (Exception e) {
            LOGGER.warn("Converting the " + value + " to Boolean failed with " + e.getMessage());
            LOGGER.debug(ExceptionUtils.getStackTrace(e));
            return Boolean.FALSE;
        }
    }
}

From source file:io.federecio.dropwizard.swagger.SwaggerContextService.java

private Object getSwaggerFromConfig() {
    String configIdKey;/* w  w w .j  a  v a2 s. com*/
    if (configId != null) {
        configIdKey = CONFIG_ID_PREFIX + configId;
    } else if (contextId != null) {
        configIdKey = CONFIG_ID_PREFIX + contextId;
    } else {
        if (isServletConfigAvailable(sc)) {
            configIdKey = (sc.getInitParameter(CONFIG_ID_KEY) != null)
                    ? CONFIG_ID_PREFIX + sc.getInitParameter(CONFIG_ID_KEY)
                    : null;
            if (configIdKey == null) {
                boolean usePathBasedConfig = Boolean.valueOf(sc.getInitParameter(USE_PATH_BASED_CONFIG));
                if (usePathBasedConfig && StringUtils.isNotBlank(basePath)) {
                    configIdKey = CONFIG_ID_PREFIX + basePath;
                } else {
                    configIdKey = (sc.getInitParameter(CONTEXT_ID_KEY) != null)
                            ? CONFIG_ID_PREFIX + sc.getInitParameter(CONTEXT_ID_KEY)
                            : CONFIG_ID_DEFAULT;
                }
            }
        } else {
            configIdKey = CONFIG_ID_DEFAULT;
        }
    }
    return SwaggerConfigLocator.getInstance().getSwagger(configIdKey);
}

From source file:eu.europeana.core.util.web.ConfigInterceptor.java

@SuppressWarnings({ "unchecked" })
@Override//from w ww.  j  av a  2  s.c om
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o,
        ModelAndView modelAndView) throws Exception {
    super.postHandle(httpServletRequest, httpServletResponse, o, modelAndView);
    final PortalTheme theme = themeHandler.getByRequest(httpServletRequest);
    if (modelAndView != null && !modelAndView.getViewName().startsWith("redirect:")) {
        modelAndView.addObject("debug", Boolean.valueOf(debug));
        modelAndView.addObject("interfaceLanguage", ControllerUtil.getLocale(httpServletRequest));
        modelAndView.addObject("cacheUrl", theme.getCacheUrl());
        modelAndView.addObject("portalName", portalName);
        modelAndView.addObject("portalDisplayName", theme.getDisplayName());
        modelAndView.addObject("portalBaseUrl", theme.getBaseUrl());
        modelAndView.addObject("portalColor", theme.getColorScheme());
        modelAndView.addObject("portalTheme", "theme/" + theme.getName());
        modelAndView.addObject("portalThemeName", theme.getName());
        final QueryParamList queryParamList = FreemarkerUtil
                .createQueryParamList(httpServletRequest.getParameterMap());
        modelAndView.addObject("queryParamList", queryParamList);
        modelAndView.addObject("defaultParams", queryParamList.getDefaultParamsFormatted());
        modelAndView.addObject("includedMacros", includedMacros);
        modelAndView.addObject("pageGrabber", freeMarkerUtil);
        modelAndView.addObject("homePage", theme.getHomePage());
        if (!theme.getGaCode().isEmpty()) {
            modelAndView.addObject("googleAnalyticsTrackingCode", theme.getGaCode());
        }
        if (!theme.getAddThisCode().isEmpty()) {
            modelAndView.addObject("addThisTrackingCode", theme.getAddThisCode());
        }
    }
}

From source file:com.nike.cerberus.security.VaultAuthPrincipal.java

private Set<String> buildRoles(VaultClientTokenResponse clientToken) {
    final ImmutableSet.Builder<String> roleSetBuilder = ImmutableSet.builder();
    final Map<String, String> meta = clientToken.getMeta();

    if (meta != null && Boolean.valueOf(meta.get(METADATA_KEY_IS_ADMIN))) {
        roleSetBuilder.add(ROLE_ADMIN);/*from w  w  w. ja  v  a 2 s  .  c  o m*/
    }

    roleSetBuilder.add(ROLE_USER);

    return roleSetBuilder.build();
}

From source file:com.wickettasks.business.services.user.TestUserService.java

@SuppressWarnings("null")
public void testAddExistingUser() {
    User user = null;/*from w w w . j  a  v  a2 s  .c  o  m*/
    try {
        user = this.userService.add("test@email.com", "password");
    } catch (ExistingUserException e) {
        throw new AssertionError();
    }
    assertEquals(Boolean.TRUE, Boolean.valueOf(user != null));
    assertEquals(Boolean.TRUE, Boolean.valueOf("password".equals(user.getPassword())));
    assertEquals(Boolean.TRUE, Boolean.valueOf("test@email.com".equals(user.getEmail())));
}

From source file:blue.soundObject.jmask.Oscillator.java

public static Generator loadFromXML(Element data) {
    Oscillator retVal = new Oscillator();

    Elements nodes = data.getElements();

    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();

        if (nodeName.equals("oscillatorType")) {
            retVal.oscillatorType = Integer.parseInt(node.getTextString());
        } else if (nodeName.equals("phaseInit")) {
            retVal.phaseInit = Double.parseDouble(node.getTextString());
        } else if (nodeName.equals("frequency")) {
            retVal.setFrequency(Double.parseDouble(node.getTextString()));
        } else if (nodeName.equals("freqTableEnabled")) {
            retVal.setFreqTableEnabled(Boolean.valueOf(node.getTextString()).booleanValue());
        } else if (nodeName.equals("table")) {
            retVal.setFreqTable(Table.loadFromXML(node));
        } else if (nodeName.equals("exponent")) {
            retVal.exponent = Double.parseDouble(node.getTextString());
        }/*ww w. j a v  a2 s.  c o  m*/

    }

    return retVal;
}

From source file:com.adaptris.core.jms.MetadataProducerSessionFactory.java

boolean newSessionRequired(AdaptrisMessage msg) {
    return msg.containsKey(getMetadataKey())
            && Boolean.valueOf(defaultIfEmpty(msg.getMetadataValue(getMetadataKey()), "false")).booleanValue();
}