Example usage for java.lang Boolean booleanValue

List of usage examples for java.lang Boolean booleanValue

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public boolean booleanValue() 

Source Link

Document

Returns the value of this Boolean object as a boolean primitive.

Usage

From source file:com.liferay.portlet.login.action.CreateAccountAction.java

protected void addUser(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest);
    HttpSession session = request.getSession();

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Company company = themeDisplay.getCompany();

    boolean autoPassword = true;
    String password1 = null;//from   ww w .  jav  a 2 s.  c o  m
    String password2 = null;
    boolean autoScreenName = false;
    String screenName = ParamUtil.getString(actionRequest, "emailAddress");
    String emailAddress = ParamUtil.getString(actionRequest, "emailAddress");
    String openId = ParamUtil.getString(actionRequest, "openId");
    String firstName = ParamUtil.getString(actionRequest, "firstName");
    String middleName = ParamUtil.getString(actionRequest, "middleName");
    String lastName = ParamUtil.getString(actionRequest, "lastName");
    int prefixId = ParamUtil.getInteger(actionRequest, "prefixId");
    int suffixId = ParamUtil.getInteger(actionRequest, "suffixId");
    boolean male = ParamUtil.get(actionRequest, "male", true);
    int birthdayMonth = 1;
    int birthdayDay = 1;
    int birthdayYear = 1970;
    String jobTitle = ParamUtil.getString(actionRequest, "jobTitle");
    long[] groupIds = null;
    long[] organizationIds = null;
    long[] userGroupIds = null;
    boolean sendEmail = true;

    // additional data [KRS]
    String phone = ParamUtil.getString(actionRequest, "phone");
    String position = ParamUtil.getString(actionRequest, "position");
    String companyName = ParamUtil.getString(actionRequest, "company_name");
    String companyAddress = ParamUtil.getString(actionRequest, "company_address");
    String companyPostalCode = ParamUtil.getString(actionRequest, "company_postal_code");
    String companyCity = ParamUtil.getString(actionRequest, "company_city");
    String companyPhone = ParamUtil.getString(actionRequest, "company_phone");
    String companyFax = ParamUtil.getString(actionRequest, "company_fax");
    String companyMail = ParamUtil.getString(actionRequest, "company_email");
    AccountType accountType = AccountType.valueOf(ParamUtil.getString(actionRequest, "account_type"));
    String acceptRules = ParamUtil.getString(actionRequest, "accept_rules");

    long[] roleIds = getUserRoles(accountType);

    additionalValidate(emailAddress, phone, position, companyName, companyAddress, companyPostalCode,
            companyCity, companyPhone, companyFax, companyMail, accountType, acceptRules);

    ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest);

    if (PropsValues.LOGIN_CREATE_ACCOUNT_ALLOW_CUSTOM_PASSWORD) {
        autoPassword = false;

        password1 = ParamUtil.getString(actionRequest, "password1");
        password2 = ParamUtil.getString(actionRequest, "password2");
    }

    boolean openIdPending = false;

    Boolean openIdLoginPending = (Boolean) session.getAttribute(WebKeys.OPEN_ID_LOGIN_PENDING);

    if ((openIdLoginPending != null) && (openIdLoginPending.booleanValue()) && (Validator.isNotNull(openId))) {

        sendEmail = false;
        openIdPending = true;
    }

    if (PropsValues.CAPTCHA_CHECK_PORTAL_CREATE_ACCOUNT) {
        CaptchaUtil.check(actionRequest);
    }

    User user = UserServiceUtil.addUser(company.getCompanyId(), autoPassword, password1, password2,
            autoScreenName, screenName, emailAddress, openId, themeDisplay.getLocale(), firstName, middleName,
            lastName, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds,
            organizationIds, roleIds, userGroupIds, sendEmail, serviceContext);
    UserLocalServiceUtil.updateAgreedToTermsOfUse(user.getUserId(), true);

    // additional data
    if (accountType == AccountType.CONSULTANT_COMPANY || accountType == AccountType.EMITER) {
        long userOrganizationId = CounterLocalServiceUtil.increment();
        UserOrganization userOrganization = UserOrganizationLocalServiceUtil
                .createUserOrganization(userOrganizationId);
        userOrganization.setAddress(companyAddress);
        userOrganization.setCity(companyCity);
        userOrganization.setPostalCode(companyPostalCode);
        userOrganization.setEmail(companyMail);
        userOrganization.setFax(companyFax);
        userOrganization.setName(companyName);
        userOrganization.setPhone(companyPhone);
        UserOrganizationLocalServiceUtil.updateUserOrganization(userOrganization);

        UserAddon userAddon = UserAddonLocalServiceUtil.createUserAddon(user.getUserId());
        userAddon.setPhone(phone);
        userAddon.setPosition(position);
        userAddon.setOrganizationId(userOrganizationId);
        userAddon.setApiKey(getRandomApiKey());
        UserAddonLocalServiceUtil.updateUserAddon(userAddon);
    }

    if (openIdPending) {
        session.setAttribute(WebKeys.OPEN_ID_LOGIN, new Long(user.getUserId()));

        session.removeAttribute(WebKeys.OPEN_ID_LOGIN_PENDING);
    } else {
        // Session messages
        SessionMessages.add(request, "user_added", user.getEmailAddress());
        SessionMessages.add(request, "user_added_password", user.getPasswordUnencrypted());
    }

    logger.info("Creating account: firstName" + firstName + ", lastName:" + lastName + ", email:" + emailAddress
            + ", accountType: " + accountType);

    // Send redirect

    String login = null;

    if (company.getAuthType().equals(CompanyConstants.AUTH_TYPE_ID)) {
        login = String.valueOf(user.getUserId());
    } else if (company.getAuthType().equals(CompanyConstants.AUTH_TYPE_SN)) {
        login = user.getScreenName();
    } else {
        login = user.getEmailAddress();
    }

    PortletURL loginURL = LoginUtil.getLoginURL(request, themeDisplay.getPlid());

    loginURL.setParameter("login", login);

    String redirect = loginURL.toString();

    actionResponse.sendRedirect(redirect);
}

