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:glluch.com.ontotaxoseeker.Terms.java

protected Term containsLema(String lema) {

    Iterator iter = this.iterator();
    while (iter.hasNext()) {
        Term term = (Term) iter.next();/*ww  w .j a  va2s  . c  o m*/
        if (StringUtils.isNotEmpty(lema) && StringUtils.equals(lema, term.getLema())) {
            return term;
        }

    }

    return null;
}

From source file:com.google.mr4c.content.S3Credentials.java

public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (!obj.getClass().equals(this.getClass()))
        return false;
    S3Credentials cred = (S3Credentials) obj;
    if (!StringUtils.equals(m_id, cred.m_id))
        return false;
    if (!StringUtils.equals(m_secret, cred.m_secret))
        return false;
    return true;/*from   w  w w .j  av  a 2s.  c om*/
}

From source file:de.micromata.genome.gwiki.page.impl.GWikiPropsDescriptorValue.java

/**
 * Parses the request.// www  .  j  a  va  2s .  c  om
 *
 * @param pct the pct
 */
public void parseRequest(PropsEditContext pct) {
    if (pct.invokeOnControlerBean("onParseRequest") == true) {
        return;
    }
    if (pct.isReadOnly() == true || pct.isDisplayable() == false) {
        return;
    }
    String value = pct.getRequestValue();
    /*
     * if (StringUtils.isEmpty(value) == true) { value = pct.getDefaultValue(); }
     */
    if (StringUtils.equals(pct.getControlType(), "DATE") == true) {
        value = GWikiProps.formatTimeStamp(pct.getWikiContext().parseUserDateString(value));
    }
    pct.setPropsValue(value);
}

From source file:de.micromata.genome.gwiki.page.impl.GWikiPropsEditorArtefakt.java

private void mergeSettingsProps() {
    if (propDescriptor != null && elementToEdit != null && StringUtils.equals(partName, "Settings") == true) {
        GWikiMetaTemplate mt = elementToEdit.getMetaTemplate();
        if (mt != null && mt.getAddPropsDescriptor() != null) {
            List<GWikiPropsDescriptorValue> descriptors = new ArrayList<GWikiPropsDescriptorValue>();
            descriptors.addAll(propDescriptor.getDescriptors());
            descriptors.addAll(mt.getAddPropsDescriptor().getDescriptors());
            GWikiPropsDescriptor np = new GWikiPropsDescriptor();
            np.setDescriptors(descriptors);
            np.setGroups(propDescriptor.getGroups());
            this.propDescriptor = np;
        }/*from w  w  w  .j  a va  2  s .c om*/
    }
}

From source file:io.wcm.testing.mock.aem.MockPage.java

@Override
public int getDepth() {
    if (StringUtils.equals("/", this.resource.getPath())) {
        return 0;
    } else {/*from  w  w  w.  j  av  a2  s  .c  o m*/
        return StringUtils.countMatches(this.resource.getPath(), "/");
    }
}

From source file:com.glaf.core.service.impl.MxSystemPropertyServiceImpl.java

public List<SystemProperty> getSystemProperties(String category) {
    SystemPropertyQuery query = new SystemPropertyQuery();
    query.category(category);//from   w w w. j  ava 2s .  co  m
    List<SystemProperty> list = this.list(query);
    List<SystemProperty> rows = new ArrayList<SystemProperty>();
    if (list != null && !list.isEmpty()) {
        for (SystemProperty p : list) {
            if (!StringUtils.equals("TOKEN", p.getId())) {
                rows.add(p);
            }
        }
    }
    return rows;
}

From source file:edu.cornell.kfs.fp.document.validation.impl.CuDisbursementVoucherDocumentPreRules.java

/**
  * This method returns true if the state of all the tabs is valid, false otherwise.
  *//from  www . ja  v a2 s. c o  m
  * @param dvDocument submitted disbursement voucher document
  * @return Returns true if the state of all the tabs is valid, false otherwise.
  */
