Example usage for org.apache.commons.lang.builder ReflectionToStringBuilder toString

List of usage examples for org.apache.commons.lang.builder ReflectionToStringBuilder toString

Introduction

In this page you can find the example usage for org.apache.commons.lang.builder ReflectionToStringBuilder toString.

Prototype

public static String toString(Object object) 

Source Link

Document

Builds a toString value using the default ToStringStyle through reflection.

Usage

From source file:org.oscarehr.web.eform.EfmpatientformlistSendPhrAction.java

public EfmpatientformlistSendPhrAction(HttpServletRequest request) {
    localUri = getEformRequestUrl(request);

    clientId = request.getParameter("clientId");

    LoggedInInfo loggedInfo = LoggedInInfo.loggedInInfo.get();
    providerNo = loggedInfo.loggedInProvider.getProviderNo();

    logger.debug(ReflectionToStringBuilder.toString(this));
}

From source file:org.oscarehr.web.reports.ocan.beans.OcanDomainConsumerStaffBean.java

public String toString() {
    return (ReflectionToStringBuilder.toString(this));
}

From source file:org.sipfoundry.sipxconfig.common.DataCollectionUtil.java

public static String toString(Object o) {
    if (o instanceof Collection<?>) {
        StringBuilder sb = new StringBuilder();
        Iterator<?> i = ((Collection<?>) o).iterator();
        for (int ndx = 0; i.hasNext(); ndx++) {
            if (sb.length() == 0) {
                sb.append("[");
            } else {
                sb.append(",");
            }/*from   w w w .j a  va2  s.  c o  m*/
            sb.append(toString(i.next()));
            if (!i.hasNext()) {
                sb.append("]");
            }
        }
        return sb.toString();
    } else {
        return ReflectionToStringBuilder.toString(o);
    }
}

From source file:org.sonar.batch.components.PastSnapshot.java

@Override
public String toString() {
    if (StringUtils.equals(mode, CoreProperties.TIMEMACHINE_MODE_VERSION)) {
        String label = String.format("Compare to version %s", modeParameter);
        if (getTargetDate() != null) {
            label += String.format(" (%s)", DateUtils.formatDate(getTargetDate()));
        }//from ww w .j a  v  a2 s .c o  m
        return label;
    }
    if (StringUtils.equals(mode, CoreProperties.TIMEMACHINE_MODE_DAYS)) {
        String label = String.format("Compare over %s days (%s", modeParameter,
                DateUtils.formatDate(getTargetDate()));
        if (isRelatedToSnapshot()) {
            label += ", analysis of " + getDate();
        }
        label += ")";
        return label;
    }
    if (StringUtils.equals(mode, CoreProperties.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS)) {
        String label = "Compare to previous analysis";
        if (isRelatedToSnapshot()) {
            label += String.format(" (%s)", DateUtils.formatDate(getDate()));
        }
        return label;
    }
    if (StringUtils.equals(mode, CoreProperties.TIMEMACHINE_MODE_PREVIOUS_VERSION)) {
        String label = "Compare to previous version";
        if (isRelatedToSnapshot()) {
            label += String.format(" (%s)", DateUtils.formatDate(getDate()));
        }
        return label;
    }
    if (StringUtils.equals(mode, CoreProperties.TIMEMACHINE_MODE_DATE)) {
        String label = "Compare to date " + DateUtils.formatDate(getTargetDate());
        if (isRelatedToSnapshot()) {
            label += String.format(" (analysis of %s)", DateUtils.formatDate(getDate()));
        }
        return label;
    }
    return ReflectionToStringBuilder.toString(this);
}

From source file:oscar.oscarLab.ca.all.upload.handlers.OscarToOscarHl7V2.AdtA09Handler.java

