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.abdin.noorsingles.service.AdminService.java

public boolean isAuthenticated(HttpSession session) {
    Boolean authenticated = (Boolean) session.getAttribute("authenticated");
    if (authenticated != null && authenticated.booleanValue()) {
        return true;
    }//from   ww  w .j  a v  a 2s  .  com
    return false;
}

From source file:com.fheebiy.http.lite.apache.StandardHttpRequestRetryHandler.java

@Override
protected boolean handleAsIdempotent(final HttpRequest request) {
    if (request == null) {
        return true;
    }/* w  w w  . ja  v a2s  .  c  o  m*/
    System.out.println("request" + request);
    System.out.println("request.getRequestLine()" + request.getRequestLine());
    System.out.println(" request.getRequestLine().getMethod()" + request.getRequestLine().getMethod());
    final String method = request.getRequestLine().getMethod().toUpperCase(Locale.US);
    final Boolean b = this.idempotentMethods.get(method);
    return b != null && b.booleanValue();
}

From source file:com.cyclopsgroup.waterview.jelly.AbstractTag.java

/**
 * If the tag is in the middle of rendering
 *
 * @return If the tag is in the middle of rendering
 *//*from   w  ww .jav a 2s  .  com*/
protected boolean isRendering() {
    Boolean b = (Boolean) getContext().getVariable(JellyEngine.RENDERING);
    return b != null && b.booleanValue();
}

From source file:com.aurel.track.prop.LoginBL.java

/**
 * This method controls entire login procedure.
 *
 * @param isInTestMode/*from  w  w w . j ava2  s . c  o m*/
 * @param isMobileApplication
 * @param username
 * @param usingContainerBasedAuthentication
 * @param password
 * @param forwardUrl
 * @param springAuthenticated
 * @param mobileApplicationVersionNo
 * @param locale
 * @return
 */
public static String login(String isInTestMode, boolean isMobileApplication, String username,
        boolean usingContainerBasedAuthentication, String password, String forwardUrl,
        boolean springAuthenticated, Integer mobileApplicationVersionNo, Locale _locale) {
    Boolean ready = (Boolean) ServletActionContext.getServletContext().getAttribute(ApplicationStarter.READY);
    if (ready == null || !ready.booleanValue()) {
        return "loading";
    }
    HttpServletRequest request = ServletActionContext.getRequest();
    HttpSession httpSession = request.getSession();
    String nonce = (String) httpSession.getAttribute("NONCE");

    if ("true".equals(isInTestMode)) {
        nonce = null; // accept clear text passwords
    }

    httpSession.setAttribute(ISMOBILEAPP, isMobileApplication);

    Locale locale = _locale;
    if (locale == null) {
        locale = Locale.getDefault();
        LOGGER.debug("Requested locale is null. Using default:" + locale.getDisplayName());
    } else {
        LOGGER.debug("Requested locale " + locale.getDisplayName());
    }
    httpSession.setAttribute("localizationJSON", LocalizeJSON.encodeLocalization(locale));
    TMotdBean motd = MotdBL.loadMotd(locale.getLanguage());

    if (motd == null) {
        motd = MotdBL.loadMotd("en");
    }
    // if already logged in forward to home page
    if (SessionUtils.getCurrentUser(httpSession) != null) {

        String redirectMapEntry = "itemNavigator";
        TPersonBean personBean = (TPersonBean) httpSession.getAttribute(Constants.USER_KEY);
        if (personBean != null && personBean.getHomePage() != null
                && personBean.getHomePage().trim().length() > 0) {
            redirectMapEntry = personBean.getHomePage();
        }
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        JSONUtility.appendBooleanValue(sb, JSONUtility.JSON_FIELDS.SUCCESS, true);
        sb.append(DATABRACE);
        JSONUtility.appendStringValue(sb, "jsonURL", redirectMapEntry + DOTACTION, true);
        sb.append("}");
        sb.append("}");
        return LoginBL.writeJSONResponse(sb); // The redirect is done by the
        // client JavaScript
    }
    // if Container Based Authentication is enabled and we can get a remote
    // user we use that one, no more questions asked. However, a local login
    // always overrules.

    if ((username == null || "".equals(username) || password == null || "".equals(password))
            && (request.getRemoteUser() != null
                    && ApplicationBean.getInstance().getSiteBean().getIsCbaAllowed())) {
        username = request.getRemoteUser();
        usingContainerBasedAuthentication = true;
    }

    List<LabelValueBean> errors = new ArrayList<LabelValueBean>();
    StringBuilder sb = new StringBuilder();
    String redirectMapEntry = "";
    sb = LoginBL.createLoginResponseJSON(username, password, nonce, usingContainerBasedAuthentication,
            springAuthenticated, request, errors, httpSession, forwardUrl, motd, isMobileApplication, locale,
            mobileApplicationVersionNo, redirectMapEntry);

    if (errors != null && errors.size() > 0 && usingContainerBasedAuthentication) {
        return "forwardToLogin"; // could not verify container registered
        // user with Genji
    }

    if (usingContainerBasedAuthentication && !isMobileApplication) {
        ACCESSLOGGER.info("User was authenticated via container.");
        if (redirectMapEntry.isEmpty())
            return SUCCESS;
        return redirectMapEntry;
    }
    return writeJSONResponse(sb); // The redirect is done by the client
    // JavaScript
}

