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.ocpsoft.pretty.faces.config.reload.PrettyConfigReloader.java

/**
 * Detects the PrettyFaces development mode using the {@link DevelopmentModeDetector} SPI.
 */// w w  w.j a v  a2 s . c  om
private boolean isDevelopmentModeActive(ServletContext servletContext) {

    // create the ServiceLoader for the SPI
    ServiceLoader<DevelopmentModeDetector> serviceLoader = ServiceLoader.load(DevelopmentModeDetector.class);

    // we need a list to be able to sort it
    List<DevelopmentModeDetector> detectors = new ArrayList<DevelopmentModeDetector>();
    for (DevelopmentModeDetector detector : serviceLoader) {
        detectors.add(detector);
    }

    // sort them by priority
    Collections.sort(detectors, new Comparator<DevelopmentModeDetector>() {
        public int compare(DevelopmentModeDetector left, DevelopmentModeDetector right) {
            return left.getPriority() - right.getPriority();
        }
    });

    // process the detectors until one returns a result != null
    for (DevelopmentModeDetector detector : detectors) {

        Boolean result = detector.isDevelopmentMode(servletContext);

        if (log.isDebugEnabled()) {
            log.debug("Detector " + detector.getClass().getSimpleName() + " returned: " + result);
        }

        if (result != null) {
            return result.booleanValue();
        }

    }

    // default value
    return false;

}

From source file:dk.dbc.opensearch.datadock.DatadockThreadTest.java

/**
 * Testing happy path of the call //  w ww.  jav  a  2s .  co  m
 */
