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._17od.upm.transport.HTTPTransport.java

public HTTPTransport() {

    client = new HttpClient();

    Boolean acceptSelfSignedCerts = new Boolean(
            Preferences.get(Preferences.ApplicationOptions.HTTPS_ACCEPT_SELFSIGNED_CERTS));
    if (acceptSelfSignedCerts.booleanValue()) {
        // Create a Protcol handler which contains a HTTPS socket factory
        // capable of accepting self signed and otherwise invalid certificates.
        Protocol httpsProtocol = new Protocol("https",
                (ProtocolSocketFactory) new EasySSLProtocolSocketFactory(), 443);
        Protocol.registerProtocol("https", httpsProtocol);
    }//w  ww . j  a  va  2  s. c o  m

    //Get the proxy settings
    Boolean proxyEnabled = new Boolean(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_ENABLED));
    if (proxyEnabled.booleanValue()) {
        String proxyHost = Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_HOST);
        String proxyPortStr = Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_PORT);
        String proxyUserName = Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_USERNAME);
        String proxyPassword = Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_PASSWORD);
        String decodedPassword = new String(Base64.decodeBase64(proxyPassword.getBytes()));

        if (isNotEmpty(proxyHost)) {
            int proxyPort = 0;
            if (isNotEmpty(proxyPortStr)) {
                proxyPort = Integer.parseInt(proxyPortStr);
                client.getHostConfiguration().setProxy(proxyHost, proxyPort);
                if (isNotEmpty(proxyUserName) && isNotEmpty(proxyPassword)) {
                    client.getState().setProxyCredentials(AuthScope.ANY,
                            new UsernamePasswordCredentials(proxyUserName, decodedPassword));
                }
            }
        }
    }

}

From source file:com.autentia.intra.manager.billing.BillManager.java

/**
 * Account DAO *// w w w . ja v  a2  s .  c  o m
 */

public List<BillBreakDown> getAllBitacoreBreakDowns(Date start, Date end, Set<ProjectRole> roles,
        Set<ProjectCost> costes) {

    List<BillBreakDown> desgloses = new ArrayList<BillBreakDown>();

    ActivityDAO activityDAO = ActivityDAO.getDefault();
    ActivitySearch actSearch = new ActivitySearch();
    actSearch.setBillable(new Boolean(true));
    actSearch.setStartStartDate(start);
    actSearch.setEndStartDate(end);

    List<Activity> actividadesTotal = new ArrayList<Activity>();
    Hashtable user_roles = new Hashtable();

    for (ProjectRole proyRole : roles) {
        actSearch.setRole(proyRole);
        List<Activity> actividades = activityDAO.search(actSearch, new SortCriteria("startDate", false));
        actividadesTotal.addAll(actividades);
    }

    for (Activity act : actividadesTotal) {
        String key = act.getRole().getId().toString() + act.getUser().getId().toString();

        if (!user_roles.containsKey(key)) {
            Hashtable value = new Hashtable();
            value.put("ROLE", act.getRole());
            value.put("USER", act.getUser());
            user_roles.put(key, value);
        }
    }

    Enumeration en = user_roles.keys();

    while (en.hasMoreElements()) {
        String key = (String) en.nextElement();
        Hashtable pair = (Hashtable) user_roles.get(key);
        actSearch.setBillable(new Boolean(true));
        actSearch.setStartStartDate(start);
        actSearch.setEndStartDate(end);

        ProjectRole pR = (ProjectRole) pair.get("ROLE");
        User u = (User) pair.get("USER");
        actSearch.setRole(pR);
        actSearch.setUser(u);
        List<Activity> actividadesUsuarioRol = activityDAO.search(actSearch,
                new SortCriteria("startDate", false));

        BillBreakDown brd = new BillBreakDown();
        brd.setConcept("Imputaciones (usuario - rol): " + u.getName() + " - " + pR.getName());
        brd.setAmount(pR.getCostPerHour());
        brd.setIva(new BigDecimal(ConfigurationUtil.getDefault().getIva()));
        BigDecimal unitsTotal = new BigDecimal(0);
        for (Activity act : actividadesUsuarioRol) {
            BigDecimal unitsActual = new BigDecimal(act.getDuration());
            unitsActual = unitsActual.divide(new BigDecimal(60), 2, RoundingMode.HALF_UP);
            unitsTotal = unitsTotal.add(unitsActual);
        }
        brd.setUnits(unitsTotal);
        brd.setSelected(true);
        desgloses.add(brd);
    }

    for (ProjectCost proyCost : costes) {
        BillBreakDown brd = new BillBreakDown();
        brd.setConcept("Coste: " + proyCost.getName());
        brd.setUnits(new BigDecimal(1));
        brd.setAmount(proyCost.getCost());
        brd.setIva(new BigDecimal(ConfigurationUtil.getDefault().getIva()));
        brd.setSelected(true);
        desgloses.add(brd);
    }

    return desgloses;

}

