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:it.govpay.web.console.anagrafica.form.ConnettoreForm.java

private void setRendered(FormField<?> field, boolean common, boolean isHttp, boolean isSsl) {

    boolean rendered = false;
    Boolean value1 = this.abilitato.getValue();
    boolean abilt = (value1 != null ? value1.booleanValue() : false);

    if (common) {
        if (!isConnettorePdd) {
            if (abilt) {
                rendered = true;//from w  w  w  .j  a v  a  2s .c om
            } else {
                rendered = false;
            }
        } else
            rendered = true;
    } else {
        if (abilt) {

            SelectItem value = this.autenticazione.getValue();

            if (value != null) {
                String value2 = value.getValue();

                if (value2 != null) {
                    EnumAuthType auth = EnumAuthType.valueOf(value2);

                    if (auth.equals(EnumAuthType.NONE))
                        rendered = false;
                    else if (auth.equals(EnumAuthType.HTTPBasic)) {
                        if (isHttp)
                            rendered = true;

                        if (isSsl)
                            rendered = false;
                    } else {
                        if (isHttp)
                            rendered = false;

                        if (isSsl)
                            rendered = true;
                    }
                }
            }
        }
    }

    field.setRendered(rendered);
}

From source file:er.extensions.ERXExtensions.java

/**
 * This method is called by the delegate when the configuration
 * file is changed. It's sole purpose is to map a logging logger
 * to a debug group. Hopefully in the future we will have a more
 * generic solution.//from   w  ww .j av  a2  s .  c o m
 */
public static void configureAdaptorContext() {
    Boolean targetState = null;
    if (adaptorLogger != null) {
        if (adaptorLogger.isDebugEnabled() && !adaptorEnabled.booleanValue()) {
            targetState = Boolean.TRUE;
        } else if (!adaptorLogger.isDebugEnabled() && adaptorEnabled.booleanValue()) {
            targetState = Boolean.FALSE;
        }
        if (targetState != null) {
            setAdaptorLogging(targetState.booleanValue());
        }
    }
}

From source file:com.redhat.rhn.domain.user.UserFactory.java

/**
 * Syncs the user permissions with server group info..
 * @param usr the user to sync/* w w w.  ja v a  2  s . c  o m*/
 */
protected void syncUserPerms(User usr) {
    // Here we are replacing the functionality in add/remove_from_usergroup
    // and update_perms_for_user stored procedures
    UserImpl uimpl = (UserImpl) usr;

    boolean orgAdminChanged = false;
    Boolean wasOrgAdmin = uimpl.wasOrgAdmin();
    if (wasOrgAdmin != null) {
        orgAdminChanged = usr.hasRole(RoleFactory.ORG_ADMIN) != wasOrgAdmin.booleanValue();
    }

    if (orgAdminChanged) {
        syncServerGroupPerms(usr);
    }
    uimpl.resetWasOrgAdmin();
}

From source file:com.cloud.hypervisor.guru.VMwareGuru.java

/**
 * Decide in which cases nested virtualization should be enabled based on (1){@code globalNestedV}, (2){@code globalNestedVPerVM}, (3){@code localNestedV}<br/>
 * Nested virtualization should be enabled when one of this cases:
 * <ul>/*from  w ww  .  ja v a 2s .  c  o  m*/
 * <li>(1)=TRUE, (2)=TRUE, (3) is NULL (missing)</li>
 * <li>(1)=TRUE, (2)=TRUE, (3)=TRUE</li>
 * <li>(1)=TRUE, (2)=FALSE</li>
 * <li>(1)=FALSE, (2)=TRUE, (3)=TRUE</li>
 * </ul>
 * In any other case, it shouldn't be enabled
 * @param globalNestedV value of {@code 'vmware.nested.virtualization'} global config
 * @param globalNestedVPerVM value of {@code 'vmware.nested.virtualization.perVM'} global config
 * @param localNestedV value of {@code 'nestedVirtualizationFlag'} key in vm details if present, null if not present
 * @return "true" for cases in which nested virtualization is enabled, "false" if not
 */
protected Boolean shouldEnableNestedVirtualization(Boolean globalNestedV, Boolean globalNestedVPerVM,
        String localNestedV) {
    if (globalNestedV == null || globalNestedVPerVM == null) {
        return false;
    }
    boolean globalNV = globalNestedV.booleanValue();
    boolean globalNVPVM = globalNestedVPerVM.booleanValue();

    if (globalNVPVM) {
        return (localNestedV == null && globalNV) || BooleanUtils.toBoolean(localNestedV);
    }
    return globalNV;
}

