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

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

Introduction

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

Prototype

public static boolean equalsIgnoreCase(String str1, String str2) 

Source Link

Document

Compares two Strings, returning true if they are equal ignoring the case.

Usage

From source file:net.sourceforge.fenixedu.domain.cms.UnitClassTemplateController.java

/**
 * @param unit//from w w  w.  j a va  2  s  .co m
 * @param subUnitAcronym
 * @return the first subUnit of 'unit' with a 'subUnitAcronym'
 */
private Unit findSubUnitByAcronym(final Unit unit, final String subUnitAcronym) {
    return Iterables.find(unit.getSubUnits(), new Predicate<Unit>() {
        @Override
        public boolean apply(Unit subUnit) {
            return StringUtils.equalsIgnoreCase(UnitAcronym.normalize(subUnit.getAcronym()),
                    UnitAcronym.normalize(subUnitAcronym));
        }
    }, null);
}

From source file:com.thed.launcher.EggplantZBotScriptLauncher.java

@Override
public void testcaseExecutionResult() {
    String scriptPath = LauncherUtils.getFilePathFromCommand(currentTestcaseExecution.getScriptPath());
    logger.info("Script Path is " + scriptPath);
    File scriptFile = new File(scriptPath);
    String scriptName = scriptFile.getName().split("\\.")[0];
    logger.info("Script Name is " + scriptName);
    File resultsFolder = new File(
            scriptFile.getParentFile().getParentFile().getAbsolutePath() + File.separator + "Results");
    File statisticalFile = resultsFolder.listFiles(new FilenameFilter() {
        @Override/*ww  w  .j a  va  2  s  .com*/
        public boolean accept(File file, String s) {
            return StringUtils.endsWith(s, "Statistics.xml");
        }
    })[0];
    try {
        XPath xpath = XPathFactory.newInstance().newXPath();
        Document statisticalDoc = getDoc(statisticalFile);
        String result = xpath.compile("/statistics/script[@name='" + scriptName + "']/LastStatus/text()")
                .evaluate(statisticalDoc, XPathConstants.STRING).toString();
        logger.info("Result is " + result);
        String comments;
        if (StringUtils.equalsIgnoreCase(result, "Success")) {
            logger.info("Test success detected");
            status = currentTestcaseExecution.getTcId() + ": " + currentTestcaseExecution.getScriptId()
                    + " STATUS: Script Successfully Executed";
            currentTcExecutionResult = new Integer(1);
            comments = " Successfully executed on " + agent.getAgentHostAndIp();
        } else {
            logger.info("Test failure detected, getting error message");
            status = currentTestcaseExecution.getTcId() + ": " + currentTestcaseExecution.getScriptId()
                    + " STATUS: Script Successfully Executed";
            currentTcExecutionResult = new Integer(2);
            comments = " Error in test: ";
            String lastRunDateString = xpath
                    .compile("/statistics/script[@name='" + scriptName + "']/LastRun/text()")
                    .evaluate(statisticalDoc);
            //Date lastRunDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(lastRunDateString);
            File historyFile = new File(resultsFolder.getAbsolutePath() + File.separator + scriptName
                    + File.separator + "RunHistory.xml");
            Document historyDoc = getDoc(historyFile);
            //xpath = XPathFactory.newInstance().newXPath();
            String xpathExpr = "/runHistory[@script='" + scriptName + "']/run[contains(RunDate, '"
                    + StringUtils.substringBeforeLast(lastRunDateString, " ") + "')]/ErrorMessage/text()";
            logger.info("Using xPath to find errorMessage " + xpathExpr);
            comments += xpath.compile(xpathExpr).evaluate(historyDoc, XPathConstants.STRING);
            logger.info("Sending comments: " + comments);
        }
        if (currentTcExecutionResult != null) {
            ScriptUtil.updateTestcaseExecutionResult(url, currentTestcaseExecution, currentTcExecutionResult,
                    comments);
        }
    } catch (Exception e) {
        logger.log(Level.SEVERE, "Error in reading process steams \n", e);
    }
}

From source file:com.alibaba.otter.node.etl.transform.transformer.RowDataTransformer.java

