/** * build the descriptive information of the given account. The information includes account name * and project director's name if any * * @param chartOfAccountsCode the given chart of accounts code * @param accountNumber the given account number * @return the descriptive information of the given account */ public static String buildAccountInfo(Account account) { if (ObjectUtils.isNull(account)) { return KFSConstants.EMPTY_STRING; } String projectDirectorName = KFSConstants.EMPTY_STRING; try { ContractsAndGrantsModuleService contractsAndGrantsModuleService = SpringContext.getBean(ContractsAndGrantsModuleService.class); Person projectDirector = contractsAndGrantsModuleService.getProjectDirectorForAccount(account); projectDirectorName = projectDirector != null ? MessageFormat.format(" ({0})", projectDirector.getName()) : KFSConstants.EMPTY_STRING; } catch (Exception e) { LOG.error("Cannot find a project director for the account:" + account); } return MessageFormat.format("{0}{1}", account.getAccountName(), projectDirectorName); }