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, ToStringStyle style) 

Source Link

Document

Forwards to ReflectionToStringBuilder.

Usage

From source file:com.marvelution.gadgets.sonar.rest.model.I18nEntries.java

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, I18nEntries.TO_STRING_STYLE);
}

From source file:ch.systemsx.cisd.openbis.generic.server.dataaccess.db.search.HibernateSearchContext.java

@Override
public final String toString() {
    return ToStringBuilder.reflectionToString(this,
            ModifiedShortPrefixToStringStyle.MODIFIED_SHORT_PREFIX_STYLE);
}

From source file:com.gemini.domain.model.GeminiNetwork.java

public void addServer(GeminiServer s) {
    if (servers.contains(s)) {
        Logger.info("Did not add server:{} already exists in network start: {} end: {}", s, getStart(),
                getEnd());//from   www.  j  av a2s . c  o  m
    } else {
        if (!servers.add(s)) {
            Logger.error("Failed to add server: {}",
                    ToStringBuilder.reflectionToString(s, ToStringStyle.MULTI_LINE_STYLE));
        } else {
            //add a connection between this network and the server
            Logger.debug("Successfully added server: {}",
                    ToStringBuilder.reflectionToString(s, ToStringStyle.MULTI_LINE_STYLE));
            //s.setNetwork(this);
        }
    }
}

From source file:com.marvelution.jira.plugins.hudson.rest.model.Charts.java

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, Charts.TO_STRING_STYLE);
}

From source file:com.aeells.hibernate.model.AbstractPersistentObject.java

@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE);
}

From source file:com.gemini.provision.loadbalancer.openstack.LoadBalancerProviderOpenStackImpl.java

@Override
public List<GeminiLoadBalancer> listAllVIPs(GeminiTenant tenant, GeminiEnvironment env) {
    List<GeminiLoadBalancer> vips = Collections.synchronizedList(new ArrayList());

    //authenticate the session with the OpenStack installation
    OSClient os = OSFactory.builder().endpoint(env.getEndPoint())
            .credentials(env.getAdminUserName(), env.getAdminPassword()).tenantName(tenant.getName())
            .authenticate();/*w  w  w.  j  a  v a2 s.  c  o m*/
    if (os == null) {
        Logger.error("Failed to authenticate Tenant: {}",
                ToStringBuilder.reflectionToString(tenant, ToStringStyle.MULTI_LINE_STYLE));
        return null;
    }

    //try to get the list of VIP's
    List<? extends Vip> osVips;
    try {
        osVips = os.networking().loadbalancers().vip().list();
    } catch (ClientResponseException e) {
        Logger.error("Cloud failure - could not retrieve load balancer Vips. Exception: {}", e);
        return null;
    }

    //copy them to the gemini load balancer objects
    osVips.stream().filter(v -> v != null).forEach(v -> {
        GeminiLoadBalancer newLB = new GeminiLoadBalancer();

        //the simple stuff
        newLB.setCloudID(v.getId());
        newLB.setVirtualPvtIP(InetAddresses.forString(v.getAddress()));

        //Load balancer object references a subnet - this subnet must be 
        //previously created and therefore MSUT BE AVAILABLE in the environment
        //scan the environment networks and find the subnet
        GeminiSubnet subnet = env.getApplications().stream().map(GeminiApplication::getNetworks)
                .flatMap(List::stream).map(GeminiNetwork::getSubnets).flatMap(List::stream)
                .filter(s -> s.getCloudID().equals(v.getId())).findFirst().get();
        if (subnet == null) {
            Logger.info(
                    "Load Balancer cloud ID {} references a subnet not available in environment {}  Subnet ID: {}",
                    v.getId(), env.getName(), v.getSubnetId());
        } else {
            newLB.setVirtualPvtSubnet(subnet);
        }

        //now the pool
        String poolID = v.getPoolId();
        String protocol = v.getProtocol();
        vips.add(newLB);
    });
    return vips;
}

From source file:com.marvelution.jira.plugins.hudson.rest.model.Associations.java

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, Associations.TO_STRING_STYLE);
}

From source file:com.nhncorp.ips.common.bo.ProcessStatusBOImpl.java