From source file:com.aurel.track.persist.TListTypePeer.java

/**
 * if documents==true only documents else other than documents
 * @param projectType//from   w  ww.j  a v a  2 s  .c  om
 * @param documents
 * @return
 */
private List<TListTypeBean> loadAllowedByProjectType(Integer projectType, Boolean documents) {
    if (projectType == null) {
        return new LinkedList<TListTypeBean>();
    }
    Criteria crit = new Criteria();
    crit.addJoin(TPlistTypePeer.CATEGORY, PKEY);
    crit.add(TPlistTypePeer.PROJECTTYPE, projectType);
    crit.add(PKEY, Integer.valueOf(0), Criteria.NOT_EQUAL);
    if (documents != null) {
        if (documents.booleanValue()) {
            addDocumentTypeFlags(crit);
        } else {
            addNonDocumentTypeFlags(crit);
        }
    }
    crit.addAscendingOrderByColumn(SORTORDER);
    crit.addAscendingOrderByColumn(LABEL);
    try {
        return convertTorqueListToBeanList(doSelect(crit));
    } catch (TorqueException e) {
        LOGGER.error("Getting the issueTypes allowed by projectType " + projectType + " failed with "
                + e.getMessage());
        return new ArrayList<TListTypeBean>();
    }
}

From source file:de.hybris.platform.marketplaceintegrationbackoffice.renderer.MarketplaceIntegrationOrderInitialRenderer.java

