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.anite.antelope.validation.RegexMaskStringValidator.java

public boolean doValidate(ParameterParser params, String key, ValidationResults validationData)
        throws ReviewValidationException {
    boolean valid = true;
    String[] values = params.getStrings(key);
    if (values == null) {
        return valid;
    }/*from   w  ww  .ja va2s.  c om*/

    String regexMask = (String) args.get("regexMask");
    String invalidFormatMessage = (String) args.get("invalidFormatMessage");

    for (int i = 0; i < values.length; i++) {
        if (!Pattern.matches(regexMask, values[i])) {
            valid = false;
            validationData.addMessage(key, invalidFormatMessage);
        }
    }
    log.debug("Called validate() : returning :" + (new Boolean(valid)).toString());
    return valid;
}

From source file:org.myjerry.evenstar.web.blog.ReplyCommentController.java

public ModelAndView postReply(HttpServletRequest request, HttpServletResponse response) throws Exception {
    ModelAndView mav = new ModelAndView();

    String postID = request.getParameter("postID");
    String blogID = request.getParameter("blogID");
    String parentID = request.getParameter("parentID");
    String thoughts = request.getParameter("thoughts");

    Comment parentComment = this.commentService.getComment(StringUtils.getLong(parentID),
            StringUtils.getLong(postID), StringUtils.getLong(blogID));

    Comment comment = new Comment();
    comment.setAuthorID(StringUtils.getLong(GAEUserUtil.getUserID()));
    comment.setBlogID(StringUtils.getLong(blogID));
    comment.setContent(thoughts);//  w  w w. jav  a 2  s  .  c  o  m
    comment.setPostID(StringUtils.getLong(postID));
    comment.setParentID(StringUtils.getLong(parentID));
    comment.setPermissions(parentComment.getPermissions());

    boolean result = this.commentService.postComment(comment);
    if (!result) {
        mav = view(request, response);
        mav.addObject("thoughts", thoughts);
        mav.addObject("parentID", parentID);
    }

    mav.addObject("result", new Boolean(result));
    mav.setViewName(".post.comments");
    return mav;
}

From source file:com.duroty.application.admin.actions.UpdateUserAction.java

protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    ActionMessages errors = new ActionMessages();

    try {//ww w. java2 s.c om
        DynaActionForm _form = (DynaActionForm) form;

        Admin adminInstance = getAdminInstance(request);

        UserObj userObj = new UserObj();

        String password = (String) _form.get("password");
        String confirmPassword = (String) _form.get("confirmPassword");

        if (!StringUtils.isBlank(password)) {
            adminInstance.confirmPassword(password, confirmPassword);
            userObj.setPassword(password);
        }

        userObj.setIdint(((Integer) _form.get("idint")).intValue());

        Boolean active = new Boolean(false);

        if (_form.get("active") != null) {
            active = (Boolean) _form.get("active");
        }

        userObj.setActive(active.booleanValue());

        userObj.setEmail((String) _form.get("email"));
        userObj.setEmailIdentity((String) _form.get("emailIdentity"));

        Boolean htmlMessages = new Boolean(false);

        if (_form.get("htmlMessages") != null) {
            htmlMessages = (Boolean) _form.get("htmlMessages");
        }

        userObj.setHtmlMessages(htmlMessages.booleanValue());

        userObj.setLanguage((String) _form.get("language"));
        userObj.setMessagesByPage(((Integer) _form.get("byPage")).intValue());
        userObj.setName((String) _form.get("name"));
        userObj.setQuotaSize(((Integer) _form.get("quotaSize")).intValue());
        userObj.setRegisterDate(new Date());
        userObj.setRoles((Integer[]) _form.get("roles"));
        userObj.setSignature((String) _form.get("signature"));

        Boolean spamTolerance = new Boolean(false);

        if (_form.get("spamTolerance") != null) {
            spamTolerance = (Boolean) _form.get("spamTolerance");
        }

        userObj.setSpamTolerance(spamTolerance.booleanValue());

        userObj.setVacationBody((String) _form.get("vacationBody"));
        userObj.setVacationSubject((String) _form.get("vacationSubject"));

        Boolean vacationActive = new Boolean(false);

        if (_form.get("vacationActive") != null) {
            vacationActive = (Boolean) _form.get("vacationActive");
        }

        userObj.setVactionActive(vacationActive.booleanValue());

        adminInstance.updateUser(userObj);
    } catch (Exception ex) {
        if (ex instanceof ChatException) {
            if (ex.getCause() instanceof NotOnlineException) {
                request.setAttribute("result", "not_online");
            } else if (ex.getCause() instanceof NotLoggedInException) {
                request.setAttribute("result", "not_logged_in");
            } else if (ex.getCause() instanceof NotAcceptChatException) {
                request.setAttribute("result", "not_accept_chat");
            } else {
                request.setAttribute("result", ex.getMessage());
            }
        } else {
            String errorMessage = ExceptionUtilities.parseMessage(ex);

            if (errorMessage == null) {
                errorMessage = "NullPointerException";
            }

            request.setAttribute("result", errorMessage);

            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:com.aurel.track.admin.server.siteConfig.incomingEmail.IncomingEmailBL.java

/**
 * This method returns a transfer object for the incoming e-mail
 * configuration (POP3 or IMAP). The transfer object can be used to move
 * data between the application layer and the user interface.
 *
 * @param siteBean contains all data for the server configuration
 * @param locale the locale used for translating the radio group texts.
 *
 * @return the transfer object for the incoming e-mail configuration
 *///from  ww  w  .j ava2s.c o m
public static IncomingEmailTO getIncomingEmailTO(TSiteBean siteBean, Locale locale) {
    IncomingEmailTO incomingEmailTO = new IncomingEmailTO();
    incomingEmailTO.setEmailSubmissionEnabled(siteBean.getIsEmailSubmissionOn());
    String protocol = siteBean.getMailReceivingProtocol();
    if (protocol == null || protocol.length() == 0) {
        protocol = "pop3";
        siteBean.setMailReceivingProtocol(protocol);
    }
    Integer popPort = siteBean.getMailReceivingPort();
    if (popPort == null || popPort.intValue() < 1) {
        if ("pop3".equals(protocol)) {
            siteBean.setMailReceivingPort(new Integer(110)); // set port to default value
        }
        if ("imap".equals(protocol)) {
            siteBean.setMailReceivingPort(new Integer(143)); // set port to default value
        }
    }
    incomingEmailTO.setProtocol(siteBean.getMailReceivingProtocol());
    incomingEmailTO.setServerName(siteBean.getMailReceivingServerName());
    incomingEmailTO.setPort(siteBean.getMailReceivingPort());
    incomingEmailTO.setUser(siteBean.getMailReceivingUser());
    incomingEmailTO.setPassword(siteBean.getMailReceivingPassword());

    Integer mailReceivingSecurityConnection = siteBean.getMailReceivingSecurityConnection();
    if (mailReceivingSecurityConnection != null) {
        incomingEmailTO.setSecurityConnection(siteBean.getMailReceivingSecurityConnection());
    } else {
        incomingEmailTO.setSecurityConnection(TSiteBean.SECURITY_CONNECTIONS_MODES.NEVER);
    }

    incomingEmailTO.setKeepMessagesOnServer(
            new Boolean(siteBean.getPreferenceProperty(TSiteBean.KEEP_MESSAGES_ON_SERVER)));
    incomingEmailTO.setUnknownSenderEnabled(siteBean.getIsUnknownSenderOn());
    incomingEmailTO.setUnknownSenderRegistrationEnabled(siteBean.getIsUnknownSenderRegistrationOn());
    incomingEmailTO.setDefaultProject(siteBean.getDefaultProject());
    incomingEmailTO.setAllowedEmailPattern(siteBean.getAllowedEmailPattern());
    if (locale != null) {
        incomingEmailTO.setSecurityConnectionsModes(OutgoingEmailBL.getSecurityConnectionsModes(locale));
    }
    return incomingEmailTO;
}

From source file:es.pode.modificador.presentacion.ejecutadas.ModificacionesEjecutadasControllerImpl.java

/**
 * @see es.pode.modificador.presentacion.ejecutadas.ModificacionesEjecutadasController#recuperarModificaciones(org.apache.struts.action.ActionMapping, es.pode.modificador.presentacion.ejecutadas.RecuperarModificacionesForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *///from  w  ww .  j  av a  2  s  .  c o  m
public final void recuperarModificaciones(ActionMapping mapping,
        es.pode.modificador.presentacion.ejecutadas.RecuperarModificacionesForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    request.getSession().setAttribute("offline", new Boolean(DecisorOffline.esOffline()));
    ModificacionVO[] modificacionesEjecutadas = this.getSrvHerramientaModificacion()
            .obtenerModificacionesEjecutadas();
    List modificacionesPendientesList = new ArrayList();
    for (int i = 0; i < modificacionesEjecutadas.length; i++) {
        modificacionesPendientesList.add(i, modificacionesEjecutadas[i]);
    }
    logger.debug("las modificaciones se han recuperado con xito");
    form.setModificaciones(modificacionesPendientesList);
    form.setIdiomaBuscadorBackingList(
            IdiomasBuscadorSingleton.getInstance().obtenerIdiomas(LdapUserDetailsUtils.getIdioma()),
            "idLocalizacion", "nombre");
    form.setOffline(DecisorOffline.esOffline());
}

From source file:it.jugpadova.blo.ParticipantBo.java

/**
 * Set the attended flag of a participant.
 *
 * @param participantId The id of the participa
 * @param value true if attended/*from  w ww.  j a v a 2s  . c o  m*/
 */
public void setAttended(long participantId, boolean value) {
    Participant participant = participantDao.read(Long.valueOf(participantId));
    participant.setAttended(new Boolean(value));
}

From source file:com.netflix.simianarmy.aws.janitor.RDSJanitorResourceTracker.java

public Object value(boolean value) {
    return new Boolean(value).toString();
}

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

protected void setProperties(UIComponent component) {
    super.setProperties(component);
    UIInput input = null;/*from w  w  w . j  av a  2s. c  om*/
    try {
        input = (UIInput) component;
    } catch (ClassCastException cce) {
        throw new IllegalStateException("Component " + component.toString()
                + " not expected type.  Expected: UIInput.  Perhaps you're missing a tag?");
    }

    if (converter != null) {
        if (isValueReference(converter)) {
            ValueBinding vb = Util.getValueBinding(converter);
            input.setValueBinding("converter", vb);
        } else {
            Converter _converter = FacesContext.getCurrentInstance().getApplication()
                    .createConverter(converter);
            input.setConverter(_converter);
        }
    }

    if (immediate != null) {
        if (isValueReference(immediate)) {
            ValueBinding vb = Util.getValueBinding(immediate);
            input.setValueBinding("immediate", vb);
        } else {
            boolean _immediate = new Boolean(immediate).booleanValue();
            input.setImmediate(_immediate);
        }
    }
    if (required != null) {
        if (isValueReference(required)) {
            ValueBinding vb = Util.getValueBinding(required);
            input.setValueBinding("required", vb);
        } else {
            boolean _required = new Boolean(required).booleanValue();
            input.setRequired(_required);
        }
    }
    if (validator != null) {
        if (isValueReference(validator)) {
            Class args[] = { FacesContext.class, UIComponent.class, Object.class };
            MethodBinding vb = FacesContext.getCurrentInstance().getApplication().createMethodBinding(validator,
                    args);
            input.setValidator(vb);
        } else {
            Object params[] = { validator };
            throw new javax.faces.FacesException(
                    Util.getExceptionMessageString(Util.INVALID_EXPRESSION_ID, params));
        }
    }
    if (value != null) {
        if (isValueReference(value)) {
            ValueBinding vb = Util.getValueBinding(value);
            input.setValueBinding("value", vb);
        } else {
            input.setValue(value);
        }
    }
    if (valueChangeListener != null) {
        if (isValueReference(valueChangeListener)) {
            Class args[] = { ValueChangeEvent.class };
            MethodBinding vb = FacesContext.getCurrentInstance().getApplication()
                    .createMethodBinding(valueChangeListener, args);
            input.setValueChangeListener(vb);
        } else {
            Object params[] = { valueChangeListener };
            throw new javax.faces.FacesException(
                    Util.getExceptionMessageString(Util.INVALID_EXPRESSION_ID, params));
        }
    }
}

From source file:org.ff4j.spring.autowire.AutowiredFF4JBeanPostProcessor.java

private void autoWiredFeature(Object bean, Field field) {
    // Find the required and name parameters
    FF4JFeature annFeature = field.getAnnotation(FF4JFeature.class);
    String annValue = annFeature.value();
    String featureName = field.getName();
    if (annValue != null && !"".equals(annValue)) {
        featureName = annValue;//w w  w. j ava 2 s.c  om
    }
    Feature feature = readFeature(field, featureName, annFeature.required());
    if (feature != null) {
        if (Feature.class.isAssignableFrom(field.getType())) {
            injectValue(field, bean, featureName, feature);
        } else if (Boolean.class.isAssignableFrom(field.getType())) {
            injectValue(field, bean, featureName, new Boolean(feature.isEnable()));
        } else if (boolean.class.isAssignableFrom(field.getType())) {
            injectValue(field, bean, featureName, feature.isEnable());
        } else {
            throw new IllegalArgumentException("Field annotated with @FF4JFeature"
                    + " must inherit from org.ff4j.Feature or be boolean " + field.getType() + " [class="
                    + bean.getClass().getName() + ", field=" + field.getName() + "]");
        }
    }
}

From source file:com.googlesource.gerrit.plugins.rabbitmq.Properties.java

public boolean getBoolean(Keys key) {
    return pluginConfig.getBoolean(key.section, key.name, new Boolean(key.defaultVal.toString()));
}