@Transactional
@Override/*  w w w . jav a 2  s  . c  o m*/
public IpsResponse modifyProcessStatus(WorkRequest workRequest) {
    final List<ReportProduct> productList = workRequest.getProductList();
    IpsResponse response = new IpsResponse();
    logger.debug("modifyProcessStatus : {}", productList);
    if (isRelatedWithPresume(workRequest)) {
        presumeBO.modifyPresume(workRequest);
    }

    if (isRequireInvokePmon(workRequest)) {
        //  ? 
        Set<Long> idList = new HashSet<Long>();
        for (Product reportProduct : productList) {
            idList.add(reportProduct.getProductId());
        }

        response = pmonInvoker.updateStatus(idList, workRequest.getWkResult().getCode(),
                workRequest.getAdmin().getAdminId());
        logger.debug("##   pmonInvoker.updateStatus() 's response = {}",
                ToStringBuilder.reflectionToString(response, ToStringStyle.MULTI_LINE_STYLE));
        workRequest.setProductList(failIdRemover.adjust(productList, response.getFailProductIdList()));
    }

    // REPORT_PROD_MSTR?  ??? ? ?  ? ??.
    logger.debug("## workRequest.getWkResult() : {}", workRequest.getWkResult());
    if (WorkStatus.REPORT_ACCEPTED.getCode().equals(workRequest.getWkResult().getCode())
            || WorkStatus.REPORT_RE_ACCEPTED.getCode().equals(workRequest.getWkResult().getCode())) {
        final int restDateCountToLimitation = 3;
        Date currentDate = new Date();
        String currentDateWithoutHour = DateUtil.dateTOString(currentDate, "yyyy-MM-dd") + " 23:59:59";
        Date today = DateUtil.stringToDate(currentDateWithoutHour, "yyyy-MM-dd HH:mm:ss");
        Date limitDate = workingdayCalculator.calc(today, restDateCountToLimitation);
        workRequest.setLimitDate(limitDate);
    }

    if (workRequest.getProductList().size() == 0) {
        logger.debug("workRequest? productList .");
        return response;
    }

    logger.debug("workRequest = {}",
            ToStringBuilder.reflectionToString(workRequest, ToStringStyle.MULTI_LINE_STYLE));
    Integer result = processStatusDAO.updateProductProcessStatus(workRequest);
    if (result != workRequest.getProductList().size()) {
        throw new NotReportedProductException(workRequest);
    }
    processStatusDAO.insertProcessStatusHistory(workRequest);

    resultSenderBO.send(workRequest);

    return response;
}

From source file:com.marvelution.jira.plugins.hudson.rest.model.Option.java

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, Option.TO_STRING_STYLE);
}

From source file:com.gemini.provision.network.openstack.NetworkProviderOpenStackImpl.java

@Override
public List<GeminiNetwork> getExternalGateways(GeminiTenant tenant, GeminiEnvironment env) {
    //authenticate the session with the OpenStack installation
    OSClient os = OSFactory.builder().endpoint(env.getEndPoint())
            .credentials(env.getAdminUserName(), env.getAdminPassword()).tenantName(tenant.getName())
            .authenticate();/*from   ww  w  .j  av a  2  s . c o  m*/
    if (os == null) {
        Logger.error("Failed to authenticate Tenant: {}",
                ToStringBuilder.reflectionToString(tenant, ToStringStyle.MULTI_LINE_STYLE));
        return null;
    }

    List<? extends Network> networks = os.networking().network().list();
    List<GeminiNetwork> gateways = new ArrayList();

    //map the list of network gateways and their subnets to gemini equivalents
    networks.stream().filter(osn -> osn.isRouterExternal()).forEach(osn -> {
        GeminiNetwork gn = null;
        try {
            gn = env.getOrphanNetworks().stream().filter(n -> n.getCloudID().equals(osn.getId())) //filter on the OpenStack network object cloud id
                    .findFirst().get();
        } catch (NoSuchElementException ex) {
            //not an error, just log the event. the network object will be created below
            Logger.debug("Gateway {} not mapped in Gemini models, creating one...", osn.getName());
        }

        if (gn == null) {
            //the network has not created in gemini data model - create and it's subnets, etc
            GeminiNetwork newGn = new GeminiNetwork();
            newGn.setName(osn.getName());
            newGn.setCloudID(osn.getId());
            if (osn.getNetworkType() != null) {
                newGn.setNetworkType(osn.getNetworkType().name());
            }
            //add the subnets to the new network. List all subnets and filter by the parent network id
            List<? extends Subnet> osSubnets = os.networking().subnet().list();
            osSubnets.stream().filter(osSubnet -> osSubnet != null)
                    .filter(osSubnet -> osSubnet.getNetworkId().equals(osn.getId())).forEach(osSubnet -> {
                        GeminiSubnet gs = new GeminiSubnet();
                        gs.setCloudID(osSubnet.getId());
                        gs.setParent(newGn);
                        gs.setCidr(osSubnet.getCidr());
                        osSubnet.getAllocationPools().stream().forEach(ap -> {
                            GeminiSubnetAllocationPool geminiAp = new GeminiSubnetAllocationPool(
                                    InetAddresses.forString(ap.getStart()),
                                    InetAddresses.forString(ap.getEnd()));
                            geminiAp.setParent(gs);
                            gs.addAllocationPool(geminiAp);
                        });
                        gs.setParent(newGn);
                        newGn.addSubnet(gs);
                    });
            gn = newGn;
            env.addGateway(newGn);
        }
        //TODO: When gn != null, do we need to check if subnet objects are correctly captured
        //      in the Gemini data model
        gateways.add(gn);
    });
    return gateways;
}