Example usage for java.lang Boolean Boolean

List of usage examples for java.lang Boolean Boolean

Introduction

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

Prototype

@Deprecated(since = "9")
public Boolean(String s) 

Source Link

Document

Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true" .

Usage

From source file:com.xpn.xwiki.gwt.api.server.XWikiServiceImpl.java

/**
 * Initialize XWiki Context and XWiki Container Objects.
 *///from w  ww . j a  va 2 s  . c  o  m
private void initXWiki() throws Exception {
    XWikiEngineContext engine = new XWikiServletContext(getServletContext());
    XWikiRequest request = new XWikiServletRequest(getThreadLocalRequest());
    XWikiResponse response = new XWikiServletResponse(getThreadLocalResponse());

    XWikiContext context = Utils.prepareContext("", request, response, engine);
    context.setMode(XWikiContext.MODE_GWT);
    context.setWikiId("xwiki");

    initializeContainerComponent(context);

    XWiki xwiki = XWiki.getXWiki(context);
    XWikiURLFactory urlf = xwiki.getURLFactoryService().createURLFactory(context.getMode(), context);
    context.setURLFactory(urlf);

    xwiki.prepareResources(context);

    String username = "XWiki.XWikiGuest";
    if (context.getMode() == XWikiContext.MODE_GWT_DEBUG) {
        username = "XWiki.superadmin";
    }
    XWikiUser user = context.getWiki().checkAuth(context);
    if (user != null) {
        username = user.getUser();
    }
    context.setUser(username);

    if (context.getDoc() == null) {
        context.setDoc(new XWikiDocument("Fake", "Document"));
    }

    context.put("ajax", new Boolean(true));
}

From source file:com.google.gsa.valve.modules.ldap.LDAPUniqueCreds.java

/**
 * This is the main method that does the LDAP authentication using user's 
 * credential in the format of username and password. It creates a 
 * connection with the user credentials and reads his/her own information. 
 * It does not read any other LDAP attribute out of the user entry.
 * <p>//from   ww w  .  j  av  a  2  s.  c  o m
 * If the LDAP authentication result is OK, it creates an 
 * authentication cookie. Anyway, the HTTP response code is returned in this 
 * method to inform the caller on the status.
 * 
 * @param request HTTP request
 * @param response HTTP response
 * @param authCookies vector that contains the authentication cookies
 * @param url the document url
 * @param creds an array of credentials for all external sources
 * @param id the default credential id to be retrieved from creds
        
 * @return the HTTP error code
        
 * @throws HttpException
 * @throws IOException
 */
