Example usage for java.lang Boolean Boolean

List of usage examples for java.lang Boolean Boolean

Introduction

In this page you can find the example usage for java.lang Boolean Boolean.

Prototype

@Deprecated(since = "9")
public Boolean(String s) 

Source Link

Document

Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true" .

Usage

From source file:com.sun.faces.taglib.html_basic.MessageTag.java

protected void setProperties(UIComponent component) {
    super.setProperties(component);
    UIMessage message = null;/*from   www  . ja  v a  2  s .c o  m*/
    try {
        message = (UIMessage) component;
    } catch (ClassCastException cce) {
        throw new IllegalStateException("Component " + component.toString()
                + " not expected type.  Expected: UIMessage.  Perhaps you're missing a tag?");
    }

    if (_for != null) {
        if (isValueReference(_for)) {
            ValueBinding vb = Util.getValueBinding(_for);
            message.setValueBinding("_for", vb);
        } else {
            message.setFor(_for);
        }
    }
    if (showDetail != null) {
        if (isValueReference(showDetail)) {
            ValueBinding vb = Util.getValueBinding(showDetail);
            message.setValueBinding("showDetail", vb);
        } else {
            boolean _showDetail = new Boolean(showDetail).booleanValue();
            message.setShowDetail(_showDetail);
        }
    }
    if (showSummary != null) {
        if (isValueReference(showSummary)) {
            ValueBinding vb = Util.getValueBinding(showSummary);
            message.setValueBinding("showSummary", vb);
        } else {
            boolean _showSummary = new Boolean(showSummary).booleanValue();
            message.setShowSummary(_showSummary);
        }
    }
    if (errorClass != null) {
        if (isValueReference(errorClass)) {
            ValueBinding vb = Util.getValueBinding(errorClass);
            message.setValueBinding("errorClass", vb);
        } else {
            message.getAttributes().put("errorClass", errorClass);
        }
    }
    if (errorStyle != null) {
        if (isValueReference(errorStyle)) {
            ValueBinding vb = Util.getValueBinding(errorStyle);
            message.setValueBinding("errorStyle", vb);
        } else {
            message.getAttributes().put("errorStyle", errorStyle);
        }
    }
    if (fatalClass != null) {
        if (isValueReference(fatalClass)) {
            ValueBinding vb = Util.getValueBinding(fatalClass);
            message.setValueBinding("fatalClass", vb);
        } else {
            message.getAttributes().put("fatalClass", fatalClass);
        }
    }
    if (fatalStyle != null) {
        if (isValueReference(fatalStyle)) {
            ValueBinding vb = Util.getValueBinding(fatalStyle);
            message.setValueBinding("fatalStyle", vb);
        } else {
            message.getAttributes().put("fatalStyle", fatalStyle);
        }
    }
    if (infoClass != null) {
        if (isValueReference(infoClass)) {
            ValueBinding vb = Util.getValueBinding(infoClass);
            message.setValueBinding("infoClass", vb);
        } else {
            message.getAttributes().put("infoClass", infoClass);
        }
    }
    if (infoStyle != null) {
        if (isValueReference(infoStyle)) {
            ValueBinding vb = Util.getValueBinding(infoStyle);
            message.setValueBinding("infoStyle", vb);
        } else {
            message.getAttributes().put("infoStyle", infoStyle);
        }
    }
    if (style != null) {
        if (isValueReference(style)) {
            ValueBinding vb = Util.getValueBinding(style);
            message.setValueBinding("style", vb);
        } else {
            message.getAttributes().put("style", style);
        }
    }
    if (styleClass != null) {
        if (isValueReference(styleClass)) {
            ValueBinding vb = Util.getValueBinding(styleClass);
            message.setValueBinding("styleClass", vb);
        } else {
            message.getAttributes().put("styleClass", styleClass);
        }
    }
    if (title != null) {
        if (isValueReference(title)) {
            ValueBinding vb = Util.getValueBinding(title);
            message.setValueBinding("title", vb);
        } else {
            message.getAttributes().put("title", title);
        }
    }
    if (tooltip != null) {
        if (isValueReference(tooltip)) {
            ValueBinding vb = Util.getValueBinding(tooltip);
            message.setValueBinding("tooltip", vb);
        } else {
            boolean _tooltip = new Boolean(tooltip).booleanValue();
            message.getAttributes().put("tooltip", _tooltip ? Boolean.TRUE : Boolean.FALSE);
        }
    }
    if (warnClass != null) {
        if (isValueReference(warnClass)) {
            ValueBinding vb = Util.getValueBinding(warnClass);
            message.setValueBinding("warnClass", vb);
        } else {
            message.getAttributes().put("warnClass", warnClass);
        }
    }
    if (warnStyle != null) {
        if (isValueReference(warnStyle)) {
            ValueBinding vb = Util.getValueBinding(warnStyle);
            message.setValueBinding("warnStyle", vb);
        } else {
            message.getAttributes().put("warnStyle", warnStyle);
        }
    }
}