From source file:com.aurel.track.itemNavigator.ItemNavigatorFilterBL.java

public static Navigator createNavigator(TPersonBean personBean, List<ILabelBean> usedStatusList,
        Locale locale) {//from ww  w . ja v a 2  s .com
    Map<Integer, Boolean> userLevelMap = personBean.getUserLevelMap();
    Boolean hasAccessFiltersBoolean = userLevelMap
            .get(UserLevelBL.USER_LEVEL_ACTION_IDS.ITEM_NAVIGATOR_MAIN_FILTER);
    Boolean hasAccessSubFiltersBoolean = userLevelMap
            .get(UserLevelBL.USER_LEVEL_ACTION_IDS.ITEM_NAVIGATOR_SUBFILTER);

    boolean hasAccessFilters = hasAccessFiltersBoolean != null && hasAccessFiltersBoolean.booleanValue();
    boolean hasAccessSubFilters = hasAccessSubFiltersBoolean != null
            && hasAccessSubFiltersBoolean.booleanValue();

    if (hasAccessFilters == false && hasAccessSubFilters == false) {
        return null;
    }

    Navigator nav = new Navigator();
    if (hasAccessFilters) {
        View queryView = createQueryView(personBean, usedStatusList, locale);
        nav.setQueryView(queryView);
    }
    if (hasAccessSubFilters) {
        Boolean hasAccessSubFiltersWorkspacesBoolean = userLevelMap
                .get(UserLevelBL.USER_LEVEL_ACTION_IDS.SUBFILTER_PROJECT);
        Boolean hasAccessSubFiltersBasketsBoolean = userLevelMap
                .get(UserLevelBL.USER_LEVEL_ACTION_IDS.SUBFILTER_BASKET);
        Boolean hasAccessSubFiltersStatesBoolean = userLevelMap
                .get(UserLevelBL.USER_LEVEL_ACTION_IDS.SUBFILTER_STATUS);
        Boolean hasAccessSubFiltersItemTypesBoolean = userLevelMap
                .get(UserLevelBL.USER_LEVEL_ACTION_IDS.SUBFILTER_ITEMTYPE);
        Boolean hasAccessSubFiltersPrioritiesBoolean = userLevelMap
                .get(UserLevelBL.USER_LEVEL_ACTION_IDS.SUBFILTER_PRIORITY);
        Boolean hasAccessSubFiltersScheduleBoolean = userLevelMap
                .get(UserLevelBL.USER_LEVEL_ACTION_IDS.SUBFILTER_SCHEDULE);

        boolean hasAccessSubFiltersWorkspaces = hasAccessSubFiltersWorkspacesBoolean != null
                && hasAccessSubFiltersWorkspacesBoolean.booleanValue();
        boolean hasAccessSubFiltersBaskets = hasAccessSubFiltersBasketsBoolean != null
                && hasAccessSubFiltersBasketsBoolean.booleanValue();
        boolean hasAccessSubFiltersStates = hasAccessSubFiltersStatesBoolean != null
                && hasAccessSubFiltersStatesBoolean.booleanValue();
        boolean hasAccessSubFiltersItemTypes = hasAccessSubFiltersItemTypesBoolean != null
                && hasAccessSubFiltersItemTypesBoolean.booleanValue();
        boolean hasAccessSubFiltersPriorities = hasAccessSubFiltersPrioritiesBoolean != null
                && hasAccessSubFiltersPrioritiesBoolean.booleanValue();
        boolean hasAccessSubFiltersSchedule = hasAccessSubFiltersScheduleBoolean != null
                && hasAccessSubFiltersScheduleBoolean.booleanValue();

        View subFilterView = new View();
        subFilterView
                .setName(LocalizeUtil.getLocalizedTextFromApplicationResources("common.lbl.subfilter", locale));
        subFilterView.setObjectID(1);
        subFilterView.setIconCls("subfilterView");

        List<ItemOperation> itemOperationList = new ArrayList<ItemOperation>();
        if (hasAccessSubFiltersWorkspaces) {
            itemOperationList.add(new ItemOperationSelectProject(locale));
        }
        if (hasAccessSubFiltersStates) {
            itemOperationList.add(new ItemOperationSelectState(usedStatusList, locale));
        }
        if (hasAccessSubFiltersPriorities) {
            itemOperationList.add(new ItemOperationSelectPriority(locale));
        }
        if (hasAccessSubFiltersItemTypes) {
            itemOperationList.add(new ItemOperationSelectIssueType(locale));
        }
        if (hasAccessSubFiltersBaskets) {
            itemOperationList.add(new BasketOperation(personBean, locale));
        }
        if (hasAccessSubFiltersSchedule) {
            itemOperationList.add(new ItemOperationScheduling(locale));
        }

        List<Section> sections = new ArrayList<Section>();

        for (int i = 0; i < itemOperationList.size(); i++) {
            ItemOperation operation = itemOperationList.get(i);
            ItemOperationManager.registerOperation(operation);
            sections.add(createSection(operation, personBean, locale));
        }
        subFilterView.setSections(sections);

        nav.setSubFilterView(subFilterView);
    }

    return nav;
}