From source file:com.glaf.core.service.impl.MxTablePageServiceImpl.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public List<Object> getTableList(String tableName, String idColumn, Map<String, String> selectColumns,
        int begin, int pageSize, List<QueryCondition> conditions,
        LinkedHashMap<String, Boolean> orderByColumns) {
    SqlExecutor sqlExecutor = QueryUtils.getMyBatisAndConditionSql(conditions);
    StringBuilder buffer = new StringBuilder();
    buffer.append(" select ");
    if (selectColumns != null && !selectColumns.isEmpty()) {
        Set<Entry<String, String>> entrySet = selectColumns.entrySet();
        for (Entry<String, String> entry : entrySet) {
            String columnName = entry.getKey();
            String columnLabel = entry.getValue();
            if (columnName != null && columnLabel != null) {
                buffer.append(columnName).append(" as ").append(columnLabel);
                buffer.append(" , ");
            }//  w  w w.  j av  a2s.c om
        }
        buffer.delete(buffer.length() - 2, buffer.length());
        buffer.append(" from ").append(tableName);
    } else {
        buffer.append(" * from ").append(tableName);
    }

    buffer.append(" where 1=1 ");

    String sql = buffer.toString() + sqlExecutor.getSql();

    if (orderByColumns != null && !orderByColumns.isEmpty()) {
        buffer.delete(0, buffer.length());
        buffer.append(" order by ");
        Set<Entry<String, Boolean>> entrySet = orderByColumns.entrySet();
        for (Entry<String, Boolean> entry : entrySet) {
            String columnName = entry.getKey();
            Boolean ordinal = entry.getValue();
            if (columnName != null && ordinal != null) {
                buffer.append(columnName);
                if (ordinal.booleanValue()) {
                    buffer.append(" asc");
                } else {
                    buffer.append(" desc");
                }
                buffer.append(" ,");
            }
        }
        if (buffer.toString().endsWith(",")) {
            buffer.delete(buffer.length() - 2, buffer.length());
        }
    }

    sql = sql + buffer.toString();

    Map<String, Object> params = new java.util.HashMap<String, Object>();
    if (sqlExecutor.getParameter() instanceof Map) {
        params.putAll((Map) sqlExecutor.getParameter());
    }

    logger.debug("sql:\n" + sql);
    logger.debug("params:" + params);

    params.put("queryString", sql);

    if (begin < 0) {
        begin = 0;
    }
    if (pageSize <= 0) {
        pageSize = Paging.DEFAULT_PAGE_SIZE;
    }
    RowBounds rowBounds = new RowBounds(begin, pageSize);
    List<Object> rows = sqlSession.selectList("getSqlQueryList", params, rowBounds);
    return rows;
}

