List of usage examples for org.apache.commons.lang.builder ReflectionToStringBuilder toString
public static String toString(Object object)
Builds a toString
value using the default ToStringStyle
through reflection.
From source file:de.hybris.platform.b2b.WorkflowIntegrationTest.java
public boolean waitForProcessToEnd(final String businessProcessCode, final long maxWait) throws InterruptedException { final long start = System.currentTimeMillis(); while (true) { final B2BApprovalProcessModel bp = businessProcessService.getProcess(businessProcessCode); final String currentAction = bp.getCurrentTasks() != null && bp.getCurrentTasks().iterator().hasNext() ? bp.getCurrentTasks().iterator().next().getAction() : null;/* ww w. j a va2 s . com*/ modelService.refresh(bp); // without refresh this object is stale if (ProcessState.SUCCEEDED.getCode().equals(bp.getProcessState().getCode()) || "FINISHED".equals(bp.getProcessState().getCode())) { return true; } else if (ProcessState.ERROR.getCode().equals(bp.getProcessState().getCode())) { return false; } if (System.currentTimeMillis() - start > maxWait) { LOG.debug("BusinessPRocess: " + ReflectionToStringBuilder.toString(bp)); throw new InterruptedException(String.format("BusinessProcess %s did not end! Waited for %s", bp.getCode(), Utilities.formatTime(System.currentTimeMillis() - start))); } else { Thread.sleep(1000); final OrderModel order = bp.getOrder(); if (LOG.isInfoEnabled() && order != null) { final WorkflowModel workflow = order.getWorkflow(); if (workflow != null) { LOG.info(String.format( "Workflow %s [%s] for order %s [%s] has status %s, BisunessProcess State %s running action %s", workflow.getCode(), workflow.getDescription(), order.getCode(), order.getStatus(), workflow.getStatus(), bp.getProcessState().getCode(), currentAction)); } } LOG.debug(String.format("Waited for process end for %s current state is %s", Utilities.formatTime(System.currentTimeMillis() - start), bp.getProcessState())); } } }
From source file:cn.loveapple.client.android.database.entity.TemperatureEntity.java
/** * * {@inheritDoc} */ @Override public String toString() { return ReflectionToStringBuilder.toString(this); }
From source file:com.redhat.rhn.frontend.servlets.DumpFilter.java
private void logAttributes(HttpServletRequest req) { Enumeration items = req.getAttributeNames(); while (items.hasMoreElements()) { String name = (String) items.nextElement(); Object obj = req.getAttribute(name); if (obj != null) { log.debug("Attribute: name [" + name + "] value [" + ReflectionToStringBuilder.toString(obj) + "]"); } else {//from www. j av a 2 s. c om log.debug("Attribute: name [" + name + "] value [null]"); } } }
From source file:cc.aileron.accessor.PojoAccessorMixerImpl.java
@Override public PojoAccessor<?> mixin(final List<PojoAccessor<?>> accessors, final List<Object> parents) { final InstanceManager i = accessors.get(0).instanceManager(); final HashMap<String, PojoAccessor<?>> map = new HashMap<String, PojoAccessor<?>>(); final EnumMap<PojoAccessorMethod, List<String>> keys = new EnumMap<PojoAccessorMethod, List<String>>( PojoAccessorMethod.class); keys.put(PojoAccessorMethod.GET, new SkipList<String>()); keys.put(PojoAccessorMethod.SET, new SkipList<String>()); final HashMap<String, PojoAccessor<?>> setmap = new HashMap<String, PojoAccessor<?>>(); for (final PojoAccessor<?> accessor : accessors) { for (final PojoAccessorMethod method : PojoAccessorMethod.values()) { final List<String> methodKeys = accessor.keys(method); keys.get(method).addAll(methodKeys); }/*from w w w. j a v a 2 s .c o m*/ for (final String key : accessor.keys(PojoAccessorMethod.GET)) { map.put(key, accessor); } for (final String key : accessor.keys(PojoAccessorMethod.SET)) { setmap.put(key, accessor); } } final PojoAccessorManagerLocal manager = this.manager; return new PojoAccessor<Object>() { @Override public boolean exist(final String key) { for (final PojoAccessor<?> accessor : accessors) { if (accessor.exist(key)) { return true; } } return false; } @Override public InstanceManager instanceManager() { return i; } @Override public List<String> keys(final PojoAccessorMethod method) { return keys.get(method); } @Override public PojoAccessor<?> mixin(final Object... objects) { final SkipList<PojoAccessor<?>> list = new SkipList<PojoAccessor<?>>(); list.add(this); for (final Object object : objects) { list.add(manager.from(object, parents)); } return PojoAccessorMixerImpl.this.mixin(list, parents); } @Override public Iterable<PojoAccessorValue> set(final PojoAccessorMethod method) { final HashMap<String, PojoAccessor<?>> m = method == PojoAccessorMethod.GET ? map : setmap; return new Iterable<PojoAccessorValue>() { @Override public Iterator<PojoAccessorValue> iterator() { final Iterator<Entry<String, PojoAccessor<?>>> ite = m.entrySet().iterator(); return new Iterator<PojoAccessorValue>() { @Override public boolean hasNext() { return ite.hasNext(); } @Override public PojoAccessorValue next() { final Entry<String, PojoAccessor<?>> e = ite.next(); try { return e.getValue().to(e.getKey()); } catch (final PojoAccessorValueNotFoundException e1) { throw new Error(e1); } catch (final PojoPropertiesNotFoundException e1) { throw new Error(e1); } } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; } @Override public PojoAccessorValue to(final String key) throws PojoAccessorValueNotFoundException, PojoPropertiesNotFoundException { { final PojoAccessor<?> a = map.get(key); if (a != null) { return a.to(key); } } for (final PojoAccessor<?> a : accessors) { if (a.exist(key)) { return a.to(key); } } for (final PojoAccessor<?> a : accessors) { try { final PojoAccessorValue result = a.to(key); if (result != null) { return result; } } catch (final PojoAccessorValueNotFoundException e) { } catch (final PojoPropertiesNotFoundException e) { } } throw new PojoAccessorValueNotFoundException(accessors, key); } @Override public String toString() { return ReflectionToStringBuilder.toString(this); } @Override public Object toTarget() { throw new UnsupportedOperationException(); } }; }
From source file:com.sforce.cd.apexUnit.client.connection.ConnectionHandler.java
public static String logConnectionException(ConnectionException connEx, PartnerConnection conn, String soql) { StringBuffer returnString = new StringBuffer("Connection Exception encountered "); if (null != soql) { returnString.append("when trying to query : " + soql); }/* w w w .j a va 2 s .c o m*/ returnString.append(" The connection exception description says : " + connEx.getMessage()); returnString.append(" Object dump for the Connection object: " + ReflectionToStringBuilder.toString(conn)); return returnString.toString(); }
From source file:de.hybris.platform.integration.cis.avs.impl.DefaultCisAddressVerificationService.java
/** * This method will remove suggested address from list when it is identical with address we sent for verification but * only when it is the only address on the list *///from w w w . j a va2 s. co m protected void removeVerifiedAddressFromSuggestedAddresses(final CisAddress veryfiedAddress, final List<CisAddress> suggestedAddressesList) { if (suggestedAddressesList.size() == 1 && areAddressesEqual(veryfiedAddress, suggestedAddressesList.get(0))) { if (LOG.isInfoEnabled()) { LOG.info(String.format( "Removing suggestedAddress %s because it matches the entered address exactly %s", ReflectionToStringBuilder.toString(suggestedAddressesList.get(0)), ReflectionToStringBuilder.toString(veryfiedAddress))); } suggestedAddressesList.clear(); } }
From source file:jp.primecloud.auto.process.nifty.NiftyProcessClient.java
public RunningInstancesItemType waitInstance(String instanceId) { // ???//from ww w. j a va2 s .c o m String[] stableStatus = new String[] { "running", "stopped" }; // TODO: API??? warning ?API?????? String[] unstableStatus = new String[] { "pending", "warning" };// RunningInstancesItemType instance; while (true) { instance = describeInstance(instanceId); String status = instance.getInstanceState().getName(); if (ArrayUtils.contains(stableStatus, status)) { break; } if (!ArrayUtils.contains(unstableStatus, status)) { // ??? AutoException exception = new AutoException("EPROCESS-000604", instanceId, status); exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(instance)); throw exception; } } return instance; }
From source file:jp.primecloud.auto.process.vmware.VmwareProcessClient.java
public void cloneVM(String machineName, String templateName, String computeResourceName, String resourcePoolName, String datastoreName) { // ?????/* ww w.java 2s .c o m*/ VirtualMachine machine = vmwareClient.search(VirtualMachine.class, machineName); if (machine != null) { return; } // ?? VirtualMachine templateMachine = getVirtualMachine(templateName); // ? VirtualMachineCloneSpec cloneSpec = createCloneSpec(computeResourceName, resourcePoolName, datastoreName); // // TODO: ??? Folder vmFolder = vmwareClient.search(Folder.class, "vm"); // ? Task task; try { task = templateMachine.cloneVM_Task(vmFolder, machineName, cloneSpec); } catch (RemoteException e) { throw new AutoException("EPROCESS-000502", e, machineName); } if (log.isInfoEnabled()) { log.info(MessageUtils.getMessage("IPROCESS-100421", machineName, templateName)); } // ????? try { task.waitForTask(); } catch (RemoteException e) { throw new AutoException("EPROCESS-000502", e, machineName); } catch (InterruptedException ignore) { } // ?? TaskInfo taskInfo; try { taskInfo = task.getTaskInfo(); } catch (RemoteException e) { throw new AutoException("EPROCESS-000502", e, machineName); } if (taskInfo.getState() != TaskInfoState.success) { // ????? AutoException exception = new AutoException("EPROCESS-000502", machineName); if (taskInfo.getError() != null) { exception.addDetailInfo(ReflectionToStringBuilder.toString(taskInfo.getError().getFault())); exception.addDetailInfo(taskInfo.getError().getLocalizedMessage()); } throw exception; } if (log.isInfoEnabled()) { log.info(MessageUtils.getMessage("IPROCESS-100422", machineName, templateName)); } }
From source file:jp.primecloud.auto.nifty.process.NiftyProcessClient.java
public InstanceDto waitInstance(String instanceId) { // ???/* ww w. j a va2 s.c o m*/ String[] stableStatus = new String[] { "running", "stopped" }; // TODO: API??? warning ?API?????? String[] unstableStatus = new String[] { "pending", "warning" };// InstanceDto instance; while (true) { instance = describeInstance(instanceId); String status = instance.getState().getName(); if (ArrayUtils.contains(stableStatus, status)) { break; } if (!ArrayUtils.contains(unstableStatus, status)) { // ??? AutoException exception = new AutoException("EPROCESS-000604", instanceId, status); exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(instance)); throw exception; } } return instance; }
From source file:jp.primecloud.auto.process.nifty.NiftyProcessClient.java
public RunningInstancesItemType waitRunInstance(String instanceId) { // TODO: API??RunInstances??????????????????????? long timeout = 600 * 1000L; long startTime = System.currentTimeMillis(); while (true) { boolean exist = false; List<RunningInstancesItemType> instances = describeAllInstances(); for (RunningInstancesItemType instance : instances) { if (StringUtils.equals(instanceId, instance.getInstanceId())) { exist = true;/*from ww w.j a v a 2s.c o m*/ break; } } if (exist) { break; } if (System.currentTimeMillis() - startTime > timeout) { // ???????? throw new AutoException("EPROCESS-000605", instanceId); } } RunningInstancesItemType instance = waitInstance(instanceId); String state = instance.getInstanceState().getName(); if (!"running".equals(state)) { // AutoException exception = new AutoException("EPROCESS-000606", instanceId, state); exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(instance)); throw exception; } // if (log.isInfoEnabled()) { log.info(MessageUtils.getMessage("IPROCESS-100512", instanceId)); } return instance; }