private void initialOrderDownload(final MarketplaceStoreModel model) {
    if (null == model.getOrderStartTime()) {
        NotificationUtils.notifyUserVia(Localization
                .getLocalizedString("type.Marketplacestore." + MarketplaceStoreModel.ORDERSTARTTIME + ".name")
                + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, "");
        LOG.warn("get order start time is not filled!");
        return;//from   w  ww .  jav a2  s . c  o m
    } else if (null == model.getOrderEndTime()) {
        NotificationUtils.notifyUserVia(Localization
                .getLocalizedString("type.Marketplacestore." + MarketplaceStoreModel.ORDERENDTIME + ".name")
                + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, "");
        LOG.warn("get order end time is not filled!");
        return;
    } else if (model.getOrderStartTime().after(model.getOrderEndTime())) {
        NotificationUtils.notifyUserVia(Labels.getLabel("backoffice.field.timerange.error"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("start time is greate than end time!");
        return;
    } else if (model.getMarketplace().getTmallOrderStatus().isEmpty()
            || null == model.getMarketplace().getTmallOrderStatus()) {
        NotificationUtils.notifyUserVia(
                Localization
                        .getLocalizedString("type.Marketplace." + MarketplaceModel.TMALLORDERSTATUS + ".name")
                        + " " + Labels.getLabel("backoffice.field.notfilled"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("order status field is not filled!");
        return;
    }
    if (!StringUtils.isBlank(model.getIntegrationId()) && !model.getAuthorized().booleanValue()) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("authorization is expired!");
        return;
    }
    // in order to avoid this value out of date, we only get it from
    // database
    final Boolean isAuth = ((MarketplaceStoreModel) modelService.get(model.getPk())).getAuthorized();
    final String integrationId = ((MarketplaceStoreModel) modelService.get(model.getPk())).getIntegrationId();
    model.setIntegrationId(integrationId);
    model.setAuthorized(isAuth);
    if (null == isAuth || !isAuth.booleanValue()) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.unauthed"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("marketplace store do not authorized, initial download failed!");
        return;
    }

    String urlStr = "";
    final String logUUID = logUtil.getUUID();
    final MarketplaceSellerModel seller = model.getMarketplaceSeller();
    final MarketplaceModel marketPlace = seller.getMarketplace();
    try {

        // Configure and open a connection to the site you will send the
        urlStr = marketPlace.getAdapterUrl() + Config.getParameter(MARKETPLACE_ORDER_SYCHRONIZE_PATH)
                + Config.getParameter(MARKETPLACE_ORDER_INITIAL_PATH) + integrationId
                + Config.getParameter(MARKETPLACE_ORDER_INITIAL_LOGUUID) + logUUID;
        final JSONObject jsonObj = new JSONObject();
        jsonObj.put("batchSize", BATCH_SIZE);
        jsonObj.put("status", getOrderStatus(model.getMarketplace().getTmallOrderStatus()));
        //jsonObj.put("marketplaceLogId", marketplacelogUUID);
        // set the correct timezone
        final String configTimezone = model.getMarketplace().getTimezone();
        boolean isValidTimezone = false;
        for (final String vaildTimezone : TimeZone.getAvailableIDs()) {
            if (vaildTimezone.equals(configTimezone)) {
                isValidTimezone = true;
                break;
            }
        }

        if (!isValidTimezone) {
            final String[] para = { configTimezone == null ? "" : configTimezone,
                    model.getMarketplace().getName() };
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.wrongtimezone", para),
                    NotificationEvent.Type.WARNING, "");
            LOG.warn("wrong timezone or missing timezone configed in market:"
                    + model.getMarketplace().getName());
            return;
        }

        final SimpleDateFormat format = new SimpleDateFormat(Config.getParameter(BACKOFFICE_FORMAT_DATEFORMAT));
        format.setTimeZone(TimeZone.getTimeZone(configTimezone));

        final String startTimeWithCorrectZone = format.format(model.getOrderStartTime()).toString();
        final String endTimeWithCorrectZone = format.format(model.getOrderEndTime()).toString();

        jsonObj.put("startCreated", startTimeWithCorrectZone);
        jsonObj.put("endCreated", endTimeWithCorrectZone);
        jsonObj.put("productCatalogVersion",
                model.getCatalogVersion().getCatalog().getId() + ":" + model.getCatalogVersion().getVersion());
        jsonObj.put("currency", model.getCurrency().getIsocode());

        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.success"),
                NotificationEvent.Type.SUCCESS, "");

        final JSONObject results = marketplaceHttpUtil.post(urlStr, jsonObj.toJSONString());

        final String msg = results.toJSONString();
        final String responseCode = results.get("code").toString();

        if ("401".equals(responseCode)) {
            LOG.error("=========================================================================");
            LOG.error("Order initial download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + responseCode);
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Authentication was failed, please re-authenticate again!");
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"),
                    NotificationEvent.Type.FAILURE, "");
            LOG.warn("Authentication was failed, please re-authenticate again!");
            return;
        } else if (!("0".equals(responseCode))) {
            LOG.error("=========================================================================");
            LOG.error("Order initial download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + responseCode);
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("A known issue occurs in tmall, error details :" + msg);
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(
                    Labels.getLabel("marketplace.tmallapp.known.issues", new Object[] { msg }),
                    NotificationEvent.Type.FAILURE, "");
            LOG.warn("A known issue occurs in tmall, error details :" + msg);
            return;
        }

    } catch (final HttpClientErrorException httpError) {
        if (httpError.getStatusCode().is4xxClientError()) {
            LOG.error("=========================================================================");
            LOG.error("Order initial download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Tmall service URL is not correct!");
            LOG.error("Detail error info: " + httpError.getMessage());
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.request.post.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        if (httpError.getStatusCode().is5xxServerError()) {
            LOG.error("=========================================================================");
            LOG.error("Order initial download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Json Ojbect is not correct!");
            LOG.error("Detail error info: " + httpError.getMessage());
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        LOG.error(httpError.toString());
        return;
    } catch (final ResourceAccessException raError) {
        LOG.error("=========================================================================");
        LOG.error("Order initial download request post to Tmall failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Marketplace order download request server access failed!");
        LOG.error("Detail error info: " + raError.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.access.error"),
                NotificationEvent.Type.FAILURE, "");
        return;
    } catch (final HttpServerErrorException serverError) {
        LOG.error("=========================================================================");
        LOG.error("Order initial download request post to Tmall failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Marketplace order download request server process failed!");
        LOG.error("Detail error info: " + serverError.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                NotificationEvent.Type.FAILURE, "");
        return;
    } catch (final Exception e) {
        final String errorMsg = e.getClass().toString() + ":" + e.getMessage();
        NotificationUtils.notifyUserVia(
                Labels.getLabel("marketplace.runtime.issues", new Object[] { errorMsg }),
                NotificationEvent.Type.FAILURE, "");
        LOG.warn(e.getMessage() + e.getStackTrace());
        return;
    }
    LOG.info("=========================================================================");
    LOG.info("Order initial download request post to Tmall suceessfully!");
    LOG.info("-------------------------------------------------------------------------");
    LOG.info("Marketplacestore Code: " + model.getName());
    LOG.info("Request path: " + urlStr);
    LOG.info("=========================================================================");

    //      logUtil.addMarketplaceLog("PENDING", model.getIntegrationId(), Labels.getLabel("marketplace.order.initial.action"),
    //            Labels.getLabel("marketplace.order.initial.object.type"), marketPlace, model, logUUID);
}

From source file:org.openmrs.module.idgen.service.BaseIdentifierSourceService.java

/**
 * @see org.openmrs.module.idgen.service.IdentifierSourceService#getPatientIdentifierTypesByAutoGenerationOption(java.lang.Boolean, java.lang.Boolean)
 *//*  w  w w .j  av  a2s . c  om*/
public List<PatientIdentifierType> getPatientIdentifierTypesByAutoGenerationOption(Boolean manualEntryEnabled,
        Boolean autoGenerationEnabled) {

    List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();

    for (PatientIdentifierType type : Context.getPatientService().getAllPatientIdentifierTypes()) {
        AutoGenerationOption option = getAutoGenerationOption(type);
        if (option != null && option.isManualEntryEnabled() == manualEntryEnabled.booleanValue()
                && option.isAutomaticGenerationEnabled() == autoGenerationEnabled.booleanValue()) {
            identifierTypes.add(type);
        }
    }
    return identifierTypes;
}

From source file:com.duroty.controller.actions.ForgotPasswordAction.java

protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    ActionMessages errors = new ActionMessages();

    try {/*from  ww w  .  j  a  v a2s. co  m*/
        Boolean isResponseCorrect = Boolean.FALSE;

        //remenber that we need an id to validate!
        String captchaId = request.getSession().getId();

        //retrieve the response
        String captchResponse = request.getParameter("j_captcha_response");

        // Call the Service method
        try {
            isResponseCorrect = CaptchaServiceSingleton.getInstance().validateResponseForID(captchaId,
                    captchResponse);
        } catch (CaptchaServiceException e) {
            //should not happen, may be thrown if the id is not valid 
        }

        if (!isResponseCorrect.booleanValue()) {
            errors.add("general", new ActionMessage(ExceptionCode.ERROR_MESSAGES_PREFIX + "general",
                    "general.captcha.error"));
            request.setAttribute("exception", "general.captcha.error");
            doTrace(request, DLog.ERROR, getClass(), "general.captcha.error");
        } else {
            String j_data = request.getParameter("j_data");

            if (StringUtils.isBlank(j_data)) {
                errors.add("general", new ActionMessage(ExceptionCode.ERROR_MESSAGES_PREFIX + "general",
                        "general.captcha.data.required"));
                request.setAttribute("exception", "general.captcha.data.required");
                doTrace(request, DLog.ERROR, getClass(), "general.captcha.data.required");
            } else {
                Open openInstance = getOpenInstance(request);

                openInstance.forgotPassword(j_data);
            }
        }
    } catch (Exception ex) {
        String errorMessage = ExceptionUtilities.parseMessage(ex);

        if (errorMessage == null) {
            errorMessage = "NullPointerException";
        }

        errors.add("general", new ActionMessage(ExceptionCode.ERROR_MESSAGES_PREFIX + "general", errorMessage));
        request.setAttribute("exception", errorMessage);
        doTrace(request, DLog.ERROR, getClass(), errorMessage);
    }

    if (errors.isEmpty()) {
        doTrace(request, DLog.INFO, getClass(), "OK");

        return mapping.findForward(Constants.ACTION_SUCCESS_FORWARD);
    } else {
        saveErrors(request, errors);

        return mapping.findForward(Constants.ACTION_FAIL_FORWARD);
    }
}

From source file:ucar.unidata.idv.control.chart.ChartHolder.java

/**
 * is the given legend visible/*from  ww  w  .j  ava 2s . c  o m*/
 *
 * @param param which legend
 *
 * @return is visible
 */
private boolean isLegendVisible(int param) {
    Boolean b = legendVisible.get(param);
    if (b != null) {
        return b.booleanValue();
    }
    return true;
}