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.jaspersoft.jasperserver.remote.handlers.ReportUnitHandler.java

protected void doGet(Resource resource, ResourceDescriptor descriptor, Map options) throws ServiceException {
    ReportUnit reportUnit = (ReportUnit) resource;
    descriptor.setWsType(ResourceDescriptor.TYPE_REPORTUNIT);

    descriptor.setResourceProperty(ResourceDescriptor.PROP_RU_ALWAYS_PROPMT_CONTROLS,
            reportUnit.isAlwaysPromptControls());
    descriptor.setResourceProperty(ResourceDescriptor.PROP_RU_CONTROLS_LAYOUT, reportUnit.getControlsLayout());

    if (reportUnit.getInputControlRenderingView() != null) {
        descriptor.setResourceProperty(ResourceDescriptor.PROP_RU_INPUTCONTROL_RENDERING_VIEW,
                reportUnit.getInputControlRenderingView());
    }//from   w w  w. j  av  a 2 s. com

    if (reportUnit.getReportRenderingView() != null) {
        descriptor.setResourceProperty(ResourceDescriptor.PROP_RU_REPORT_RENDERING_VIEW,
                reportUnit.getReportRenderingView());
    }

    Boolean reportUnitContent = options == null ? null : (Boolean) options.get(OPTION_REPORT_UNIT_CONTENTS);

    if (reportUnitContent != null && reportUnitContent.booleanValue()) {
        // Get datasource...
        ResourceReference ruDataSource = reportUnit.getDataSource();
        ResourcesManagementRemoteService resourcesManagementRemoteService = getResourcesManagementRemoteService();
        if (ruDataSource != null) {
            if (ruDataSource.isLocal()) {
                ResourceDescriptor dsDescriptor = resourcesManagementRemoteService
                        .createResourceDescriptor(ruDataSource.getLocalResource());
                descriptor.getChildren().add(dsDescriptor);
            } else {
                ResourceDescriptor rdDs = new ResourceDescriptor();
                rdDs.setWsType(ResourceDescriptor.TYPE_DATASOURCE);
                rdDs.setReferenceUri(ruDataSource.getReferenceURI());
                rdDs.setIsReference(true);
                descriptor.getChildren().add(rdDs);
            }
        }

        ResourceReference ruQuery = reportUnit.getQuery();
        if (ruQuery != null) {
            if (ruQuery.isLocal()) {
                ResourceDescriptor queryDescriptor = resourcesManagementRemoteService
                        .createResourceDescriptor(ruQuery.getLocalResource());
                descriptor.getChildren().add(ruQuery);
            } else {
                ResourceDescriptor rdDs = new ResourceDescriptor();
                rdDs.setWsType(ResourceDescriptor.TYPE_QUERY);
                rdDs.setReferenceUri(ruDataSource.getReferenceURI());
                rdDs.setIsReference(true);
                descriptor.getChildren().add(rdDs);
            }
        }

        // Get the main jrxml...
        ResourceReference ruMainReportResourceResourceReference = reportUnit.getMainReport();

        ResourceDescriptor ruMainReportResourceDescriptor = null;

        if (ruMainReportResourceResourceReference != null) {
            if (ruMainReportResourceResourceReference.isLocal()) {
                ruMainReportResourceDescriptor = resourcesManagementRemoteService
                        .createResourceDescriptor(ruMainReportResourceResourceReference.getLocalResource());
                // ruMainReportResourceDescriptor.setLocal(true);
            } else {
                ruMainReportResourceDescriptor = resourcesManagementRemoteService
                        .createResourceDescriptor(resourcesManagementRemoteService
                                .locateResource(ruMainReportResourceResourceReference.getReferenceURI()));
                // This is a trick to say that this is really a reference,
                // and the resource is not local!
                ruMainReportResourceDescriptor
                        .setReferenceUri(ruMainReportResourceResourceReference.getReferenceURI());
                ruMainReportResourceDescriptor.setIsReference(true);
                // ruMainReportResourceDescriptor.setLocal(false);
            }

            ruMainReportResourceDescriptor.setMainReport(true);
            descriptor.getChildren().add(ruMainReportResourceDescriptor);
        }

        List inputControls = reportUnit.getInputControls();
        if (inputControls != null && !inputControls.isEmpty()) {
            for (Iterator it = inputControls.iterator(); it.hasNext();) {

                ResourceReference resRef = (ResourceReference) it.next();
                ResourceDescriptor ruResourceDescriptor = null;
                if (resRef.isLocal()) {
                    ruResourceDescriptor = resourcesManagementRemoteService
                            .createResourceDescriptor(resRef.getLocalResource());
                    // ruMainReportResourceDescriptor.setLocal(true);
                } else {
                    ruResourceDescriptor = resourcesManagementRemoteService.createResourceDescriptor(
                            resourcesManagementRemoteService.locateResource(resRef.getReferenceURI(),
                                    ExecutionContextImpl.getRuntimeExecutionContext()));
                    // ruMainReportResourceDescriptor.setLocal(false);
                }

                if (ruResourceDescriptor != null) {
                    descriptor.getChildren().add(ruResourceDescriptor);
                }
            }
        }

        List resources = reportUnit.getResources();
        if (resources != null && !resources.isEmpty()) {
            for (Iterator it = resources.iterator(); it.hasNext();) {

                ResourceReference resRef = (ResourceReference) it.next();
                ResourceDescriptor ruResourceDescriptor = null;
                if (resRef.isLocal()) {
                    ruResourceDescriptor = resourcesManagementRemoteService
                            .createResourceDescriptor(resRef.getLocalResource());
                    // ruMainReportResourceDescriptor.setLocal(true);
                } else {
                    ruResourceDescriptor = resourcesManagementRemoteService.createResourceDescriptor(
                            resourcesManagementRemoteService.locateResource(resRef.getReferenceURI()));
                    // ruMainReportResourceDescriptor.setLocal(false);
                }

                if (ruResourceDescriptor != null && !ruMainReportResourceDescriptor.getUriString()
                        .equals(ruResourceDescriptor.getUriString())) {
                    descriptor.getChildren().add(ruResourceDescriptor);
                }
            }
        }
    }
}

