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.bluexml.xforms.generator.forms.renderable.classes.RenderableAttribute.java

/**
 * Checks if is the attribute refers to an image file field.
 * //from   w w w . jav a  2 s  .  c o  m
 * @return true, if is an image file field
 */
private boolean isImageFileField() {
    return (StringUtils.equals(attribute.getName(), "content_img")
            || StringUtils.equals(attribute.getName(), "repositoryContent_img"));
}

From source file:com.openteach.diamond.repository.client.Key.java

@Override
public boolean equals(Object obj) {

    if (obj == this) {
        return true;
    }/*  w ww  .  j  ava  2 s. co m*/

    if (null == obj) {
        return false;
    }

    return StringUtils.equals(namespace, ((Key) obj).namespace) && StringUtils.equals(key, ((Key) obj).key)
            && StringUtils.equals(subKey, ((Key) obj).subKey) && sequence == ((Key) obj).sequence;
}

From source file:gemlite.core.webapp.demo.OrderController.java

@RequestMapping(value = "/customer", method = RequestMethod.POST)
@ResponseBody/*w w  w.  j  a v a 2 s . c  o  m*/
public ModelAndView post(HttpServletRequest request, ModelAndView modelAndView) {

    List<Customer> list = new ArrayList<Customer>();
    modelAndView = new ModelAndView("demo/customer");
    String c_name = StringUtils.trim((String) request.getParameter("c_name"));
    boolean c_like = StringUtils.equals((String) request.getParameter("c_like"), "on");
    String c_id = StringUtils.trim((String) request.getParameter("c_id"));
    Integer c_age_begin = StringUtils.isEmpty((String) request.getParameter("c_age_begin")) ? null
            : Integer.valueOf((String) request.getParameter("c_age_begin"));
    Integer c_age_end = StringUtils.isEmpty((String) request.getParameter("c_age_end")) ? null
            : Integer.valueOf((String) request.getParameter("c_age_end"));
    String c_tel = StringUtils.trim((String) request.getParameter("c_tel"));
    getConnection();
    if (StringUtils.isNotEmpty(c_name) && StringUtils.isNotEmpty(c_id) && !c_like) {
        CustomerDBKey key = new CustomerDBKey();
        key.setName(c_name);
        key.setId_num(c_id);
        RemoteResult rr = LogicServices.createRequestWithFilter("customer", "QueryByCustomerDBKey", key, key);
        if (rr != null) {
            Customer cust = rr.getResult(Customer.class);
            if (cust != null)
                list.add(cust);
        }
    } else if (c_like && StringUtils.isNotEmpty(c_name)) {
        RemoteResult rr = LogicServices.createHeavyRequest("QueryByCustomerNameLike", c_name);
        if (rr != null)
            list = rr.getResult(List.class);
    } else if (!c_like && StringUtils.isNotEmpty(c_name) && StringUtils.isEmpty(c_id)) {

        RemoteResult rr = LogicServices.createRequestWithFilter("customer", "QueryByCustomerName", c_name,
                c_name);
        if (rr != null)
            list = rr.getResult(List.class);
    }

    else if (StringUtils.isNotEmpty(c_id)) {
        RemoteResult rr = LogicServices.createHeavyRequest("QueryByCustomerID", c_id);
        if (rr != null)
            list = rr.getResult(List.class);
    }

    else if (StringUtils.isNotEmpty(c_tel)) {

        RemoteResult rr = LogicServices.createRequestWithFilter("CustomerIndex04", "GetNamesFromTel", c_tel,
                c_tel);
        if (rr != null)
            list = rr.getResult(List.class);
    } else if (c_age_begin != null && c_age_end != null) {
        Map map = new HashMap();
        if (c_age_begin != 0)
            map.put("min", c_age_begin);
        if (c_age_end != 0)
            map.put("max", c_age_end);

        RemoteResult rr = LogicServices.createHeavyRequest("QueryByCustomerAgeRange", map);
        if (rr != null)
            list = rr.getResult(List.class);
    }

    modelAndView.addObject("list", list);
    // set user's query terms
    modelAndView.addObject("c_name", c_name);
    modelAndView.addObject("c_id", c_id);
    modelAndView.addObject("c_age_begin", c_age_begin);
    modelAndView.addObject("c_age_end", c_age_end);
    modelAndView.addObject("c_tel", c_tel);

    return modelAndView;
}

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;
    }/*from  w  w w . j a va 2s. c o  m*/

    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:jp.co.acroquest.endosnipe.perfdoctor.rule.code.NoTimeoutDetectRule.java

/**
 * {@inheritDoc}//from w  w w .j a  v a 2 s.  co  m
 */
@SuppressWarnings("deprecation")
@Override
protected void doJudgeElement(final JavelinLogElement element) {
    // ??"Event"??????????
    String type = element.getBaseInfo().get(JavelinLogColumnNum.ID);
    boolean isEvent = MSG_EVENT.equals(type);

    if (isEvent == false) {
        return;
    }

    String eventName = element.getBaseInfo().get(JavelinLogColumnNum.EVENT_NAME);
    String eventLevel = element.getBaseInfo().get(JavelinLogColumnNum.EVENT_LEVEL);

    if (StringUtils.equals(this.level, eventLevel) == false) {
        return;
    }

    // ???"NoTimeoutDetected"????
    if (EventConstants.NAME_NOTIMEOUT_DETECTED.equals(eventName) == false) {
        return;
    }

    Map<String, String> eventInfoMap = JavelinLogUtil.parseDetailInfo(element,
            JavelinParser.TAG_TYPE_EVENTINFO);
    String identifier = eventInfoMap.get(EventConstants.NOTIMEOUT_IDENTIFIER);
    String timeoutStr = eventInfoMap.get(EventConstants.NOTIMEOUT_TIMEOUT);

    if (timeoutStr != null) {
        int timeout = 0;
        try {
            timeout = Integer.parseInt(timeoutStr);
        } catch (NumberFormatException ex) {
            LOGGER.warn(ex);
            return;
        }

        String stackTrace = eventInfoMap.get(EventConstants.NOTIMEOUT_STACKTRACE);
        addError(true, stackTrace, element, false, new Object[] { identifier, timeout });
    }
}