public EventData transform(EventData data, OtterTransformerContext context) {
    EventData result = new EventData();
    // ?Table//from  w w w . j av a  2 s.c  o m
    DataMedia dataMedia = context.getDataMediaPair().getTarget();
    result.setPairId(context.getDataMediaPair().getId());
    result.setTableId(dataMedia.getId());
    // ??multi
    buildName(data, result, context.getDataMediaPair());
    result.setEventType(data.getEventType());
    result.setExecuteTime(data.getExecuteTime());
    result.setSyncConsistency(data.getSyncConsistency());
    result.setRemedy(data.isRemedy());
    result.setSyncMode(data.getSyncMode());
    result.setSize(data.getSize());
    result.setHint(data.getHint());
    result.setWithoutSchema(data.isWithoutSchema());
    if (data.getEventType().isDdl()) {
        // ddl???
        if (StringUtils.equalsIgnoreCase(result.getSchemaName(), data.getSchemaName())
                && StringUtils.equalsIgnoreCase(result.getTableName(), data.getTableName())) {
            // ??ddl sql????????
            result.setDdlSchemaName(data.getDdlSchemaName());
            result.setSql(data.getSql());
            return result;
        } else {
            throw new TransformException("no support ddl for [" + data.getSchemaName() + "."
                    + data.getTableName() + "] to [" + result.getSchemaName() + "." + result.getTableName()
                    + "] , sql :" + data.getSql());
        }
    }

    Multimap<String, String> translateColumnNames = HashMultimap.create();
    if (context.getDataMediaPair().getColumnPairMode().isInclude()) { // ?????exclude???
        List<ColumnPair> columnPairs = context.getDataMediaPair().getColumnPairs();
        for (ColumnPair columnPair : columnPairs) {
            translateColumnNames.put(columnPair.getSourceColumn().getName(),
                    columnPair.getTargetColumn().getName());
        }
    }
    // table meta
    DataMediaPair dataMediaPair = context.getDataMediaPair();
    boolean useTableTransform = context.getPipeline().getParameters().getUseTableTransform();
    boolean enableCompatibleMissColumn = context.getPipeline().getParameters().getEnableCompatibleMissColumn();
    TableInfoHolder tableHolder = null;
    if (useTableTransform || enableCompatibleMissColumn) {// ????table
                                                          // meta??????
                                                          // ??
        DbDialect dbDialect = dbDialectFactory.getDbDialect(dataMediaPair.getPipelineId(),
                (DbMediaSource) dataMedia.getSource());

        Table table = dbDialect.findTable(result.getSchemaName(), result.getTableName());
        tableHolder = new TableInfoHolder(table, useTableTransform, enableCompatibleMissColumn);
    }

    // ?column
    List<EventColumn> otherColumns = translateColumns(result, data.getColumns(), context.getDataMediaPair(),
            translateColumnNames, tableHolder);
    translatePkColumn(result, data.getKeys(), data.getOldKeys(), otherColumns, context.getDataMediaPair(),
            translateColumnNames, tableHolder);

    result.setColumns(otherColumns);
    return result;
}

From source file:com.sammyun.service.impl.MemberServiceImpl.java

/**
 * E-mail?/*from  ww  w  .  j  a  v a  2s . c om*/
 * 
 * @param previousEmail ?E-mail(?)
 * @param currentEmail ?E-mail(?)
 * @return E-mail?
 */
@Transactional(readOnly = true)
public boolean emailUnique(String previousEmail, String currentEmail) {
    if (StringUtils.equalsIgnoreCase(previousEmail, currentEmail)) {
        return true;
    } else {
        if (memberDao.emailExists(currentEmail)) {
            return true;
        } else {
            return false;
        }
    }
}

From source file:eu.annocultor.analyzers.SolrPropertyHitsAnalyzer.java