From source file:net.sf.wickedshell.facade.descriptor.ExtensionShellDescriptor.java

/**
 * Constructor for ExtensionShellDescriptor.
 * //w  ww .j  a  v a 2 s.c  om
 * @param extension
 *            The <code>IConfigurationElement</code> representing the
 *            <code>IShellDescriptor</code>
 */
@SuppressWarnings("unchecked")
public ExtensionShellDescriptor(IConfigurationElement configurationElement) {
    super();
    shellName = configurationElement.getAttribute(SHELL_NAME_ATTRIBUTE);
    shellExecutable = configurationElement.getAttribute(EXECUTABLE_ATTRIBUTE);
    characterEncoding = configurationElement.getAttribute(CHARACTER_ENCODING_ATTRIBUTE);
    String lineFeed = configurationElement.getAttribute(LINE_FEED_ATTRIBUTE);
    StringBuffer buffer = new StringBuffer();
    if (lineFeed.equals(DomainID.CR_LF_VALUE)) {
        buffer.append(SWT.CR);
    }
    buffer.append(SWT.LF);
    lineFeedString = buffer.toString();
    pathDelimiter = configurationElement.getAttribute(PATH_DELIMITER_ATTRIBUTE).replace(BLANK_SUBSTITUTE, ' ');

    String pathSeparatorDefinition = configurationElement.getAttribute(PATH_SEPARATOR_ATTRIBUTE);
    if (pathSeparatorDefinition.equals(DomainID.SLASH_VALUE)) {
        pathSeparator = "/";
    } else {
        pathSeparator = "\\";
    }
    systemPathSeparator = configurationElement.getAttribute(SYSTEM_PATH_SEPARATOR_ATTRIBUTE);
    hasCustomRoot = Boolean.valueOf(configurationElement.getAttribute(HAS_CUSTOM_ROOT_ATTRIBUTE))
            .booleanValue();
    if (hasCustomRoot) {
        binariesDirectory = configurationElement.getAttribute(BINARIES_DIRECTORY_ATTRIBUTE);
    } else {
        binariesDirectory = new String();
    }
    commandDelimiter = configurationElement.getAttribute(COMMAND_DELIMITER_ATTRIBUTE);
    isUILineFeedProvided = Boolean
            .valueOf(configurationElement.getAttribute(IS_UI_LINE_FEED_PROVIDED_ATTRIBUTE)).booleanValue();
    isExecutedComandProvided = Boolean
            .valueOf(configurationElement.getAttribute(IS_EXECUTED_COMMAND_PROVIDED_ATTIBUTE)).booleanValue();
    id = configurationElement.getAttribute(SHELL_ID_ATTRIBUTE);
    executableFiles = (IExecutableFile[]) CollectionUtils.collect(
            Arrays.asList(configurationElement.getChildren(EXECUTABLE_FILES_ATTRIBUTE)), new Transformer() {
                /**
                * @see org.apache.commons.collections.Transformer#transform(java.lang.Object)
                */
                public Object transform(Object object) {
                    IConfigurationElement executableFileElement = (IConfigurationElement) object;
                    String extension = executableFileElement.getAttribute(EXTENSION_ATTRIBUTE);
                    String description = executableFileElement.getAttribute(DESCRIPTION_ATTRIBUTE);
                    Boolean isBatchFile = Boolean
                            .valueOf(executableFileElement.getAttribute(IS_BATCH_FILE_ATTRIBUTE));
                    return IExecutableFile.Factory.newInstance(description, extension,
                            isBatchFile.booleanValue());
                }
            }).toArray(new IExecutableFile[0]);
    supportingOperatingSystems = (String[]) CollectionUtils.collect(
            Arrays.asList(configurationElement.getChildren(SUPPORTING_OS_ATTRIBUTE)), new Transformer() {
                /**
                * @see org.apache.commons.collections.Transformer#transform(java.lang.Object)
                */
                public Object transform(Object object) {
                    IConfigurationElement executableFileElement = (IConfigurationElement) object;
                    return executableFileElement.getAttribute(OS_NAME_ATTRIBUTE);
                }
            }).toArray(new String[0]);
    externalShellInvoker = null;
    if (configurationElement.getAttribute(EXTERNAL_SHELL_INVOKER_ATTRIBUTE) != null) {
        try {
            externalShellInvoker = (IExternalShellInvoker) configurationElement
                    .createExecutableExtension(EXTERNAL_SHELL_INVOKER_ATTRIBUTE);
        } catch (CoreException exception) {
            shellLogger.error(exception.getMessage(), exception);
        }
    }
    environmentalValueProvider = null;
    if (configurationElement.getAttribute(ENVIRONMENTAL_VALUE_PROVIDER_ATTRIBUTE) != null) {
        try {
            environmentalValueProvider = (IEnvironmentalValueProvider) configurationElement
                    .createExecutableExtension(ENVIRONMENTAL_VALUE_PROVIDER_ATTRIBUTE);
        } catch (CoreException exception) {
            shellLogger.error(exception.getMessage(), exception);
        }
    }
    commandProvider = null;
    if (configurationElement.getAttribute(COMMAND_PROVIDER_ATTRIBUTE) != null) {
        try {
            commandProvider = (ICommandProvider) configurationElement
                    .createExecutableExtension(COMMAND_PROVIDER_ATTRIBUTE);
        } catch (CoreException exception) {
            shellLogger.error(exception.getMessage(), exception);
        }
    }
}

