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:de.willuhn.jameica.hbci.passports.pintan.ChipTANDialog.java

/**
 * Findet heraus, ob alle Vorbedingungen fuer die Nutzung von ChipTAN USB erfuellt sind.
 * @throws RemoteException/* w w w .j a  va  2 s  . c o m*/
 */
private void checkUSB() throws RemoteException {
    // Checken, ob wir chipTAN USB ausgewaehlt haben
    PtSecMech mech = config != null ? config.getCurrentSecMech() : null;
    if (mech == null || !mech.useUSB())
        return; // brauchen wir gar nicht weiter ueberlegen

    // Checken, ob der User schon entschieden hatte, dass er chipTAN USB NICHT nutzen moechte
    Boolean use = config != null ? config.isChipTANUSB() : null;
    if (use != null && !use.booleanValue())
        return; // User hat explizit entschieden, chipTAN USB NICHT zu nutzen

    // Versuchen, die Verbindung zum Kartenleser herzustellen
    try {
        Logger.info("searching for smartcards, please wait...");
        Application.getMessagingFactory().sendMessage(new StatusBarMessage(
                i18n.tr("Legen Sie die bitte Chipkarte ein."), StatusBarMessage.TYPE_INFO));
        this.service = SmartCardService.createInstance(ChipTanCardService.class,
                this.config != null ? StringUtils.trimToNull(this.config.getCardReader()) : null);

        // Wir haben grundsaetzlich einen Kartenleser.
        if (this.service != null && this.config != null) {
            Logger.info("found smartcard, to be used: " + (use != null ? use : "<asking user>"));

            // User hat explizit entschieden, den Kartenleser per USB zu nutzen.
            if (use != null && use.booleanValue()) {
                this.usb = this.config.isChipTANUSB();
                return;
            }

            // User fragen, ob er ihn auch nutzen moechte, wenn wir das noch nicht getan haben
            // Das Speichern der Antwort koennen wir nicht Jameica selbst ueberlassen, weil
            // die Entscheidung ja pro PIN/TAN-Config gelten soll und nicht global.
            this.usb = Application.getCallback().askUser(i18n.tr(
                    "Es wurde ein USB-Kartenleser gefunden.\nMchten Sie diesen zur Erzeugung der TAN verwenden?"),
                    false);
            this.config.setChipTANUSB(this.usb);
        }
    } catch (Throwable t) {
        Logger.info("no chipcard reader found, chipTAN USB not available: " + t.getMessage());
        Logger.write(Level.DEBUG, "stacktrace for debugging purpose", t);
    }
}

From source file:br.mdarte.exemplo.academico.cd.EstudanteDAO.java

/**
 * Lista todos os objetos./*from w  ww . j  ava2s . c  om*/
 * 
 * @return Lista de objetos
 */
public List<AbstractEntity> list(PaginationStrategy paginacao, String propriedade, Boolean desc)
        throws DAOException {

    try {
        Session session = currentSession();

        String hql = "from br.mdarte.exemplo.academico.cd.Estudante";

        if (propriedade != null && !propriedade.equals("")) {
            String order = desc.booleanValue() ? " desc" : " asc";
            hql += " order by " + propriedade + order;
        }

        org.hibernate.Query qry = session.createQuery(hql);

        if (paginacao == null)
            paginacao = new NoPagination();

        paginacao.paginateResult(qry);
        qry.setCacheable(true);
        return qry.list();

    } catch (HibernateException h) {
        throw new DAOException(h);
    }
}

From source file:com.oneops.cms.ws.rest.DjRestController.java

@RequestMapping(value = "/dj/simple/releases", method = RequestMethod.GET)
@ResponseBody/*  w ww  .j  ava  2  s  .  c  o m*/
public List<CmsRelease> getReleaseBy3(@RequestParam("nsPath") String nsPath,
        @RequestParam(value = "releaseName", required = false) String releaseName,
        @RequestParam(value = "releaseState", required = false) String releaseState,
        @RequestParam(value = "latest", required = false) Boolean latest,
        @RequestHeader(value = "X-Cms-Scope", required = false) String scope) {

    List<CmsRelease> relList = null;

    if (latest != null && latest.booleanValue()) {
        relList = djManager.getLatestRelease(nsPath, releaseState);
    } else {
        relList = djManager.getReleaseBy3(nsPath, releaseName, releaseState);
    }

    if (scope != null) {
        for (CmsRelease rel : relList) {
            scopeVerifier.verifyScope(scope, rel);
        }
    }

    return relList;
}

