Example usage for org.apache.commons.lang.builder ToStringStyle MULTI_LINE_STYLE

List of usage examples for org.apache.commons.lang.builder ToStringStyle MULTI_LINE_STYLE

Introduction

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

Prototype

ToStringStyle MULTI_LINE_STYLE

To view the source code for org.apache.commons.lang.builder ToStringStyle MULTI_LINE_STYLE.

Click Source Link

Document

The multi line toString style.

Usage

From source file:org.slc.sli.api.security.context.resolver.EdOrgHelper.java

/**
 * Get current education organizations for the specified staff member.
 *///from www.j  av a2s . c  o  m
private Set<String> getStaffDirectlyAssociatedEdorgs(Entity staff, boolean filterByOwnership) {
    LOG.trace(">>>EdOrgHelper.getStaffDirectlyAssociatedEdorgs()");
    LOG.trace("  staff: " + ToStringBuilder.reflectionToString(staff, ToStringStyle.MULTI_LINE_STYLE));
    LOG.trace("  filterByOwnership: " + filterByOwnership);
    Set<String> edorgs = new HashSet<String>();
    Iterable<Entity> associations = locateValidSEOAs(staff.getEntityId(), filterByOwnership);

    for (Entity association : associations) {
        LOG.trace("  association: "
                + ToStringBuilder.reflectionToString(association, ToStringStyle.MULTI_LINE_STYLE));
        edorgs.add((String) association.getBody().get(ParameterConstants.EDUCATION_ORGANIZATION_REFERENCE));
    }

    return edorgs;
}

From source file:org.slc.sli.api.service.BasicService.java

/**
 * Retrieves an entity from the data store with certain fields added/removed.
 *
 * @param neutralQuery all parameters to be included in query
 * @return the body of the entity//from  w  w w .  j  a v a  2 s. com
 */
@Override
public Iterable<String> listIds(final NeutralQuery neutralQuery) {
    LOG.debug(">>>BasicService.listIds()");
    LOG.debug("  neutralQuery: "
            + ToStringBuilder.reflectionToString(neutralQuery, ToStringStyle.MULTI_LINE_STYLE));
    checkAccess(true, false, null);
    checkFieldAccess(neutralQuery, false);

    NeutralQuery nq = neutralQuery;
    injectSecurity(nq);
    Iterable<Entity> entities = repo.findAll(collectionName, nq);

    List<String> results = new ArrayList<String>();
    for (Entity entity : entities) {
        results.add(entity.getEntityId());
    }
    return results;
}

From source file:org.slc.sli.api.service.BasicServiceTest.java

@SuppressWarnings("unchecked")
@Test/*from w  w  w  .j  a  v  a 2  s. com*/
public void testCreate()
        throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
    securityContextInjector.setEducatorContext();

    //adding this to research "Heisenbug" that may be related to timing of resource initialization, which causes nonrepeatable test failures.
    try {
        Thread.currentThread().sleep(5L); //sleep for 5 ms
    } catch (InterruptedException is) {
        //squish
    }

    RightAccessValidator mockAccessValidator = Mockito.mock(RightAccessValidator.class);
    Field rightAccessValidator = BasicService.class.getDeclaredField("rightAccessValidator");
    rightAccessValidator.setAccessible(true);
    rightAccessValidator.set(service, mockAccessValidator);

    //adding this to research "Heisenbug" that may be related to timing of resource initialization, which causes nonrepeatable test failures.
    try {
        Thread.currentThread().sleep(5L); //sleep for 5 ms
    } catch (InterruptedException is) {
        //squish
    }

    EntityBody entityBody1 = new EntityBody();
    entityBody1.put("studentUniqueStateId", "student1");
    EntityBody entityBody2 = new EntityBody();
    entityBody2.put("studentUniqueStateId", "student2");

    List<EntityBody> entityBodies = Arrays.asList(entityBody1, entityBody2);

    Entity entity1 = new MongoEntity("student", "student1", entityBody1, new HashMap<String, Object>());
    Entity entity2 = new MongoEntity("student", "student2", entityBody2, new HashMap<String, Object>());
    Mockito.when(mockRepo.create(Mockito.eq("student"), Mockito.eq(entityBody1), Mockito.any(Map.class),
            Mockito.eq("student"))).thenReturn(entity1);
    Mockito.when(mockRepo.create(Mockito.eq("student"), Mockito.eq(entityBody2), Mockito.any(Map.class),
            Mockito.eq("student"))).thenReturn(entity2);

    LOG.debug(ToStringBuilder.reflectionToString(entityBodies, ToStringStyle.MULTI_LINE_STYLE));

    //adding this to research "Heisenbug" that may be related to timing of resource initialization, which causes nonrepeatable test failures.
    try {
        Thread.currentThread().sleep(5L); //sleep for 5 ms
    } catch (InterruptedException is) {
        //squish
    }

    List<String> listResult = service.create(entityBodies);

    Assert.assertEquals("EntityBody mismatch", entity1.getEntityId(), listResult.toArray()[0]);
    Assert.assertEquals("EntityBody mismatch", entity2.getEntityId(), listResult.toArray()[1]);
}