From source file:cordova.plugins.Diagnostic.java

private boolean shouldShowRequestPermissionRationale(Activity activity, String permission) throws Exception {
    boolean shouldShow;
    try {/*from w ww.j ava  2s  . c  o  m*/
        java.lang.reflect.Method method = ActivityCompat.class.getMethod("shouldShowRequestPermissionRationale",
                Activity.class, java.lang.String.class);
        Boolean bool = (Boolean) method.invoke(null, activity, permission);
        shouldShow = bool.booleanValue();
    } catch (NoSuchMethodException e) {
        throw new Exception(
                "shouldShowRequestPermissionRationale() method not found in ActivityCompat class. Check you have Android Support Library v23+ installed");
    }
    return shouldShow;
}

From source file:com.emc.plants.web.servlets.AccountServlet.java

private void performTask(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    String action = null;//  ww  w. j  a  v  a 2  s .c  o m

    action = req.getParameter(Util.ATTR_ACTION);
    Util.debug("action=" + action);

    if (action.equals(ACTION_LOGIN)) {
        try {
            HttpSession session = req.getSession(true);
            String userid = req.getParameter("userid");
            String passwd = req.getParameter("passwd");
            String updating = req.getParameter(Util.ATTR_UPDATING);

            String results = null;
            if (Util.validateString(userid)) {
                results = login.verifyUserAndPassword(userid, passwd);
            } else {
                //user id was invalid, and may contain XSS attack
                results = "\nEmail address was invalid.";
                Util.debug("User id or email address was invalid. id=" + userid);
            }

            // If results have an error msg, return it, otherwise continue.
            if (results != null) {
                // Proliferate UPDATING flag if user is trying to update his account.
                if (updating.equals("true"))
                    req.setAttribute(Util.ATTR_UPDATING, "true");

                req.setAttribute(Util.ATTR_RESULTS, results);
                requestDispatch(getServletConfig().getServletContext(), req, resp, Util.PAGE_LOGIN);
            } else {
                // If not logging in for the first time, then clear out the
                // session data for the old user.
                if (session.getAttribute(Util.ATTR_CUSTOMER) != null) {
                    session.removeAttribute(Util.ATTR_CART);
                    session.removeAttribute(Util.ATTR_CART_CONTENTS);
                    session.removeAttribute(Util.ATTR_CHECKOUT);
                    session.removeAttribute(Util.ATTR_ORDERKEY);
                }

                // Store customer userid in HttpSession.
                CustomerInfo customerInfo = login.getCustomerInfo(userid);
                session.setAttribute(Util.ATTR_CUSTOMER, customerInfo);
                Util.debug("updating=" + updating + "=");

                // Was customer trying to edit account information.
                if (updating.equals("true")) {
                    req.setAttribute(Util.ATTR_EDITACCOUNTINFO, customerInfo);

                    requestDispatch(getServletConfig().getServletContext(), req, resp, Util.PAGE_ACCOUNT);
                } else {
                    // See if user was in the middle of checking out.
                    Boolean checkingOut = (Boolean) session.getAttribute(Util.ATTR_CHECKOUT);
                    Util.debug("checkingOut=" + checkingOut + "=");
                    if ((checkingOut != null) && (checkingOut.booleanValue())) {
                        Util.debug("must be checking out");
                        requestDispatch(getServletConfig().getServletContext(), req, resp, Util.PAGE_ORDERINFO);
                    } else {
                        Util.debug("must NOT be checking out");
                        String url;
                        String category = (String) session.getAttribute(Util.ATTR_CATEGORY);

                        // Default to plants
                        Util.debug("category : " + category);
                        if ((category == null) || (category.equals("null"))) {
                            url = Util.PAGE_PROMO;
                        } else {
                            url = Util.PAGE_SHOPPING;
                            req.setAttribute(Util.ATTR_INVITEMS,
                                    catalog.getItemsByCategory(Integer.parseInt(category)));
                        }

                        requestDispatch(getServletConfig().getServletContext(), req, resp, url);
                    }
                }
            }
        } catch (ServletException e) {
            e.printStackTrace();
            req.setAttribute(Util.ATTR_RESULTS, "/nException occurred");
            throw e;
        } catch (Exception e) {
            req.setAttribute(Util.ATTR_RESULTS, "/nException occurred");
            e.printStackTrace();
            throw new ServletException(e.getMessage());
        }
    } else if (action.equals(ACTION_REGISTER)) {
        // Register a new user.
        //         try
        //         {
        String url;
        HttpSession session = req.getSession(true);

        String userid = req.getParameter("userid");
        String password = req.getParameter("passwd");
        String cpassword = req.getParameter("vpasswd");
        String firstName = req.getParameter("fname");
        String lastName = req.getParameter("lname");
        String addr1 = req.getParameter("addr1");
        String addr2 = req.getParameter("addr2");
        String addrCity = req.getParameter("city");
        String addrState = req.getParameter("state");
        String addrZip = req.getParameter("zip");
        String phone = req.getParameter("phone");

        //validate all user input
        //This could be done more eloquently using a framework such as Struts...
        if (!Util.validateString(userid)) {
            req.setAttribute(Util.ATTR_RESULTS, "Email address contains invalid characters.");
            url = Util.PAGE_REGISTER;
        } else if (!Util.validateString(firstName)) {
            req.setAttribute(Util.ATTR_RESULTS, "First Name contains invalid characters.");
            url = Util.PAGE_REGISTER;
        } else if (!Util.validateString(lastName)) {
            req.setAttribute(Util.ATTR_RESULTS, "Last Name contains invalid characters.");
            url = Util.PAGE_REGISTER;
        } else if (!Util.validateString(addr1)) {
            req.setAttribute(Util.ATTR_RESULTS, "Address Line 1 contains invalid characters.");
            url = Util.PAGE_REGISTER;
        } else if (!Util.validateString(addr2)) {
            req.setAttribute(Util.ATTR_RESULTS, "Address Line 2 contains invalid characters.");
            url = Util.PAGE_REGISTER;
        } else if (!Util.validateString(addrCity)) {
            req.setAttribute(Util.ATTR_RESULTS, "City contains invalid characters.");
            url = Util.PAGE_REGISTER;
        } else if (!Util.validateString(addrState)) {
            req.setAttribute(Util.ATTR_RESULTS, "State contains invalid characters.");
            url = Util.PAGE_REGISTER;
        } else if (!Util.validateString(addrZip)) {
            req.setAttribute(Util.ATTR_RESULTS, "Zip contains invalid characters.");
            url = Util.PAGE_REGISTER;
        } else if (!Util.validateString(phone)) {
            req.setAttribute(Util.ATTR_RESULTS, "Phone Number contains invalid characters.");
            url = Util.PAGE_REGISTER;
        }
        // Make sure passwords match.
        else if (!password.equals(cpassword)) {
            req.setAttribute(Util.ATTR_RESULTS, "Passwords do not match.");
            url = Util.PAGE_REGISTER;
        } else {
            // Create the new user.
            CustomerInfo customerInfo = login.createNewUser(userid, password, firstName, lastName, addr1, addr2,
                    addrCity, addrState, addrZip, phone);

            if (customerInfo != null) {
                // Store customer info in HttpSession.
                session.setAttribute(Util.ATTR_CUSTOMER, customerInfo);

                // See if user was in the middle of checking out.
                Boolean checkingOut = (Boolean) session.getAttribute(Util.ATTR_CHECKOUT);
                if ((checkingOut != null) && (checkingOut.booleanValue())) {
                    url = Util.PAGE_ORDERINFO;
                } else {
                    String category = (String) session.getAttribute(Util.ATTR_CATEGORY);

                    // Default to plants
                    if (category == null) {
                        url = Util.PAGE_PROMO;
                    } else {
                        url = Util.PAGE_SHOPPING;
                        req.setAttribute(Util.ATTR_INVITEMS,
                                catalog.getItemsByCategory(Integer.parseInt(category)));
                    }
                }
            } else {
                url = Util.PAGE_REGISTER;
                req.setAttribute(Util.ATTR_RESULTS, "New user NOT created!");
            }
        }
        requestDispatch(getServletConfig().getServletContext(), req, resp, url);
        //         }
        //         catch (CreateException e) { }
    } else if (action.equals(ACTION_ACCOUNT)) {
        String url;
        HttpSession session = req.getSession(true);
        CustomerInfo customerInfo = (CustomerInfo) session.getAttribute(Util.ATTR_CUSTOMER);
        if (customerInfo == null) {
            url = Util.PAGE_LOGIN;
            req.setAttribute(Util.ATTR_UPDATING, "true");
            req.setAttribute(Util.ATTR_RESULTS, "\nYou must login first.");
        } else {
            url = Util.PAGE_ACCOUNT;
            req.setAttribute(Util.ATTR_EDITACCOUNTINFO, customerInfo);
        }
        requestDispatch(getServletConfig().getServletContext(), req, resp, url);
    } else if (action.equals(ACTION_ACCOUNTUPDATE)) {
        //         try
        //         {
        String url;
        HttpSession session = req.getSession(true);
        CustomerInfo customerInfo = (CustomerInfo) session.getAttribute(Util.ATTR_CUSTOMER);

        String userid = customerInfo.getCustomerID();
        String firstName = req.getParameter("fname");
        String lastName = req.getParameter("lname");
        String addr1 = req.getParameter("addr1");
        String addr2 = req.getParameter("addr2");
        String addrCity = req.getParameter("city");
        String addrState = req.getParameter("state");
        String addrZip = req.getParameter("zip");
        String phone = req.getParameter("phone");

        // Create the new user.
        customerInfo = login.updateUser(userid, firstName, lastName, addr1, addr2, addrCity, addrState, addrZip,
                phone);
        // Store updated customer info in HttpSession.
        session.setAttribute(Util.ATTR_CUSTOMER, customerInfo);

        // See if user was in the middle of checking out.
        Boolean checkingOut = (Boolean) session.getAttribute(Util.ATTR_CHECKOUT);
        if ((checkingOut != null) && (checkingOut.booleanValue())) {
            url = Util.PAGE_ORDERINFO;
        } else {
            String category = (String) session.getAttribute(Util.ATTR_CATEGORY);

            // Default to plants
            if (category == null) {
                url = Util.PAGE_PROMO;
            } else {
                url = Util.PAGE_SHOPPING;
                req.setAttribute(Util.ATTR_INVITEMS, catalog.getItemsByCategory(Integer.parseInt(category)));
            }
        }

        requestDispatch(getServletConfig().getServletContext(), req, resp, url);
        //         }
        //         catch (CreateException e) { }
    } else if (action.equals(ACTION_SETLOGGING)) {
        String debugSetting = req.getParameter("logging");
        if ((debugSetting == null) || (!debugSetting.equals("debug")))
            Util.setDebug(false);
        else
            Util.setDebug(true);

        requestDispatch(getServletConfig().getServletContext(), req, resp, Util.PAGE_HELP);
    }
}