From source file:com.anite.antelope.zebra.factory.AntelopeStateFactory.java

/**
 * Delete with extra step of creating a task instance history object
 *//*from ww  w  . j a  v  a 2s. co  m*/
public void deleteObject(IStateObject stateObject) throws StateFailureException {

    Session s;
    try {
        s = PersistenceLocator.getInstance().getCurrentSession();

        if (stateObject instanceof AntelopeTaskInstance) {

            AntelopeTaskInstance antelopeTaskInstance = (AntelopeTaskInstance) stateObject;

            if (log.isInfoEnabled()) {
                produceDetailedDeleteLog(antelopeTaskInstance);
            }
            // Copy to history
            AntelopeTaskInstanceHistory antelopeTaskInstanceHistory = new AntelopeTaskInstanceHistory(
                    antelopeTaskInstance);
            AntelopeTaskDefinition taskDefinition = (AntelopeTaskDefinition) antelopeTaskInstance
                    .getTaskDefinition();
            antelopeTaskInstanceHistory.setShowInHistory(new Boolean(taskDefinition.getShowInHistory()));
            s.save(antelopeTaskInstanceHistory);

            // Tidy up process reference
            AntelopeProcessInstance processInstance = (AntelopeProcessInstance) antelopeTaskInstance
                    .getProcessInstance();
            processInstance.getTaskInstances().remove(antelopeTaskInstance);
            antelopeTaskInstance.setProcessInstance(null);

            // Add history to processInstance 
            processInstance.getHistoryInstances().add(antelopeTaskInstanceHistory);
            antelopeTaskInstanceHistory.setProcessInstance(processInstance);

            s.save(processInstance);
        }
        s.delete(stateObject);
    } catch (Exception e) {
        log.error("Failed to delete:" + stateObject.toString(), e);
        throw new StateFailureException("Failed to delete State Object", e);
    }

}

From source file:userinterface.graph.DisplaySettings.java

/**
 * Setter for property antiAlias./*  w  w w .  j  a  v  a 2  s  .  c  o m*/
 * @param value Value of property antiAlias.
 */
public void setAntiAliased(boolean value) {
    try {
        antiAlias.setValue(new Boolean(value));
        updateDisplay();
        setChanged();
        notifyObservers(this);
    } catch (SettingException e) {
        // Shouldn't happen.
    }
}

From source file:com.britesnow.snow.util.ObjectUtil.java

