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

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

Introduction

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

Prototype

public static boolean containsIgnoreCase(String str, String searchStr) 

Source Link

Document

Checks if String contains a search String irrespective of case, handling null.

Usage

From source file:adalid.commons.util.FilUtils.java

public static FileFilter nameContainsFilter(final String string) {
    return new FileFilter() {

        @Override//from   ww  w.java  2s  .  c  om
        public boolean accept(File file) {
            return isVisibleFile(file) && StringUtils.containsIgnoreCase(file.getName(), string);
        }

    };
}

From source file:com.hangum.tadpole.sql.util.SQLUtil.java

/**
 * ?   Table name? ./*  w  w  w.j a  v a2  s . c  o m*/
 * 
 * @param userDB
 * @param tableName
 * @return
 */
public static String makeIdentifierName(UserDBDAO userDB, String tableName) {
    boolean isChanged = false;
    String retStr = tableName;
    TadpoleMetaData tmd = TadpoleSQLManager.getDbMetadata(userDB);

    switch (tmd.getSTORE_TYPE()) {
    //      case NONE: 
    //         retStr = tableName;
    //         break;
    case BLANK:
        if (tableName.matches(".*\\s.*")) {
            isChanged = true;
            retStr = makeFullyTableName(tableName, tmd.getIdentifierQuoteString());
        }
        break;
    case LOWCASE_BLANK:
        if (tableName.matches(".*[a-z\\s].*")) {
            isChanged = true;
            retStr = makeFullyTableName(tableName, tmd.getIdentifierQuoteString());
        }
        break;
    case UPPERCASE_BLANK:
        if (tableName.matches(".*[A-Z\\s].*")) {
            isChanged = true;
            retStr = makeFullyTableName(tableName, tmd.getIdentifierQuoteString());
        }
        break;
    }

    // Is keywords?
    // schema.tableName
    if (!isChanged) {
        String[] arryRetStr = StringUtils.split(retStr, ".");
        if (arryRetStr.length == 1) {
            if (StringUtils.containsIgnoreCase("," + tmd.getKeywords() + ",", "," + arryRetStr[0] + ",")) {
                retStr = tmd.getIdentifierQuoteString() + retStr + tmd.getIdentifierQuoteString();
            }
        } else if (arryRetStr.length > 1) {
            if (StringUtils.containsIgnoreCase("," + tmd.getKeywords() + ",", "," + arryRetStr[1] + ",")) {
                retStr = tmd.getIdentifierQuoteString() + retStr + tmd.getIdentifierQuoteString();
            }
        }
    }

    //      if(logger.isDebugEnabled()) logger.debug("[tmd.getSTORE_TYPE()]" + tmd.getSTORE_TYPE() + "[original]" + tableName + "[retStr = ]" + retStr);

    return retStr;
}

From source file:com.microsoft.alm.plugin.idea.common.ui.common.ServerContextTableModel.java

private boolean rowContains(ServerContext repositoryRow) {
    // search for the string in a case insensitive way
    // check each column for a match, if any column contains the string the result is true
    for (int c = 0; c < columns.length; c++) {
        if (StringUtils.containsIgnoreCase(getValueFor(repositoryRow, c), filter)) {
            return true;
        }/* ww  w  . j  av a  2s .  c om*/
    }

    return false;
}

From source file:com.byraphaelmedeiros.autosubdown.domain.Rule.java

