private CustomerRecentActivityDto assembleCustomerActivityDto( CustomerActivityEntity customerActivityEntity, Locale locale) { CustomerRecentActivityDto customerRecentActivityDto = new CustomerRecentActivityDto(); String preferredDate = DateUtils.getUserLocaleDate(locale, customerActivityEntity.getCreatedDate().toString()); customerRecentActivityDto.setActivityDate(customerActivityEntity.getCreatedDate()); customerRecentActivityDto.setUserPrefferedDate(preferredDate); customerRecentActivityDto.setDescription(customerActivityEntity.getDescription()); Money amount = removeSign(customerActivityEntity.getAmount()); if (amount.isZero()) { customerRecentActivityDto.setAmount("-"); } else { customerRecentActivityDto.setAmount(amount.toString()); } if (customerActivityEntity.getPersonnel() != null) { customerRecentActivityDto.setPostedBy(customerActivityEntity.getPersonnel().getDisplayName()); } return customerRecentActivityDto; }
private Money removeSign(Money amount) { if (amount != null && amount.isLessThanZero()) { return amount.negate(); } return amount; }