@Test
public void testCall() throws Exception {
    new NonStrictExpectations() {
        {
            mockHarvester.getCargoContainer(mockIdentifier);
            returns(mockCC);
            mockFlowmap.get(anyString);
            returns(pluginTaskList);
        }
    };

    pluginTask1 = new PluginTask(mockPluginResolver.getPlugin("dk.dbc.opensearch.plugins.XMLDCHarvester"),
            null);
    pluginTask2 = new PluginTask(
            mockPluginResolver.getPlugin("dk.dbc.opensearch.plugins.SimpleGenericRelation"), null);
    pluginTask3 = new PluginTask(mockPluginResolver.getPlugin("dk.dbc.opensearch.plugins.Store"), null);
    pluginTaskList.add(pluginTask1);
    pluginTaskList.add(pluginTask2);
    pluginTaskList.add(pluginTask3);

    TaskInfo job = new TaskInfo(mockIdentifier, referenceData);
    ddThread = new DatadockThread(job.getIdentifier(), mockHarvester, mockFlowmap);
    Boolean result = ddThread.call();

    assertTrue(result.booleanValue() == true);
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.publico.SearchInquiriesResultPageDA.java

public ActionForward selectExecutionDegree(ActionMapping actionMapping, ActionForm actionForm,
        HttpServletRequest request, HttpServletResponse response) {

    SearchInquiriesResultPageDTO searchPageDTO = (SearchInquiriesResultPageDTO) actionForm;

    ExecutionSemester executionSemester = searchPageDTO.getExecutionSemester();
    if (executionSemester == null) {
        return prepare(actionMapping, actionForm, request, response);
    }//  w w  w .ja v a2 s .c  om

    ExecutionDegree executionDegree = searchPageDTO.getExecutionDegree();
    if (executionDegree == null) {
        return selectExecutionSemester(actionMapping, actionForm, request, response);
    }

    Collection<ExecutionCourse> executionCourses = new ArrayList<ExecutionCourse>();
    for (StudentInquiriesCourseResult studentInquiriesCourseResult : executionDegree
            .getStudentInquiriesCourseResultsSet()) {
        final ExecutionCourse executionCourse = studentInquiriesCourseResult.getExecutionCourse();
        if (executionCourse != null && executionCourse.getExecutionPeriod() == executionSemester) {
            final Boolean publicDisclosure = studentInquiriesCourseResult.getPublicDisclosure();
            final TeachingInquiry responsibleTeachingInquiry = executionCourse.getResponsibleTeachingInquiry();
            if ((publicDisclosure != null && publicDisclosure.booleanValue())
                    || (responsibleTeachingInquiry != null
                            && responsibleTeachingInquiry.getResultsDisclosureToAcademicComunity())) {
                executionCourses.add(studentInquiriesCourseResult.getExecutionCourse());
            }
        }
    }
    Collections.sort((List<ExecutionCourse>) executionCourses,
            ExecutionCourse.EXECUTION_COURSE_NAME_COMPARATOR);

    request.setAttribute("executionCourses", executionCourses);
    request.setAttribute("executionDegrees", getExecutionDegrees(executionSemester));
    request.setAttribute("executionSemesters", getExecutionSemesters());

    return actionMapping.findForward("searchPage");
}

From source file:de.extra.client.plugins.responseprocessplugin.filesystem.FileSystemResultPackageDataResponseProcessPlugin.java

private PersistentStatus calcResponseStatus(final Boolean successful) {
    if (successful == null || successful.booleanValue() == false) {
        return PersistentStatus.FAIL;
    }//  w  w w  .jav  a  2s.  c o m
    // TODO WAIT aus Konstante?!
    if (successStatus != null && successStatus.toLowerCase().equals("wait")) {
        return PersistentStatus.WAIT;
    }
    return PersistentStatus.DONE;
}

From source file:com.aurel.track.fieldType.runtime.matchers.run.CompositeSelectMatcherRT.java

/**
 * Whether the value matches or not/*from w  w  w  . j a  v  a  2s . c om*/
 * @param attributeValue
 * @return
 */
@Override
public boolean match(Object attributeValue) {
    Boolean nullMatch = nullMatcher(attributeValue);
    if (nullMatch != null) {
        return nullMatch.booleanValue();
    }
    if (attributeValue == null || matchValue == null) {
        return false;
    }
    Map<Integer, Object> attributeValueMap = null;
    try {
        attributeValueMap = (Map<Integer, Object>) attributeValue;
    } catch (Exception e) {
        LOGGER.warn("Converting the attribute value of type " + attributeValue.getClass().getName()
                + " to Map<Integer, Object failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    SortedMap<Integer, Object> matcherValueMap = null;
    try {
        matcherValueMap = (SortedMap<Integer, Object>) matchValue;
    } catch (Exception e) {
        LOGGER.warn("Converting the matcher value of type " + matchValue.getClass().getName()
                + " to SortedMap<Integer, Object> failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (attributeValueMap == null || matcherValueMap == null) {
        return false;
    }
    Iterator<Integer> iterator = matcherValueMap.keySet().iterator();
    while (iterator.hasNext()) {
        Integer parameterCode = iterator.next();
        Object[] attributeValueCustomOption = null;
        try {
            attributeValueCustomOption = (Object[]) attributeValueMap.get(parameterCode);
        } catch (Exception e) {
            LOGGER.warn("Converting the attribute value for part " + parameterCode + " to Object[] failed with "
                    + e.getMessage());
            LOGGER.debug(ExceptionUtils.getStackTrace(e));
            return false;
        }
        Integer[] matcherValueCustomOption = null;
        try {
            matcherValueCustomOption = (Integer[]) matcherValueMap.get(parameterCode);
        } catch (Exception e) {
            LOGGER.error("Converting the matcher value for part " + parameterCode + " to Integer[] failed with "
                    + e.getMessage());
            LOGGER.debug(ExceptionUtils.getStackTrace(e));
            return false;
        }

        if (attributeValueCustomOption == null) {
            attributeValueCustomOption = new Object[0];
        }
        if (matcherValueCustomOption == null) {
            matcherValueCustomOption = new Integer[0];
        }
        if (attributeValueCustomOption.length != matcherValueCustomOption.length) {
            return false;
        }

        if (matcherValueCustomOption.length == 0) {
            return matcherValueCustomOption.length == 0;
        }
        Integer matcherValueAtLevel = matcherValueCustomOption[0];
        switch (relation) {
        case MatchRelations.EQUAL:
            if (!containsValue(matcherValueAtLevel, attributeValueCustomOption)) {
                return false;
            }
            break;
        case MatchRelations.NOT_EQUAL:
            if (!containsValue(matcherValueAtLevel, attributeValueCustomOption)) {
                return true;
            }
            break;
        case MatchRelations.PARTIAL_MATCH:
            if (matcherValueAtLevel.equals(ANY_FROM_LEVEL)) {
                return true;
            } else {
                if (!containsValue(matcherValueAtLevel, attributeValueCustomOption)) {
                    return false;
                }
            }
            break;
        case MatchRelations.PARTIAL_NOTMATCH:
            if (!containsValue(matcherValueAtLevel, attributeValueCustomOption)
                    && !matcherValueCustomOption[0].equals(NONE_FROM_LEVEL)) {
                return true;
            }
            break;
        default:
            return false;
        }
    }
    if (relation == MatchRelations.NOT_EQUAL || relation == MatchRelations.PARTIAL_NOTMATCH) {
        return false;
    } else {
        return true;
    }
}

From source file:com.duroty.application.admin.utils.AdminDefaultAction.java

/**
 * DOCUMENT ME!/*from   w  ww. j a va 2 s  .co m*/
 *
 * @param request DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 *
 * @throws NamingException DOCUMENT ME!
 * @throws RemoteException DOCUMENT ME!
 * @throws CreateException DOCUMENT ME!
 */
protected Admin getAdminInstance(HttpServletRequest request)
        throws NamingException, RemoteException, CreateException {
    AdminHome home = null;

    Boolean localServer = new Boolean(Configuration.properties.getProperty(Configuration.LOCAL_WEB_SERVER));

    if (localServer.booleanValue()) {
        home = AdminUtil.getHome();
    } else {
        Hashtable environment = getContextProperties(request);
        home = AdminUtil.getHome(environment);
    }

    return home.create();
}

From source file:com.duroty.application.admin.utils.AdminDefaultAction.java

/**
 * DOCUMENT ME!/*  w  w w  .j av a  2 s.c o  m*/
 *
 * @param request DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 *
 * @throws NamingException DOCUMENT ME!
 * @throws RemoteException DOCUMENT ME!
 * @throws CreateException DOCUMENT ME!
 */
protected Mail getMailInstance(HttpServletRequest request)
        throws NamingException, RemoteException, CreateException {
    MailHome home = null;

    Boolean localServer = new Boolean(Configuration.properties.getProperty(Configuration.LOCAL_WEB_SERVER));

    if (localServer.booleanValue()) {
        home = MailUtil.getHome();
    } else {
        Hashtable environment = getContextProperties(request);
        home = MailUtil.getHome(environment);
    }

    return home.create();
}

From source file:com.duroty.application.admin.utils.AdminDefaultAction.java

/**
 * DOCUMENT ME!//from   w ww  . j  a va 2  s  .  c o m
 *
 * @param request DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 *
 * @throws NamingException DOCUMENT ME!
 * @throws RemoteException DOCUMENT ME!
 * @throws CreateException DOCUMENT ME!
 */
protected Preferences getPreferencesInstance(HttpServletRequest request)
        throws NamingException, RemoteException, CreateException {
    PreferencesHome home = null;

    Boolean localServer = new Boolean(Configuration.properties.getProperty(Configuration.LOCAL_WEB_SERVER));

    if (localServer.booleanValue()) {
        home = PreferencesUtil.getHome();
    } else {
        Hashtable environment = getContextProperties(request);
        home = PreferencesUtil.getHome(environment);
    }

    return home.create();
}

From source file:com.duroty.application.admin.utils.AdminDefaultAction.java

/**
 * DOCUMENT ME!/*from   w  ww.  j  av  a2s.c  o  m*/
 *
 * @param request DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 *
 * @throws NamingException DOCUMENT ME!
 * @throws RemoteException DOCUMENT ME!
 * @throws CreateException DOCUMENT ME!
 */
protected Send getSendInstance(HttpServletRequest request)
        throws NamingException, RemoteException, CreateException {
    SendHome home = null;

    Boolean localServer = new Boolean(Configuration.properties.getProperty(Configuration.LOCAL_WEB_SERVER));

    if (localServer.booleanValue()) {
        home = SendUtil.getHome();
    } else {
        Hashtable environment = getContextProperties(request);
        home = SendUtil.getHome(environment);
    }

    return home.create();
}

From source file:com.duroty.application.admin.utils.AdminDefaultAction.java

/**
 * DOCUMENT ME!//from w w w.  j  ava 2 s.  c o  m
 *
 * @param request DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 *
 * @throws NamingException DOCUMENT ME!
 * @throws RemoteException DOCUMENT ME!
 * @throws CreateException DOCUMENT ME!
 */
protected Search getSearchInstance(HttpServletRequest request)
        throws NamingException, RemoteException, CreateException {
    SearchHome home = null;

    Boolean localServer = new Boolean(Configuration.properties.getProperty(Configuration.LOCAL_WEB_SERVER));

    if (localServer.booleanValue()) {
        home = SearchUtil.getHome();
    } else {
        Hashtable environment = getContextProperties(request);
        home = SearchUtil.getHome(environment);
    }

    return home.create();
}