From source file:com.sun.identity.admin.model.ViewApplication.java

public ViewApplication(Application a) {
    this();//from   ww  w .  j av  a 2s.co m

    ManagedBeanResolver mbr = new ManagedBeanResolver();

    name = a.getName();
    description = a.getDescription();

    // application type
    Map<String, ViewApplicationType> entitlementApplicationTypeToViewApplicationTypeMap = (Map<String, ViewApplicationType>) mbr
            .resolve("entitlementApplicationTypeToViewApplicationTypeMap");
    viewApplicationType = entitlementApplicationTypeToViewApplicationTypeMap
            .get(a.getApplicationType().getName());

    // birth, modified, author, modifier
    birth = new Date(a.getCreationDate());
    modified = new Date(a.getLastModifiedDate());
    author = a.getCreatedBy();
    modifier = a.getLastModifiedBy();

    // resources
    for (String resourceString : a.getResources()) {
        Resource r;
        try {
            r = (Resource) Class.forName(viewApplicationType.getResourceClassName()).newInstance();
        } catch (ClassNotFoundException cnfe) {
            throw new RuntimeException(cnfe);
        } catch (InstantiationException ie) {
            throw new RuntimeException(ie);
        } catch (IllegalAccessException iae) {
            throw new RuntimeException(iae);
        }
        r.setName(resourceString);
        resources.add(r);
    }

    // actions
    for (String actionName : a.getActions().keySet()) {
        Boolean value = a.getActions().get(actionName);
        BooleanAction ba = new BooleanAction();
        ba.setName(actionName);
        ba.setAllow(value.booleanValue());
        booleanActionsBean.getActions().add(ba);
    }

    // conditions
    ConditionFactory ctf = (ConditionFactory) mbr.resolve("conditionFactory");
    Map<String, ConditionType> conditionTypeNameMap = ctf.getConditionTypeNameMap();
    for (String conditionTypeName : a.getConditions()) {
        ConditionType ct = conditionTypeNameMap.get(conditionTypeName);
        assert (ct != null);
        conditionTypes.add(ct);
    }

    // subjects
    SubjectFactory sf = (SubjectFactory) mbr.resolve("subjectFactory");
    for (String viewSubjectClassName : a.getSubjects()) {
        SubjectType st = sf.getSubjectType(viewSubjectClassName);
        assert (st != null);
        subjectTypes.add(st);
    }

    // override rule
    Class ecClass = a.getEntitlementCombinerClass();
    overrideRule = OverrideRule.valueOf(ecClass);
}

