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:de.fhg.fokus.odp.registry.ckan.impl.UserImpl.java

@Override
public boolean isCreator(Metadata metadata) {
    return StringUtils.equals(this.user.getId(), metadata.getCreatorUserId());
}

From source file:io.wcm.handler.link.testcontext.DummyLinkHandlerConfig.java

@Override
public boolean isRedirect(Page page) {
    String templatePath = page.getProperties().get(NameConstants.PN_TEMPLATE, String.class);
    return StringUtils.equals(templatePath, DummyAppTemplate.REDIRECT.getTemplatePath());
}

From source file:io.wcm.handler.media.impl.JcrBinary.java

/**
 * Checks if the given resource is a node with the given node type name
 * @param resource Resource//from w  w w.ja v  a2s  .  c  o  m
 * @param nodeTypeName Node type name
 * @return true if resource is of the given node type
 */
private static boolean isNt(Resource resource, String nodeTypeName) {
    if (resource != null) {
        return StringUtils.equals(resource.getResourceType(), nodeTypeName);
    }
    return false;
}

From source file:com.eryansky.common.orm.core.hibernate.restriction.support.EqRestriction.java

public MatchValue getMatchValue(String matchValue, Class<?> FieldType) {

    MatchValue matchValueModel = super.getMatchValue(matchValue, FieldType);
    for (int i = 0; i < matchValueModel.getValues().size(); i++) {
        Object value = matchValueModel.getValues().get(i);
        if (value instanceof String && StringUtils.equals(value.toString(), "null")) {
            matchValueModel.getValues().remove(i);
            matchValueModel.getValues().add(i, null);
        }/*www  .ja v  a2 s. c  o m*/
    }
    return matchValueModel;
}

From source file:de.micromata.genome.logging.LogRequestParameterAttribute.java

/**
 * Gets the request for logging.//from   w  w w.  jav a  2 s.  com
 *
 * @param request the request
 * @param excludingKeys the excluding keys
 * @return the request for logging
 */
public static String getRequestForLogging(Map<String, Object> request, String... excludingKeys) {
    if (request == null || request.isEmpty() == true) {
        return "<no params>";
    }
    StringBuilder sb = new StringBuilder();
    for (Map.Entry<String, Object> me : request.entrySet()) {
        final String key = me.getKey();
        String value = Objects.toString(me.getValue(), StringUtils.EMPTY);
        for (String exKey : excludingKeys) {
            if (StringUtils.equals(key, exKey) == true) {
                value = "****";
                break;
            }
        } // for

        sb.append(key).append('=').append(value).append('\n');
    }
    return sb.toString();
}

From source file:de.micromata.genome.gwiki.page.gspt.GWikiIncludeReplacer.java

public String replace(ReplacerContext ctx, Map<String, String> attr, boolean isClosed) {
    String fn = attr.get("file");
    String embedd = attr.get("embedd");
    boolean doEmbedd = StringUtils.equals(embedd, "false") == false;
    if (doEmbedd == false)
        return externalInclude(attr, fn);

    GWikiContext wctx = (GWikiContext) ctx.getAttribute("wikiContext");
    String id = fn;/*  ww  w  .  j a  va 2 s.  com*/
    if (id.endsWith(".gspt") == true) {
        id = id.substring(0, id.length() - ".gspt".length());
    }
    if (id.startsWith("/") == true)
        id = id.substring(1);
    GWikiElement el = wctx.getWikiWeb().getElement(id);
    GWikiArtefakt<?> fact = el.getMainPart();
    if (fact instanceof GWikiTextArtefakt) {
        GWikiTextArtefakt<?> text = (GWikiTextArtefakt<?>) fact;
        return text.getStorageData();
    } else {
        return "<% wikiContext.includeText('" + id + "'); %>";
    }
}

From source file:com.nesscomputing.service.discovery.client.internal.ConsistentRingGroup.java

public ConsistentRingGroup(Collection<ServiceInformation> servers) {
    totalServers = servers.size();/*  w  w w  .  j a va2s  .  c o m*/
    Map<String, List<ServiceInformation>> serverGroups = Maps.newHashMap();
    String serviceName = null;
    //Sort the servers by type
    for (ServiceInformation info : servers) {
        Preconditions.checkArgument(
                serviceName == null || StringUtils.equals(serviceName, info.getServiceName()),
                "All services must have the same name: " + servers);
        serviceName = info.getServiceName();
        //Hashmaps allow null keys, so null service types should map correctly.
        if (!serverGroups.containsKey(info.getServiceType())) {
            serverGroups.put(info.getServiceType(), new ArrayList<ServiceInformation>());
        }
        serverGroups.get(info.getServiceType()).add(info);
    }

    for (Map.Entry<String, List<ServiceInformation>> entry : serverGroups.entrySet()) {
        rings.put(entry.getKey(), new ConsistentHashRing(entry.getValue()));
    }
}

From source file:io.relution.jenkins.awssqs.model.entities.codecommit.CodeCommitEvent.java

@Override
public boolean isMatch(final URIish uri) {
    if (uri == null) {
        return false;
    }/*  w  w  w. ja  v a 2  s.c om*/

    if (!StringUtils.equals(this.host, uri.getHost())) {
        return false;
    }

    if (!StringUtils.equals(this.path, uri.getPath())) {
        return false;
    }

    return true;
}

From source file:com.marand.thinkmed.api.externals.data.object.ExternalIdentityDto.java

@Override
public boolean equals(final Object o) {
    if (this == o) {
        return true;
    }/*from   ww  w  .ja va 2s. c o  m*/
    if (!(o instanceof ExternalIdentityDto)) {
        return false;
    }

    final ExternalIdentityDto that = (ExternalIdentityDto) o;

    return StringUtils.equals(id, that.id);
}

From source file:edu.sabanciuniv.sentilab.sare.controllers.opinion.OpinionMiningEngine.java

/**
 * Creates an engine with the specified code which is either a subtype of the provided class or the class itself.
 * @param code the engine code.//from  ww w. j  a  va2 s  .  c  o m
 * @param classOfBaseEngine the base class of the engine.
 * @return the desired engine of type {@code T} or {@code null} if none matched.
 */
public static <T extends OpinionMiningEngine> T create(String code, Class<T> classOfBaseEngine) {
    Class<? extends T> engine = null;

    if (ObjectUtils.equals(code, getCode(classOfBaseEngine))) {
        engine = classOfBaseEngine;
    }

    Reflections reflections = new Reflections("edu.sabanciuniv.sentilab.sare.controllers.opinion");
    for (Class<? extends T> classOfEngine : reflections.getSubTypesOf(classOfBaseEngine)) {
        if (StringUtils.equals(code, getCode(classOfEngine))) {
            engine = classOfEngine;
            break;
        }
    }

    if (engine != null) {
        try {
            return engine.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
        }
    }

    return null;
}