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:jp.terasoluna.fw.web.taglib.IfAuthorizedBlockTag.java

/**
 * ^O{fB?I?\bh?B//from  w w  w  .j av a 2 s.c o  m
 *
 * @return ???w
 * @throws JspException JSPO
 */
@Override
public int doAfterBody() throws JspException {

    // u?bN?
    Boolean blockInfo = null;
    try {
        // pageContext u?bN?
        blockInfo = (Boolean) pageContext.getAttribute(this.blockId);
    } catch (ClassCastException e) {
        if (log.isWarnEnabled()) {
            log.warn("Class cast error.", e);
        }
    }

    // {fB?o
    boolean outputBody = false;
    if (blockInfo != null && blockInfo.booleanValue()) {
        //blockInfonulltrue??
        outputBody = true;
    }

    // ?eu?bN?
    if (this.parentBlockId != null) {
        // ANZX`FbN
        pageContext.setAttribute(this.parentBlockId, new Boolean(outputBody));
    }

    // {fB?o
    if (outputBody) {
        try {
            bodyContent.writeOut(bodyContent.getEnclosingWriter());
        } catch (IOException e) {
            log.error("Output error.");
            throw new JspException(e);
        }
    }

    // {fB?]
    return SKIP_BODY;
}

From source file:module.siadap.domain.SiadapEvaluationUniverse.java

public boolean hasExcellencyAwarded() {
    if (isCurriculumPonderation()) {
        for (CurricularPonderationEvaluationItem curricularPonderationEvaluationItem : getEvaluations(
                CurricularPonderationEvaluationItem.class, null, null)) {
            Boolean excellencyAward = curricularPonderationEvaluationItem.getExcellencyAward();
            if (excellencyAward == null) {
                return false;
            }/*w w  w . ja v a  2  s  .  c  o m*/
            return excellencyAward.booleanValue();
        }
    } else {
        if (getSiadapEvaluation() == null || !getSiadap().isDefaultEvaluationDone()) {
            return false;
        }
        Boolean excellencyAward = getSiadapEvaluation().getExcellencyAward();
        if (excellencyAward == null) {
            return false;
        }
        return excellencyAward.booleanValue();
    }
    return false;
}

From source file:com.googlecode.android_scripting.facade.EventFacade.java

/**
 * Registers a listener for a new broadcast signal
 *///from  w w w . j  a v a 2s  .  com
@Rpc(description = "Registers a listener for a new broadcast signal")
public boolean eventRegisterForBroadcast(@RpcParameter(name = "category") String category,
        @RpcParameter(name = "enqueue", description = "Should this events be added to the event queue or only dispatched") @RpcDefault(value = "true") Boolean enqueue) {
    if (mBroadcastListeners.containsKey(category)) {
        return false;
    }

    BroadcastListener b = new BroadcastListener(this, enqueue.booleanValue());
    IntentFilter c = new IntentFilter(category);
    mContext.registerReceiver(b, c);
    mBroadcastListeners.put(category, b);

    return true;
}

From source file:info.magnolia.cms.filters.HostSecurityFilter.java

@Override
public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
        throws IOException, ServletException {

    String uri = request.getRequestURI();
    String host = request.getServerName();
    Boolean isHostValid = null;

    for (String[] mapping : uriToHost) {
        if (uri.startsWith(mapping[0])) {
            // set to false only if exist at least one matching pattern
            if (isHostValid == null) {
                isHostValid = false;// w  ww . j  av  a2s .  c o  m
            }
            // url allowed on this host
            if (host.endsWith(mapping[1])) {
                isHostValid = true;
                break;
            }

        }
    }
    if (isHostValid != null && !isHostValid.booleanValue()) {
        response.setStatus(404);
        return;
    }

    chain.doFilter(request, response);

}

From source file:com.jaspersoft.jasperserver.export.modules.scheduling.ReportJobsImporter.java