From source file:org.netxilia.spi.impl.formula.JavaCCFormulaParserImpl.java

@Override
public boolean isCacheable(Formula formula) throws FormulaParsingException {
    ASTFormulaTree tree = parse(formula);
    // stops at the first function node with a non-cacheable result
    Boolean cacheable = tree.visit(new INodeVisitor<Boolean>() {
        @Override/* w  w w .ja v a 2 s . c  o  m*/
        public Boolean visit(ASTBaseNode node) {
            if (node instanceof ASTFunction) {
                IFunction function = ((ASTFunction) node).getFunction();
                if (function == null || !function.isCacheble()) {
                    return Boolean.FALSE;
                }
            }
            return null;
        }
    });
    return cacheable != null ? cacheable.booleanValue() : true;

}

From source file:net.sourceforge.vulcan.spring.jdbc.JdbcSchemaMigrator.java

boolean isTablePresent(final String tableName) {
    final Boolean b = (Boolean) jdbcTemplate.execute(new StatementCallback() {
        public Object doInStatement(Statement stmt) throws SQLException, DataAccessException {
            ResultSet rs = stmt.getConnection().getMetaData().getTables(null, null, null,
                    new String[] { "TABLE" });
            while (rs.next()) {
                if (tableName.equalsIgnoreCase(rs.getString("TABLE_NAME"))) {
                    return true;
                }//from   w ww.  j  a v a 2 s .c o  m
            }
            return false;
        }
    });

    return b.booleanValue();
}