From source file:com.centurylink.mdw.plugin.designer.views.ListViewLabelProvider.java

public Image getColumnImage(Object element, int columnIndex) {
    ColumnSpec colspec = columnSpecs.get(columnIndex);
    if (colspec.type.equals(TYPE_CHECKBOX)) {
        ImageDescriptor descriptor = null;
        Boolean value = (Boolean) getValue(element, columnIndex);
        if (value.booleanValue()) {
            descriptor = MdwPlugin.getImageDescriptor("icons/checked.gif");
        } else {//from  w  ww .j  a v a 2  s.c om
            descriptor = MdwPlugin.getImageDescriptor("icons/unchecked.gif");
        }
        Image image = (Image) imageCache.get(descriptor);
        if (image == null) {
            image = descriptor.createImage();
            imageCache.put(descriptor, image);
        }
        return image;
    } else {
        return null;
    }
}

From source file:net.lightbody.bmp.proxy.jetty.jetty.jmx.ServerMBean.java

/** 
 * @param ok /*from w  ww .  jav  a  2s.c om*/
 */
public void postRegister(Boolean ok) {
    super.postRegister(ok);

    if (ok.booleanValue()) {
        if (_configuration != null) {
            try {
                _jettyServer.configure(_configuration);
                _jettyServer.start();
            } catch (Exception e) {
                log.warn(LogSupport.EXCEPTION, e);
            }
        }
    }
}