protected boolean userExists(String username) {
    Boolean indicator = (Boolean) userIndicator.get(username);
    if (indicator == null) {
        indicator = Boolean/*  w  w w . j av  a2s. c  o  m*/
                .valueOf(configuration.getAuthorityService().getUser(executionContext, username) != null);
        userIndicator.put(username, indicator);
    }
    return indicator.booleanValue();
}

From source file:gate.DocumentFormat.java

public void setShouldCollectRepositioning(Boolean b) {
    if (supportsRepositioning().booleanValue() && b.booleanValue()) {
        shouldCollectRepositioning = b;/* ww w  .j av a  2  s .c om*/
    } else {
        shouldCollectRepositioning = new Boolean(false);
    } // if
}

From source file:com.avego.oauth.migration.OauthDataMigrator.java

/**
 * This creates a OauthDataMigrator using the give params, it automatically
 * creates a deserialisation class loader used to deserialize existing oauth data and creates a migration dao using
 * the given parameters//from ww w  . j av  a 2  s  .  c  om
 * @param params The parameters used to create the migration dao
 * @throws FileNotFoundException If the oldlib dir was not found relative to the current dir or in currentdir/target/oldlib
 * @throws DaoCreationException If the oauth migration dao could not be created from the given parameters
 */
public OauthDataMigrator(Map<String, Object> params) throws FileNotFoundException, DaoCreationException {
    this.dao = OauthMigrationDaoFactory.newInstance(params);
    // find where to source the old jars from
    File oldLibDir = new File("oldlib");
    if (!oldLibDir.exists()) {
        oldLibDir = new File("target/oldlib");
    }
    if (!oldLibDir.exists()) {
        throw new FileNotFoundException(
                "Could not find the lib dir either in the current dir or in target dir");
    }

    // the system class loader includes jars on the class path, however this also would include
    // the new versions of the spring classes which we do not want, so we use the
    // Parent of the system class loader which is the ext class loader/ e..g includes bootstrap java classes
    this.deserialisationClassLoader = ClassLoaderUtils.createClassLoaderWithJars(oldLibDir.getAbsolutePath(),
            ClassLoader.getSystemClassLoader().getParent());
    if (params != null) {
        Boolean val = (Boolean) params.get(REMOVE_REFRESH_TOKENS_PARAM);
        if (val != null) {
            this.removeRefreshTokens = val.booleanValue();
        }
        val = (Boolean) params.get(SERIALIZE_NEW_TOKEN_VALUES_PARAM);
        if (val != null) {
            this.serializeNewTokenValues = val.booleanValue();
        }
    }
}

From source file:es.pode.catalogadorWeb.presentacion.importar.ImportarControllerImpl.java

public String submit(ActionMapping mapping, SubmitForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    String resultado = "";
    String action = form.getAccion();

    //String idiomaLocale=((Locale)request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE)).getLanguage();
    ResourceBundle i18n = I18n.getInstance().getResource("application-resources",
            (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE));

    if (action != null) {
        if (action.equals(i18n.getString("catalogadorAvanzado.importar.aceptar"))) {
            resultado = "Aceptar";
            if (form.getFichero() == null || form.getFichero().getFileName().equals("")
                    || form.getFichero().getFileSize() == 0)
                throw new ValidatorException("{catalogadorAvanzado.importar.error.ficherovacio}");

            //crear el datahandler
            InternetHeaders ih = new InternetHeaders();
            MimeBodyPart mbp = null;//from  www.j  a v  a  2 s.c o  m
            DataSource source = null;
            DataHandler dh = null;
            try {
                FormFile ff = (FormFile) form.getFichero();
                mbp = new MimeBodyPart(ih, ff.getFileData());
                source = new MimePartDataSource(mbp);
                dh = new DataHandler(source);
            } catch (Exception e) {
                if (logger.isDebugEnabled()) {
                    logger.debug("error al crear el datahandler");
                }
                throw new ValidatorException("{catalogadorAvanzado.importar.error}");
            }

            //validar el fichero
            Boolean valido = new Boolean(false);
            try {
                valido = this.getSrvValidadorService().obtenerValidacionLomes(dh);
            } catch (Exception e) {
                if (logger.isDebugEnabled()) {
                    logger.debug("error al llamar al servicio de validacin");
                }
                throw new ValidatorException("{catalogadorAvanzado.importar.error.novalido}");
            }

            if (!valido.booleanValue())
                throw new ValidatorException("{catalogadorAvanzado.importar.error.novalido}");

            //agregar el datahandler a sesion
            this.getCatalogadorAvSession(request).setLomesImportado(dh);

        } else if (action.equals(i18n.getString("catalogadorAvanzado.importar.cancelar")))
            resultado = "Cancelar";
    }
    return resultado;
}

