Example usage for org.apache.commons.lang StringUtils equalsIgnoreCase

List of usage examples for org.apache.commons.lang StringUtils equalsIgnoreCase

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils equalsIgnoreCase.

Prototype

public static boolean equalsIgnoreCase(String str1, String str2) 

Source Link

Document

Compares two Strings, returning true if they are equal ignoring the case.

Usage

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 {//from   w  w w  .ja v a 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:com.puyuntech.flowerToHome.controller.admin.LoginController.java

/**
 * /*  w w w .j  av  a  2 s  . c o  m*/
 * ?. author:  date: 2015-9-21 ?1:29:55
 * 
 * @param request
 *            ??
 * @param model
 *            ?
 * @return ??
 */
@RequestMapping
public String index(HttpServletRequest request, ModelMap model) {

    /**
     * 
     */
    String loginToken = WebUtils.getCookie(request, Admin.LOGIN_TOKEN_COOKIE_NAME);

    /**
     * ?
     */
    if (!StringUtils.equalsIgnoreCase(loginToken, adminService.getLoginToken())) {
        return "redirect:/";
    }

    /**
     * ???
     */
    if (adminService.isAuthenticated()) {
        return "redirect:common/main.jhtml";
    }

    Message failureMessage = null;

    /**
     * 
     */
    String loginFailure = (String) request
            .getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
    if (StringUtils.isNotEmpty(loginFailure)) {
        if (loginFailure.equals("com.puyuntech.ycmall.exception.IncorrectCaptchaException")) {
            failureMessage = Message.error("admin.captcha.invalid");
        } else if (loginFailure.equals("org.apache.shiro.authc.UnknownAccountException")) {
            failureMessage = Message.error("admin.login.unknownAccount");
        } else if (loginFailure.equals("org.apache.shiro.authc.DisabledAccountException")) {
            failureMessage = Message.error("admin.login.disabledAccount");
        } else if (loginFailure.equals("org.apache.shiro.authc.LockedAccountException")) {
            failureMessage = Message.error("admin.login.lockedAccount");
        } else if (loginFailure.equals("org.apache.shiro.authc.IncorrectCredentialsException")) {
            Setting setting = SystemUtils.getSetting();
            if (ArrayUtils.contains(setting.getAccountLockTypes(), Setting.AccountLockType.admin)) {
                failureMessage = Message.error("admin.login.accountLockCount", setting.getAccountLockCount());
            } else {
                failureMessage = Message.error("admin.login.incorrectCredentials");
            }
        } else if (loginFailure.equals("com.puyuntech.ycmall.exception.IllegalLicenseException")) {
            failureMessage = Message.error("admin.login.incorrectLicense");
        } else if (loginFailure.equals("org.apache.shiro.authc.AuthenticationException")) {
            failureMessage = Message.error("admin.login.authentication");
        }
    }

    /**
     * ?
     */
    RSAPublicKey publicKey = rsaService.generateKey(request);

    /**
     * ?
     */
    model.addAttribute("modulus", Base64.encodeBase64String(publicKey.getModulus().toByteArray()));
    model.addAttribute("exponent", Base64.encodeBase64String(publicKey.getPublicExponent().toByteArray()));
    model.addAttribute("captchaId", request.getSession().getId());
    model.addAttribute("failureMessage", failureMessage);
    return "/admin/login/index";
}

From source file:com.recomdata.transmart.data.export.util.ExportImageProcessor.java

private String getFilename(URI imageURI) {
    String filename = null;/*from w  ww . j  av a2 s .  c om*/
    if (StringUtils.equalsIgnoreCase("file", imageURI.getScheme())) {
        filename = (new File(imageURI.toString())).getName();
    } else {
        if (null != imageURI) {
            String imageURIStr = imageURI.toString();
            if (StringUtils.isNotEmpty(imageURIStr)) {
                int loc = imageURIStr.lastIndexOf("/");
                if (loc == imageURIStr.length() - 1) {
                    loc = (imageURIStr.substring(0, loc - 1)).lastIndexOf("/");
                }
                filename = imageURIStr.substring(loc + 1, imageURIStr.length());
            }
        }
    }

    return filename;
}

From source file:com.smartitengineering.cms.ws.common.jackson.FieldDefTypeIdResolver.java

@Override
public JavaType typeFromId(String id) {
    if (StringUtils.equalsIgnoreCase(id, "collection")) {
        return SimpleType.construct(CollectionFieldDef.class);
    } else if (StringUtils.equalsIgnoreCase(id, "content")) {
        return SimpleType.construct(ContentFieldDef.class);
    } else if (StringUtils.equalsIgnoreCase(id, "composite")) {
        return SimpleType.construct(CompositeFieldDef.class);
    } else if (StringUtils.equalsIgnoreCase(id, "enum")) {
        return SimpleType.construct(EnumFieldDef.class);
    } else if (StringUtils.equalsIgnoreCase(id, "string") || StringUtils.equalsIgnoreCase(id, "other")) {
        return SimpleType.construct(OtherFieldDef.class);
    } else {/*  w w w  .j a  va  2s.  co m*/
        return SimpleType.construct(FieldDef.class);
    }
}

From source file:broadwick.graph.Vertex.java

/**
 * Add an attribute to the vertex, overwriting any attribute of the same name.
 * @param attribute the attribute to be added.
 * @return true if the collection of attributes changed as a result of the call
 *///from  w  w w. j  a  va 2s.c  om
public final boolean addAttribute(final VertexAttribute attribute) {
    for (VertexAttribute attr : attributes) {
        if (StringUtils.equalsIgnoreCase(attribute.getName(), attr.getName())) {
            attributes.remove(attr);
            break;
        }
    }
    return attributes.add(attribute);
}

From source file:com.activecq.api.utils.ValidationUtil.java

/**
 * Checks to make sure the field (key) represents a confirmed input
 *
 * @param form/*from  w  ww  .  ja va 2  s  .c o m*/
 * @param key
 * @return
 */
public static boolean isConfirmed(ActiveForm form, String key) {
    if (!isPresent(form, key)) {
        return false;
    }

    String val = form.get(key);
    return StringUtils.equalsIgnoreCase(val, "true");
}

From source file:hydrograph.ui.propertywindow.widgets.listeners.OverWriteWidgetSelectionListener.java

@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,
        Widget... widgets) {//  ww  w .jav  a2 s .  co m
    final Widget[] widgetList = widgets;

    Listener listener = new Listener() {
        @Override
        public void handleEvent(Event event) {
            if (StringUtils.equalsIgnoreCase(((Combo) widgetList[0]).getText(), String.valueOf(Boolean.TRUE))) {
                MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
                        SWT.ICON_INFORMATION | SWT.OK);
                messageBox.setText(INFORMATION);
                messageBox.setMessage("All files at given location will be overwritten.");
                messageBox.open();
            }
        }
    };
    return listener;
}