From source file:org.dspace.app.webui.cris.controller.RPSearchFormController.java

@Override
protected Map referenceData(HttpServletRequest request) throws Exception {
    Map<String, Object> model = new HashMap<String, Object>();
    Context context = UIUtil.obtainContext(request);
    EPerson currUser = context.getCurrentUser();
    boolean isAdmin = AuthorizeManager.isAdmin(context);
    if (currUser != null) {
        model.put("researcher_page_menu", new Boolean(true));
    }/*from   w  ww  .j  a  v  a  2  s. c om*/
    if (isAdmin) {
        model.put("see_search_staffno", new Boolean(true));
        model.put("see_search_rp", new Boolean(true));// not used on jsp
        // (now search for
        // RP
        // is public)
    }

    SolrQuery query = new SolrQuery();
    query.setQuery("disabled:false");

    query.setFacet(true);
    query.setFacetLimit(-1);
    query.setFacetMinCount(1);
    query.setFacetMissing(true);
    query.setFacetSort(FacetParams.FACET_SORT_INDEX);
    // check table name
    query.addFacetField("faculty_filter");
    query.setRows(0);

    QueryResponse qResponse = ((CrisSearchService) searchService).search(query);

    FacetField facetField = qResponse.getFacetField("faculty_filter");

    List<DiscoverResult.FacetResult> faculties = new ArrayList<DiscoverResult.FacetResult>();
    List<Count> values = facetField.getValues();
    if (values != null) {
        for (FacetField.Count facetValue : values) {
            DiscoverResult.FacetResult fr = searchService.getDiscoveryFacet(context, facetField, facetValue);
            faculties.add(fr);
        }
    }
    DiscoveryConfiguration discoveryConf = SearchUtils.getDiscoveryConfigurationByName("crisrp");

    List<String> searchFields = new LinkedList<String>();
    for (DiscoverySearchFilter field : discoveryConf.getSearchFilters()) {
        searchFields.add(field.getIndexFieldName());
    }
    model.put("faculties", faculties);
    model.put("fields", searchFields);
    return model;
}

From source file:gate.corpora.FastInfosetDocumentFormat.java

/** We could collect repositioning information during XML parsing */
@Override/*w w w  .  j a  v a  2 s . c  o  m*/
public Boolean supportsRepositioning() {
    return new Boolean(true);
}

From source file:userinterface.graph.DisplaySettings.java

public DisplaySettings(Graph graph) {
    this.graph = graph;
    this.chart = graph.getChart();
    this.plot = chart.getXYPlot();

    antiAlias = new BooleanSetting("anti-aliasing", new Boolean(true),
            "Should the graph be rendered using anti-aliasing?", this, false);
    Color defaultColor = Color.white;

    //Color defaultColor =  UIManager.getColor("Panel.background");

    //if (chart.getBackgroundPaint() instanceof Color)
    //   defaultColor = ((Color)chart.getBackgroundPaint());

    backgroundColor = new ColorSetting("background colour", defaultColor,
            "The background colour of the graph panel", this, false);

    updateDisplay();/*from  w  w  w. j  a v  a2s.  co m*/
    setChanged();
    notifyObservers();
}

From source file:edu.indiana.d2i.sloan.ui.SessionTimeoutInterceptor.java

@Override
public String intercept(final ActionInvocation invocation) throws Exception {
    Object action = invocation.getAction();
    if (!(action instanceof SessionTimeoutRequired)) {
        return invocation.invoke();
    }/*from  ww w .  j a v a  2s .  c om*/

    Map<String, Object> session = invocation.getInvocationContext().getSession();
    if (session == null || session.isEmpty()) {
        HttpServletRequest httpRequest = ServletActionContext.getRequest();
        Cookie[] cookies = httpRequest.getCookies();
        for (int i = 0; i < cookies.length; i++) {
            if (cookies[i].getName().equals(Constants.SESSION_EXIST_BEFORE)
                    && (cookies[i].getValue().equals("true"))) {
                logger.info("Session expired.");
                session.put(Constants.SESSION_EXIST_BEFORE, new Boolean(true));
                return "sessionexpiredRedirect";
            }
        }

    }
    return invocation.invoke();
}

From source file:org.dspace.app.webui.cris.controller.PJSearchFormController.java

