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

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

Introduction

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

Prototype

public static boolean equals(String str1, String str2) 

Source Link

Document

Compares two Strings, returning true if they are equal.

Usage

From source file:com.tesora.dve.mysqlapi.repl.MyBinLogPosition.java

@Override
public boolean equals(Object arg0) {
    if (arg0 instanceof MyBinLogPosition) {
        MyBinLogPosition other = (MyBinLogPosition) arg0;
        boolean ret = StringUtils.equals(this.masterHost, other.masterHost)
                && StringUtils.equals(this.fileName, other.fileName) && (this.position == other.position);
        return ret;
    } else {/*  w ww .ja v a2s  .c o  m*/
        return super.equals(arg0);
    }
}

From source file:io.wcm.tooling.netbeans.sightly.completion.classLookup.ClassLookupResolver.java

/**
 * returns a list with all classes matchting the given filter
 *//*  www  . ja v a 2s.  c  o m*/
public List<CompletionItem> resolve(String filter, int startOffset, int caretOffset) {
    final Set<ElementHandle<TypeElement>> result = classpath.getClassIndex().getDeclaredTypes("",
            ClassIndex.NameKind.PREFIX, EnumSet.of(ClassIndex.SearchScope.SOURCE));
    List<CompletionItem> ret = new ArrayList<>();

    for (ElementHandle<TypeElement> te : result) {
        if (te.getKind().isClass()) {
            String binaryName = te.getBinaryName();
            if (!StringUtils.equals(binaryName, "") && StringUtils.startsWith(binaryName, filter)) {
                ret.add(new BasicCompletionItem(te.getBinaryName(), false, startOffset, caretOffset));
            }
        }
    }
    return ret;
}

From source file:com.appleframework.monitor.model.Chart.java

@Override
public boolean equals(Object o) {
    if (this == o)
        return true;
    if (!(o instanceof Chart))
        return false;
    Chart that = (Chart) o;/*from  www .jav  a  2  s. c  om*/
    return StringUtils.equals(that.getName(), this.getName());
}

From source file:com.edgenius.wiki.render.object.ObjectPosition.java

/**
 * For same kind ObjectPositon, return ture but their uuid maybe different
 *//*w w  w .jav a2s . c o  m*/
public boolean equals(Object obj) {
    if (!(obj instanceof ObjectPosition))
        return false;

    return StringUtils.equals(serverHandler, ((ObjectPosition) obj).serverHandler);
}

From source file:com.smartitengineering.event.hub.core.AbstractChannelResource.java

protected void checkAuthToken(Channel myChannel) {
    if (myChannel == null || !StringUtils.equals(getAuthToken(), myChannel.getAuthToken())) {
        throw new WebApplicationException(Response.Status.FORBIDDEN);
    }/*from   w  w w  .j a  v a2 s . c o m*/
}

From source file:com.inkubator.hrm.web.payroll.LoanUploadDetailController.java

@PostConstruct
@Override//from  w  w w  .j  a v a 2s  . c om
public void initialization() {
    try {
        super.initialization();
        String execution = FacesUtil.getRequestParameter("execution");
        String param = execution.substring(0, 1);
        if (StringUtils.equals(param, "e")) {
            /* parameter (id) ini datangnya dari loan Flow atau View */
            selectedLoan = loanService.getEntityByPkWithDetail(Long.parseLong(execution.substring(1)));
        } else {
            /* parameter (activityNumber) ini datangnya dari home approval request history View */
            selectedLoan = loanService.getEntityByApprovalActivityNumberWithDetail(execution.substring(1));
        }

        selectedApprovalActivity = approvalActivityService
                .getEntityByActivityNumberLastSequence(selectedLoan.getApprovalActivityNumber());
        loanPaymentDetails = loanPaymentDetailService.getAllDataByLoanId(selectedLoan.getId());
    } catch (Exception ex) {
        LOGGER.error("Error", ex);

    }
}

From source file:com.tikal.tallerWeb.servicio.validacion.imp.HibernateValidatorDelegate.java