static boolean hasWord(SolrDocument document, String fieldNamePrefix, String textToFind) {

    String[] wordsToFind = textToFind.toString().split("[\\W]+");
    Set<String> docToLog = new HashSet<String>();
    Set<String> queryToLog = new HashSet<String>();
    for (String keyword : wordsToFind) {
        if (isLongEnoughToCount(keyword)) {
            queryToLog.add(keyword);//  ww  w  . j a va2s. co m
            for (String fieldName : document.getFieldNames()) {
                if (fieldName.startsWith(fieldNamePrefix)) {
                    for (Object fieldValue : document.getFieldValues(fieldName)) {
                        if (fieldValue != null) {
                            for (String word : split(fieldValue)) {
                                docToLog.add(word);
                                if (StringUtils.equalsIgnoreCase(word, keyword)) {
                                    System.out.println(
                                            fieldNamePrefix + "-T: Q: " + StringUtils.join(queryToLog, ",")
                                                    + "; doc: " + StringUtils.join(docToLog, ","));
                                    return true;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    System.out.println(fieldNamePrefix + "-F: Q: " + StringUtils.join(queryToLog, ",") + "; doc: "
            + StringUtils.join(docToLog, ","));
    return false;
}

From source file:info.magnolia.cms.core.version.ContentVersion.java

/**
 * Set frozen node of this version as working node
 * @throws RepositoryException//from   w ww.j  ava 2  s  . co m
 */
private void init() throws RepositoryException {
    this.setNode(this.state.getNode(ItemType.JCR_FROZENNODE));
    try {
        if (!StringUtils.equalsIgnoreCase(this.state.getName(), VersionManager.ROOT_VERSION)) {
            this.rule = VersionManager.getInstance().getUsedFilter(this);
        }
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
    if (this.rule == null) {
        log.info("failed to get filter used for creating this version, use open filter");
        this.rule = new Rule();
    }
}

From source file:hydrograph.ui.engine.ui.util.ImportedSchemaPropagation.java

/**
 * Initiates schema propagation after importing target XML.
 * /*from   w w  w  .j a  va  2s.co m*/
 * @param container
 * @return
 */
public void initiateSchemaPropagationAfterImport(Container container, boolean isUpdateExtrenalSchema) {
    for (Component component : container.getUIComponentList()) {
        Map<String, ComponentsOutputSchema> schemaMap = (Map<String, ComponentsOutputSchema>) component
                .getProperties().get(Constants.SCHEMA_TO_PROPAGATE);
        if (schemaMap != null && !StringUtils.equalsIgnoreCase(component.getCategory(), Constants.TRANSFORM))
            SchemaPropagation.INSTANCE.continuousSchemaPropagation(component, schemaMap,
                    isUpdateExtrenalSchema);
    }

    schemaPropagationForTransformCategory(container);
    removeTempraryProperties(container);
    addPropogatedSchemaToEachComponent(container);
    addOldSchemaMapPropertyToEachComponent(container);
    validateAllComponents(container);
}

From source file:info.magnolia.rendering.template.configured.ConfiguredInheritance.java

@Override
public Boolean isInheritsComponents() {
    return isEnabled() != null && isEnabled()
            && (StringUtils.equalsIgnoreCase(StringUtils.trim(components), COMPONENTS_ALL)
                    || StringUtils.equalsIgnoreCase(StringUtils.trim(components), COMPONENTS_FILTERED));
}

From source file:eu.arthepsy.sonar.plugins.scapegoat.rule.ScapegoatRulesDefinition.java

private void processRule(NewRepository repository, SMInputCursor ruleC) throws XMLStreamException {
    String key = null, name = null, description = null;
    String severity = Severity.defaultSeverity();
    String status = null;/*w ww .  ja v a  2  s  .  co m*/

    SMInputCursor cursor = ruleC.childElementCursor();
    while (cursor.getNext() != null) {
        String nodeName = cursor.getLocalName();
        if (StringUtils.equalsIgnoreCase("key", nodeName)) {
            key = XmlUtils.getNodeText(cursor);
        } else if (StringUtils.equalsIgnoreCase("name", nodeName)) {
            name = XmlUtils.getNodeText(cursor);
        } else if (StringUtils.equalsIgnoreCase("description", nodeName)) {
            description = XmlUtils.getNodeText(cursor);
        } else if (StringUtils.equalsIgnoreCase("severity", nodeName)) {
            severity = XmlUtils.getNodeText(cursor);
        } else if (StringUtils.equalsIgnoreCase("status", nodeName)) {
            status = XmlUtils.getNodeText(cursor);
        }
    }
    RulesDefinition.NewRule rule = repository.createRule(key).setInternalKey(key).setName(name)
            .setMarkdownDescription(description).setSeverity(severity).setTemplate(false);
    if (status != null) {
        rule.setStatus(RuleStatus.valueOf(status));
    }
}

From source file:gov.nih.nci.cabig.caaers.service.migrator.adverseevent.SAEAdverseEventReportingPeriodConverter.java

/**
 * Will convert to domain object from AdverseEventInputMessage
 * @param aeiMsg/*from   www  .j av a2 s  . c  o m*/
 * @return
 */
public AdverseEventReportingPeriod convert(SaveAndEvaluateAEsInputMessage aeiMsg,
        Map<AdverseEvent, AdverseEventResult> mapAE2DTO) {
    Criteria criteria = aeiMsg.getCriteria();
    AdverseEventReportingPeriod rp = new AdverseEventReportingPeriod();
    Study study = new LocalStudy();
    StudySite studySite = new StudySite();
    study.addStudySite(studySite);

    Participant participant = new Participant();
    StudyParticipantAssignment assignment = new StudyParticipantAssignment();
    assignment.setReportingPeriods(new ArrayList<AdverseEventReportingPeriod>());
    participant.addAssignment(assignment);
    rp.setAssignment(assignment);
    assignment.getReportingPeriods().add(rp);
    assignment.setStudySite(studySite);

    //set SSI
    assignment.setStudySubjectIdentifier(criteria.getStudySubjectIdentifier());

    //set Study Protocol Identifier
    Identifier studyIdentifier = new OrganizationAssignedIdentifier();
    studyIdentifier.setType(OrganizationAssignedIdentifier.SPONSOR_IDENTIFIER_TYPE);
    studyIdentifier.setValue(criteria.getStudyIdentifier());
    study.addIdentifier(studyIdentifier);

    //set the course details
    CourseType course = criteria.getCourse();
    if (course.getCycleNumber() != null)
        rp.setCycleNumber(course.getCycleNumber().intValue());
    if (course.getExternalId() != null)
        rp.setExternalId(course.getExternalId());
    if (course.getTreatmentType() != null) {
        rp.setEpoch(new Epoch());
        rp.getEpoch().setName(course.getTreatmentType());
    }
    String desc = course.getOtherTreatmentAssignmentDescription();
    if (course.getTreatmentAssignmentCode() != null) {
        String code = course.getTreatmentAssignmentCode();

        //other TAC ?
        if (StringUtils.equalsIgnoreCase("other", code)) {
            if (StringUtils.isNotEmpty(desc) && !StringUtils.equalsIgnoreCase("n/a", desc)) {
                rp.setTreatmentAssignmentDescription(desc);
            }
        } else {
            TreatmentAssignment ta = new TreatmentAssignment();
            ta.setCode(code);
            ta.setStudy(study);
            rp.setTreatmentAssignment(ta);
        }
    } else {
        rp.setTreatmentAssignmentDescription(desc);
    }

    if (course.getStartDateOfFirstCourse() != null) {
        rp.getAssignment()
                .setStartDateOfFirstCourse(course.getStartDateOfFirstCourse().toGregorianCalendar().getTime());
    }

    if (course.getStartDateOfThisCourse() != null) {
        rp.setStartDate(course.getStartDateOfThisCourse().toGregorianCalendar().getTime());
    }

    if (course.getEndDateOfThisCourse() != null) {
        rp.setEndDate(course.getEndDateOfThisCourse().toGregorianCalendar().getTime());
    }

    if (aeiMsg.getAdverseEvents() != null && aeiMsg.getAdverseEvents().getAdverseEvent() != null) {
        for (AdverseEventType aeType : aeiMsg.getAdverseEvents().getAdverseEvent()) {
            AdverseEvent ae = aeConverter.convert(aeType);

            // Create a Map to convert given ae to result object.
            AdverseEventResult result = new AdverseEventResult();
            result.setAdverseEvent(aeType);
            result.setRequiresReporting(false);
            mapAE2DTO.put(ae, result);

            rp.addAdverseEvent(ae);
        }
    }

    return rp;
}