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.basistech.m2e.code.quality.pmd.MavenPluginConfigurationTranslator.java

/**
 * Get the {@literal includeTests} element value if present in the configuration.
 * /*from  ww w. jav a 2s .co m*/
 * @return the value of the {@code includeTests} element.
 * @throws CoreException
 */
public boolean getIncludeTests() throws CoreException {
    Boolean tests = configurator.getParameterValue("includeTests", Boolean.class, session, pmdGoalExecution);
    return tests != null && tests.booleanValue();
}

From source file:com.agiletec.plugins.jpcrowdsourcing.apsadmin.ideainstance.IdeaInstanceAction.java

public String trash() {
    try {//  w  w  w  . j  a  va2  s. c o  m
        IdeaInstance ideaInstance = this.getIdeaInstanceManager().getIdeaInstance(this.getCode());
        if (null == ideaInstance) {
            this.addActionError(this.getText("jpcrowdsourcing.error.ideaInstance.null"));
            return INPUT;
        }
        Boolean b = this.isPublished();
        if (null == b || b.booleanValue()) {
            return INPUT;
        }

        this.populateForm(ideaInstance);
        this.setStrutsAction(ApsAdminSystemConstants.DELETE);
    } catch (Throwable t) {
        _logger.error("error in trash", t);
        return FAILURE;
    }
    return SUCCESS;
}

From source file:com.duroty.application.mail.actions.CreateIdentityAction.java

/**
 * DOCUMENT ME!/*from  w w  w  .j  av a2  s.  c o m*/
 *
 * @param mapping DOCUMENT ME!
 * @param form DOCUMENT ME!
 * @param request DOCUMENT ME!
 * @param response DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 *
 * @throws Exception DOCUMENT ME!
 */
protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    ActionMessages errors = new ActionMessages();

    try {
        Preferences preferencesInstance = getPreferencesInstance(request);

        PreferencesObj preferencesObj = preferencesInstance.getPreferences();

        DynaActionForm _form = (DynaActionForm) form;

        IdentityObj identityObj = new IdentityObj();

        identityObj.setEmail((String) _form.get("email"));

        Boolean important = (Boolean) _form.get("default");

        if (important == null) {
            important = new Boolean(false);
        }

        identityObj.setImportant(important.booleanValue());
        identityObj.setName((String) _form.get("name"));
        identityObj.setReplyTo((String) _form.get("replyTo"));

        String code = preferencesInstance.createIdentity(identityObj);

        String body = getEmailBody(request, preferencesObj.getLanguage());

        MessageResources message = getResources(request);
        String subject = message.getMessage("general.title");

        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
                + path + "/mail/preferences/validateIdentity.drt?user=" + request.getUserPrincipal() + "&code="
                + code;

        body = body.replaceAll("\\$\\{email\\}", identityObj.getEmail());
        body = body.replaceAll("\\$\\{url\\}", basePath);

        IdentityObj identityDefault = preferencesInstance.getIdentityDefault();

        Send sendInstance = getSendInstance(request);
        sendInstance.sendIdentity(identityDefault.getEmail(), identityObj.getEmail(), subject, body);
    } 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);
    } finally {
    }

    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:org.apache.archiva.redback.rest.services.UserServiceTest.java

@Test
public void ping() throws Exception {
    Boolean res = getUserService().ping();
    assertTrue(res.booleanValue());
}

From source file:com.redhat.rhn.frontend.action.monitoring.notification.BaseFilterEditAction.java

private void processDates(DynaActionForm form, ModifyFilterCommand cmd, DatePickerResults dates) {
    Boolean recurring = (Boolean) form.get(RECURRING);
    int duration = 0;
    if (recurring.booleanValue()) {
        String s = form.getString(RECURRING_DURATION);
        duration = NumberUtils.createInteger(s).intValue();
        int durationType = ((Long) form.get(DURATION_TYPE)).intValue();
        Long frequency = (Long) form.get(RECURRING_FREQUENCY);
        cmd.updateRecurring(recurring, duration, durationType, frequency);
    } else {//from   w  w w.j  av a  2s  .  c o m
        cmd.disableRecurring();
    }
    cmd.setStartDate(dates.getStart().getDate());
    cmd.setExpiration(dates.getEnd().getDate());
}