private static boolean demographicMatches(Demographic appointmentDemographic, Demographic demographic) {
    // the expectation is that the demographic should have at least
    // lastname, firstname, health number, health province, (gender/birthday are not ubiquitously available)
    // there's a chance we may need to relax the birthday requirement to only need birth year/month as some or all BC cards may have no birthdays on them.
    // because of name truncation, we will match only first and last initials of the names.

    if (appointmentDemographic == null) {
        logger.debug("appointmentDemographic was null");
        return (false);
    }//w ww .  j a v a2 s . co  m

    if (logger.isDebugEnabled()) {
        logger.debug("Checking demographic : " + ReflectionToStringBuilder.toString(demographic));
        logger.debug("Against appointmentDemographic : "
                + ReflectionToStringBuilder.toString(appointmentDemographic));
    }

    if (demographic.getLastName() == null || demographic.getFirstName() == null || demographic.getHin() == null
            || demographic.getHcType() == null) {
        logger.debug("fail : demographic has null data");
        return (false);
    }

    char firstLetter = demographic.getLastName().toLowerCase().charAt(0);
    if (firstLetter != appointmentDemographic.getLastName().toLowerCase().charAt(0)) {
        logger.debug("fail : last name");
        return (false);
    }

    firstLetter = demographic.getFirstName().toLowerCase().charAt(0);
    if (firstLetter != appointmentDemographic.getFirstName().toLowerCase().charAt(0)) {
        logger.debug("fail : first name");
        return (false);
    }

    if (!demographic.getHin().equals(appointmentDemographic.getHin())) {
        logger.debug("fail : hin");
        return (false);
    }

    if (!demographic.getHcType().equalsIgnoreCase(appointmentDemographic.getHcType())) {
        logger.debug("fail : hc type");
        return (false);
    }

    // bc has no birthday
    if (demographic.getBirthDay() != null
            && !demographic.getBirthDay().equals(appointmentDemographic.getBirthDay())) {
        logger.debug("fail : birthday");
        return (false);
    }

    // BC has no gender
    if (demographic.getSex() != null
            && !demographic.getSex().equalsIgnoreCase(appointmentDemographic.getSex())) {
        logger.debug("fail : gender");
        return (false);
    }

    // for people in ontario, if there's a hc version, it needs to match too.
    if (demographic.getVer() != null
            && !demographic.getVer().equalsIgnoreCase(appointmentDemographic.getVer())) {
        logger.debug("fail : hc ver");
        return (false);
    }

    logger.debug("successful match");
    return (true);
}

From source file:oscar.oscarLab.ca.on.HRMResultsData.java

public Collection<LabResultData> populateHRMdocumentsResultsData(String providerNo, String status,
        Date newestDate, Date oldestDate) {
    if (providerNo == null || "".equals(providerNo)) {
        providerNo = "%";
    } else if (providerNo.equalsIgnoreCase("0")) {
        providerNo = "-1";
    }//from w  w w .  j  ava 2s  .co m

    Integer viewed = 1;
    Integer signedOff = 0;
    if (status == null || status.equalsIgnoreCase("N")) {
        viewed = 0;
    } else if (status != null && (status.equalsIgnoreCase("A") || status.equalsIgnoreCase("F"))) {
        signedOff = 1;
    }

    if (status != null && status.equalsIgnoreCase("")) {
        viewed = 2;
    }

    List<HRMDocumentToProvider> hrmDocResultsProvider = hrmDocumentToProviderDao
            .findByProviderNoLimit(providerNo, newestDate, oldestDate, viewed, signedOff);

    // the key = SendingFacility+':'+ReportNumber+':'+DeliverToUserID as per HRM spec can be used to signify duplicate report
    HashMap<String, LabResultData> labResults = new HashMap<String, LabResultData>();
    HashMap<String, HRMReport> labReports = new HashMap<String, HRMReport>();

    for (HRMDocumentToProvider hrmDocResult : hrmDocResultsProvider) {
        Integer id = Integer.parseInt(hrmDocResult.getHrmDocumentId());
        LabResultData lbData = new LabResultData(LabResultData.HRM);

        List<HRMDocument> hrmDocument = hrmDocumentDao.findById(id);

        lbData.dateTime = hrmDocument.get(0).getTimeReceived().toString();
        lbData.acknowledgedStatus = "U";
        lbData.reportStatus = hrmDocument.get(0).getReportStatus();
        lbData.segmentID = hrmDocument.get(0).getId().toString();
        lbData.setDateObj(hrmDocument.get(0).getReportDate());
        lbData.patientName = "Not, Assigned";

        // check if patient is matched
        List<HRMDocumentToDemographic> hrmDocResultsDemographic = hrmDocumentToDemographicDao
                .findByHrmDocumentId(hrmDocument.get(0).getId().toString());
        HRMReport hrmReport = HRMReportParser.parseReport(hrmDocument.get(0).getReportFile());
        if (hrmReport == null)
            continue;

        hrmReport.setHrmDocumentId(id);

        if (hrmDocResultsDemographic.size() > 0) {
            Demographic demographic = demographicDao
                    .getDemographic(hrmDocResultsDemographic.get(0).getDemographicNo());
            if (demographic != null) {
                lbData.patientName = demographic.getLastName() + "," + demographic.getFirstName();
                lbData.sex = demographic.getSex();
                lbData.healthNumber = demographic.getHin();
                lbData.isMatchedToPatient = true;
            }
        } else {
            lbData.sex = hrmReport.getGender();
            lbData.healthNumber = hrmReport.getHCN();
            lbData.patientName = hrmReport.getLegalName();

        }

        lbData.reportStatus = hrmReport.getResultStatus();
        lbData.priority = "----";
        lbData.requestingClient = "";
        lbData.discipline = "HRM";
        lbData.resultStatus = hrmReport.getResultStatus();

        String duplicateKey = hrmReport.getSendingFacilityId() + ':' + hrmReport.getSendingFacilityReportNo()
                + ':' + hrmReport.getDeliverToUserId();

        // if no duplicate
        if (!labResults.containsKey(duplicateKey)) {
            labResults.put(duplicateKey, lbData);
            labReports.put(duplicateKey, hrmReport);
        } else // there exists an entry like this one
        {
            HRMReport previousHrmReport = labReports.get(duplicateKey);

            logger.debug("Duplicate report found : previous=" + previousHrmReport.getHrmDocumentId()
                    + ", current=" + hrmReport.getHrmDocumentId());

            // if the current entry is newer than the previous one then replace it, other wise just keep the previous entry
            if (isNewer(hrmReport, previousHrmReport)) {
                LabResultData olderLabData = labResults.get(duplicateKey);

                lbData.getDuplicateLabIds().addAll(olderLabData.getDuplicateLabIds());
                lbData.getDuplicateLabIds().add(previousHrmReport.getHrmDocumentId());

                labResults.put(duplicateKey, lbData);
                labReports.put(duplicateKey, hrmReport);
            } else {
                LabResultData newerLabData = labResults.get(duplicateKey);
                newerLabData.getDuplicateLabIds().add(hrmReport.getHrmDocumentId());
            }
        }

    }

    if (logger.isDebugEnabled()) {
        for (LabResultData temp : labResults.values()) {
            logger.debug("------------------");
            logger.debug(ReflectionToStringBuilder.toString(temp));
        }
    }

    return labResults.values();
}