From source file:lucee.commons.io.res.type.ftp.FTPResource.java

@Override
public boolean isReadable() {
    Boolean rtn = hasPermission(FTPFile.READ_PERMISSION);
    if (rtn == null)
        return false;
    return rtn.booleanValue();
}

From source file:lucee.commons.io.res.type.ftp.FTPResource.java

public boolean isWriteable() {
    Boolean rtn = hasPermission(FTPFile.WRITE_PERMISSION);
    if (rtn == null)
        return false;
    return rtn.booleanValue();
}

From source file:org.opentaps.common.reporting.ChartViewHandler.java

/**
 * Encode chart as image/png and send it to browser
 *
 * @param chartContext// w  ww  .j  a va2  s .  c o m
 * @param response
 * @throws IOException
 */
protected void sendChart(Map<String, Object> chartContext, HttpServletResponse response) throws IOException {

    JFreeChart chartObject = (JFreeChart) chartContext.get("chartObject");
    Integer width = (Integer) chartContext.get("width");
    Integer height = (Integer) chartContext.get("height");
    Boolean encodeAlpha = (Boolean) chartContext.get("alphaCompression");
    Integer compressRatio = (Integer) chartContext.get("compressRatio");

    if (chartObject != null && width.compareTo(0) > 0 && height.compareTo(0) > 0) {
        response.setContentType("image/png");
        if (encodeAlpha != null
                || (compressRatio != null && compressRatio.intValue() >= 0 && compressRatio.intValue() <= 9)) {
            ChartUtilities.writeChartAsPNG(response.getOutputStream(), chartObject, width, height,
                    encodeAlpha.booleanValue(), compressRatio.intValue());
        } else {
            ChartUtilities.writeChartAsPNG(response.getOutputStream(), chartObject, width, height);
        }
    }
}