@SuppressWarnings("deprecation")
protected boolean checkWireTransferTabState(DisbursementVoucherDocument dvDocument) {
    boolean tabStatesOK = true;

    PaymentSourceWireTransfer dvWireTransfer = dvDocument.getWireTransfer();

    // if payment method is CHECK and wire tab contains data, ask user to clear tab
    if ((StringUtils.equals(KFSConstants.PaymentSourceConstants.PAYMENT_METHOD_CHECK,
            dvDocument.getDisbVchrPaymentMethodCode())
            || StringUtils.equals(KFSConstants.PaymentSourceConstants.PAYMENT_METHOD_DRAFT,
                    dvDocument.getDisbVchrPaymentMethodCode()))
            && hasWireTransferValues(dvWireTransfer)) {
        String questionText = SpringContext.getBean(ConfigurationService.class)
                .getPropertyValueAsString(CUKFSKeyConstants.QUESTION_CLEAR_UNNEEDED_WIRE_TAB);

        boolean clearTab = super.askOrAnalyzeYesNoQuestion(
                KFSConstants.DisbursementVoucherDocumentConstants.CLEAR_WIRE_TRANSFER_TAB_QUESTION_ID,
                questionText);
        if (clearTab) {
            // NOTE: Can't replace with new instance because Foreign Draft uses same object
            clearWireTransferValues(dvWireTransfer);
        } else {
            // return to document if the user doesn't want to clear the Wire Transfer tab
            super.event.setActionForwardName(KFSConstants.MAPPING_BASIC);
            tabStatesOK = false;
        }
    }

    return tabStatesOK;
}

From source file:com.evolveum.midpoint.prism.PrismObjectValue.java

@Override
public boolean equivalent(PrismContainerValue<?> other) {
    if (!(other instanceof PrismObjectValue)) {
        return false;
    }/*from  w ww . ja  v  a2s .c om*/
    PrismObjectValue otherPov = (PrismObjectValue) other;
    return StringUtils.equals(oid, otherPov.oid) && super.equivalent(other);
}

From source file:com.nesscomputing.httpserver.jetty.ClasspathResourceHandler.java

@Override
public void handle(final String target, final Request baseRequest, final HttpServletRequest request,
        final HttpServletResponse response) throws IOException, ServletException {
    if (baseRequest.isHandled()) {
        return;/*w  w  w. ja  v  a2s.  c  om*/
    }

    String pathInfo = request.getPathInfo();

    // Only serve the content if the request matches the base path.
    if (pathInfo == null || !pathInfo.startsWith(basePath)) {
        return;
    }

    pathInfo = pathInfo.substring(basePath.length());

    if (!pathInfo.startsWith("/") && !pathInfo.isEmpty()) {
        // basepath is /foo and request went to /foobar --> pathInfo starts with bar
        // basepath is /foo and request went to /foo --> pathInfo should be /index.html
        return;
    }

    // Allow index.html as welcome file
    if ("/".equals(pathInfo) || "".equals(pathInfo)) {
        pathInfo = "/index.html";
    }

    boolean skipContent = false;

    // When a request hits this handler, it will serve something. Either data or an error.
    baseRequest.setHandled(true);

    final String method = request.getMethod();
    if (!StringUtils.equals(HttpMethods.GET, method)) {
        if (StringUtils.equals(HttpMethods.HEAD, method)) {
            skipContent = true;
        } else {
            response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
            return;
        }
    }

    // Does the request contain an IF_MODIFIED_SINCE header?
    final long ifModifiedSince = request.getDateHeader(HttpHeaders.IF_MODIFIED_SINCE);
    if (ifModifiedSince > 0 && startupTime <= ifModifiedSince / 1000 && !is304Disabled) {
        response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
        return;
    }

    InputStream resourceStream = null;

    try {
        if (pathInfo.startsWith("/")) {
            final String resourcePath = resourceLocation + pathInfo;
            resourceStream = getClass().getResourceAsStream(resourcePath);
        }

        if (resourceStream == null) {
            response.sendError(HttpServletResponse.SC_NOT_FOUND);
            return;
        }

        final Buffer mime = MIME_TYPES.getMimeByExtension(request.getPathInfo());
        if (mime != null) {
            response.setContentType(mime.toString("ISO8859-1"));
        }

        response.setDateHeader(HttpHeaders.LAST_MODIFIED, startupTime * 1000L);

        if (skipContent) {
            return;
        }

        // Send the content out. Lifted straight out of ResourceHandler.java

        OutputStream out = null;
        try {
            out = response.getOutputStream();
        } catch (IllegalStateException e) {
            out = new WriterOutputStream(response.getWriter());
        }

        if (out instanceof AbstractHttpConnection.Output) {
            ((AbstractHttpConnection.Output) out).sendContent(resourceStream);
        } else {
            ByteStreams.copy(resourceStream, out);
        }
    } finally {
        IOUtils.closeQuietly(resourceStream);
    }
}