From source file:org.slc.sli.dashboard.client.SDKAPIClient.java

@Override
public List<GenericEntity> searchStudents(String token, String query, Map<String, String> params) {
    LOG.info("searchStudents: " + query);
    LOG.info("params: " + ToStringBuilder.reflectionToString(params, ToStringStyle.MULTI_LINE_STYLE));

    //rreturn this.readEntityList(token, "search/students?q=" + query + "&" + this.buildQueryString(params));
    return this.readEntityList(token, SDKConstants.STUDENTS + "?" + SDKConstants.PARAM_LAST_NAME + "=~" + query
            + "&" + this.buildQueryString(params));
}

From source file:org.sonar.api.batch.sensor.duplication.DuplicationGroup.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("origin", originBlock)
            .append("duplicates", duplicates, true).toString();
}

From source file:org.springframework.cloud.cloudfoundry.sample.DemoApplication.java

@Bean
CommandLineRunner consume(final LoadBalancerClient loadBalancerClient,
        final CloudFoundryDiscoveryClient discoveryClient, final HiServiceClient hiServiceClient,
        final RestTemplate restTemplate) {

    return new CommandLineRunner() {
        @Override//w  ww  .j  a v  a2  s .co  m
        public void run(String... args) throws Exception {

            try {
                // this demonstrates using the CF/Ribbon-aware RestTemplate
                // interceptor
                log.info("=====================================");
                log.info("Hi: "
                        + restTemplate.getForEntity("http://hi-service/hi/{name}", String.class, "Josh"));
            } catch (Exception e) {
                log.warn("Failed to fetch hi-service", e);
            }

            // this demonstrates using the Spring Cloud Commons DiscoveryClient
            // abstraction
            log.info("=====================================");
            for (String svc : discoveryClient.getServices()) {
                log.info("service = " + svc);
                List<ServiceInstance> instances = discoveryClient.getInstances(svc);
                for (ServiceInstance si : instances) {
                    log.info("\t"
                            + ReflectionToStringBuilder.reflectionToString(si, ToStringStyle.MULTI_LINE_STYLE));
                }
            }

            log.info("=====================================");
            log.info("local: ");
            log.info("\t" + ReflectionToStringBuilder.reflectionToString(
                    discoveryClient.getLocalServiceInstance(), ToStringStyle.MULTI_LINE_STYLE));

            try {
                // this demonstrates using a CF/Ribbon-aware Feign client
                log.info("=====================================");
                log.info("Hi:" + hiServiceClient.hi("Josh"));
            } catch (Exception e) {
                log.warn("Failed to fetch hi-service", e);
            }

            // this demonstrates using the Spring Cloud Commons LoadBalancerClient
            log.info("=====================================");
            ServiceInstance choose = loadBalancerClient.choose("hi-service");
            if (choose != null) {
                log.info("chose: " + '(' + choose.getServiceId() + ") " + choose.getHost() + ':'
                        + choose.getPort());
            }
        }
    };
}

From source file:org.syncope.client.to.UserTO.java

@Override
public String toString() {
    return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) {

        @Override//from w  ww. ja v a 2  s .c  o m
        protected boolean accept(Field f) {
            return super.accept(f) && !f.getName().equals("password");
        }
    }.toString();
}

From source file:org.trend.hgraph.AbstractElement.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", id)
            .append("properties", properties).toString();
}

From source file:org.trend.hgraph.Properties.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("keyValueMap", keyValueMap)
            .append("keyValueTypeMap", keyValueTypeMap).toString();
}

From source file:org.xlcloud.service.dao.VirtualClusterDefinitionsDaoTest.java

@Test
public void getAllModels() {
    LOG.info("Get all vcDefinition models test");
    Collection<VirtualClusterDefinitionModel> allVcDefinitions = vcDefinitionsDao.findAll();
    assertEquals(4, allVcDefinitions.size());

    for (VirtualClusterDefinitionModel model : allVcDefinitions) {
        LOG.info(ToStringBuilder.reflectionToString(model, ToStringStyle.MULTI_LINE_STYLE));
    }/*from w w  w. j  ava2s . c  o  m*/
}