From source file:com.jaspersoft.jasperserver.ws.axis2.repository.ReportUnitHandler.java

protected void updateResource(Resource resource, ResourceDescriptor descriptor,
        RepositoryServiceContext serviceContext) throws WSException {
    ReportUnit reportUnit = (ReportUnit) resource;

    Boolean alwaysPrompt = descriptor
            .getResourcePropertyValueAsBoolean(ResourceDescriptor.PROP_RU_ALWAYS_PROPMT_CONTROLS);
    if (alwaysPrompt != null) {
        reportUnit.setAlwaysPromptControls(alwaysPrompt.booleanValue());
    }//  ww  w  . j  a  va 2  s . com

    Integer controlsLayout = descriptor
            .getResourcePropertyValueAsInteger(ResourceDescriptor.PROP_RU_CONTROLS_LAYOUT);
    if (controlsLayout != null) {
        reportUnit.setControlsLayout(controlsLayout.byteValue());
    }

    String controlsView = descriptor
            .getResourcePropertyValue(ResourceDescriptor.PROP_RU_INPUTCONTROL_RENDERING_VIEW);
    if (controlsView != null)
        reportUnit.setInputControlRenderingView(controlsView);

    String renderingView = descriptor
            .getResourcePropertyValue(ResourceDescriptor.PROP_RU_REPORT_RENDERING_VIEW);
    if (renderingView != null)
        reportUnit.setReportRenderingView(renderingView);

    List children = descriptor.getChildren();
    for (int i = 0; i < children.size(); ++i) {
        ResourceDescriptor childResource = (ResourceDescriptor) children.get(i);
        if (serviceContext.getHandlerRegistry().typeExtends(childResource.getWsType(),
                ResourceDescriptor.TYPE_DATASOURCE)) {
            if (childResource.getIsReference()) {
                reportUnit.setDataSourceReference(childResource.getReferenceUri());
            } else {
                ReportDataSource dataSource = (ReportDataSource) toChildResource(childResource, serviceContext);
                reportUnit.setDataSource(dataSource);
            }
        } else if (childResource.getWsType().equals(ResourceDescriptor.TYPE_JRXML)
                && childResource.isMainReport()) {
            String referenceURI = childResource.getReferenceUri();
            if (referenceURI != null && referenceURI.trim().length() > 0) {
                reportUnit.setMainReportReference(referenceURI);
            } else {
                FileResource fileResource = (FileResource) toChildResource(childResource, serviceContext);
                fileResource.setFileType(FileResource.TYPE_JRXML);

                reportUnit.setMainReport(fileResource);
            }
        }
    }
}

From source file:org.apache.ofbiz.base.util.UtilHttp.java

/**
 * Create a map from a HttpServletRequest (parameters) object
 * @param onlyIncludeOrSkip If true only include, if false skip, the named parameters in the nameSet. If this is null and nameSet is not null, default to skip.
 * @return The resulting Map//from  ww  w .  ja  v  a2  s  . co  m
 */
public static Map<String, Object> getParameterMap(HttpServletRequest request, Set<? extends String> nameSet,
        Boolean onlyIncludeOrSkip) {
    boolean onlyIncludeOrSkipPrim = onlyIncludeOrSkip == null ? true : onlyIncludeOrSkip.booleanValue();
    Map<String, Object> paramMap = new HashMap<String, Object>();

    // add all the actual HTTP request parameters
    Enumeration<String> e = UtilGenerics.cast(request.getParameterNames());
    while (e.hasMoreElements()) {
        String name = e.nextElement();
        if (nameSet != null && (onlyIncludeOrSkipPrim ^ nameSet.contains(name))) {
            continue;
        }

        Object value = null;
        String[] paramArr = request.getParameterValues(name);
        if (paramArr != null) {
            if (paramArr.length > 1) {
                value = Arrays.asList(paramArr);
            } else {
                value = paramArr[0];
                // does the same thing basically, nothing better about it as far as I can see: value = request.getParameter(name);
            }
        }
        paramMap.put(name, value);
    }

    paramMap.putAll(getPathInfoOnlyParameterMap(request, nameSet, onlyIncludeOrSkip));

    if (paramMap.size() == 0) {
        // nothing found in the parameters; maybe we read the stream instead
        Map<String, Object> multiPartMap = UtilGenerics.checkMap(request.getAttribute("multiPartMap"));
        if (UtilValidate.isNotEmpty(multiPartMap)) {
            paramMap.putAll(multiPartMap);
        }
    }

    if (Debug.verboseOn()) {
        Debug.logVerbose("Made Request Parameter Map with [" + paramMap.size() + "] Entries", module);
        Debug.logVerbose("Request Parameter Map Entries: " + System.getProperty("line.separator")
                + UtilMisc.printMap(paramMap), module);
    }

    return canonicalizeParameterMap(paramMap);
}