public String getEpisode(String content) {
    if (isTVShow()) {
        String[] search = episode.split(",");

        if (search.length == 2) {
            String seasonSearch = search[0];
            String episodeSearch = search[1];

            int seasonStart = 0;
            int seasonEnd = 0;
            int episodeStart = 0;
            int episodeEnd = 0;

            boolean isSeasonRange = false;
            boolean isEpisodeRange = false;

            // verifica se a temporada esta em intervalo
            if (seasonSearch.contains("-")) {
                String[] seasonRange = seasonSearch.split("-");

                if (seasonRange.length == 2) {
                    seasonStart = Integer.parseInt(seasonRange[0]);
                    seasonEnd = Integer.parseInt(seasonRange[1]);

                    isSeasonRange = true;
                }/*  w  ww  .  jav a2s.  co m*/
            }

            // verifica se o episodio esta em intervalo
            if (episodeSearch.contains("-")) {
                String[] episodeRange = episodeSearch.split("-");

                if (episodeRange.length == 2) {
                    episodeStart = Integer.parseInt(episodeRange[0]);
                    episodeEnd = Integer.parseInt(episodeRange[1]);

                    isEpisodeRange = true;
                }
            }

            String rangeSearch = "";

            if (isSeasonRange && isEpisodeRange) {
                for (int s = seasonStart; s <= seasonEnd; s++) {
                    for (int e = episodeStart; e <= episodeEnd; e++) {
                        rangeSearch = "S" + String.format("%02d", s) + "E" + String.format("%02d", e);

                        if (StringUtils.containsIgnoreCase(content, rangeSearch)
                                && !isEpisodeDownloaded(rangeSearch))
                            return rangeSearch;
                    }
                }
            } else if (!isSeasonRange && isEpisodeRange) {
                for (int e = episodeStart; e <= episodeEnd; e++) {
                    rangeSearch = "S" + String.format("%02d", Integer.parseInt(seasonSearch)) + "E"
                            + String.format("%02d", e);

                    if (StringUtils.containsIgnoreCase(content, rangeSearch)
                            && !isEpisodeDownloaded(rangeSearch))
                        return rangeSearch;
                }
            } else if (isSeasonRange && !isEpisodeRange) {
                for (int s = seasonStart; s <= seasonEnd; s++) {
                    rangeSearch = "S" + String.format("%02d", s) + "E"
                            + String.format("%02d", Integer.parseInt(episodeSearch));

                    if (StringUtils.containsIgnoreCase(content, rangeSearch)
                            && !isEpisodeDownloaded(rangeSearch))
                        return rangeSearch;
                }
            }
        }
    }

    return null;
}

From source file:adalid.commons.properties.PropertiesHandler.java

private static void log(Properties properties, Level level) {
    String[] names = new String[properties.stringPropertyNames().size()];
    properties.stringPropertyNames().toArray(names);
    Arrays.sort(names);//from  w  w w. ja  va2 s . c  o m
    String value;
    for (String name : names) {
        value = properties.getProperty(name);
        logger.log(level, name + " = " + (StringUtils.containsIgnoreCase(name, "password") ? "***" : value));
    }
}

From source file:net.daboross.bukkitdev.playerdata.PlayerHandlerImpl.java

@Override
public PlayerData getPlayerDataPartial(String partialName) {
    ArgumentCheck.notNull(partialName);//from  w w w .  j a  va 2s.  com
    PlayerData[] possibleMatches = new PlayerData[2];
    synchronized (LIST_LOCK) {
        for (int i = 0; i < playerDataList.size(); i++) {
            PlayerData pd = playerDataList.get(i);
            if (pd.getUsername().equalsIgnoreCase(partialName)) {
                return pd;
            }
            if (StringUtils.containsIgnoreCase(pd.getUsername(), partialName)) {
                if (possibleMatches[0] == null) {
                    possibleMatches[0] = pd;
                }
            }
            if (StringUtils.containsIgnoreCase(ChatColor.stripColor(pd.getDisplayName()), partialName)) {
                if (possibleMatches[1] == null) {
                    possibleMatches[1] = pd;
                }
            }
        }
    }
    for (int i = 0; i < possibleMatches.length; i++) {
        if (possibleMatches[i] != null) {
            return possibleMatches[i];
        }
    }
    return null;
}

From source file:com.obomprogramador.tools.jqana.parsers.Lcom4Listener.java