From source file:net.gtl.movieanalytics.data.InfoStore.java

private void readJsonFile(String path) {
    JSONParser parser = new JSONParser();

    try {//from www  . j  a v  a  2 s.  c  o m
        JSONObject root = (JSONObject) parser.parse(new FileReader(path));
        double testRecordPercentage = (Double) root.get("testRecordPercentage");
        this.setTestRecordPercentage(testRecordPercentage);

        JSONArray tolerances = (JSONArray) root.get("errorToleranceRate");

        double errorToleranceRate[] = new double[tolerances.size()];
        Iterator<Double> iter = tolerances.iterator();
        int i = 0;
        while (iter.hasNext()) {
            errorToleranceRate[i] = iter.next();
            i++;
        }
        this.setErrorToleranceRate(errorToleranceRate);
        String tableName = (String) root.get("tableName");
        this.setTableName(tableName);
        String sourceTableName = (String) root.get("sourceTableName");
        this.setSourceTableName(sourceTableName);
        String resultFieldName = (String) root.get("resultFieldName");
        this.setResultFieldName(resultFieldName);

        JSONObject tdObj = (JSONObject) root.get("testDataSource");
        boolean isNew = (Boolean) tdObj.get("newGenerated");
        String tdPath = (String) tdObj.get("saveToFilePath");
        if ((tdPath == null) || (tdPath.equals(""))) {
            isNew = true;
        }
        this.setNewGeneratedTestDataSet(isNew);
        this.setTestDataSetIdFilePath(tdPath);

        String dbHost = (String) root.get("dbHost");
        this.setDbHost(dbHost);

        JSONArray features = (JSONArray) root.get("features");
        Iterator<JSONObject> iterator = features.iterator();
        while (iterator.hasNext()) {
            JSONObject featureObj = iterator.next();
            String name = (String) featureObj.get("name");
            String type = (String) featureObj.get("type");
            DBFieldType fType = DBFieldType.valueOf(type);
            int subNum = ((Long) featureObj.get("subNum")).intValue();

            FeatureDimension feature = new FeatureDimension(fType, name, subNum);
            this.addFeature(feature);
        }

        JSONArray fm = (JSONArray) root.get("featuresInModel");
        List<Feature> featuresInModel = new ArrayList<Feature>();
        Iterator<JSONObject> iterS = fm.iterator();
        while (iterS.hasNext()) {
            JSONObject currentFeature = iterS.next();
            Boolean isEnabled = (Boolean) currentFeature.get("enabled");
            if ((isEnabled != null) && (isEnabled.booleanValue() == false)) {
                continue;
            }

            String featureName = (String) currentFeature.get("name");
            Feature feature = new Feature(featureName);

            JSONArray functions = (JSONArray) currentFeature.get("functions");
            if (functions != null) {
                List<FeatureFunction> functionList = new ArrayList<FeatureFunction>();
                Iterator<JSONObject> funs = functions.iterator();
                while (funs.hasNext()) {
                    JSONObject function = funs.next();
                    String functionName = (String) function.get("name");
                    FeatureFunction featureFunction = new FeatureFunction(functionName);
                    JSONArray args = (JSONArray) function.get("arguments");

                    if ((args != null) && (args.size() > 0)) {
                        double arguments[] = new double[tolerances.size()];
                        Iterator<Double> iterA = args.iterator();
                        i = 0;
                        while (iterA.hasNext()) {
                            arguments[i] = iterA.next();
                            i++;
                        }
                        featureFunction.setArguments(arguments);
                    }
                    functionList.add(featureFunction);
                }
                feature.setFunctions(functionList);
            }
            featuresInModel.add(feature);
        }

        this.setFeaturesInModel(featuresInModel);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:net.solarnetwork.node.control.modbus.heartbeat.ModbusHeartbeatJob.java

@Override
protected void executeInternal(JobExecutionContext jobContext) throws Exception {
    final DateTime heartbeatDate = new DateTime();
    String heartbeatMessage = null;
    boolean heartbeatSuccess = false;
    try {//  w  w w .j av  a2  s  . com
        final Boolean executed = setValue(registerValue);
        if (executed == null) {
            // hmm, how can this be localized?
            heartbeatMessage = "No Modbus connection available.";
        } else if (executed.booleanValue() == false) {
            heartbeatMessage = "Unknown Modbus error.";
        } else {
            // good
            heartbeatSuccess = true;
        }
    } catch (RuntimeException e) {
        log.error("Error sending heartbeat message: {}", e.toString());
        Throwable root = e;
        while (root.getCause() != null) {
            root = root.getCause();
        }
        heartbeatMessage = "Error: " + root.getMessage();
    }
    STATUS_MAP.put(getStatusKey(), new JobStatus(heartbeatDate, heartbeatSuccess, heartbeatMessage));
}

From source file:org.metis.MetisServlet.java

/**
 * This is where we initialize the web application's strategy objects (rdbs,
 * pools, etc.) This method is called prior to initFrameworkServlet() being
 * called./*  w w  w  .j  av  a  2  s  . c o m*/
 */
@Override
protected void initStrategies(ApplicationContext context) {
    super.initStrategies(context);

    // Assign the resource bean this container's info
    WdsResourceBean.serverInfo = getServletContext().getServerInfo();

    // get list of all RDBs and PUSHERs for this application context
    rdbs = context.getBeansOfType(WdsResourceBean.class);
    pdbs = context.getBeansOfType(PusherBean.class);
    if (rdbs.isEmpty() && pdbs.isEmpty()) {
        LOG.error(getServletConfig().getServletName()
                + ": Neither RDBs nor PUSHERs have been defined for this web application");
        return;
    }

    Boolean secure = null;
    String prop = getInitParameter("secure");
    if (prop != null) {
        secure = Boolean.valueOf(prop);
        LOG.debug(getServletConfig().getServletName() + ": secure = " + secure.booleanValue());
    }

    Boolean authenticated = null;
    prop = getInitParameter("authenticated");
    if (prop != null) {
        authenticated = Boolean.valueOf(prop);
        LOG.debug(getServletConfig().getServletName() + ": authenticated = " + authenticated.booleanValue());
    }

    String agentNames = getInitParameter("agentNames");
    if (agentNames != null) {
        LOG.debug(getServletConfig().getServletName() + ": agentNames = " + agentNames);
    }

    String cacheControl = getInitParameter("cacheControl");
    if (cacheControl != null) {
        LOG.debug(getServletConfig().getServletName() + ": cacheControl = " + cacheControl);
    }

    try {
        // assign global init properties to the RDBs
        for (Iterator<WdsResourceBean> it = rdbs.values().iterator(); it.hasNext();) {
            WdsResourceBean rdb = it.next();

            if (rdb.getAuthenticated() == null && authenticated != null) {
                rdb.setAuthenticated(authenticated.booleanValue());
            }

            if (rdb.getSecure() == null && secure != null) {
                rdb.setSecure(secure.booleanValue());
            }

            if (rdb.getAgentNames() == null && agentNames != null) {
                rdb.setAgentNames(agentNames);
            }

            if (rdb.getCacheControl() == null && cacheControl != null) {
                rdb.setCacheControl(cacheControl);
            }
        }

    } catch (Exception e) {
        LOG.error(getServletConfig().getServletName() + "initStrategies: ERROR, this exception was caught - "
                + e.getLocalizedMessage());
    }
}

From source file:be.agiv.security.handler.WSSecurityHandler.java

public boolean handleMessage(SOAPMessageContext context) {
    Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);

    if (true == outboundProperty.booleanValue()) {
        try {/*  ww w .j ava  2  s.com*/
            handleOutboundMessage(context);
        } catch (Exception e) {
            LOG.error("outbound exception: " + e.getMessage(), e);
            throw new ProtocolException(e);
        }
    } else {
        try {
            handleInboundMessage(context);
        } catch (Exception e) {
            throw new ProtocolException(e);
        }
    }

    return true;
}

From source file:com.alibaba.dubbo.config.spring.ReferenceBean.java

public void afterPropertiesSet() throws Exception {
    if (getConsumer() == null) {
        Map<String, ConsumerConfig> consumerConfigMap = applicationContext == null ? null
                : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, ConsumerConfig.class,
                        false, false);/*www  .  ja  v  a  2 s  .c o  m*/
        if (consumerConfigMap != null && consumerConfigMap.size() > 0) {
            ConsumerConfig consumerConfig = null;
            for (ConsumerConfig config : consumerConfigMap.values()) {
                if (config.isDefault() == null || config.isDefault().booleanValue()) {
                    if (consumerConfig != null) {
                        throw new IllegalStateException(
                                "Duplicate consumer configs: " + consumerConfig + " and " + config);
                    }
                    consumerConfig = config;
                }
            }
            if (consumerConfig != null) {
                setConsumer(consumerConfig);
            }
        }
    }
    if (getApplication() == null && (getConsumer() == null || getConsumer().getApplication() == null)) {
        Map<String, ApplicationConfig> applicationConfigMap = applicationContext == null ? null
                : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, ApplicationConfig.class,
                        false, false);
        if (applicationConfigMap != null && applicationConfigMap.size() > 0) {
            ApplicationConfig applicationConfig = null;
            for (ApplicationConfig config : applicationConfigMap.values()) {
                if (config.isDefault() == null || config.isDefault().booleanValue()) {
                    if (applicationConfig != null) {
                        throw new IllegalStateException(
                                "Duplicate application configs: " + applicationConfig + " and " + config);
                    }
                    applicationConfig = config;
                }
            }
            if (applicationConfig != null) {
                setApplication(applicationConfig);
            }
        }
    }
    if (getModule() == null && (getConsumer() == null || getConsumer().getModule() == null)) {
        Map<String, ModuleConfig> moduleConfigMap = applicationContext == null ? null
                : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, ModuleConfig.class, false,
                        false);
        if (moduleConfigMap != null && moduleConfigMap.size() > 0) {
            ModuleConfig moduleConfig = null;
            for (ModuleConfig config : moduleConfigMap.values()) {
                if (config.isDefault() == null || config.isDefault().booleanValue()) {
                    if (moduleConfig != null) {
                        throw new IllegalStateException(
                                "Duplicate module configs: " + moduleConfig + " and " + config);
                    }
                    moduleConfig = config;
                }
            }
            if (moduleConfig != null) {
                setModule(moduleConfig);
            }
        }
    }
    if ((getRegistries() == null || getRegistries().size() == 0)
            && (getConsumer() == null || getConsumer().getRegistries() == null
                    || getConsumer().getRegistries().size() == 0)
            && (getApplication() == null || getApplication().getRegistries() == null
                    || getApplication().getRegistries().size() == 0)) {
        Map<String, RegistryConfig> registryConfigMap = applicationContext == null ? null
                : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, RegistryConfig.class,
                        false, false);
        if (registryConfigMap != null && registryConfigMap.size() > 0) {
            List<RegistryConfig> registryConfigs = new ArrayList<RegistryConfig>();
            for (RegistryConfig config : registryConfigMap.values()) {
                if (config.isDefault() == null || config.isDefault().booleanValue()) {
                    registryConfigs.add(config);
                }
            }
            if (registryConfigs != null && registryConfigs.size() > 0) {
                super.setRegistries(registryConfigs);
            }
        }
    }
    if (getMonitor() == null && (getConsumer() == null || getConsumer().getMonitor() == null)
            && (getApplication() == null || getApplication().getMonitor() == null)) {
        Map<String, MonitorConfig> monitorConfigMap = applicationContext == null ? null
                : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, MonitorConfig.class, false,
                        false);
        if (monitorConfigMap != null && monitorConfigMap.size() > 0) {
            MonitorConfig monitorConfig = null;
            for (MonitorConfig config : monitorConfigMap.values()) {
                if (config.isDefault() == null || config.isDefault().booleanValue()) {
                    if (monitorConfig != null) {
                        throw new IllegalStateException(
                                "Duplicate monitor configs: " + monitorConfig + " and " + config);
                    }
                    monitorConfig = config;
                }
            }
            if (monitorConfig != null) {
                setMonitor(monitorConfig);
            }
        }
    }
    Boolean b = isInit();
    if (b == null && getConsumer() != null) {
        b = getConsumer().isInit();
    }
    if (b != null && b.booleanValue()) {
        getObject();
    }
}