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:io.brooklyn.ambari.rest.RequestCheckRunnable.java

@Override
public void run() {
    boolean done = Repeater.create(String.format("Request %s status check", builder.request.toString()))
            .every(Duration.ONE_SECOND).until(new Callable<Boolean>() {
                @Override// w  w w .j a  va  2s.  com
                public Boolean call() throws Exception {
                    final String json = HttpTool
                            .httpGet(builder.httpClient, URI.create(builder.request.getHref()), builder.headers)
                            .getContentAsString();
                    final String status = JsonPath.read(json, "$.Requests.request_status");
                    if (!VALID_STATES.contains(status)) {
                        throw new RuntimeException("Request fails with state " + status
                                + ". Check here for details " + builder.request.getHref());
                    }
                    return StringUtils.equals(status, "COMPLETED");
                }
            }).limitTimeTo(builder.timeout).rethrowExceptionImmediately().run();

    if (!done) {
        throw new RuntimeException(builder.errorMessage);
    }
}

From source file:com.google.mr4c.hadoop.Cluster.java

public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (!obj.getClass().equals(this.getClass()))
        return false;
    Cluster cluster = (Cluster) obj;//from   w  w w.  j  a  va2s .  c  o m
    if (!StringUtils.equals(m_tracker, cluster.m_tracker))
        return false;
    if (!StringUtils.equals(m_fs, cluster.m_fs))
        return false;
    return true;
}

From source file:de.micromata.genome.gwiki.launcher.config.GWikiFilesystemConfigModel.java

@Override
public void validate(ValContext ctx) {
    if (isTrue(useContextXml) == true) {
        if (StringUtils.isBlank(contextXml) == true) {
            ctx.directError("contextXml", "Please select a GWikiContext.xml file");
        } else if (new File(contextXml).exists() == false) {
            ctx.directError("contextXml", "Please select an existant GWikiContext.xml file");
        }// w w  w.jav  a 2  s .c  o m
    } else {
        if (StringUtils.equals(storageType, FILESYSTEM) == false
                && StringUtils.equals(storageType, FILESYSTEM) == false) {
            ctx.directError("storageType", "Please select valid Storagetype");
            return;
        }
        if (StringUtils.equals(storageType, FILESYSTEM) == true) {
            if (StringUtils.isBlank(storageFilePath) == true) {
                ctx.directError("storageFilePath", "Please select directory where to store wiki files");
                return;
            }
            File dirFile = new File(storageFilePath);
            if (dirFile.exists() == true) {
                if (dirFile.isDirectory() == true) {
                    return;
                } else {
                    ctx.directError("storageFilePath", "Please select a directory where to store wiki files");
                }
            } else {
                boolean suc = dirFile.mkdirs();
                if (suc == false) {
                    ctx.directError("storageFilePath", "Cannot create storageFilePath");
                }
            }
        } else {
            jdbcConfigModel.validate(ctx);
        }

    }
}

From source file:com.glaf.batch.domain.JobInstance.java

public java.util.Date getDateValue(String keyName) {
    if (params != null && !params.isEmpty()) {
        for (JobParam param : params) {
            if (StringUtils.equals(keyName, param.getKeyName())) {
                return param.getDateVal();
            }/*from  w ww  .ja  va2  s.c o m*/
        }
    }
    return null;
}

From source file:de.dominikschadow.duke.encounters.controller.EncounterController.java

@GetMapping("/encounters")
public String getEncounters(final Model model,
        @RequestParam(name = "type", required = false) final String type) {
    boolean confirmable = !StringUtils.equals(userService.getUser().getUsername(), "anonymousUser")
            && !StringUtils.equals("own", type);

    List<Encounter> encounters = encounterService.getEncounters(type);
    model.addAttribute("encounters", encounters);
    model.addAttribute("confirmable", confirmable);

    return "encounters";
}

From source file:de.knightsoftnet.validationexample.shared.models.UserData.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/* www.  j a  v  a2  s  .c  o m*/
    if (obj == null) {
        return false;
    }
    if (this.getClass() != obj.getClass()) {
        return false;
    }
    final UserData other = (UserData) obj;
    return StringUtils.equals(this.userName, other.getUserName());
}

From source file:com.inkubator.hrm.web.lazymodel.PerformanceIndicatorJabatanLazyDataModel.java

@Override
public PerformanceIndicatorJabatanViewModel getRowData(String id) {
    for (PerformanceIndicatorJabatanViewModel model : list) {
        if (StringUtils.equals(id, String.valueOf(model.getJabatanId()))) {
            return model;
        }/*from   www.j a  v  a2  s.  com*/
    }
    return null;
}

From source file:io.wcm.caravan.io.http.impl.ribbon.LoadBalancerCommandFactory.java

/**
 * Determines if the HTTP request will be a local request by checking hosts of the configured servers.
 * @param serviceId Logical name of the HTTP service
 * @return True if load balancer has only local servers
 *///w  ww  .  j  av  a  2s. c  o  m
public boolean isLocalRequest(String serviceId) {

    try {
        ILoadBalancer loadBalancer = loadBalancerFactory.getLoadBalancer(serviceId);
        List<Server> serverList = loadBalancer.getServerList(true);
        return serverList.stream().filter(server -> !StringUtils.equals(server.getHost(), "localhost"))
                .count() == 0;
    } catch (RequestInstantiationRuntimeException ex) {
        return false;
    }

}

From source file:info.magnolia.ui.admincentral.setup.for5_3.WidgetsetRelocationCondition.java

@Override
public boolean check(InstallContext installContext) {
    String widgetset = magnoliaProperties.getProperty(WIDGETSET_PROPERTY_KEY);
    if (StringUtils.equals(widgetset, OLD_52_WIDGETSET)) {
        installContext.warn("Magnolia's default widgetset was relocated to '" + DEFAULT_WIDGETSET
                + "' but the '" + WIDGETSET_PROPERTY_KEY + "' property still points to its former location. "
                + "Please update your magnolia.properties; for more info, see " + WIDGETSET_DOCUMENTATION_URL);
    }//from   ww w .j  a v a 2  s . com
    return true;
}

From source file:info.magnolia.ui.api.app.launcherlayout.AppLauncherLayout.java

public AppLauncherGroupEntry getAppGroupEntry(String name) {
    for (AppLauncherGroup group : getGroups()) {
        for (AppLauncherGroupEntry entry : group.getApps()) {
            if (StringUtils.equals(entry.getName(), name)) {
                return entry;
            }/* w  w w  .j a  va2  s  .  c  o m*/
        }
    }
    return null;
}