From source file:de.codecentric.multitool.ftp.SimpleUserManager.java

/**
 * {@inheritDoc}/*  ww  w  .  j ava  2 s.c  om*/
 */
public User authenticate(Authentication auth) throws AuthenticationFailedException {
    if (auth instanceof UsernamePasswordAuthentication) {
        UsernamePasswordAuthentication authentication = (UsernamePasswordAuthentication) auth;
        if (StringUtils.equals(authentication.getUsername(), user.getName())
                && getPasswordEncryptor().matches(authentication.getPassword(), user.getPassword())) {

            return user;
        }

    }
    throw new AuthenticationFailedException("Authentication credentials did not match");
}

From source file:hydrograph.ui.expression.editor.evaluate.EvaluateExpression.java

boolean isValidExpression() {
    try {//www .  java2 s.  c  o  m
        DiagnosticCollector<JavaFileObject> diagnosticCollector = ValidateExpressionToolButton.compileExpresion(
                expressionEditor.getText(),
                (Map<String, Class<?>>) expressionEditor.getData(ExpressionEditorDialog.FIELD_DATA_TYPE_MAP),
                String.valueOf(expressionEditor.getData(ExpressionEditorDialog.COMPONENT_NAME_KEY)));
        if (diagnosticCollector != null && !diagnosticCollector.getDiagnostics().isEmpty()) {
            for (Diagnostic<?> diagnostic : diagnosticCollector.getDiagnostics()) {
                if (StringUtils.equals(diagnostic.getKind().name(), Diagnostic.Kind.ERROR.name())) {
                    evaluateDialog.showError(diagnostic.getMessage(Locale.ENGLISH));
                    return false;
                }
            }
        }
        return true;
    } catch (JavaModelException | MalformedURLException | IllegalAccessException
            | IllegalArgumentException exception) {
        LOGGER.error("Exception occurred while compiling expression", exception);
    } catch (InvocationTargetException exception) {
        LOGGER.warn("Exception occurred while invoking compile method for compiling expression");
        evaluateDialog.showError(exception.getCause().getMessage());
    } catch (ClassNotFoundException classNotFoundException) {
        evaluateDialog.showError("Cannot find validation jar in build path");
    }
    return false;
}

From source file:com.funambol.framework.tools.beans.BeanUsingBeanTool.java

@Override
public boolean equals(Object o) {
    if (!(o instanceof BeanUsingBeanTool)) {
        return false;
    }//  ww  w  .  j  a v  a 2s .  co  m
    BeanUsingBeanTool clBean = (BeanUsingBeanTool) o;
    return (StringUtils.equals(prop1, clBean.prop1) && StringUtils.equals(prop2, clBean.prop2)
            && initialized == clBean.initialized);
}

From source file:com.gewara.web.support.OpenMemberAuthenticationProvider.java

@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
    Assert.isInstanceOf(OpenMemberAuthenticationToken.class, authentication,
            "OpenMemberAuthenticationProvider only supports OpenMemberAuthenticationToken");
    OpenMemberAuthenticationToken auth = (OpenMemberAuthenticationToken) authentication;
    Member member = daoService.getObject(Member.class, auth.getMemberid());
    if (StringUtils.equals(auth.getSource(), MemberConstant.SOURCE_DYNCODE)) {
        if (!StringUtils.equals(member.getMobile(), auth.getIdentity())
                || !ValidateUtil.isMobile(auth.getIdentity())) {
            dbLogger.warn("" + auth.getIdentity());
            throw new IllegalArgumentException("!");
        }//w  ww. jav a  2s  .c  o  m
    } else {
        MemberInfo info = daoService.getObject(MemberInfo.class, auth.getMemberid());
        String mSource = VmUtils.getJsonValueByKey(info.getOtherinfo(), "openMember");
        if (!StringUtils.contains(mSource, auth.getSource())) {
            //TODO:openMember
            //if(!StringUtils.equals(mSource, auth.getSource())){
            dbLogger.warn("" + auth.getSource() + ", memberid=" + auth.getMemberid());
            throw new IllegalArgumentException("");
        }
    }
    Assert.notNull(member, "");
    preAuthenticationChecks.check(member);
    postAuthenticationChecks.check(member);
    Assert.notNull(member, "");
    return createSuccessAuthentication(auth, member);
}

From source file:com.adobe.acs.commons.users.impl.EnsureAuthorizableManagerImpl.java

@Override
public final void ensurePrincipalName(String principalName) {
    for (final EnsureAuthorizable ensureAuthorizable : ensureAuthorizables.values()) {
        if (StringUtils.equals(principalName, ensureAuthorizable.getAuthorizable().getPrincipalName())) {
            try {
                ensureAuthorizable.ensure(ensureAuthorizable.getOperation(),
                        ensureAuthorizable.getAuthorizable());
            } catch (EnsureAuthorizableException e) {
                log.error("Error Ensuring Authorizable [ {} ]",
                        ensureAuthorizable.getAuthorizable().getPrincipalName(), e);
            }/*from   w  w w.j a  v a 2 s . c o  m*/
        }
    }
}