public static final <T> T getValue(String valueStr, Class<T> cls, T defaultValue) {
    if (valueStr == null) {
        return defaultValue;
    } else {/*  w w w . j a  v  a  2s  .c o  m*/
        try {
            if (cls == String.class) {
                return (T) valueStr;
            } else if (valueStr.length() > 0) {

                if (cls.isArray()) {
                    return getValue(new String[] { valueStr }, cls, defaultValue);
                } else if (cls == Integer.class) {
                    Integer value = numberFormat.parse(valueStr).intValue();
                    return (T) value;
                } else if (cls == Long.class) {
                    Long value = numberFormat.parse(valueStr).longValue();
                    return (T) value;
                } else if (cls == Float.class) {
                    Float value = numberFormat.parse(valueStr).floatValue();
                    return (T) value;
                } else if (cls == Double.class) {
                    Double value = numberFormat.parse(valueStr).doubleValue();
                    return (T) value;
                } else if (cls == Boolean.class) {
                    if ("true".equals(valueStr)) {
                        return (T) new Boolean(true);
                    } else {
                        return (T) new Boolean(false);
                    }
                } else if (cls.isEnum()) {
                    try {
                        return (T) Enum.valueOf((Class<Enum>) cls, valueStr);
                    } catch (IllegalArgumentException e) {
                        return defaultValue;
                    }
                } else if (cls == Date.class) {
                    SimpleDateFormat sdf = new SimpleDateFormat(DEFAULT_DATE_PATTERN);
                    return (T) new java.util.Date(sdf.parse(valueStr).getTime());
                }
            } else {
                return defaultValue;
            }
        } catch (Exception e) {
            return defaultValue;
        }
    }
    return defaultValue;
}

From source file:com.duroty.application.files.actions.DownloadFileAction.java

/**
 * DOCUMENT ME!/*w  w w. j  ava2s  .  co  m*/
 *
 * @param request DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 *
 * @throws NamingException DOCUMENT ME!
 * @throws RemoteException DOCUMENT ME!
 * @throws CreateException DOCUMENT ME!
 */
protected Files getFilesInstance(HttpServletRequest request)
        throws NamingException, RemoteException, CreateException {
    FilesHome home = null;

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

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

    return home.create();
}

From source file:com.duroty.application.files.utils.FilesDefaultAction.java

/**
 * DOCUMENT ME!// w w w .j  a va2 s  . co  m
 *
 * @param request DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 *
 * @throws NamingException DOCUMENT ME!
 * @throws RemoteException DOCUMENT ME!
 * @throws CreateException DOCUMENT ME!
 */
protected Store getStoreInstance(HttpServletRequest request)
        throws NamingException, RemoteException, CreateException {
    StoreHome home = null;

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

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

    return home.create();
}

From source file:es.pode.gestorFlujo.presentacion.objetosDespublicados.ObjetosDespublicadosControllerImpl.java

/**
 * @see es.pode.gestorFlujo.presentacion.objetosDespublicados.ObjetosDespublicadosController#cargarODESDespublicados(org.apache.struts.action.ActionMapping, es.pode.gestorFlujo.presentacion.objetosDespublicados.CargarODESDespublicadosForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//*from ww w  .  j a  v a 2s. co  m*/
public final void cargarODESDespublicados(ActionMapping mapping,
        es.pode.gestorFlujo.presentacion.objetosDespublicados.CargarODESDespublicadosForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    if (logger.isDebugEnabled())
        logger.debug("Cargando objetos Despublicados");
    SrvPublicacionService publi = this.getSrvPublicacionService();
    SrvAdminUsuariosService admin = this.getSrvAdminUsuariosService();
    TransicionVO[] odes = null;
    try {
        if (logger.isDebugEnabled())
            logger.debug("Recogemos los usuarios");
        String[] todosUsuariosGrupos = admin
                .obtenerListaUsuariosGrupoTrabajo(LdapUserDetailsUtils.getUsuario());

        if (todosUsuariosGrupos != null && todosUsuariosGrupos.length > 0) {
            logger.info("Obtenidos lista de usuarios de los grupos pertenecientes de usuario:["
                    + LdapUserDetailsUtils.getUsuario() + "Numero de usuarios:[" + todosUsuariosGrupos.length);
            odes = publi.obtenODEsDespublicadosPorUsuarios(todosUsuariosGrupos);
            logger.info("Obtenidos odes de esos usuarios, numero de odes despublicados [" + odes.length);
        } else {
            logger.info("Obtenidos lista de todos los ODES, pues el usuario:["
                    + LdapUserDetailsUtils.getUsuario() + " es parte de todos los grupos");
            odes = publi.obtenODEsDespublicados();
            logger.info("Obtenidos odes de todos los usuarios, numero de odes despublicados[" + odes.length);
        }

        form.setListaODESAsArray(odes);
    } catch (Exception ex) {
        logger.error("Imposible obtener los odes despublicados", ex);
        throw new ValidatorException("{gestorFlujo.error.inesperado}");
    }
    form.setIdUsuario(LdapUserDetailsUtils.getUsuario());

    // Como estamos en administracin damos por sentado que esta autenticado
    form.setTipoUsuario(tipo_usuario(LdapUserDetailsUtils.getRoles()));

    form.setEsDespublicado(new Boolean(true));
    logger.debug(
            "cargarODESDespublicados-El objeto es despublicado?" + form.getEsDespublicado().booleanValue());
    logger.info("Objetos Despublicados cargados correctamente");
}