From source file:org.frontcache.core.RequestContext.java

/**
 * Convenience method to return a boolean value for a given key
 *
 * @param key/*w  ww  . java2 s  .  c om*/
 * @param defaultResponse
 * @return true or false depending what was set. default defaultResponse
 */
public boolean getBoolean(String key, boolean defaultResponse) {
    Boolean b = (Boolean) get(key);
    if (b != null) {
        return b.booleanValue();
    }
    return defaultResponse;
}

From source file:com.icesoft.faces.component.panelpopup.PanelPopupRenderer.java

private String modalJavascript(UIComponent uiComponent, Boolean modal, Boolean visible,
        FacesContext facesContext, String clientId) {
    String call = "";
    String iframeUrl = CoreUtils.resolveResourceURL(facesContext, "/xmlhttp/blank");
    if (modal != null) {
        if (modal.booleanValue() && visible.booleanValue()) {
            String trigger = "";
            // ICE-3563
            if (!((PanelPopup) uiComponent).isRunningModal()) {
                Map requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
                if (requestParameterMap.get("ice.focus") != null) {
                    trigger = (String) requestParameterMap.get("ice.focus");
                }//  ww w.j av a2  s.c om
                ((PanelPopup) uiComponent).setRunningModal(true);
                CoreComponentUtils.setFocusId("");
            }

            String autoPosition = (String) uiComponent.getAttributes().get("autoPosition");
            boolean positionOnLoadOnly = ((Boolean) uiComponent.getAttributes().get("positionOnLoadOnly"))
                    .booleanValue();
            call = "Ice.modal.start('" + clientId + "', '" + iframeUrl + "', '" + trigger + "',"
                    + "manual".equalsIgnoreCase(autoPosition) + "," + positionOnLoadOnly + ","
                    + getIE8DisableModalFrame(facesContext) + ");" + "ice.onElementUpdate('" + clientId
                    + "',function() {Ice.modal.stop('" + clientId + "');});";

            if (log.isTraceEnabled()) {
                log.trace("Starting Modal Function");
            }
        } else {
            // ICE-3563
            if (((PanelPopup) uiComponent).isRunningModal()) {
                ((PanelPopup) uiComponent).setRunningModal(false);
                CoreComponentUtils.setFocusId("");
            }
            call = "Ice.modal.stop('" + clientId + "');";
            if (log.isTraceEnabled()) {
                log.trace("Stopping modal function");
            }
        }
    }
    return call;
}

From source file:de.fme.alfresco.repo.jscript.PagedSearch.java