From source file:org.apache.ofbiz.base.util.UtilHttp.java

/** Returns true if the user has JavaScript enabled.
 * @param request// ww  w .  j a v a 2 s .  c  om
 * @return whether javascript is enabled
 */
public static boolean isJavaScriptEnabled(HttpServletRequest request) {
    HttpSession session = request.getSession();
    Boolean javaScriptEnabled = (Boolean) session.getAttribute("javaScriptEnabled");
    if (javaScriptEnabled != null) {
        return javaScriptEnabled.booleanValue();
    }
    return false;
}

From source file:org.apache.ofbiz.base.util.UtilHttp.java

public static Map<String, Object> getPathInfoOnlyParameterMap(String pathInfoStr, Set<? extends String> nameSet,
        Boolean onlyIncludeOrSkip) {
    boolean onlyIncludeOrSkipPrim = onlyIncludeOrSkip == null ? true : onlyIncludeOrSkip.booleanValue();
    Map<String, Object> paramMap = new HashMap<String, Object>();

    // now add in all path info parameters /~name1=value1/~name2=value2/
    // note that if a parameter with a given name already exists it will be put into a list with all values

    if (UtilValidate.isNotEmpty(pathInfoStr)) {
        // make sure string ends with a trailing '/' so we get all values
        if (!pathInfoStr.endsWith("/"))
            pathInfoStr += "/";

        int current = pathInfoStr.indexOf('/');
        int last = current;
        while ((current = pathInfoStr.indexOf('/', last + 1)) != -1) {
            String element = pathInfoStr.substring(last + 1, current);
            last = current;/*from ww  w . j ava2  s . c o m*/
            if (element.charAt(0) == '~' && element.indexOf('=') > -1) {
                String name = element.substring(1, element.indexOf('='));
                if (nameSet != null && (onlyIncludeOrSkipPrim ^ nameSet.contains(name))) {
                    continue;
                }

                String value = element.substring(element.indexOf('=') + 1);
                Object curValue = paramMap.get(name);
                if (curValue != null) {
                    List<String> paramList = null;
                    if (curValue instanceof List<?>) {
                        paramList = UtilGenerics.checkList(curValue);
                        paramList.add(value);
                    } else {
                        String paramString = (String) curValue;
                        paramList = new LinkedList<String>();
                        paramList.add(paramString);
                        paramList.add(value);
                    }
                    paramMap.put(name, paramList);
                } else {
                    paramMap.put(name, value);
                }
            }
        }
    }

    return canonicalizeParameterMap(paramMap);
}

From source file:com.jaspersoft.jasperserver.ws.axis2.repository.ReportUnitHandler.java