From source file:com.github.xbn.array.primitive.ObjectArrayFromPrimitive.java

/**
   <p>Get a {@code java.lang.Object} array from an array of {@code boolean}-s.</p>
        /*from   www  .  j  a  v  a  2  s  .  c o m*/
 * @return  If {@code prmtv_array} is<ul>
 <li>{@code null}: {@code null}</li>
 <li>non-{@code null} and has no elements: <code>org.apache.commons.lang3.{@link org.apache.commons.lang3.ArrayUtils ArrayUtils}.{@link org.apache.commons.lang3.ArrayUtils#EMPTY_OBJECT_ARRAY EMPTY_OBJECT_ARRAY}</code></li>
 <li>Otherwise: A new {@code Object} array containing all elements in {@code prmtv_array}.</li>
   </ul>
        
 * @see  #get(char[], NullContainer, String) get(char[],s)
 * @see  #get(byte[], NullContainer, String) get(byte[],s)
 * @see  #get(short[], NullContainer, String) get(short[],s)
 * @see  #get(int[], NullContainer, String) get(int[],s)
 * @see  #get(long[], NullContainer, String) get(long[],s)
 * @see  #get(float[], NullContainer, String) get(float[],s)
 * @see  #get(double[], NullContainer, String) get(double[],s)
 */
public static final Object[] get(boolean[] prmtv_array, NullContainer nnull, String cntrName_forNullBad) {
    if (prmtv_array == null) {
        IndexableUtil.crashIfContainerIsNullAndThatIsBad(nnull, cntrName_forNullBad);
        return null;
    }

    if (prmtv_array.length == 0) {
        return ArrayUtils.EMPTY_OBJECT_ARRAY;
    }

    Object[] ao = new Object[prmtv_array.length];
    for (int i = 0; i < prmtv_array.length; i++) {
        ao[i] = new Boolean(prmtv_array[i]);
    }

    return ao;
}

From source file:com.llc.bumpr.sdk.models.Driver.java

/**
 * Respond to the given request.//from  w  w w . j a  va 2 s.  c om
 * @param request The request that the driver is responding to.
 * @param cb The Callback method that needs to be implemented when response is returned from the server
 * @return an ApiRequest object which can be sent to the session object to be executed.
 */
public ApiRequest respondToRequest(final Request request, final Callback<Response> cb) {
    return new ApiRequest() {

        @Override
        public void execute(String baseURL, String authToken) {
            BumprAPI api = BumprClient.api();
            HashMap<String, Object> map = new HashMap<String, Object>();
            map.put("accepted", new Boolean(request.getAccepted()));
            api.respondTo(authToken, id, request.getId(), map, cb);
        }

        @Override
        public boolean needsAuth() {
            return true;
        }
    };
}

From source file:com.autentia.tnt.bean.admin.ProjectBean.java

public ProjectBean() {
    search.setOpen(new Boolean(true));
}