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:hydrograph.ui.graph.editor.JobDeleteParticipant.java

@Override
protected boolean initialize(Object element) {
    this.modifiedResource = (IFile) element;
    IProject[] iProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    for (IProject iProject : iProjects) {
        if (StringUtils.equals(iProject.getName(), modifiedResource.getFullPath().segment(0))) {
            if (StringUtils.equalsIgnoreCase(Messages.PROPERTIES_EXT, modifiedResource.getFileExtension())) {
                return deleteCorrospondingXmlAndJobFileifUserDeletePropertyFile(iProject);
            } else if (StringUtils.equalsIgnoreCase(Messages.JOB_EXT, modifiedResource.getFileExtension())) {
                return deleteCorrospondingXmlAndPropertyFileifUserDeleteJobFile(iProject);
            } else if (StringUtils.equalsIgnoreCase(Messages.XML_EXT, modifiedResource.getFileExtension())) {
                return deleteCorrospondingJobAndPropertyFileifUserDeleteXmlFile(iProject);
            }//from   www .ja v  a2 s.  com
        }
    }

    return true;
}

From source file:edu.mayo.cts2.framework.webapp.rest.util.ControllerUtils.java

/**
 * Gets the reference.//  w  w  w  . j  a va2  s.  co  m
 *
 * @param <R> the generic type
 * @param nameOrUri the name or uri
 * @param list the list
 * @return the reference
 */
public static <R extends NameAndMeaningReference> R getReference(String nameOrUri, Iterable<R> list) {

    for (R ref : list) {
        if (StringUtils.equals(ref.getContent(), nameOrUri) || StringUtils.equals(ref.getUri(), nameOrUri)) {
            return ref;
        }
    }

    throw ExceptionFactory.createUnsupportedNameOrUriException(nameOrUri, list);
}

From source file:com.sebrichard.mfgen.inspection.InspectingMetaFields.java

@NotNull
@Override//from  w  w w . j  a v  a2s. co m
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
    return new JavaElementVisitor() {

        @Override
        public void visitClass(PsiClass psiClass) {
            Set<String> acceptedMetaFieldNames = generateAcceptedMetaFieldNames(psiClass);

            Set<PsiField> metaFields = findMetaFields(psiClass);

            for (PsiField metaField : metaFields) {

                if (!metaField.hasModifierProperty(PsiModifier.FINAL)) {
                    holder.registerProblem(metaField, "Meta-field not final");
                    continue;
                }

                if (!metaField.getType().equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
                    // The field with the 'meta-field' name pattern does not have the String type!
                    holder.registerProblem(metaField, "Meta-field is not a String");
                    continue;
                }

                PsiExpression initializer = metaField.getInitializer();
                if (initializer != null) {
                    if (initializer instanceof PsiLiteral) {
                        PsiLiteral literal = (PsiLiteral) initializer;
                        if (literal.getValue() != null && literal.getValue() instanceof String) {
                            String initializationValue = (String) literal.getValue();
                            if (!StringUtils.equals(metaField.getName(),
                                    MetaFieldUtil.generateMetaFieldName(initializationValue))) {
                                holder.registerProblem(metaField, "Meta-field name does not match its value");
                                continue;
                            }
                        } else {
                            holder.registerProblem(metaField,
                                    "Meta-field initializing value is not a String value");
                            continue;
                        }
                    } else {
                        holder.registerProblem(metaField,
                                "Meta-field initializing value is not a String constant value");
                        continue;
                    }
                } else {
                    holder.registerProblem(metaField, "Uninitialized Meta-field");
                }

                if (!acceptedMetaFieldNames.contains(metaField.getName())) {
                    // We didn't find any matching field!
                    holder.registerProblem(metaField, "Did not find any matching non-static field.");
                    continue;
                }
            }
        }

    };
}

From source file:edu.csu.kfs.fp.identity.InternalSupplierRoleTypeServiceImpl.java

@Override
protected boolean performMatch(AttributeSet qualification, AttributeSet roleQualifier) {
    validateRequiredAttributesAgainstReceived(roleQualifier);
    validateRequiredAttributesAgainstReceived(qualification);

    String docNumber = "";
    String docSuppId = "";
    if (qualification != null) {
        docNumber = qualification.get(KfsKimAttributes.DOCUMENT_NUMBER);
    }//from w  w w .  j  a  v  a2 s  .co m
    docSuppId = SpringContext.getBean(InternalOrderSupplierService.class).getInternalSupplierId(docNumber);

    String roleSupplierId = roleQualifier.get(CsuKimAttributes.INTERNAL_SUPPLIER_ID);

    // Compare the Internal Order Document Supplier Id with the Role Qualifier Supplier ID
    if (StringUtils.isBlank(roleSupplierId)) {
        return false;
    }
    if (!StringUtils.equals(roleSupplierId, docSuppId)) {
        return false;
    }
    return true;
}