/**
 * Execute a query based on the supplied search definition object.
 * // ww w  .j a v a2  s  . co m
 * Search object is defined in JavaScript thus:
 * <pre>
 * search
 * {
 *    query: string,          mandatory, in appropriate format and encoded for the given language
 *    store: string,          optional, defaults to 'workspace://SpacesStore'
 *    language: string,       optional, one of: lucene, xpath, jcr-xpath, fts-alfresco - defaults to 'lucene'
 *    templates: [],          optional, Array of query language template objects (see below) - if supported by the language 
 *    sort: [],               optional, Array of sort column objects (see below) - if supported by the language
 *    page: object,           optional, paging information object (see below) - if supported by the language
 *    namespace: string,      optional, the default namespace for properties
 *    defaultField: string,   optional, the default field for query elements when not explicit in the query
 *    onerror: string         optional, result on error - one of: exception, no-results - defaults to 'exception'
 * }
 * 
 * sort
 * {
 *    column: string,         mandatory, sort column in appropriate format for the language
 *    ascending: boolean      optional, defaults to false
 * }
 * 
 * page
 * {
 *    maxItems: int,          optional, max number of items to return in result set
 *    pageSize: int,        optional, max number of items to return in PagingResult
 *    skipCount: int          optional, number of items to skip over before returning results
 * }
 * 
 * template
 * {
 *    field: string,          mandatory, custom field name for the template
 *    template: string        mandatory, query template replacement for the template
 * }
 * 
 * Note that only some query languages support custom query templates, such as 'fts-alfresco'. 
 * See the following documentation for more details:
 * {@link http://wiki.alfresco.com/wiki/Full_Text_Search_Query_Syntax#Templates}
 * </pre>
 * 
 * @param search    Search definition object as above
 * 
 * @return Array of ScriptNode results
 */
public ScriptPagingNodes pagedQuery(Object search) {
    ScriptPagingNodes results = null;

    if (search instanceof Serializable) {
        Serializable obj = new ValueConverter().convertValueForRepo((Serializable) search);
        if (obj instanceof Map) {
            Map<Serializable, Serializable> def = (Map<Serializable, Serializable>) obj;

            // test for mandatory values
            String query = (String) def.get("query");
            if (query == null || query.length() == 0) {
                throw new AlfrescoRuntimeException("Failed to search: Missing mandatory 'query' value.");
            }

            // collect optional values
            String store = (String) def.get("store");
            String language = (String) def.get("language");
            List<Map<Serializable, Serializable>> sort = (List<Map<Serializable, Serializable>>) def
                    .get("sort");
            Map<Serializable, Serializable> page = (Map<Serializable, Serializable>) def.get("page");
            String namespace = (String) def.get("namespace");
            String onerror = (String) def.get("onerror");
            String defaultField = (String) def.get("defaultField");

            // extract supplied values

            // sorting columns
            SortColumn[] sortColumns = null;
            if (sort != null) {
                sortColumns = new SortColumn[sort.size()];
                int index = 0;
                for (Map<Serializable, Serializable> column : sort) {
                    String strCol = (String) column.get("column");
                    if (strCol == null || strCol.length() == 0) {
                        throw new AlfrescoRuntimeException(
                                "Failed to search: Missing mandatory 'sort: column' value.");
                    }
                    Boolean boolAsc = (Boolean) column.get("ascending");
                    boolean ascending = (boolAsc != null ? boolAsc.booleanValue() : false);
                    sortColumns[index++] = new SortColumn(strCol, ascending);
                }
            }

            // paging settings
            int maxResults = -1;
            int skipResults = 0;
            int pageSizes = -1;
            if (page != null) {
                if (page.get("maxItems") != null) {
                    Object maxItems = page.get("maxItems");
                    if (maxItems instanceof Number) {
                        maxResults = ((Number) maxItems).intValue();
                    } else if (maxItems instanceof String) {
                        // try and convert to int (which it what it should be!)
                        maxResults = Integer.parseInt((String) maxItems);
                    }
                }
                if (page.get("skipCount") != null) {
                    Object skipCount = page.get("skipCount");
                    if (skipCount instanceof Number) {
                        skipResults = ((Number) page.get("skipCount")).intValue();
                    } else if (skipCount instanceof String) {
                        skipResults = Integer.parseInt((String) skipCount);
                    }
                }
                if (page.get("pageSize") != null) {
                    Object pageSize = page.get("pageSize");
                    if (pageSize instanceof Number) {
                        pageSizes = ((Number) page.get("pageSize")).intValue();
                    } else if (pageSize instanceof String) {
                        pageSizes = Integer.parseInt((String) pageSize);
                    }
                }
            }

            // query templates
            Map<String, String> queryTemplates = null;
            List<Map<Serializable, Serializable>> templates = (List<Map<Serializable, Serializable>>) def
                    .get("templates");
            if (templates != null) {
                queryTemplates = new HashMap<String, String>(templates.size(), 1.0f);

                for (Map<Serializable, Serializable> template : templates) {
                    String field = (String) template.get("field");
                    if (field == null || field.length() == 0) {
                        throw new AlfrescoRuntimeException(
                                "Failed to search: Missing mandatory 'template: field' value.");
                    }
                    String t = (String) template.get("template");
                    if (t == null || t.length() == 0) {
                        throw new AlfrescoRuntimeException(
                                "Failed to search: Missing mandatory 'template: template' value.");
                    }
                    queryTemplates.put(field, t);
                }
            }

            SearchParameters sp = new SearchParameters();
            sp.addStore(store != null ? new StoreRef(store) : this.storeRef);
            sp.setLanguage(language != null ? language : SearchService.LANGUAGE_LUCENE);
            sp.setQuery(query);
            if (defaultField != null) {
                sp.setDefaultFieldName(defaultField);
            }
            if (namespace != null) {
                sp.setNamespace(namespace);
            }
            if (maxResults > 0) {
                sp.setLimit(maxResults);
                sp.setLimitBy(LimitBy.FINAL_SIZE);
            }
            if (skipResults > 0) {
                sp.setSkipCount(skipResults);
            }
            if (sort != null) {
                for (SortColumn sd : sortColumns) {
                    sp.addSort(sd.column, sd.asc);
                }
            }
            if (queryTemplates != null) {
                for (String field : queryTemplates.keySet()) {
                    sp.addQueryTemplate(field, queryTemplates.get(field));
                }
            }

            // error handling opions
            boolean exceptionOnError = true;
            if (onerror != null) {
                if (onerror.equals("exception")) {
                    // default value, do nothing
                } else if (onerror.equals("no-results")) {
                    exceptionOnError = false;
                } else {
                    throw new AlfrescoRuntimeException(
                            "Failed to search: Unknown value supplied for 'onerror': " + onerror);
                }
            }

            // execute search based on search definition
            results = pagedQuery(sp, pageSizes, exceptionOnError);
        }
    }

    if (results == null) {
        results = new ScriptPagingNodes(Context.getCurrentContext().newArray(getScope(), new Object[0]), false,
                0, 0);
    }

    return results;
}