From source file:com.pearson.openideas.cq5.components.content.ArticleVideo.java

/**
 * {@inheritDoc}/*  w ww  .ja  v a 2 s.co  m*/
 */
@Override
public void init() {
    setYoutubeVideoURL(getProperties().get(PROPERTY_VIDEO_URL, ""));

    transcript = new ArrayList<String>();

    try {
        Resource resource = getCurrentResource().getChild("file");
        log.debug("file associated with this: " + resource.getName() + ", " + resource.getResourceType());
        if (StringUtils.equalsIgnoreCase(resource.getResourceType(), "nt:file")) {
            InputStream inputStream = resource.adaptTo(InputStream.class);
            InputStreamReader is = new InputStreamReader(inputStream);
            BufferedReader br = new BufferedReader(is);
            String read = br.readLine();

            while (read != null) {
                transcript.add(read);
                read = br.readLine();
            }

        }
    } catch (Exception e) {
        log.warn("There is no file associated with this component");
    }

    log.debug("transcript lines: " + transcript.size());

}

From source file:com.echosource.ada.lexer.TagNode.java

public boolean equalsElementName(String elementName) {
    return StringUtils.equalsIgnoreCase(getLocalName(), elementName)
            || StringUtils.equalsIgnoreCase(getNodeName(), elementName);
}

From source file:edu.uiowa.icts.util.SortColumn.java

/**
 * <p>Setter for the field <code>direction</code>.</p>
 *
 * @param direction the direction to set
 *///from   w w w  .ja va2 s  . c o m
public void setDirection(String direction) {
    if (!StringUtils.equalsIgnoreCase(direction, ASC) && !StringUtils.equalsIgnoreCase(direction, DESC)) {
        throw new IllegalArgumentException("sort direction not supported " + direction);
    }
    this.direction = direction;
}