From source file:com.sun.faces.renderkit.html_basic.OutputMessageRenderer.java

public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    if (context == null || component == null) {
        throw new NullPointerException(Util.getExceptionMessageString(Util.NULL_PARAMETERS_ERROR_MESSAGE_ID));
    }/*from   w  w w  .ja  v a 2  s  . c o m*/
    if (log.isTraceEnabled()) {
        log.trace("End encoding component " + component.getId());
    }
    String currentValue = null, style = (String) component.getAttributes().get("style"),
            styleClass = (String) component.getAttributes().get("styleClass");

    ResponseWriter writer = context.getResponseWriter();
    Util.doAssert(writer != null);

    // suppress rendering if "rendered" property on the component is
    // false.
    if (!component.isRendered()) {
        if (log.isTraceEnabled()) {
            log.trace("End encoding component " + component.getId()
                    + " since rendered attribute is set to false");
        }
        return;
    }
    Object currentObj = ((ValueHolder) component).getValue();
    if (currentObj != null) {
        if (currentObj instanceof String) {
            currentValue = (String) currentObj;
        } else {
            currentValue = currentObj.toString();
        }
    } else {
        // if the value is null, do not output anything.
        return;
    }

    ArrayList parameterList = new ArrayList();

    // get UIParameter children...

    Iterator kids = component.getChildren().iterator();
    while (kids.hasNext()) {
        UIComponent kid = (UIComponent) kids.next();

        //PENDING(rogerk) ignore if child is not UIParameter?

        if (!(kid instanceof UIParameter)) {
            continue;
        }

        parameterList.add(((UIParameter) kid).getValue());
    }

    // If at least one substitution parameter was specified,
    // use the string as a MessageFormat instance.
    String message = null;
    if (parameterList.size() > 0) {
        message = MessageFormat.format(currentValue, parameterList.toArray(new Object[parameterList.size()]));
    } else {
        message = currentValue;
    }

    boolean wroteSpan = false;
    if (null != styleClass || null != style || Util.hasPassThruAttributes(component)
            || shouldWriteIdAttribute(component)) {
        writer.startElement("span", component);
        writeIdAttributeIfNecessary(context, writer, component);
        wroteSpan = true;

        if (null != styleClass) {
            writer.writeAttribute("class", styleClass, "styleClass");
        }
        // style is rendered as a passthru attribute
        Util.renderPassThruAttributes(writer, component);
        Util.renderBooleanPassThruAttributes(writer, component);
    }
    Boolean escape = Boolean.TRUE;
    Object val = component.getAttributes().get("escape");
    if (val != null) {
        if (val instanceof Boolean) {
            escape = (Boolean) val;
        } else if (val instanceof String) {
            try {
                escape = Boolean.valueOf((String) val);
            } catch (Throwable e) {
            }
        }
    }
    if (escape.booleanValue()) {
        writer.writeText(message, "value");
    } else {
        writer.write(message);
    }
    if (wroteSpan) {
        writer.endElement("span");
    }
}

From source file:org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQueryCriteria.java

private List<String> getBooleanListAsStringList(List<Boolean> booleanList) {
    List<String> list = new ArrayList<String>();
    for (Boolean booleanValue : booleanList) {
        if (booleanValue != null) {
            list.add(booleanValue.booleanValue() ? "1" : "0");
        } else {/*from  ww  w  .jav a2  s. c  o  m*/
            list.add(null);
        }
    }
    return list;
}