public int authenticate(HttpServletRequest request, HttpServletResponse response, Vector<Cookie> authCookies,
        String url, Credentials creds, String id) throws HttpException, IOException {

    logger.debug("LDAP Unique Credentials Start");

    Cookie[] cookies = null;

    // Initialize status code
    int statusCode = HttpServletResponse.SC_UNAUTHORIZED;

    // Read cookies
    cookies = request.getCookies();

    //First read the u/p the credentails store, in this case using the same as the root login
    logger.debug("LDAPUniqueCreds: trying to get creds from repository ID: " + id);
    Credential cred = null;
    try {
        cred = creds.getCredential(id);
    } catch (NullPointerException npe) {
        logger.error("NPE while reading credentials of ID: " + id);
    }
    if (cred == null) {
        cred = creds.getCredential("root");
        if (cred != null) {
            logger.info("LDAPUniqueCreds: credential ID used is \"root\"");
        } else {
            logger.error("LDAPUniqueCreds: No credentials available for " + id);
        }
    }

    try {
        authMaxAge = Integer.parseInt(valveConf.getAuthMaxAge());
    } catch (NumberFormatException nfe) {
        logger.error(
                "Configuration error: chack the configuration file as the number set for authMaxAge is not OK:");
    }

    //If the required cookie was not found need to authenticate.
    logger.debug("Authenticating");
    try {

        //read values from config file (if any)
        readLDAPParameters(id);

        //Check if the LDAP credentials are OK                      
        logger.debug("Base user is: " + ldapBaseuser);
        Ldap ldapconn = new Ldap(ldapHost, cred.getUsername(), cred.getPassword(), ldapBaseuser, ldapDomain,
                rdnAttr);

        try {
            logger.debug("Connection to LDAP");
            DirContext ctx = ldapconn.openConnection();
            if (ctx == null) {
                //Just send a comment  
                logger.debug("The user(" + cred.getUsername() + ")/password doesn't match");
                ldapconn.closeConnection(ctx);
                return (HttpServletResponse.SC_UNAUTHORIZED);
            }

            logger.debug("User properly authenticated against the LDAP");

            //Close the connection
            ldapconn.closeConnection(ctx);

        } catch (Exception ex) {
            logger.error("LDAP connection problem during user access: " + ex.getMessage(), ex);
            return (HttpServletResponse.SC_UNAUTHORIZED);
        } finally {
        }

        Cookie extAuthCookie = null;

        extAuthCookie = settingCookie();

        //add sendCookies support
        boolean isSessionEnabled = new Boolean(valveConf.getSessionConfig().isSessionEnabled()).booleanValue();
        boolean sendCookies = false;
        if (isSessionEnabled) {
            sendCookies = new Boolean(valveConf.getSessionConfig().getSendCookies()).booleanValue();
        }
        if ((!isSessionEnabled) || ((isSessionEnabled) && (sendCookies))) {
            response.addCookie(extAuthCookie);
        }

        //add cookie to the array
        authCookies.add(extAuthCookie);

        //This would be set to OK or 401 in a real AuthN module
        statusCode = HttpServletResponse.SC_OK;

    } catch (Exception e) {

        // Log error
        logger.error("Sample authentication failure: " + e.getMessage(), e);

        // Update status code
        statusCode = HttpServletResponse.SC_UNAUTHORIZED;

    }

    // Debug
    logger.debug("Sample Authentication completed (" + statusCode + ")");

    // Return status code
    return statusCode;

}

From source file:de.ingrid.iplug.sns.SNSController.java

/**
 * Constructor for SNS controller./*from   www . j  a  va 2s.  c  o  m*/
 * 
 * @param client
 * @param nativeKeyPrefix
 */
public SNSController(SNSClient client, String nativeKeyPrefix) {
    this.fServiceClient = client;
    this.fNativeKeyPrefix = nativeKeyPrefix;

    SpringUtil springUtil = new SpringUtil("spring/external-services.xml");
    this.thesaurusService = springUtil.getBean("thesaurusService", _thesaurusService);
    this.gazetteerService = springUtil.getBean("gazetteerService", _gazetteerService);
    this.fullClassifyService = springUtil.getBean("fullClassifyService", _fullClassifyService);

    // change default parameters e.g. query case sensitive or not ! (in GS Soil different than in PortalU)
    try {
        final Class<Map> _map = null;
        Map props = springUtil.getBean("servicesProperties", _map);
        getLocationsFromText_ignoreCase = new Boolean(
                (String) props.get("gazetteerService.getLocationsFromText.ignoreCase"));
    } catch (Exception ex) {
        if (log.isInfoEnabled()) {
            log.info("Problems fetching properties from spring/external-services.xml, we use defaults:\n"
                    + "gazetteerService.getLocationsFromText.ignoreCase:" + getLocationsFromText_ignoreCase);
        }
    }
}

From source file:com.aurel.track.fieldType.runtime.system.check.SystemAccessLevelRT.java

/**
 * Get the ISO show value for locale independent exporting to xml
 * typically same as show value, date and number values are formatted by iso format 
 * @param fieldID//w  w w .j  a  va 2  s. co  m
 * @param parameterCode
 * @param value
 * @param workItemID
 * @param localLookupContainer
 * @param locale
 * @return
 */
