Example usage for org.apache.commons.lang BooleanUtils toBoolean

List of usage examples for org.apache.commons.lang BooleanUtils toBoolean

Introduction

In this page you can find the example usage for org.apache.commons.lang BooleanUtils toBoolean.

Prototype

public static boolean toBoolean(String str) 

Source Link

Document

Converts a String to a boolean (optimised for performance).

'true', 'on' or 'yes' (case insensitive) will return true.

Usage

From source file:com.tesora.dve.common.catalog.Collations.java

public boolean getIsCompiled() {
    return BooleanUtils.toBoolean(isCompiled);
}

From source file:mitm.common.dlp.impl.PolicyCheckerContextImpl.java

@Override
public boolean isPartial() {
    return BooleanUtils.toBoolean(get(PARTIAL, Boolean.class));
}

From source file:com.alibaba.otter.manager.web.home.module.screen.api.NodeOp.java

public void execute(@Param("nid") Long nid, @Param("command") String command, @Param("value") String value) {
    try {/* w  ww . ja va  2 s  .  co m*/
        if (StringUtils.equalsIgnoreCase(command, OFFLINE)) {
            List<Channel> channels = channelService.listByNodeId(nid, ChannelStatus.START);
            for (Channel channel : channels) {// ??channel
                boolean result = arbitrateManageService.channelEvent().restart(channel.getId());
                if (result) {
                    channelService.notifyChannel(channel.getId());// ??
                }
            }
        } else if (StringUtils.equalsIgnoreCase(command, ONLINE)) {
            // doNothing?
        } else if (StringUtils.endsWithIgnoreCase(command, THREAD)) {
            nodeRemoteService.setThreadPoolSize(nid, Integer.valueOf(value));
        } else if (StringUtils.endsWithIgnoreCase(command, PROFILE)) {
            nodeRemoteService.setProfile(nid, BooleanUtils.toBoolean(value));
        } else {
            returnError("please add specfy the 'command' param.");
            return;
        }

        returnSuccess();
    } catch (Exception e) {
        String errorMsg = String.format("error happens while [%s] with node id [%d]", command, nid);
        log.error(errorMsg, e);
        returnError(errorMsg);
    }
}

From source file:net.sf.gazpachoquest.services.user.impl.GroupServiceImpl.java

@Transactional(readOnly = true)
@Override/*from   w w w.j a v a2 s.co  m*/
public boolean isUserInGroup(Integer userId, String groupName) {
    return BooleanUtils.toBoolean(((GroupRepository) repository).isUserInGroup(userId, groupName));
}

From source file:com.cognifide.cq.cqsm.core.scripts.ScriptImpl.java

@Override
public boolean isPublishRun() {
    return BooleanUtils.toBoolean(scriptContent.getPublishRun());
}

From source file:com.steeleforge.aem.ironsites.xss.taglib.XSSFilterHTMLTag.java

private String getContext() {
    if (BooleanUtils.toBoolean(isEscape())) {
        return ProtectionContext.PLAIN_HTML_CONTENT.getName();
    }//from  w ww  .j av  a 2s.  c o m

    return ProtectionContext.HTML_HTML_CONTENT.getName();
}

From source file:com.redhat.rhn.frontend.action.multiorg.ExtAuthenticationAction.java

/** {@inheritDoc} */
@Override//from  ww w . j  a  va 2  s . c  o m
public ActionForward execute(ActionMapping mapping, ActionForm formIn, HttpServletRequest request,
        HttpServletResponse response) {
    DynaActionForm daForm = (DynaActionForm) formIn;
    RequestContext ctx = new RequestContext(request);

    if (ctx.isSubmitted()) {
        Boolean useOu = (Boolean) daForm.get("use_ou");
        // store the value
        SatConfigFactory.setSatConfigBooleanValue(SatConfigFactory.EXT_AUTH_USE_ORGUNIT, useOu);

        String toOrgString = daForm.getString("to_org");
        if (!StringUtils.isEmpty(toOrgString)) {
            // just check the org id is valid
            OrgFactory.lookupById(Long.parseLong(toOrgString));
        }
        // store the value
        SatConfigFactory.setSatConfigValue(SatConfigFactory.EXT_AUTH_DEFAULT_ORGID, toOrgString);

        Boolean keepRoles = (Boolean) daForm.get("keep_roles");
        if (SatConfigFactory.getSatConfigBooleanValue(SatConfigFactory.EXT_AUTH_KEEP_ROLES)
                && !BooleanUtils.toBoolean(keepRoles)) {
            // if the option was turned off, delete temporary roles
            // across the whole satellite
            UserGroupFactory.deleteTemporaryRoles();
        }
        // store the value
        SatConfigFactory.setSatConfigBooleanValue(SatConfigFactory.EXT_AUTH_KEEP_ROLES, keepRoles);

        createSuccessMessage(request, "message.ext_auth_updated", null);
        return mapping.findForward("success");
    }

    // not submitted
    setupForm(request, daForm);
    return mapping.findForward(RhnHelper.DEFAULT_FORWARD);
}

From source file:mitm.application.djigzo.james.matchers.HasValidOriginator.java

@Override
public void init() throws MessagingException {
    messageOriginatorIdentifier = SystemServices.getMessageOriginatorIdentifier();

    String condition = getCondition();

    if (StringUtils.isNotEmpty(condition)) {
        mustMatch = BooleanUtils.toBoolean(condition);
    }/*w w w .j a v  a2  s  .  co m*/
}

From source file:com.redhat.rhn.frontend.action.kickstart.KickstartTroubleshootingEditAction.java

/**
 *
 * {@inheritDoc}/*from w ww . j a  v  a2  s  .c o m*/
 */
protected ValidatorError processFormValues(HttpServletRequest request, DynaActionForm form,
        BaseKickstartCommand cmd) {

    ValidatorError retval = null;

    KickstartTroubleshootingCommand tscmd = (KickstartTroubleshootingCommand) cmd;
    tscmd.setBootloaderType(form.getString(BOOTLOADER));

    String kernelParams = form.getString(KERNEL_PARAMS);
    if (kernelParams.length() > 128) {
        retval = new ValidatorError("kickstart.troubleshooting." + "validation.kernelparams.too_long");
    }

    tscmd.setKernelParams(form.getString(KERNEL_PARAMS));

    tscmd.getKickstartData().setNonChrootPost(BooleanUtils.toBoolean((Boolean) form.get(NONCHROOTPOST)));

    tscmd.getKickstartData().setVerboseUp2date(BooleanUtils.toBoolean((Boolean) form.get(VERBOSEUP2DATE)));

    return retval;
}

From source file:com.adaptris.util.text.xml.XmlTransformerFactoryImpl.java

TransformerFactory configure(TransformerFactory tf) throws TransformerConfigurationException {
    for (KeyValuePair kp : getTransformerFactoryAttributes()) {
        tf.setAttribute(kp.getKey(), kp.getValue());
    }//from   w w  w  .  j  a va  2s.  c  o m
    for (KeyValuePair kp : getTransformerFactoryFeatures()) {
        tf.setFeature(kp.getKey(), BooleanUtils.toBoolean(kp.getValue()));
    }
    tf.setErrorListener(new DefaultErrorListener(failOnRecoverableError()));
    return tf;
}