From source file:gov.nih.nci.cabig.caaers.domain.SiteResearchStaff.java

/**
* Find site research staff role./*from  w  ww. j  a  v  a2 s. c  o  m*/
*
* @param other the other
* @return the site research staff role
*/
public SiteResearchStaffRole findSiteResearchStaffRole(SiteResearchStaffRole other) {
    for (SiteResearchStaffRole role : siteResearchStaffRoles) {
        if (StringUtils.equals(role.getRoleCode(), other.getRoleCode()))
            return role;
    }
    return null;
}

From source file:de.iteratec.iteraplan.diffs.model.HierarchicalEntityChangeset.java

/**
 * @return if parent changed
 */
public boolean isParentChanged() {
    return !StringUtils.equals(getParentFromName(), getParentToName());
}

From source file:eu.europa.esig.dss.validation.reports.DetailedReport.java

/**
 * This method returns the result of the Basic Building Block for a token (signature, timestamp, revocation)
 * //from   w w w. ja  v a2  s.co  m
 * @param tokenId
 * @return the Indication
 */
public Indication getBasicBuildingBlocksIndication(String tokenId) {
    List<XmlBasicBuildingBlocks> basicBuildingBlocks = jaxbDetailedReport.getBasicBuildingBlocks();
    for (XmlBasicBuildingBlocks xmlBasicBuildingBlocks : basicBuildingBlocks) {
        if (StringUtils.equals(xmlBasicBuildingBlocks.getId(), tokenId)) {
            return xmlBasicBuildingBlocks.getConclusion().getIndication();
        }
    }
    return null;
}

From source file:com.iggroup.oss.restdoclet.plugin.util.ServiceUtils.java

/**
 * Searches a list of controllers for a particular Java type.
 * /*from   ww w . j  av a2s.  com*/
 * @param type the Java type of the controller to search for.
 * @param controllers the list of controllers.
 * @return the controller of the Java type searched for.
 * @throws JavadocNotFoundException if the controller of the Java type can't
 *            be found.
 */
public static Controller controller(final String type, final Collection<Controller> controllers)
        throws JavadocNotFoundException {
    for (Controller controller : controllers) {
        if (StringUtils.equals(type, controller.getType())) {
            return controller;
        }
    }
    throw new JavadocNotFoundException(type);
}

From source file:com.nhncorp.hangeul.admin.manage.bo.HangeulManageBOImpl.java

/**
 *  1, 2 /*from w  ww. j ava  2  s.  co m*/
 * @param articleParam
 * @return
 * @see com.nhncorp.hangeul.admin.work.bo.HangeulWorkManageBO#deleteArticles(com.nhncorp.hangeul.admin.work.model.ArticleParam)
 */
@Override
@Transactional
public int deleteArticles(int entySeq, String hangeulWorkType, String imgPath) throws Exception {
    int deleteCount = 0;
    boolean fileDeleteResult = false;
    String fileId = null;

    LOG.debug("********** hangeulWorkType == " + hangeulWorkType + ", imgPath == " + imgPath);
    if (StringUtils.isEmpty(hangeulWorkType) || StringUtils.isEmpty(imgPath)) {
        return deleteCount;
    }

    if (StringUtils.equals(hangeulWorkType, "IMAGE")) {
        fileId = hangeulWorkManageDAO.selectHangeulWork(entySeq, hangeulWorkType);
        LOG.debug("*** fileId == " + fileId);
    }

    // ? 
    if (StringUtils.equals(hangeulWorkType, "IMAGE")) {
        File file = ResourceUtils.getFile(imgPath + fileId);
        boolean exists = file.exists();
        LOG.debug("********** fileFullPath == " + imgPath + fileId);
        LOG.debug("********** exists == " + exists);
        if (exists == true) {
            fileDeleteResult = file.delete();
            LOG.debug("**********   , fileDeleteResult == " + fileDeleteResult);
        }
    } else {
        fileDeleteResult = true;
    }

    // DB 
    if (fileDeleteResult == true) {
        hangeulWorkManageDAO.deleteArticle(entySeq, hangeulWorkType);
        deleteCount++;
    }

    return deleteCount;
}

From source file:com.manydesigns.portofino.shiro.GAEPortofinoRealm.java

@Override
protected Collection<String> loadAuthorizationInfo(Serializable principal) {
    Set<String> authz = new HashSet<String>(super.loadAuthorizationInfo(principal));
    User user = (User) principal;/*from   w  w  w . j  a v a  2  s  .  com*/
    UserService userService = UserServiceFactory.getUserService();
    if (user != null && userService.isUserAdmin()
            && StringUtils.equals(userService.getCurrentUser().getUserId(), user.getUserId())) {
        authz.add(SecurityLogic.getAdministratorsGroup(portofinoConfiguration));
    }
    return authz;
}