@Override
protected Map referenceData(HttpServletRequest request) throws Exception {
    Map<String, Object> model = new HashMap<String, Object>();
    Context context = UIUtil.obtainContext(request);
    EPerson currUser = context.getCurrentUser();
    boolean isAdmin = AuthorizeManager.isAdmin(context);
    if (currUser != null) {
        model.put("researcher_page_menu", new Boolean(true));
    }//  w  w  w.j av a  2  s.  c o m
    if (isAdmin) {
        model.put("see_search_grantcode", new Boolean(true));
    }

    SolrQuery query = new SolrQuery();
    query.setQuery("disabled:false");

    query.setFacet(true);
    query.setFacetLimit(-1);
    query.setFacetMinCount(1);
    query.setFacetMissing(true);
    query.setFacetSort(FacetParams.FACET_SORT_INDEX);
    // check table name
    query.addFacetField("pjsponsor_filter");
    query.addFacetField("pjstatus_filter");
    query.setRows(0);

    QueryResponse qResponse = ((CrisSearchService) searchService).search(query);

    FacetField facetField = qResponse.getFacetField("pjsponsor_filter");

    List<DiscoverResult.FacetResult> sponsors = new ArrayList<DiscoverResult.FacetResult>();
    List<Count> values = facetField.getValues();
    if (values != null) {
        for (FacetField.Count facetValue : values) {
            DiscoverResult.FacetResult fr = searchService.getDiscoveryFacet(context, facetField, facetValue);
            sponsors.add(fr);
        }
    }
    FacetField facetFieldStatus = qResponse.getFacetField("pjstatus_filter");

    List<DiscoverResult.FacetResult> status = new ArrayList<DiscoverResult.FacetResult>();
    List<Count> valuesStatus = facetFieldStatus.getValues();
    if (valuesStatus != null) {
        for (FacetField.Count facetValue : valuesStatus) {
            DiscoverResult.FacetResult fr = searchService.getDiscoveryFacet(context, facetFieldStatus,
                    facetValue);
            status.add(fr);
        }
    }

    DiscoveryConfiguration discoveryConf = SearchUtils.getDiscoveryConfigurationByName("crisproject");

    List<String> searchFields = new LinkedList<String>();
    for (DiscoverySearchFilter field : discoveryConf.getSearchFilters()) {
        searchFields.add(field.getIndexFieldName());
    }
    model.put("state", status);
    model.put("sponsors", sponsors);
    model.put("fields", searchFields);
    return model;
}

From source file:gov.nih.nci.ncicb.cadsr.bulkloader.util.excel.ExcelUtility.java

public static Boolean getBoolean(HSSFSheet sheet, int row, short col) {
    HSSFRow hssfRow = getRow(sheet, row);

    if (hssfRow == null) {
        return null;
    }/*  w  w  w .jav a 2  s.  co m*/

    HSSFCell cell = getRow(sheet, row).getCell(col);

    if (isNull(cell)) {
        return null;
    }
    return new Boolean(cell.getBooleanCellValue());
}

From source file:nz.co.senanque.rules.OperationsImpl.java

@InternalFunction(operator = "==", precedence = 10)
public Boolean eq(Object value, Object value2) {
    if (value == null && value2 == null) {
        return Boolean.TRUE;
    }/*from  ww  w  .j av a 2 s .co  m*/
    if (value != null) {
        return new Boolean((value.equals(value2)));
    }
    return Boolean.FALSE;
}

From source file:org.apache.jetspeed.portlets.security.constraints.ConstraintsViewController.java

public ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response)
        throws Exception {
    Map model = new HashMap();
    model.put("messages", portletConfig.getResourceBundle(request.getLocale()));
    model.put("greeting", "Hello");
    boolean constraintsEnabled = pageManager.getConstraintsEnabled();
    model.put("constraintsEnabled", new Boolean(constraintsEnabled));
    PageSecurity constraints = pageManager.getPageSecurity();
    model.put("defs", constraints.getSecurityConstraintsDefs());
    model.put("globals", constraints.getGlobalSecurityConstraintsRefs());

    PortletSession session = request.getPortletSession();
    List<Role> roles = (List<Role>) session.getAttribute(ROLES_CACHE_SESSION_ATTRIBUTE_NAME,
            PortletSession.PORTLET_SCOPE);
    if (roles == null) {
        try {//from   w w w  . j  a v a 2s . c  o  m
            roles = rm.getRoles("");
            session.setAttribute(ROLES_CACHE_SESSION_ATTRIBUTE_NAME, roles, PortletSession.PORTLET_SCOPE);
        } catch (Exception e) {
            logger.error("Could not get list of roles from RoleManager.", e);
        }
    }
    model.put("roles", roles);

    List<Group> groups = (List<Group>) session.getAttribute(GROUPS_CACHE_SESSION_ATTRIBUTE_NAME,
            PortletSession.PORTLET_SCOPE);
    if (groups == null) {
        try {
            groups = gm.getGroups("");
            session.setAttribute(GROUPS_CACHE_SESSION_ATTRIBUTE_NAME, groups, PortletSession.PORTLET_SCOPE);
        } catch (Exception e) {
            logger.error("Could not get list of groups from GroupManager.", e);
        }
    }
    model.put("groups", groups);

    model.put("renderRequest", request);

    return new ModelAndView("constraintsView", "model", model);
}