Example usage for org.apache.commons.lang.builder ToStringBuilder reflectionToString

List of usage examples for org.apache.commons.lang.builder ToStringBuilder reflectionToString

Introduction

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

Prototype

public static String reflectionToString(Object object) 

Source Link

Document

Forwards to ReflectionToStringBuilder.

Usage

From source file:com.samples.platform.serviceprovider.library.internal.dao.PlatformDao.java

/**
 * @param uuid//from w  w  w .j a  v  a  2s.  c o  m
 *            the id of the book to find.
 * @return the {@link BookType}.
 */
@Transactional(value = PersistenceConfig.TRANSACTION_MANAGER_NAME, propagation = Propagation.REQUIRED)
public BookType getBookById(final String uuid) {
    BookType m = null;
    if (uuid == null) {
        this.logger.debug("getBookById: UUID is null.");
    } else {
        CriteriaBuilder cb = this.em.getCriteriaBuilder();
        CriteriaQuery<BookType> q = cb.createQuery(BookType.class);
        Root<BookType> c = q.from(BookType.class);
        q.where(cb.equal(c.<String>get(EntityType_.UUID), uuid));
        TypedQuery<BookType> typedQuery = this.em.createQuery(q);
        try {
            m = typedQuery.getSingleResult();
            this.logger.debug("getBookByISBN: " + ToStringBuilder.reflectionToString(m));
        } catch (NoResultException e) {
            this.logger.debug("getBookByISBN: non value found for id=" + uuid);
            m = null;
        }
    }
    return m;
}

From source file:fr.dudie.acrachilisync.utils.AcraToChiliprojectSyncHandlerTest.java

@Test
public void testOnNewReportAlreadyKnown() throws SynchronizationException, MalformedSpreadsheetLineException {

    final CustomElementCollection elems = new CustomElementCollection();
    for (final AcraReportHeader h : AcraReportHeader.values()) {
        elems.setValueLocal(h.tagName(), h.name());
    }//w ww  .  j av  a 2 s  .co m
    elems.setValueLocal(AcraReportHeader.REPORT_ID.tagName(), "reportID");
    elems.setValueLocal(AcraReportHeader.STACK_TRACE_MD5.tagName(), stacktraceMD5);
    elems.setValueLocal(AcraReportHeader.STACK_TRACE.tagName(), stacktrace);
    elems.setValueLocal(AcraReportHeader.USER_APP_START_DATE.tagName(), "2011-11-06T04:59:21.000+01:00");
    elems.setValueLocal(AcraReportHeader.USER_CRASH_DATE.tagName(), "2011-11-06T05:01:39.000+01:00");
    final AcraReport report = new AcraReport(elems);
    report.setStatus(SyncStatus.SUCCESS);

    final Issue issue = new Issue();
    issue.setId(111);
    issue.setDescription(issueDescription);
    issue.setCustomFields(new ArrayList<CustomField>());
    final CustomField cf = new CustomField();
    cf.setId(ConfigurationManager.getInstance().CHILIPROJECT_STACKTRACE_MD5_CF_ID);
    cf.setValue(stacktraceMD5);
    issue.getCustomFields().add(cf);

    handler.onKnownIssueNotSynchronized(report, issue);

    LOGGER.debug("New issue description:\n {}", ToStringBuilder.reflectionToString(issue));
}

From source file:ddf.catalog.federation.layered.replication.RestReplicatorPlugin.java

@Override
public DeleteResponse process(DeleteResponse input) throws PluginExecutionException {

    if (input != null && Requests.isLocal(input.getRequest()) && client != null) {

        WebClient updateClient = WebClient.fromClient(client);

        updateClient.type(MediaType.APPLICATION_JSON);

        if (input.getDeletedMetacards() == null || input.getDeletedMetacards().isEmpty()) {
            return input;
        }//from  w  w w . j a  v a  2 s .c  o m

        for (int i = 0; i < input.getDeletedMetacards().size(); i++) {

            Metacard metacard = input.getDeletedMetacards().get(i);

            if (metacard != null && metacard.getId() != null) {

                updateClient.path(metacard.getId());

                Response r = updateClient.delete();

                LOGGER.debug("RESPONSE: [{}]", ToStringBuilder.reflectionToString(r));
            }

        }
    }

    return input;
}