From source file:test.com.qualogy.qafe.business.integration.adapter.SomeObject.java

public String toString() {
    return ReflectionToStringBuilder.toString(this);

}

From source file:uk.co.sdev.async.http.AbstractParallel2SequentialCompletableFutureTest.java

@Test
public void shouldDivide() throws Exception {
    stubGet("/numerator", new Numerator(new BigDecimal("12.4")));
    stubGet("/denominator", new Denominator(new BigDecimal("3.2")));
    stubGet("/divide/12.4/3.2", new Quotient(new BigDecimal("3.875")));

    HandOff<Optional<Quotient>> handOff = new HandOff<>();

    sequential(parallel(getNumerator(), getDenominator()), divideFunc)
            .whenComplete((quotient, throwable) -> handOff.put(quotient));

    Optional<Quotient> quotient = handOff.get(3);
    assertThat(quotient.isPresent(), is(true));
    assertThat(quotient.get().getValue(), is(new BigDecimal("3.875")));

    List<LoggedRequest> gets = findAll(getRequestedFor(urlMatching(".*")));
    for (LoggedRequest get : gets) {
        System.out.println(ReflectionToStringBuilder.toString(get));
    }//www . j  a  v  a 2s.com
    assertThat(gets.size(), is(3));
}

From source file:uk.co.sdev.async.http.AbstractParallel2SequentialCompletableFutureTest.java

@Test
public void shouldReturnNoneIfNumeratorNotFound() throws Exception {
    stubGet("/numerator", 404);
    stubGet("/denominator", new Denominator(new BigDecimal("5.5")));

    HandOff<Optional<Quotient>> handOff = new HandOff<>();

    sequential(parallel(getNumerator(), getDenominator()), divideFunc)
            .whenComplete((quotient, throwable) -> handOff.put(quotient));

    Optional<Quotient> quotient = handOff.get(3);
    assertThat(quotient.isPresent(), is(false));

    List<LoggedRequest> gets = findAll(getRequestedFor(urlMatching(".*")));
    for (LoggedRequest get : gets) {
        System.out.println(ReflectionToStringBuilder.toString(get));
    }//w  w w  .j  a  va 2  s  .com
    assertThat(gets.size(), is(2));
}

From source file:uk.co.sdev.async.http.AbstractParallel2SequentialCompletableFutureTest.java

@Test
public void shouldReturnNoneIfGetDenominatorReturnsInternalServerError() throws Exception {
    stubGet("/numerator", new Numerator(new BigDecimal("6.2")));
    stubGet("/denominator", 500);

    HandOff<Optional<Quotient>> handOff = new HandOff<>();

    sequential(parallel(getNumerator(), getDenominator()), divideFunc)
            .whenComplete((quotient, throwable) -> handOff.put(quotient));

    Optional<Quotient> quotient = handOff.get(3);
    assertThat(quotient.isPresent(), is(false));

    List<LoggedRequest> gets = findAll(getRequestedFor(urlMatching(".*")));
    for (LoggedRequest get : gets) {
        System.out.println(ReflectionToStringBuilder.toString(get));
    }/*from   ww  w .j  a v a 2 s  .  c o  m*/
    assertThat(gets.size(), is(2));
}