From source file:com.normalexception.app.rx8club.httpclient.RetryHandler.java

public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
    // retry a max of MAX_RETRY times
    if (executionCount >= MAX_RETRY) {
        Log.d(TAG, "Max Retries Exceeded");
        return false;
    }// ww w  .j  a  va2s .  co  m

    if (exception instanceof NoHttpResponseException) {
        // Retry if the server dropped connection on us
        Log.d(TAG, "Server dropped request, retrying");
        return true;
    }

    Boolean b = (Boolean) context.getAttribute(HttpCoreContext.HTTP_REQ_SENT);
    boolean sent = (b != null && b.booleanValue());
    if (!sent) {
        // Retry if the request has not been sent fully or
        // if it's OK to retry methods that have been sent
        Log.d(TAG, "Request not fully sent, retrying");
        return true;
    }

    // otherwise do not retry
    return false;
}

From source file:me.StevenLawson.TotalFreedomMod.TFM_Util.java

public static boolean getSavedFlag(String flag) throws Exception {
    Boolean flagValue = null;

    Map<String, Boolean> flags = TFM_Util.getSavedFlags();

    if (flags != null) {
        if (flags.containsKey(flag)) {
            flagValue = flags.get(flag);
        }// www.j a v a2s.  c  om
    }

    if (flagValue != null) {
        return flagValue.booleanValue();
    } else {
        throw new Exception();
    }
}

From source file:com.projity.server.data.MPXConverter.java

public static void toProjityCustomFields(CustomFields projityFields, FieldContainer mpx,
        CustomFieldsMapper.Maps maps, Context context) {
    for (int i = 0; i < maps.costMap.length; i++) {
        Number c = (Number) mpx.getCurrentValue(maps.costMap[i]);
        if (c != null)
            projityFields.setCustomCost(i, c.doubleValue());
    }//from   www  . j  a va  2 s . com
    for (int i = 0; i < maps.dateMap.length; i++) {
        Date d = (Date) mpx.getCurrentValue(maps.dateMap[i]);
        if (d != null)
            projityFields.setCustomDate(i, d.getTime());
    }
    for (int i = 0; i < maps.durationMap.length; i++) {
        net.sf.mpxj.Duration d = (net.sf.mpxj.Duration) mpx.getCurrentValue(maps.durationMap[i]);
        if (d != null)
            projityFields.setCustomDuration(i, toProjityDuration(d, context));
    }
    for (int i = 0; i < maps.finishMap.length; i++) {
        Date d = (Date) mpx.getCurrentValue(maps.finishMap[i]);
        if (d != null)
            projityFields.setCustomFinish(i, d.getTime());
    }
    for (int i = 0; i < maps.flagMap.length; i++) {
        Boolean b = (Boolean) mpx.getCurrentValue(maps.flagMap[i]);
        if (b != null)
            projityFields.setCustomFlag(i, b.booleanValue());
    }
    for (int i = 0; i < maps.numberMap.length; i++) {
        Number n = (Number) mpx.getCurrentValue(maps.numberMap[i]);
        if (n != null)
            projityFields.setCustomNumber(i, n.doubleValue());
    }
    for (int i = 0; i < maps.startMap.length; i++) {
        Date d = (Date) mpx.getCurrentValue(maps.startMap[i]);
        if (d != null)
            projityFields.setCustomStart(i, d.getTime());
    }
    for (int i = 0; i < maps.textMap.length; i++) {
        String s = (String) mpx.getCurrentValue(maps.textMap[i]);
        if (s != null)
            projityFields.setCustomText(i, s);
    }
}