From source file:com.vangent.hieos.logbrowser.servlets.AuthenticationServlet.java

/**
 * /*from  ww  w  . j a  v a 2  s.  com*/
 *  Entry point of the servlet
 */
public void doPost(HttpServletRequest req, HttpServletResponse res) {
    res.setContentType("text/xml");
    HttpSession session = req.getSession(true);
    String passwordInput = req.getParameter("password");
    String newPassword = req.getParameter("chgPassword");
    String getIsAdmin = req.getParameter("isAdmin");
    String logout = req.getParameter("logout");
    String ipFrom = req.getRemoteAddr();
    String company = null;
    try {
        InetAddress address = InetAddress.getByName(ipFrom);
        if (address instanceof Inet6Address) {
            if (address.isLoopbackAddress()) {
                ipFrom = "127.0.0.1";
            } else {
                ipFrom = "null";
            }
        }
    } catch (UnknownHostException e) {
    }

    if (ipFrom != null && !ipFrom.equals("null")) {
        Log log = new Log();
        try {
            PreparedStatement selectCompanyName = null;
            Connection con = log.getConnection();
            selectCompanyName = con.prepareStatement("SELECT company_name,email FROM ip where ip = ? ; ");
            selectCompanyName.setString(1, ipFrom);
            ResultSet result = selectCompanyName.executeQuery();
            if (result.next()) {
                company = result.getString(1).replaceAll("'", "&quot;");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (LoggerException e) {
            e.printStackTrace();
        } finally {
            try {
                log.closeConnection();
            } catch (LoggerException ex) {
                Logger.getLogger(AuthenticationServlet.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
    String pageNumber = (String) session.getAttribute("page");
    String numberResultsByPage = (String) session.getAttribute("numberResultsByPage");
    session.setAttribute("isAdmin", true); // BHT (HACK).

    // DISABLED (BHT)
    // readFile();
    if (passwordInput != null) {
        try {
            if (passwordRead.equals(passwordInput)) {
                session.setAttribute("isAdmin", true);
                if (newPassword != null) {
                    FileWriter fstream;
                    try {
                        fstream = new FileWriter(passwordFile);
                        BufferedWriter out = new BufferedWriter(fstream);
                        out.write(newPassword);
                        out.close();
                        res.getWriter()
                                .write("<response isChanged='true' isAuthenticated='true' page ='" + pageNumber
                                        + "' numberResultByPage='" + numberResultsByPage + "'></response>");

                    } catch (IOException e) {
                        try {
                            res.getWriter().write("<response isChanged='false' page ='" + pageNumber
                                    + "' numberResultByPage='" + numberResultsByPage + "' ip='" + ipFrom + "' +"
                                    + " company='" + company + "' > " + e.getMessage() + "</response>");
                        } catch (IOException e1) {
                        }
                    }

                } else {
                    res.getWriter().write("<response isAuthenticated='true' page ='" + pageNumber
                            + "' numberResultByPage='" + numberResultsByPage + "'></response>");
                }
            } else {
                res.getWriter().write("<response isAuthenticated='false' ip='" + ipFrom + "' page ='"
                        + pageNumber + "' numberResultByPage='" + numberResultsByPage + "'></response>");
            }
        } catch (Exception e) {
        }
    } else if (getIsAdmin != null && getIsAdmin.equals("get")) {
        try {
            Boolean isAuthenticated = (Boolean) session.getAttribute("isAdmin");
            String sysType = (String) session.getAttribute("systemType");

            if (sysType == null) {
                sysType = "new";
            }

            if (isAuthenticated != null && isAuthenticated.booleanValue()) {
                res.getWriter().write("<response isAuthenticated='true' systemType='" + sysType + "' page ='"
                        + pageNumber + "' numberResultByPage='" + numberResultsByPage + "'></response>");
                /*} else if (authorizedIPs.contains(ipFrom)) {
                res.getWriter().write(
                "<response isAuthenticated='true'" + " page ='" + pageNumber + "' numberResultByPage='" + numberResultsByPage + "'></response>");
                session.setAttribute("isAdmin", true);
                }*/
            } else {
                res.getWriter()
                        .write("<response isAuthenticated='false' ip='" + ipFrom + "' systemType ='" + sysType
                                + "' company    ='" + company + "' page       ='" + pageNumber
                                + "' numberResultByPage='" + numberResultsByPage + "'></response>");
            }
        } catch (IOException e) {
        }
    } else if (logout != null && logout.equals("yes")) {
        session.invalidate();
        try {
            res.getWriter().write("<response/>");
        } catch (IOException e) {
        }
    }
}

From source file:fr.mailjet.rest.impl.ApiRESTServiceImpl.java

@Override
public String keyList(EnumReturnType parType, Boolean parIsActive, EnumCustomStatus parStatus, String parName,
        Boolean parUserType) throws UniformInterfaceException {
    MultivaluedMap<String, String> locProperties = this.createHTTPProperties(parType);
    // On ajoute l'ensemble des proprits non null
    // active property
    if (parIsActive != null) {
        // 1 : active - 0 : inactive
        int locActiveValue = parIsActive.booleanValue() ? 1 : 0;
        locProperties.putSingle(_activeProperty, Integer.toString(locActiveValue));
    }//from  w ww  . java  2  s. co m
    // custom property
    if (parStatus != null) {
        locProperties.putSingle(_customStatusProperty, parStatus.getConstName());
    }
    // name property
    if (StringUtils.isNotEmpty(parName)) {
        locProperties.putSingle(_nameProperty, parName);
    }
    // type property
    if (parUserType != null) {
        // 1 : main / 0 : subuser
        int locTypeValue = parUserType.booleanValue() ? 1 : 0;
        locProperties.putSingle(_typeProperty, Integer.toString(locTypeValue));
    }
    return this.createGETRequest("apiKeylist", locProperties);
}

From source file:com.frameworkset.commons.dbcp2.PoolableConnectionFactory.java

@Override
public void passivateObject(PooledObject<PoolableConnection> p) throws Exception {

    validateLifetime(p);//from  w  ww  . ja  v  a  2s  .  co m

    PoolableConnection conn = p.getObject();
    Boolean connAutoCommit = null;
    if (rollbackOnReturn) {
        connAutoCommit = Boolean.valueOf(conn.getAutoCommit());
        if (!connAutoCommit.booleanValue() && !conn.isReadOnly()) {
            conn.rollback();
        }
    }

    conn.clearWarnings();

    // DBCP-97 / DBCP-399 / DBCP-351 Idle connections in the pool should
    // have autoCommit enabled
    if (enableAutoCommitOnReturn) {
        if (connAutoCommit == null) {
            connAutoCommit = Boolean.valueOf(conn.getAutoCommit());
        }
        if (!connAutoCommit.booleanValue()) {
            conn.setAutoCommit(true);
        }
    }

    conn.passivate();
}

From source file:com.icesoft.faces.component.outputresource.OutputResource.java

public boolean isDisabled() {
    if (!Util.isEnabledOnUserRole(this)) {
        return true;
    }//  w ww  .  j  a v  a2s .c o m
    if (disabled != null) {
        return disabled.booleanValue();
    }
    ValueBinding vb = getValueBinding("disabled");
    Boolean v = vb != null ? (Boolean) vb.getValue(getFacesContext()) : null;
    return v != null ? v.booleanValue() : false;
}

From source file:com.ctb.prism.report.api.Controller.java

/**
 * @throws JRInteractiveException /*from   w  w w  .  j a v a 2 s .c om*/
 *
 */
public void runReport(WebReportContext webReportContext, Action action, HttpServletRequest request,
        HttpServletResponse response) throws JRException, JRInteractiveException {
    /** PRISM **/
    /*JRPropertiesUtil propUtil = JRPropertiesUtil.getInstance(jasperReportsContext);
    String reportUriParamName = propUtil.getProperty(WebUtil.REQUEST_PARAMETER_REPORT_URI);
    String reportUri = (String)webReportContext.getParameterValue(reportUriParamName);*/
    String reportUri = (String) webReportContext.getParameterValue(WebUtil.REQUEST_PARAMETER_REPORT_URI);
    /** end-PRISM **/
    int initialStackSize = 0;
    CommandStack commandStack = (CommandStack) webReportContext
            .getParameterValue(AbstractAction.PARAM_COMMAND_STACK);
    if (commandStack != null) {
        initialStackSize = commandStack.getExecutionStackSize();
    }

    setDataCache(webReportContext);

    JasperReport jasperReport = null;

    if (reportUri != null && reportUri.trim().length() > 0) {
        reportUri = reportUri.trim();

        if (action != null) {
            action.run();
        }

        jasperReport = RepositoryUtil.getInstance(jasperReportsContext).getReport(webReportContext, reportUri,
                request);
    }

    if (jasperReport == null) {
        throw new JRException("Report not found at : " + reportUri);
    }
    /** PRISM **/
    //String asyncParamName = propUtil.getProperty(WebUtil.REQUEST_PARAMETER_ASYNC_REPORT);
    //Boolean async = (Boolean)webReportContext.getParameterValue(asyncParamName);
    String asyncParamName = WebUtil.REQUEST_PARAMETER_ASYNC_REPORT;
    Boolean async = (Boolean) webReportContext.getParameterValue(WebUtil.REQUEST_PARAMETER_ASYNC_REPORT);
    /** end-PRISM **/
    if (async == null) {
        async = Boolean.FALSE;
    }
    webReportContext.setParameterValue(asyncParamName, async);

    try {
        runReport(webReportContext, jasperReport, async.booleanValue(), request, response, reportUri);
    } catch (JRException e) {
        undoAction(webReportContext, initialStackSize);
        throw e;
    } catch (JRRuntimeException e) {
        undoAction(webReportContext, initialStackSize);
        throw e;
    }
}