コード例 #1
0
 public PurchasingCapitalAssetLocationBase() {
   super();
   if (GlobalVariables.getUserSession() != null
       && GlobalVariables.getUserSession().getPerson() != null) {
     Person user = GlobalVariables.getUserSession().getPerson();
     this.campusCode = user.getCampusCode();
   }
 }
コード例 #2
0
 @Override
 public boolean canEditDocumentOverview(Document document, Person user) {
   return isAuthorizedByTemplate(
       document,
       KNSConstants.KNS_NAMESPACE,
       KimConstants.PermissionTemplateNames.EDIT_DOCUMENT,
       user.getPrincipalId());
 }
コード例 #3
0
  /**
   * 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);
  }