From source file:fr.dudie.keolis.client.JsonKeolisClientTest.java

/**
 * Test method for {@link JsonKeolisClient#getBikeStation(String)}.
 * // ww  w  . j  ava2 s  .c  om
 * @throws IOException
 *             an error occurred
 */
@Test
public void testGetBikeStation() throws IOException {

    LOGGER.info("testGetBikeStation.start");

    final BikeStation station = getKeolisClient().getBikeStation("1");

    LOGGER.debug("{}", ToStringBuilder.reflectionToString(station));

    assertNotNull("no subway station returned by the api", station);
    assertEquals("REPUBLIQUE", station.getName());
    assertEquals("PLACE DE LA RPUBLIQUE", station.getAddress());
    assertEquals(48.10999, station.getLatitude(), 0);
    assertEquals(-1.678027, station.getLongitude(), 0);
    assertNotNull(String.format("station [%s] has no avalaible slots value", station),
            station.getAvailableSlots());
    assertNotNull(String.format("station [%s] has no avalaible bikes value", station),
            station.getAvailableBikes());
    assertEquals(false, station.isPos());
    assertNotNull(String.format("station [%s] has no last update date", station), station.getLastUpdate());

    LOGGER.info("testGetBikeStation.end");
}

From source file:com.cubeia.game.server.service.wallet.LocalDummyWalletService.java

@Override
public synchronized AccountBalanceResult getBalance(long sessionId) {
    log.debug("get balance: sessionId = " + sessionId);

    AccountBalanceResult response = new AccountBalanceResult();
    if (!accountMap.containsKey(sessionId)) {
        throw new RuntimeException(
                "error getting balance, session not found: " + ToStringBuilder.reflectionToString(response));
    }/*  w  w w  . j a  va2 s.c  o  m*/
    AccountContainer account = accountMap.get(sessionId);

    response.setBalance(account.getBalance());
    return response;
}

From source file:io.fabric8.openshift.api.model.template.Template.java

@Override
public java.lang.String toString() {
    return ToStringBuilder.reflectionToString(this);
}

From source file:gov.nih.nci.cagrid.caarray.client.CaArraySvcClient.java

private static void cqlQueryTest(CaArraySvcClient client)
        throws RemoteException, QueryProcessingExceptionType, MalformedQueryExceptionType {
    StopWatch sw = new StopWatch();
    sw.start();/* w  w w.ja  va  2  s.c o m*/

    CQLQuery cqlQuery = new CQLQuery();

    Object target = new Object();
    cqlQuery.setTarget(target);

    target.setName(UserDefinedCharacteristic.class.getName());
    Attribute a = new Attribute();
    a.setName("id");
    a.setValue(CHARACTERISTIC_ID);
    a.setPredicate(Predicate.EQUAL_TO);
    target.setAttribute(a);

    CQLQueryResults results = client.query(cqlQuery);
    CQLQueryResultsIterator iter = new CQLQueryResultsIterator(results,
            CaArraySvcClient.class.getResourceAsStream("client-config.wsdd"));
    while (iter.hasNext()) {
        java.lang.Object o = iter.next();
        System.out.println("Characteristic: " + ToStringBuilder.reflectionToString(o));
    }
    sw.stop();
    System.out.println("Time for simple data service retrieval: " + sw.toString());
}

From source file:com.prowidesoftware.swift.model.UnparsedTextList.java

/**
 * convert this to string
 */
public String toString() {
    return (ToStringBuilder.reflectionToString(this));
}

From source file:io.gatling.jenkins.GatlingProjectAction.java

private void appendAssertUrl(List<String> retVal, Date time, AssertionData assertionData) {
    try {/*  w w  w .java  2  s . com*/
        String url = generateGraphiteUrl(time, assertionData);
        if (url != null) {
            retVal.add(url);
        }
    } catch (Exception ex) {
        String projectName = "Unknown";
        if (job != null)
            projectName = job.getName();
        final String assertionDataString = ToStringBuilder.reflectionToString(assertionData);
        logger.log(Level.WARNING, "Failed to generate url for assertion data\n" + "Project Name: " + projectName
                + "\n" + assertionDataString, ex);
    }
}

From source file:com.krminc.phr.domain.clinical.HealthRecordParser.java

@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this);

}