@Override
public void doValidacion(Object o, DetalleValidacion detalle, ValidationContext ctx) {
    Set<ConstraintViolation<Object>> constraintViolations = validator.validate(o);
    for (ConstraintViolation<Object> x : constraintViolations) {
        if (StringUtils.equals(propertyPath, x.getPropertyPath().toString())) {
            detalle.setCalificacion(CalifacacionValidacion.INVALIDO);
            if (messageSource != null) {
                Locale locale = LocaleContextHolder.getLocale();
                String code = x.getConstraintDescriptor().getAnnotation().annotationType().getSimpleName() + "."
                        + o.getClass().getSimpleName() + "." + x.getPropertyPath().toString();
                String msg = messageSource.getMessage(code, null, x.getMessage(), locale);
                detalle.setMensaje(msg);
            } else {
                detalle.setMensaje(x.getMessage());
            }//  w w  w. j av a 2  s. c  om
            return;
        }
    }
    detalle.setCalificacion(CalifacacionValidacion.VALIDO);
}

From source file:com.inkubator.hrm.web.workingtime.PermitImplementationDetailController.java

@PostConstruct
@Override/*w w w.  ja v  a  2  s.co m*/
public void initialization() {
    try {
        super.initialization();
        //            listPermitImplDate = new ArrayList<PermitImplementationDate>();
        String execution = FacesUtil.getRequestParameter("execution");
        String param = execution.substring(0, 1);
        if (StringUtils.equals(param, "e")) {
            /* parameter (id) ini datangnya dari permit implementation View */
            selectedPermitImplementation = permitImplementationService
                    .getEntityByPkWithDetail(Long.parseLong(execution.substring(1)));
        } else {
            /* parameter (activityNumber) ini datangnya dari home approval request history View */
            selectedPermitImplementation = permitImplementationService
                    .getEntityByApprovalActivityNumberWithDetail(execution.substring(1));
            //jika null, maka ambil entity dari previous activity number-nya
            if (selectedPermitImplementation == null) {
                ApprovalActivity prev = approvalActivityService
                        .getEntityByActivityNumberLastSequence(execution.substring(1));
                selectedPermitImplementation = permitImplementationService
                        .getEntityByApprovalActivityNumberWithDetail(prev.getPreviousActivityNumber());
            }
        }

        //            //sort by actual date
        //            listPermitImplDate.addAll(selectedPermitImplementation.getPermitImplementationDates());
        //            listPermitImplDate = Lambda.sort(listPermitImplDate, Lambda.on(PermitImplementationDate.class).getActualDate());
        //            selectedApprovalActivity = approvalActivityService.getEntityByActivityNumberLastSequence(selectedPermitImplementation.getApprovalActivityNumber());
    } catch (Exception ex) {
        LOGGER.error("Error", ex);

    }
}

From source file:cn.vlabs.duckling.vwb.ui.servlet.OauthLogoutServlet.java

public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    boolean isSubLogout = StringUtils.equals(request.getParameter("sub"), "1");

    if (isSubLogout) {
        String state = request.getParameter("state");
        response.sendRedirect(state);/* www .  j  a v  a 2  s .c  om*/
    } else {
        VWBContext context = VWBContext.createContext(request, VWBCommand.LOGOUT, null);
        VWBContext adminSiteContext = getAdminLogoutContext(request);
        VWBSession vwbsession = context.getVWBSession();
        if (vwbsession.isAuthenticated()) {
            String localURL = "";
            String next = request.getParameter("next");
            if (next != null) {
                localURL = next;
            } else {
                String referer = request.getHeader("Referer");
                if (referer != null) {
                    localURL = referer;
                } else {
                    localURL = context.getFrontPage();
                }
            }

            if (!localURL.startsWith("http")) {
                String baseURL = context.getBaseURL().replaceAll(context.getBasePath(), "");
                localURL = baseURL + localURL;
            }

            localURL = adminSiteContext.getURL(VWBContext.LOGOUT, "/logout",
                    "sub=1&state=" + URLEncoder.encode(localURL, "UTF-8"), true);
            String redirectURL = makeSSOLogoutURL(adminSiteContext, localURL);
            VWBContext.getContainer().getAuthenticationService().logout(request);
            response.sendRedirect(redirectURL);
        } else {
            log.info("User's session is invalid, just redirect to home page.");
            response.sendRedirect(context.getFrontPage());
        }
    }
}

From source file:io.github.jeddict.orm.generator.service.staticmetamodel.StaticMetamodelClassDefSnippet.java

@Override
public ImportSet getImportSet() throws InvalidDataException {
    ImportSet imports = super.getImportSet();
    if (isNotBlank(getEntityPackageName()) && !StringUtils.equals(getPackageName(), getEntityPackageName())) {
        imports.add(entityClassHelper.getFQClassName());
    }//from w  w  w.  j  a v a  2  s  .c o  m
    return imports;
}