private boolean checkForGetterSetter(Member m) {
    boolean isGetterSetter = false;
    for (Member n : this.membersTable) {
        if (n.type == MEMBER_TYPE.VARIABLE) {
            if (StringUtils.containsIgnoreCase(m.name, n.name)) {
                // StringUtils.strip("  abcyx", "xyz") = "  abc"
                String beginMethodName = StringUtils.stripEnd(m.name.toLowerCase(), n.name.toLowerCase());
                if (this.getterSetterPrefix.contains(beginMethodName)) {
                    isGetterSetter = true;
                    m.targetVariable = n;
                }//from   w w w.  j a  va2s.co m
                break;
            }
        }
    }
    return isGetterSetter;
}

From source file:adalid.commons.util.ObjUtils.java

public static Boolean contains(Object x, Object y) {
    if (x == null || y == null) {
        return false;
    } else if (x instanceof String) {
        return y instanceof String ? StringUtils.containsIgnoreCase(((String) x), ((String) y))
                : StringUtils.containsIgnoreCase(((String) x), toString(y));
    }//from   w w  w.  j  av  a  2s . c  o m
    return contains(toString(x), y);
}

From source file:com.sfs.whichdoctor.formatter.PersonFormatter.java

public static String getField(final PersonBean person, final String field, final String format,
        final PreferencesBean preferences) {

    String value = "";
    if (person == null || field == null) {
        return value;
    }// ww w  . j a va 2  s  . c om

    if (field.compareTo("Tags") == 0) {
        value = OutputFormatter.toTagList(person.getTags());
    }

    if (field.compareTo("GUID") == 0) {
        if (person.getGUID() > 0) {
            value = String.valueOf(person.getGUID());
        }
    }

    if (field.compareTo("PersonId") == 0) {
        if (person.getId() > 0) {
            value = String.valueOf(person.getId());
        }
    }

    if (field.compareTo("Gender") == 0) {
        value = person.getGender();
    }

    if (StringUtils.equals(field, "Title") || StringUtils.equals(field, "SALUTATION-1")) {
        value = person.getTitle();
    }
    if (field.compareTo("First Name") == 0) {
        value = person.getFirstName();
    }
    if (StringUtils.equals(field, "INVESTOR-GIVENNAME-1")) {
        value = person.getFirstName();
        if (StringUtils.isNotBlank(person.getMiddleName())) {
            value += " " + person.getMiddleName();
        }
    }
    if (StringUtils.equals(field, "Preferred Name") || StringUtils.equals(field, "INVESTOR-PREFERREDNAME-1")) {
        value = person.getPreferredName();
    }
    if (field.compareTo("Middle Name") == 0) {
        value = person.getMiddleName();
    }
    if (StringUtils.equals(field, "Last Name") || StringUtils.equals(field, "INVESTOR-SURNAME-1")) {
        value = person.getLastName();
    }
    if (field.compareTo("Maiden Name") == 0) {
        value = person.getMaidenName();
    }
    if (field.compareTo("Formatted Name") == 0) {
        value = OutputFormatter.toFormattedName(person);
    }
    if (field.compareTo("Honors") == 0) {
        value = person.getHonors();
    }
    if (field.compareTo("Age") == 0) {
        value = person.getAge();
    }
    if (StringUtils.equals(field, "MIN") || StringUtils.equals(field, "HOLDER-NUMBER")
            || StringUtils.equals(field, "ALTERNATE-ID")) {
        value = String.valueOf(person.getPersonIdentifier());
    }

    String status = "";

    if (person.getPrimaryMembership() != null) {
        MembershipBean membership = person.getPrimaryMembership();
        status = membership.getField("Status");

        if (StringUtils.equals(field, "Candidate Number")) {
            value = membership.getField("Candidate Number");
        }

        if (StringUtils.equals(field, "Status")) {
            value = status;
        }

        if (StringUtils.equals(field, "Membership Class")) {
            ObjectTypeBean object = membership.getObjectTypeField("Membership Type");
            value = object.getClassName();
        }

        if (StringUtils.equals(field, "Membership Type") || StringUtils.equals(field, "RACP-MEMBERSHIP-TYPE")) {
            ObjectTypeBean object = membership.getObjectTypeField("Membership Type");
            value = object.getName();
        }

        if (StringUtils.equals(field, "Date Registered")) {
            if (membership.getJoinedDate() != null) {
                value = Formatter.conventionalDate(membership.getJoinedDate());
            }
        }

        if (StringUtils.equals(field, "Date Retired")) {
            if (membership.getLeftDate() != null) {
                value = Formatter.conventionalDate(membership.getLeftDate());
            }
        }

        if (StringUtils.equals(field, "Financial Exemption")) {
            value = membership.getField("Financial Excemption");
        }

        if (StringUtils.equals(field, "Division")) {
            value = membership.getField("Division");
        }

        if (StringUtils.equals(field, "Supervisor Status")) {
            value = membership.getField("Supervisor Status");
        }

        if (StringUtils.equals(field, "Training Type")) {
            value = membership.getField("Training Type");
        }
    }

    if (StringUtils.equals(field, "Works Overseas")) {
        value = Formatter.convertBoolean(person.getWorksOverseas());
    }
    if (StringUtils.equals(field, "Exam Deadline")) {
        value = Formatter.conventionalDate(person.getExamDeadline());
    }
    if (StringUtils.equals(field, "Birthdate") && person.getBirthDate() != null) {
        value = Formatter.conventionalDate(person.getBirthDate());
    }

    if (StringUtils.equals(field, "DATE-OF-BIRTH") && person.getBirthDate() != null) {
        value = Formatter.numericDate(person.getBirthDate(), "yyyyMMdd");
    }

    if (StringUtils.equals(field, "Date Deceased") && person.getDeceasedDate() != null) {
        value = Formatter.conventionalDate(person.getDeceasedDate());
    }

    if (StringUtils.equals(field, "INVESTOR-DECEASED")) {
        value = "N";
        if (person.getDeceasedDate() != null) {
            value = "Y";
        }
    }

    /** Training curriculum year **/
    if (field.compareTo("Training Curriculum Year") == 0 && person.getSpecialtyList() != null) {
        value = person.getCurriculumYear();
    }

    if (field.compareTo("Training Status") == 0) {
        value = person.getTrainingStatus();
        if (StringUtils.isNotBlank(person.getTrainingStatusDetail())) {
            value += " - " + person.getTrainingStatusDetail();
        }
    }

    if (field.compareTo("CHCCH-TRAINEE") == 0) {
        value = "N";

        if (isCCHTrainee(person)) {
            value = "Y";
        }
    }

    /** Fellowship information **/

    if (person.getMembershipDetails() != null) {
        for (MembershipBean membership : person.getMembershipDetails()) {
            if (StringUtils.equals(membership.getMembershipClass(), "RACP")
                    && StringUtils.equals(membership.getMembershipType(), "Fellowship Details")) {

                if (StringUtils.equals(field, "FRACP")) {
                    if (value.length() > 0) {
                        value += " and ";
                    }
                    value += membership.getField("FRACP");
                }
                if (StringUtils.equals(field, "Admitting S.A.C.")) {
                    if (value.length() > 0) {
                        value += " and ";
                    }
                    value += membership.getField("Admitting SAC");
                }
                if (StringUtils.equals(field, "Admitting Country")
                        || StringUtils.equals(field, "RACP-ADMITTING-COUNTRY")) {
                    if (value.length() > 0) {
                        value += " and ";
                    }
                    value += membership.getField("Admitting Country");
                }
                if (StringUtils.equals(field, "Fellowship Date")
                        && membership.getDateField("Fellowship Date") != null) {
                    if (value.length() > 0) {
                        value += " and ";
                    }
                    value += Formatter.conventionalDate(membership.getDateField("Fellowship Date"));
                }

                if (StringUtils.equals(field, "DATE-FIRST-REGISTERED")
                        && membership.getDateField("Fellowship Date") != null) {
                    value = Formatter.numericDate(membership.getDateField("Fellowship Date"), "yyyyMMdd");
                }
            }

            if (StringUtils.equals(membership.getMembershipClass(), "RACP")
                    && StringUtils.equals(membership.getMembershipType(), "Affiliation")) {

                if (StringUtils.equals(field, "RACP-FACULTY")) {
                    ObjectTypeBean affiliation = membership.getObjectTypeField("Affiliation");
                    if (value.length() > 0) {
                        value += " and ";
                    }
                    value = affiliation.getAbbreviation();
                }
            }
        }
    }

    if (StringUtils.equals(field, "CLASSIFICATION-CODE")) {
        String subType = "";

        // Is a trainee
        if (person.getPrimaryMembership() != null) {
            String membershipType = person.getPrimaryMembership().getObjectTypeField("Membership Type")
                    .getName();

            if (StringUtils.containsIgnoreCase(membershipType, "Trainee")) {
                subType = "C";

                if (StringUtils.equalsIgnoreCase(person.getTrainingStatus(), "Training")
                        && StringUtils.equalsIgnoreCase(person.getTrainingStatusDetail(), "Post-FRACP")) {
                    // The person is a Post-FRACP trainee, so they qualify as a 'B'
                    subType = "B";
                }
            }

        }

        // Is a Fellow
        if (person.getMembershipDetails() != null) {
            for (MembershipBean membership : person.getMembershipDetails()) {
                if (StringUtils.equals(membership.getMembershipClass(), "RACP")
                        && StringUtils.equals(membership.getMembershipType(), "Fellowship Details")) {

                    if (StringUtils.startsWith(status, "Active")
                            || StringUtils.equalsIgnoreCase(status, "Life Fellow")
                            || StringUtils.equalsIgnoreCase(status, "Retired")
                            || StringUtils.equalsIgnoreCase(status, "Semi-retired")) {
                        subType = "B";
                    }
                }
            }
        }

        // Is a Community Child Health trainee
        if (isCCHTrainee(person)) {
            subType = "D";
        }

        // Is an Honorary Fellow
        if (person.getTags() != null) {
            for (TagBean tag : person.getTags()) {
                if (StringUtils.equalsIgnoreCase(tag.getTagName(), "Honorary Fellow")) {
                    subType = "A";
                }
            }
        }

        if (StringUtils.isNotBlank(subType)) {
            value = "RACP-" + subType;
        }
    }

    if (field.compareTo("Last Workplace") == 0 && person.getEmployers() != null) {
        String workplaceName = "";
        for (String identifier : person.getEmployers().keySet()) {
            final ItemBean workplace = person.getEmployers().get(identifier);
            if (workplace != null && StringUtils.isBlank(workplaceName)) {
                workplaceName = workplace.getName();
            }
        }
        value = workplaceName;
    }

    if (field.compareTo("Last Rotation Description") == 0 && person.getRotations() != null) {
        for (RotationBean rotation : person.getRotations()) {
            if (rotation.getDescription() != null) {
                value = rotation.getDescription();
            }
        }
    }

    if (field.compareTo("Last Rotation Date") == 0 && person.getRotations() != null) {
        for (RotationBean rotation : person.getRotations()) {
            if (rotation.getEndDate() != null) {
                value = Formatter.conventionalDate(rotation.getEndDate());
            }
        }
    }

    if (field.compareTo("Accred: Basic (wks)") == 0) {
        value = calculateTrainingSummaryTotal(person.getTrainingSummary("Basic Training"), false);
    }

    if (field.compareTo("Accred: Basic (mths)") == 0) {
        value = calculateTrainingSummaryTotal(person.getTrainingSummary("Basic Training"), true);
    }

    if (field.compareTo("Accred: Advanced (wks)") == 0) {
        value = calculateTrainingSummaryTotal(person.getTrainingSummary("Advanced Training"), false);
    }

    if (field.compareTo("Accred: Advanced (mths)") == 0) {
        value = calculateTrainingSummaryTotal(person.getTrainingSummary("Advanced Training"), true);
    }

    if (field.compareTo("Accred: Post-FRACP (wks)") == 0) {
        value = calculateTrainingSummaryTotal(person.getTrainingSummary("Post-FRACP Training"), false);
    }

    if (field.compareTo("Accred: Post-FRACP (mths)") == 0) {
        value = calculateTrainingSummaryTotal(person.getTrainingSummary("Post-FRACP Training"), true);
    }

    if (field.compareTo("Opening Balance") == 0) {
        FinancialSummaryBean openResults = person.getFinancialSummary();
        FinancialSummaryBean restrictedResults = person.getRestrictedFinancialSummary();

        double balance = 0;
        if (openResults != null) {
            balance += openResults.getOpeningBalance();
        }
        if (restrictedResults != null) {
            balance += restrictedResults.getOpeningBalance();
        }
        value = Formatter.toCurrency(balance, "$");
    }

    if (field.compareTo("Closing Balance") == 0) {
        FinancialSummaryBean openResults = person.getFinancialSummary();
        FinancialSummaryBean restrictedResults = person.getRestrictedFinancialSummary();

        double balance = 0;
        if (openResults != null) {
            balance += openResults.getClosingBalance();
        }
        if (restrictedResults != null) {
            balance += restrictedResults.getClosingBalance();
        }
        value = Formatter.toCurrency(balance, "$");
    }

    if (field.compareTo("Outstanding Summary") == 0) {
        final StringBuffer debits = new StringBuffer();
        if (person.getDebits() != null) {
            for (DebitBean debit : person.getDebits()) {
                if (debits.length() > 0) {
                    debits.append(", ");
                }
                debits.append(debit.getAbbreviation());
                debits.append(" ");
                debits.append(debit.getNumber());
            }
        }
        value = debits.toString();
    }

    if (field.compareTo("Country B.M.Q. Awarded") == 0 && person.getQualifications() != null) {
        for (QualificationBean qualification : person.getQualifications()) {
            if (StringUtils.equalsIgnoreCase(qualification.getQualificationSubType(),
                    "Basic medical qualification")) {
                // Qualification is flagged as BMQ, record value of BMQ country
                if (value.compareTo("") != 0 && value.compareTo(qualification.getCountry()) != 0) {
                    // BMQ country has already been set, add an ' and ' as a delimiter
                    value += " and ";
                }
                if (value.compareTo(qualification.getCountry()) != 0) {
                    // Only add to value if qualification country is unique
                    value += qualification.getCountry();
                }
            }
        }
    }
    if (field.compareTo("Year B.M.Q. Awarded") == 0 && person.getQualifications() != null) {
        for (QualificationBean qualification : person.getQualifications()) {
            if (StringUtils.equalsIgnoreCase(qualification.getQualificationSubType(),
                    "Basic medical qualification")) {
                // Qualification is flagged as BMQ, record value of BMQ year
                if (value.compareTo("") != 0 && value.compareTo(String.valueOf(qualification.getYear())) != 0) {
                    // BMQ year has already been set, add an ' and ' as a delimiter
                    value += " and ";
                }
                if (value.compareTo(String.valueOf(qualification.getYear())) != 0) {
                    // Only add to value if qualification year is unique
                    value += qualification.getYear();
                }
            }
        }
    }
    if (field.compareTo("ISB Targets") == 0) {
        if (person.getIsbEntities() != null) {
            for (IsbEntityBean isbEntity : person.getIsbEntities()) {
                if (value.length() > 0) {
                    value += ", ";
                }
                value += isbEntity.getTarget();
            }
        }
    }

    // Contact details
    if (person.getFirstEmailAddress() != null) {

        if (StringUtils.equals(field, "Email Address") || StringUtils.equals(field, "EMAIL-ADDR")) {
            value = person.getFirstEmailAddress().getEmail();
            if (StringUtils.equals(format, "html")) {
                value = "<a href=\"mailto:" + value + "\">" + value + "</a>";
            }
        }
    }

    if (field.compareTo("Phone Number") == 0 && person.getFirstPhoneNo() != null) {
        value = Formatter.getPhone(String.valueOf(person.getFirstPhoneNo().getCountryCode()),
                String.valueOf(person.getFirstPhoneNo().getAreaCode()), person.getFirstPhoneNo().getNumber());
    }

    if (StringUtils.equals(field, "PHONE-NO") || StringUtils.equals(field, "MOBILE-NO")
            || StringUtils.equals(field, "FAX-NO")) {

        String phoneNumber = "";
        boolean phonePreferred = false;
        String mobileNumber = "";
        boolean mobilePreferred = false;
        String faxNumber = "";
        boolean faxPreferred = false;

        if (person.getPhone() != null) {
            for (PhoneBean phone : person.getPhone()) {
                String type = phone.getContactType();
                StringBuffer number = new StringBuffer();

                if (phone.getCountryCode() > 0) {
                    number.append(phone.getCountryCode());
                    number.append(" ");
                }
                if (phone.getAreaCode() > 0) {
                    number.append(phone.getAreaCode());
                    number.append(" ");
                }
                if (StringUtils.isNotBlank(phone.getNumber())) {
                    number.append(phone.getNumber());
                }

                if (StringUtils.equalsIgnoreCase(type, "Home") || StringUtils.equalsIgnoreCase(type, "Work")) {
                    if (!phonePreferred) {
                        phoneNumber = number.toString();
                        if (phone.getPrimary()) {
                            phonePreferred = true;
                        }
                    }
                }
                if (StringUtils.equalsIgnoreCase(type, "Mobile")) {
                    if (!mobilePreferred) {
                        mobileNumber = number.toString();
                        if (phone.getPrimary()) {
                            mobilePreferred = true;
                        }
                    }
                }
                if (StringUtils.equalsIgnoreCase(type, "Home Fax")
                        || StringUtils.equalsIgnoreCase(type, "Work Fax")) {
                    if (!faxPreferred) {
                        faxNumber = number.toString();
                        if (phone.getPrimary()) {
                            faxPreferred = true;
                        }
                    }
                }
            }
        }

        if (StringUtils.equals(field, "PHONE-NO")) {
            value = phoneNumber;
        }
        if (StringUtils.equals(field, "MOBILE-NO")) {
            value = mobileNumber;
        }
        if (StringUtils.equals(field, "FAX-NO")) {
            value = faxNumber;
        }
    }

    if (StringUtils.equals(field, "Region")) {
        value = person.getRegion();
    }

    if (StringUtils.equals(field, "Resident Country") || StringUtils.equals(field, "RESIDENT-COUNTRY")) {
        value = person.getResidentCountry();
    }

    if (person.getFirstAddress() != null) {
        if (field.compareTo("Street Address") == 0) {
            AddressBean address = person.getFirstAddress();
            for (int y = 0; y < address.getAddressFieldCount(); y++) {
                if (value.compareTo("") != 0) {
                    value += ", ";
                }
                value += address.getAddressField(y);
            }
        }

        if (field.compareTo("State") == 0) {
            value = person.getFirstAddress().getState();
        }

        if (StringUtils.equals(field, "STATE-CODE")) {
            if (StringUtils.isNotBlank(person.getFirstAddress().getState())) {
                value = person.getFirstAddress().getState();
            }
            if (StringUtils.isNotBlank(person.getFirstAddress().getStateAbbreviation())) {
                value = person.getFirstAddress().getStateAbbreviation();
            }
        }

        if (field.compareTo("Country") == 0) {
            value = person.getFirstAddress().getCountry();
        }

        if (StringUtils.equals(field, "DOMICILE-CODE")) {
            value = person.getFirstAddress().getCountryAbbreviation();
        }

        if (StringUtils.equals(field, "Postcode") || StringUtils.equals(field, "POST-CODE")) {
            value = person.getFirstAddress().getPostCode();
        }

        if (field.compareTo("Formatted Address") == 0) {
            value = OutputFormatter.toAddress(person.getFirstAddress(), preferences);
        }

        if (field.compareTo("Address (mail merge)") == 0) {
            value = OutputFormatter.toAddress(person.getFirstAddress(), preferences);
        }

        if (field.compareTo("Street Address (mail merge)") == 0) {
            value = OutputFormatter.toStreetAddress(person.getFirstAddress(), preferences);
        }

        if (StringUtils.equals(field, "ADDR-LINE-1")) {
            if (displayAddressField(person.getFirstAddress(), 0)) {
                value = person.getFirstAddress().getAddressField(0);
            }
        }

        if (StringUtils.equals(field, "ADDR-LINE-2")) {
            if (displayAddressField(person.getFirstAddress(), 1)) {
                value = person.getFirstAddress().getAddressField(1);
            }
        }

        if (StringUtils.equals(field, "ADDR-LINE-3")) {
            if (displayAddressField(person.getFirstAddress(), 2)) {
                value = person.getFirstAddress().getAddressField(2);
            }
        }

        if (StringUtils.equals(field, "ADDR-LINE-4")) {
            if (displayAddressField(person.getFirstAddress(), 3)) {
                value = person.getFirstAddress().getAddressField(3);
            }
        }

        if (StringUtils.equals(field, "SUBURB")) {
            value = PersonFormatter.getCityValue(person.getFirstAddress());
        }

        if (StringUtils.equals(field, "RETURN-MAIL")) {
            value = "N";
            if (person.getFirstAddress().getReturnedMail() || person.getFirstAddress().getRequestNoMail()) {
                value = "Y";
            }
        }

        if (StringUtils.equals(field, "NO-MAIL-FLAG")) {
            value = "N";
            if (person.getFirstAddress().getRequestNoMail()) {
                value = "Y";
            }
        }
    }

    if (field.compareTo("Created By") == 0) {
        value = person.getCreatedBy();
    }

    if (field.compareTo("Date Created") == 0 && person.getCreatedDate() != null) {
        value = Formatter.conventionalDate(person.getCreatedDate());
    }

    if (field.compareTo("Modified By") == 0) {
        value = person.getModifiedBy();
    }

    if (field.compareTo("Date Modified") == 0 && person.getModifiedDate() != null) {
        value = Formatter.conventionalDate(person.getModifiedDate());
    }

    if (value == null) {
        value = "";
    }
    return value.trim();
}

From source file:de.jutzig.github.release.plugin.UploadMojo.java

/**
 * Guess if a version defined in POM should be considered as {@link #prerelease}.
 *//*from  w  w w. j  a  v a 2s  . c  o m*/
static boolean guessPreRelease(String version) {
    boolean preRelease = version.endsWith("-SNAPSHOT") || StringUtils.containsIgnoreCase(version, "-alpha")
            || StringUtils.containsIgnoreCase(version, "-beta")
            || StringUtils.containsIgnoreCase(version, "-RC") || StringUtils.containsIgnoreCase(version, ".RC")
            || StringUtils.containsIgnoreCase(version, ".M")
            || StringUtils.containsIgnoreCase(version, ".BUILD_SNAPSHOT");
    return preRelease;
}