@Override
public String getShowISOValue(Integer fieldID, Integer parameterCode, Object value, Integer workItemID,
        LocalLookupContainer localLookupContainer, Locale locale) {
    if (value == null) {
        value = TWorkItemBean.ACCESS_LEVEL_PUBLIC;
    }
    Integer intValue = null;
    try {
        intValue = (Integer) value;
    } catch (Exception e) {
        LOGGER.error("Casting the value type " + value.getClass().getName() + " to Integer failed with "
                + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (intValue != null && TWorkItemBean.ACCESS_LEVEL_PRIVATE.equals(intValue)) {
        return new Boolean(true).toString();
    } else {
        return new Boolean(false).toString();
    }
}

From source file:com.gst.organisation.provisioning.service.ProvisioningCategoryWritePlatformServiceJpaRepositoryImpl.java

private boolean isAnyLoanProductsAssociateWithThisProvisioningCategory(final Long categoryID) {
    final String sql = "select if((exists (select 1 from m_loanproduct_provisioning_details lpd where lpd.category_id = ?)) = 1, 'true', 'false')";
    final String isLoansUsingCharge = this.jdbcTemplate.queryForObject(sql, String.class,
            new Object[] { categoryID });
    return new Boolean(isLoansUsingCharge);
}

From source file:com.liangc.hq.base.utils.MonitorUtils.java

/**
 * Method findServiceTypes.//from  www .j  a v a 2s .com
 * 
 * Given a List of services associated with an application or server, 
 * filter through them for the  service types so we can link to showing 
 * selections by type. The returned List has the ServiceTypeValue as 
 * elements.
 * 
 * This should eventually get pushed into the bizapp
 * 
 * @param services
 * @return List
 */
public static List<ServiceTypeValue> findServiceTypes(List services, Boolean internal) {
    TreeMap<String, ServiceTypeValue> serviceTypeSet = new TreeMap<String, ServiceTypeValue>();
    for (Iterator i = services.iterator(); i.hasNext();) {
        AppdefResourceValue svcCandidate = (AppdefResourceValue) i.next();
        final AppdefEntityID aeid = svcCandidate.getEntityId();
        if (aeid.isService() || aeid.isGroup()) {
            AppdefResourceValue service = (AppdefResourceValue) svcCandidate;
            if (service != null && service.getAppdefResourceTypeValue() != null) {
                // if we don't have a group that is a compat group of services, then this
                // better throw a ClassCastException
                ServiceTypeValue svcType = (ServiceTypeValue) service.getAppdefResourceTypeValue();
                if (internal == null) {
                    // if we're not discriminating between internal and deployed, we'll just
                    // return them all
                    serviceTypeSet.put(svcType.getName(), svcType);
                } else if (internal != null && new Boolean(svcType.getIsInternal()).equals(internal)) {
                    serviceTypeSet.put(svcType.getName(), svcType);
                }
            }
        } else {
            throw new IllegalStateException("Did not get a valid service: " + svcCandidate);
        }
    }
    return new ArrayList(serviceTypeSet.values());
}

From source file:com.sun.faces.taglib.html_basic.GraphicImageTag.java

protected void setProperties(UIComponent component) {
    super.setProperties(component);
    UIGraphic graphic = null;// w  w w .j  av a 2s .  co m
    try {
        graphic = (UIGraphic) component;
    } catch (ClassCastException cce) {
        throw new IllegalStateException("Component " + component.toString()
                + " not expected type.  Expected: UIGraphic.  Perhaps you're missing a tag?");
    }

    if (url != null) {
        if (isValueReference(url)) {
            ValueBinding vb = Util.getValueBinding(url);
            graphic.setValueBinding("url", vb);
        } else {
            graphic.setUrl(url);
        }
    }
    if (value != null) {
        if (isValueReference(value)) {
            ValueBinding vb = Util.getValueBinding(value);
            graphic.setValueBinding("value", vb);
        } else {
            graphic.setValue(value);
        }
    }
    if (alt != null) {
        if (isValueReference(alt)) {
            ValueBinding vb = Util.getValueBinding(alt);
            graphic.setValueBinding("alt", vb);
        } else {
            graphic.getAttributes().put("alt", alt);
        }
    }
    if (dir != null) {
        if (isValueReference(dir)) {
            ValueBinding vb = Util.getValueBinding(dir);
            graphic.setValueBinding("dir", vb);
        } else {
            graphic.getAttributes().put("dir", dir);
        }
    }
    if (height != null) {
        if (isValueReference(height)) {
            ValueBinding vb = Util.getValueBinding(height);
            graphic.setValueBinding("height", vb);
        } else {
            graphic.getAttributes().put("height", height);
        }
    }
    if (ismap != null) {
        if (isValueReference(ismap)) {
            ValueBinding vb = Util.getValueBinding(ismap);
            graphic.setValueBinding("ismap", vb);
        } else {
            boolean _ismap = new Boolean(ismap).booleanValue();
            graphic.getAttributes().put("ismap", _ismap ? Boolean.TRUE : Boolean.FALSE);
        }
    }
    if (lang != null) {
        if (isValueReference(lang)) {
            ValueBinding vb = Util.getValueBinding(lang);
            graphic.setValueBinding("lang", vb);
        } else {
            graphic.getAttributes().put("lang", lang);
        }
    }
    if (longdesc != null) {
        if (isValueReference(longdesc)) {
            ValueBinding vb = Util.getValueBinding(longdesc);
            graphic.setValueBinding("longdesc", vb);
        } else {
            graphic.getAttributes().put("longdesc", longdesc);
        }
    }
    if (onclick != null) {
        if (isValueReference(onclick)) {
            ValueBinding vb = Util.getValueBinding(onclick);
            graphic.setValueBinding("onclick", vb);
        } else {
            graphic.getAttributes().put("onclick", onclick);
        }
    }
    if (ondblclick != null) {
        if (isValueReference(ondblclick)) {
            ValueBinding vb = Util.getValueBinding(ondblclick);
            graphic.setValueBinding("ondblclick", vb);
        } else {
            graphic.getAttributes().put("ondblclick", ondblclick);
        }
    }
    if (onkeydown != null) {
        if (isValueReference(onkeydown)) {
            ValueBinding vb = Util.getValueBinding(onkeydown);
            graphic.setValueBinding("onkeydown", vb);
        } else {
            graphic.getAttributes().put("onkeydown", onkeydown);
        }
    }
    if (onkeypress != null) {
        if (isValueReference(onkeypress)) {
            ValueBinding vb = Util.getValueBinding(onkeypress);
            graphic.setValueBinding("onkeypress", vb);
        } else {
            graphic.getAttributes().put("onkeypress", onkeypress);
        }
    }
    if (onkeyup != null) {
        if (isValueReference(onkeyup)) {
            ValueBinding vb = Util.getValueBinding(onkeyup);
            graphic.setValueBinding("onkeyup", vb);
        } else {
            graphic.getAttributes().put("onkeyup", onkeyup);
        }
    }
    if (onmousedown != null) {
        if (isValueReference(onmousedown)) {
            ValueBinding vb = Util.getValueBinding(onmousedown);
            graphic.setValueBinding("onmousedown", vb);
        } else {
            graphic.getAttributes().put("onmousedown", onmousedown);
        }
    }
    if (onmousemove != null) {
        if (isValueReference(onmousemove)) {
            ValueBinding vb = Util.getValueBinding(onmousemove);
            graphic.setValueBinding("onmousemove", vb);
        } else {
            graphic.getAttributes().put("onmousemove", onmousemove);
        }
    }
    if (onmouseout != null) {
        if (isValueReference(onmouseout)) {
            ValueBinding vb = Util.getValueBinding(onmouseout);
            graphic.setValueBinding("onmouseout", vb);
        } else {
            graphic.getAttributes().put("onmouseout", onmouseout);
        }
    }
    if (onmouseover != null) {
        if (isValueReference(onmouseover)) {
            ValueBinding vb = Util.getValueBinding(onmouseover);
            graphic.setValueBinding("onmouseover", vb);
        } else {
            graphic.getAttributes().put("onmouseover", onmouseover);
        }
    }
    if (onmouseup != null) {
        if (isValueReference(onmouseup)) {
            ValueBinding vb = Util.getValueBinding(onmouseup);
            graphic.setValueBinding("onmouseup", vb);
        } else {
            graphic.getAttributes().put("onmouseup", onmouseup);
        }
    }
    if (style != null) {
        if (isValueReference(style)) {
            ValueBinding vb = Util.getValueBinding(style);
            graphic.setValueBinding("style", vb);
        } else {
            graphic.getAttributes().put("style", style);
        }
    }
    if (styleClass != null) {
        if (isValueReference(styleClass)) {
            ValueBinding vb = Util.getValueBinding(styleClass);
            graphic.setValueBinding("styleClass", vb);
        } else {
            graphic.getAttributes().put("styleClass", styleClass);
        }
    }
    if (title != null) {
        if (isValueReference(title)) {
            ValueBinding vb = Util.getValueBinding(title);
            graphic.setValueBinding("title", vb);
        } else {
            graphic.getAttributes().put("title", title);
        }
    }
    if (usemap != null) {
        if (isValueReference(usemap)) {
            ValueBinding vb = Util.getValueBinding(usemap);
            graphic.setValueBinding("usemap", vb);
        } else {
            graphic.getAttributes().put("usemap", usemap);
        }
    }
    if (width != null) {
        if (isValueReference(width)) {
            ValueBinding vb = Util.getValueBinding(width);
            graphic.setValueBinding("width", vb);
        } else {
            graphic.getAttributes().put("width", width);
        }
    }
}

From source file:gov.nih.nci.ncicb.cadsr.common.cdebrowser.DataElementSearchBean.java

public void initSearchPreferences(DBUtil dbUtil) throws Exception {
    CDEBrowserParams params = CDEBrowserParams.getInstance();
    // Initialize Search Preference Values
    boolean excludeTestContext = new Boolean(params.getExcludeTestContext()).booleanValue();
    boolean excludeTrainingContext = new Boolean(params.getExcludeTrainingContext()).booleanValue();
    setExcludeTestContext(excludeTestContext);
    setExcludeTrainingContext(excludeTrainingContext);

    String regVals = params.getExcludeRegistrationStatuses();
    if (regVals != null && regVals != "") {
        String[] regStatusExcludeList = StringUtils.tokenizeCSVList(regVals);
        setRegStatusExcludeList(regStatusExcludeList);
    }//from w w  w  .  j  a va2s  .  c  o m

    String wfVals = params.getExcludeWorkFlowStatuses();
    if (wfVals != null && wfVals != "") {
        String[] aslNameExcludeList = StringUtils.tokenizeCSVList(wfVals);
        setAslNameExcludeList(aslNameExcludeList);
    }
    setLOVLists(dbUtil);
}

From source file:de.ingrid.usermanagement.jetspeed.SecurityAccessImpl.java

/**
 * <p>/*from   w w w . j  a v  a 2  s  .  co m*/
 * Returns a collection of {@link Principal}given the filter.
 * </p>
 * 
 * @param filter
 *            The filter.
 * @return Collection of {@link InternalUserPrincipal}.
 */
public Iterator getInternalUserPrincipals(String filter) {
    Criteria queryCriteria = new Criteria();
    queryCriteria.addEqualTo("isMappingOnly", new Boolean(false));
    queryCriteria.addLike("fullPath", UserPrincipal.PREFS_USER_ROOT + filter + "%");
    Query query = QueryFactory.newQuery(InternalUserPrincipalImpl.class, queryCriteria);
    Iterator result = null;
    result = broker.getIteratorByQuery(query);
    return result;
}

From source file:it.cnr.icar.eric.client.admin.function.Cp.java

boolean checkIncludesExcludes(String fileName) {
    // Include unless there's a reason not to.
    boolean canInclude = true;

    if (includes.size() != 0) {
        // If any 'includes' regex, inclusion is no longer automatic.
        canInclude = false;//from   w  ww . j ava2s . c  om

        for (int pos = 0; pos < includes.size(); pos++) {
            canInclude = SelectorUtils.match(includes.get(pos), fileName);

            if (context.getDebug()) {
                context.printMessage(format(rb, "debug.include",
                        new Object[] { fileName, includes.get(pos), new Boolean(canInclude) }));
            }

            // If matches one include pattern, no need to check more
            if (canInclude) {
                break;
            }
        }
    }

    if (excludes.size() != 0) {
        for (int pos = 0; pos < excludes.size(); pos++) {
            canInclude = SelectorUtils.match(excludes.get(pos), fileName);

            if (context.getDebug()) {
                context.printMessage(format(rb, "debug.exclude",
                        new Object[] { fileName, excludes.get(pos), new Boolean(canInclude) }));
            }

            // If matches one exclude pattern, no need to check more
            if (!canInclude) {
                break;
            }
        }
    }

    return canInclude;
}