protected void doDescribe(Resource resource, ResourceDescriptor descriptor, Map arguments,
        RepositoryServiceContext serviceContext) throws WSException {
    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());
    }/* w  w w  .ja  v  a  2s .c  o m*/

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

    Boolean reportUnitContent = arguments == null ? null : (Boolean) arguments.get(OPTION_REPORT_UNIT_CONTENTS);
    if (reportUnitContent != null && reportUnitContent.booleanValue()) {
        // Get datasource...
        ResourceReference ruDataSource = reportUnit.getDataSource();
        if (ruDataSource != null) {
            if (ruDataSource.isLocal()) {
                ResourceDescriptor dsDescriptor = serviceContext
                        .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);
            }
        }

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

        ResourceDescriptor ruMainReportResourceDescriptor = null;

        //         if (ruMainReportResourceResourceReference != null) {
        //            if (ruMainReportResourceResourceReference.isLocal()) {
        //               ruMainReportResourceDescriptor = serviceContext
        //                     .createResourceDescriptor(ruMainReportResourceResourceReference
        //                           .getLocalResource());
        //               // ruMainReportResourceDescriptor.setLocal(true);
        //            } else {
        //               ruMainReportResourceDescriptor = serviceContext
        //                     .createResourceDescriptor(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);
        //         }

        if (ruMainReportResourceResourceReference != null) {
            if (ruMainReportResourceResourceReference.isLocal()) {
                ruMainReportResourceDescriptor = serviceContext
                        .createResourceDescriptor(ruMainReportResourceResourceReference.getLocalResource());
                // ruMainReportResourceDescriptor.setLocal(true);
            } else {
                ruMainReportResourceDescriptor = serviceContext
                        .createResourceDescriptor(ruMainReportResourceResourceReference.getReferenceURI());
                // ruMainReportResourceDescriptor.setLocal(false);
            }

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

        List inputControls = null;
        if (reportLoadingService != null) {
            //TODO consider placing runtime ICs in separate place in order to distinguish them from report's own ICs
            inputControls = reportLoadingService
                    .getInputControlReferences(ExecutionContextImpl.getRuntimeExecutionContext(), reportUnit);
        } else {
            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 = serviceContext.createResourceDescriptor(resRef.getLocalResource());
                    // ruMainReportResourceDescriptor.setLocal(true);
                } else {
                    ruResourceDescriptor = serviceContext.createResourceDescriptor(resRef.getReferenceURI());
                    // 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 = serviceContext.createResourceDescriptor(resRef.getLocalResource());
                    // ruMainReportResourceDescriptor.setLocal(true);
                } else {
                    ruResourceDescriptor = serviceContext.createResourceDescriptor(resRef.getReferenceURI());
                    // ruMainReportResourceDescriptor.setLocal(false);
                }

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

From source file:com.frank.search.solr.core.DefaultQueryParser.java

private void processStatsOptions(SolrQuery solrQuery, Query query) {
    StatsOptions statsOptions = query.getStatsOptions();

    if (statsOptions == null || (CollectionUtils.isEmpty(statsOptions.getFields())
            && CollectionUtils.isEmpty(statsOptions.getFacets())
            && CollectionUtils.isEmpty(statsOptions.getSelectiveFacets()))) {
        return;//  w w w  . j  av  a2  s . c  o m
    }

    solrQuery.set(StatsParams.STATS, true);

    for (Field field : statsOptions.getFields()) {
        solrQuery.add(StatsParams.STATS_FIELD, field.getName());

        String selectiveCalcDistinctParam = CommonParams.FIELD + "." + field.getName() + "."
                + StatsParams.STATS_CALC_DISTINCT;
        Boolean selectiveCountDistincts = statsOptions.isSelectiveCalcDistincts(field);

        if (selectiveCountDistincts != null) {
            solrQuery.add(selectiveCalcDistinctParam, String.valueOf(selectiveCountDistincts.booleanValue()));
        }

    }

    for (Field field : statsOptions.getFacets()) {
        solrQuery.add(StatsParams.STATS_FACET, field.getName());
    }

    for (Entry<Field, Collection<Field>> entry : statsOptions.getSelectiveFacets().entrySet()) {

        Field field = entry.getKey();
        String prefix = CommonParams.FIELD + "." + field.getName() + ".";

        String paramName = prefix + StatsParams.STATS_FACET;
        for (Field facetField : entry.getValue()) {
            solrQuery.add(paramName, facetField.getName());
        }

    }

}

From source file:minium.script.js.JsVariablePostProcessor.java

public void populateEngine(JsEngine engine) {
    for (Entry<String, MultiValueMap<String, Object>> entry : variables.entrySet()) {
        String beanDefinitionName = entry.getKey();
        MultiValueMap<String, Object> variable = entry.getValue();

        Object bean = beanFactory.getBean(beanDefinitionName);
        String jsVar = (String) variable.getFirst("value");
        String expression = (String) variable.getFirst("expression");
        Boolean deleteAfterExpression = (Boolean) variable.getFirst("deleteAfterExpression");

        if (jsVar == null)
            jsVar = beanDefinitionName;/*from   w w  w. j  a v  a 2s.c  o  m*/
        if (bean instanceof Jsonable) {
            engine.putJson(jsVar, ((Jsonable) bean).toJson());
        } else {
            engine.put(jsVar, bean);
        }

        try {
            if (!Strings.isNullOrEmpty(expression)) {
                engine.eval(expression, 1);
            }
        } finally {
            if (deleteAfterExpression != null && deleteAfterExpression.booleanValue()) {
                engine.delete(jsVar);
            }
        }
    }
}