Example usage for org.apache.commons.lang3 StringUtils equals

List of usage examples for org.apache.commons.lang3 StringUtils equals

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils equals.

Prototype

public static boolean equals(final CharSequence cs1, final CharSequence cs2) 

Source Link

Document

Compares two CharSequences, returning true if they represent equal sequences of characters.

null s are handled without exceptions.

Usage

From source file:com.cognifide.qa.bb.aem.core.component.configuration.ComponentConfiguration.java

/**
 * @param tabName Tab name in the dialog window
 * @param type    field type provided in yaml component configuration
 * @return a list of {@link FieldConfig} for all fields matching the provided type
 *///from ww w. j  a va2 s . c o m
public List<FieldConfig> getFieldConfigsByType(String tabName, String type) {
    return getConfigurationForTab(tabName).stream().filter(t -> StringUtils.equals(t.getType(), type))
            .collect(Collectors.toList());
}

From source file:com.hybris.mobile.factory.barcode.IntentBarcodeFactory.java

/**
 * Get the associated IntentBarcode according to the intentType
 * //w ww  .  java 2s .  c o  m
 * @param intentType
 * @param intentExtras
 * @param activity
 * @return
 */
public static IntentBarcode getIntent(String intentType, Bundle intentExtras, Activity activity) {
    IntentBarcode intentBarcode = null;

    if (StringUtils.isNotEmpty(intentType)) {

        if (StringUtils.equals(DataConstants.INTENT_ORDER_DETAILS, intentType)) {
            intentBarcode = new OrderDetailsIntentBarcodeImpl(intentExtras.getString(DataConstants.ORDER_ID),
                    activity);
        }

    }

    return intentBarcode;
}

From source file:io.wcm.devops.conga.generator.util.ConfigInheritanceResolver.java

private static Map<String, Object> getGlobalRoleConfig(Environment environment, String roleName) {
    for (RoleConfig roleConfig : environment.getRoleConfig()) {
        if (StringUtils.equals(roleConfig.getRole(), roleName)) {
            return roleConfig.getConfig();
        }/*from   w ww . ja  v a  2  s  .c om*/
    }
    return new HashMap<>();
}

From source file:com.anrisoftware.sscontrol.core.groovy.bindingaddressstatements.BindingAddressesStatementsLogger.java

void checkBindings(List<?> list, boolean requirePort, StatementsTable table) {
    int listMin = requirePort ? 1 : 0;
    isTrue(list.size() > listMin, format(binding_address_null.toString(), table.getService()));
    int addressIndex = list.size() > 1 ? 1 : 0;
    String address = list.get(addressIndex).toString();
    isTrue(InetAddressValidator.getInstance().isValid(address) || StringUtils.equals(address, "*"),
            format(binding_address_invalid.toString(), table.getService()));
}

From source file:gov.nih.nci.caintegrator.web.action.query.form.AbstractCriterionRow.java

void processCriteriaChanges() {
    if (!StringUtils.equals(getFieldName(), newFieldName)) {
        handleFieldNameChange(newFieldName);
    } else {//from  w ww  . j  av a  2s  .co m
        processParameterChanges();
    }
}

From source file:cn.codepub.redis.directory.io.InputOutputStream.java

default void checkTransactionResult(List<Object> exec) {
    for (Object o : exec) {
        boolean equals = StringUtils.equals(Objects.toString(o), "0");
        if (equals) {
            System.err.println("Execute transaction occurs error!");
        }//from   w  ww.j  a va2s  .  c o m
    }
}

From source file:com.glaf.ui.web.springmvc.MxLayoutController.java

@RequestMapping("/save")
public ModelAndView save(ModelMap modelMap, HttpServletRequest request) {
    LoginContext loginContext = RequestUtils.getLoginContext(request);

    logger.debug(RequestUtils.getParameterMap(request));

    String actorId = loginContext.getActorId();

    String layoutName = request.getParameter("layoutName");

    String isSystem = request.getParameter("isSystem");

    if (loginContext.isSystemAdministrator() && StringUtils.equals(isSystem, "true")) {
        actorId = "system";
    }/*from ww  w.j  av a 2  s . c  o  m*/

    Layout layout = layoutService.getLayoutByName(layoutName);

    UserPanel userPanel = new UserPanel();
    userPanel.setActorId(actorId);
    userPanel.setLayout(layout);
    userPanel.setLayoutName(layoutName);
    userPanel.setCreateDate(new Date());

    Enumeration<?> enumeration = request.getParameterNames();
    while (enumeration.hasMoreElements()) {
        String paramName = (String) enumeration.nextElement();
        if (StringUtils.isNotEmpty(paramName) && paramName.startsWith("x_grid_")) {
            paramName = paramName.replaceAll("x_grid_", "");
            String paramValue = RequestUtils.getParameter(request, "panel_" + paramName);
            if (StringUtils.isNotEmpty(paramValue)) {
                Panel panel = panelService.getPanelByName(paramValue);
                PanelInstance model = new PanelInstance();
                model.setName(paramName);
                model.setPanel(panel);
                model.setUserPanel(userPanel);
                userPanel.getPanelInstances().add(model);
            }
        }
    }

    panelService.saveUserPanel(userPanel);

    return showLayout(modelMap, request);
}

From source file:edu.sjsu.cohort6.openstack.server.filter.BasicAuthenticationFilter.java

private boolean authenticatedWith(final String[] credentials) {
    if (credentials != null && credentials.length == 2) {
        final String submittedUsername = credentials[0];
        final String submittedPassword = credentials[1];

        return StringUtils.equals(submittedUsername, authenticationDetails.userName)
                && StringUtils.equals(submittedPassword, new String(authenticationDetails.password));
    } else {/*from  w  w  w  .ja v  a  2  s. co  m*/
        return false;
    }
}

From source file:io.wcm.devops.conga.generator.util.VariableStringResolver.java

private static String resolve(String value, Map<String, Object> variables, int iterationCount) {
    if (iterationCount >= REPLACEMENT_MAX_ITERATIONS) {
        throw new IllegalArgumentException("Cyclic dependencies in variable string detected: " + value);
    }//  w  w w .  ja va 2 s .  c o  m

    Matcher matcher = VARIABLE_PATTERN.matcher(value);
    StringBuffer sb = new StringBuffer();
    boolean replacedAny = false;
    while (matcher.find()) {
        boolean escapedVariable = StringUtils.equals(matcher.group(1), "\\$");
        String variable = matcher.group(2);
        if (escapedVariable) {
            // keep escaped variables intact
            matcher.appendReplacement(sb, Matcher.quoteReplacement("\\${" + variable + "}"));
        } else {
            Object valueObject = MapExpander.getDeep(variables, variable);
            if (valueObject != null) {
                String variableValue = valueToString(valueObject);
                matcher.appendReplacement(sb, Matcher.quoteReplacement(variableValue.toString()));
                replacedAny = true;
            } else {
                throw new IllegalArgumentException("Unknown variable: " + variable);
            }
        }
    }
    matcher.appendTail(sb);
    if (replacedAny) {
        // try again until all nested references are resolved
        return resolve(sb.toString(), variables, iterationCount + 1);
    } else {
        return sb.toString();
    }
}

From source file:com.thoughtworks.go.config.merge.MergePipelineConfigs.java

private void validateGroupNameUniqueness(List<PipelineConfigs> parts) {
    String name = parts.get(0).getGroup();
    for (PipelineConfigs part : parts) {
        String otherName = part.getGroup();
        if (!StringUtils.equals(otherName, name))
            throw new IllegalArgumentException("Group names must be the same in merge");
    }//from w w w.  ja va  2  s .c  o m
}