@Test
  public void testGroupKeyCodeSetExtraction() {
    PayTypeBo pstnRptGrpBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "1"));
    Set<String> extractedGroupKeyCodeWithIdSet = pstnRptGrpBo.getGroupKeyCodeSet();
    Assert.assertEquals(extractedGroupKeyCodeWithIdSet.size(), 2);
    Assert.assertTrue(extractedGroupKeyCodeWithIdSet.contains("ISU-IA"));
    Assert.assertTrue(extractedGroupKeyCodeWithIdSet.contains("UGA-GA"));

    pstnRptGrpBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "5"));
    extractedGroupKeyCodeWithIdSet = pstnRptGrpBo.getGroupKeyCodeSet();
    Assert.assertEquals(2, extractedGroupKeyCodeWithIdSet.size());
    Assert.assertTrue(extractedGroupKeyCodeWithIdSet.contains("IU-IN"));
    Assert.assertTrue(extractedGroupKeyCodeWithIdSet.contains("UGA-GA"));

    pstnRptGrpBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "2"));
    extractedGroupKeyCodeWithIdSet = pstnRptGrpBo.getGroupKeyCodeSet();
    Assert.assertTrue(
        (extractedGroupKeyCodeWithIdSet == null) || extractedGroupKeyCodeWithIdSet.isEmpty());
    pstnRptGrpBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "4"));
    extractedGroupKeyCodeWithIdSet = pstnRptGrpBo.getGroupKeyCodeSet();
    Assert.assertTrue(
        (extractedGroupKeyCodeWithIdSet == null) || extractedGroupKeyCodeWithIdSet.isEmpty());
  }
  @Test
  public void testKeyCodeSetOwnerAssignment() {
    PayTypeBo pstnRptGrpBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "1"));
    for (PayTypeKeyBo keyBo : pstnRptGrpBo.getEffectiveKeySet()) {
      Assert.assertEquals(keyBo.getOwnerId(), "1");
    }

    pstnRptGrpBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "5"));
    for (PayTypeKeyBo keyBo : pstnRptGrpBo.getEffectiveKeySet()) {
      Assert.assertEquals(keyBo.getOwnerId(), "5");
    }
  }
  /**
   * @see
   *     org.kuali.kfs.module.ar.document.service.AccountsReceivableTaxService#getPostalCodeForTaxation(org.kuali.kfs.module.ar.document.CustomerInvoiceDocument)
   */
  @Override
  public String getPostalCodeForTaxation(CustomerInvoiceDocument document) {

    String postalCode = null;
    String customerNumber = document.getAccountsReceivableDocumentHeader().getCustomerNumber();
    Integer shipToAddressIdentifier = document.getCustomerShipToAddressIdentifier();

    // if customer number or ship to address id isn't provided, go to org options
    if (ObjectUtils.isNotNull(shipToAddressIdentifier) && StringUtils.isNotEmpty(customerNumber)) {

      CustomerAddressService customerAddressService =
          SpringContext.getBean(CustomerAddressService.class);
      CustomerAddress customerShipToAddress =
          customerAddressService.getByPrimaryKey(customerNumber, shipToAddressIdentifier);
      if (ObjectUtils.isNotNull(customerShipToAddress)) {
        postalCode = customerShipToAddress.getCustomerZipCode();
      }
    } else {
      Map<String, String> criteria = new HashMap<String, String>();
      criteria.put("chartOfAccountsCode", document.getBillByChartOfAccountCode());
      criteria.put("organizationCode", document.getBilledByOrganizationCode());
      OrganizationOptions organizationOptions =
          (OrganizationOptions)
              businessObjectService.findByPrimaryKey(OrganizationOptions.class, criteria);

      if (ObjectUtils.isNotNull(organizationOptions)) {
        postalCode = organizationOptions.getOrganizationPostalZipCode();
      }
    }
    return postalCode;
  }
  /**
   * @see
   *     org.kuali.kfs.module.ar.document.service.CustomerInvoiceDocumentService#getOriginalTotalAmountForCustomerInvoiceDocument(org.kuali.kfs.module.ar.document.CustomerInvoiceDocument)
   */
  @Override
  public KualiDecimal getOriginalTotalAmountForCustomerInvoiceDocument(
      CustomerInvoiceDocument customerInvoiceDocument) {
    LOG.info(
        "\n\n\n\t\t invoice: "
            + customerInvoiceDocument.getDocumentNumber()
            + "\n\t\t 111111111 HEADER TOTAL AMOUNT (should be null): "
            + customerInvoiceDocument
                .getFinancialSystemDocumentHeader()
                .getFinancialDocumentTotalAmount()
            + "\n\n");
    customerInvoiceDocument.getDocumentNumber();
    HashMap criteria = new HashMap();
    criteria.put(
        KFSPropertyConstants.DOCUMENT_NUMBER,
        customerInvoiceDocument.getDocumentHeader().getDocumentTemplateNumber());
    FinancialSystemDocumentHeader financialSystemDocumentHeader =
        businessObjectService.findByPrimaryKey(FinancialSystemDocumentHeader.class, criteria);
    KualiDecimal originalTotalAmount = KualiDecimal.ZERO;
    originalTotalAmount = financialSystemDocumentHeader.getFinancialDocumentTotalAmount();

    LOG.info(
        "\n\n\n\t\t invoice: "
            + customerInvoiceDocument.getDocumentNumber()
            + "\n\t\t 333333333333 HEADER TOTAL AMOUNT (should be set now): "
            + customerInvoiceDocument
                .getFinancialSystemDocumentHeader()
                .getFinancialDocumentTotalAmount()
            + "\n\n");
    return originalTotalAmount;
  }
  /**
   * This method looks up the default table
   *
   * @param String unitNumber
   * @return AccountAutoCreateDefaults
   */
  protected AccountAutoCreateDefaults getAccountDefaults(String unitNumber) {

    AccountAutoCreateDefaults defaults = null;

    if (unitNumber == null || unitNumber.isEmpty()) {
      return null;
    }

    Map<String, String> criteria = new HashMap<String, String>();
    criteria.put("kcUnit", unitNumber);
    defaults = businessObjectService.findByPrimaryKey(AccountAutoCreateDefaults.class, criteria);

    // if the matching defaults is null, try the parents in the hierarchy
    if (defaults == null) {

      List<String> parentUnits = null;
      try {
        parentUnits =
            SpringContext.getBean(ContractsAndGrantsModuleService.class).getParentUnits(unitNumber);
      } catch (Exception ex) {
        LOG.error(
            KcUtils.getErrorMessage(
                    KcConstants.AccountCreationService.ERROR_KC_ACCOUNT_PARAMS_UNIT_NOTFOUND, null)
                + ": "
                + ex.getMessage());

        GlobalVariables.getMessageMap()
            .putError(
                KcConstants.AccountCreationService.ERROR_KC_ACCOUNT_PARAMS_UNIT_NOTFOUND,
                "kcUnit",
                ex.getMessage());
      }

      if (parentUnits != null) {
        for (String unit : parentUnits) {
          criteria.put("kcUnit", unit);
          defaults =
              businessObjectService.findByPrimaryKey(AccountAutoCreateDefaults.class, criteria);
          if (defaults != null) {
            break;
          }
        }
      }
    }

    return defaults;
  }
예제 #6
0
 @Override
 public Question getQuestionByRefId(String questionRefId) {
   Question question = null;
   if (!StringUtils.isBlank(questionRefId)) {
     Map<String, Object> fieldValues = new HashMap<String, Object>();
     fieldValues.put(QUESTION_REF_ID, questionRefId);
     question = (Question) businessObjectService.findByPrimaryKey(Question.class, fieldValues);
   }
   return question;
 }
 /**
  * @see
  *     org.kuali.kfs.module.endow.document.service.PurposeCodeService#getByPrimaryKey(java.lang.String)
  */
 public AgreementStatus getByPrimaryKey(String code) {
   AgreementStatus agreementStatus = null;
   if (StringUtils.isNotBlank(code)) {
     Map criteria = new HashMap();
     criteria.put("code", code);
     agreementStatus =
         (AgreementStatus) businessObjectService.findByPrimaryKey(AgreementStatus.class, criteria);
   }
   return agreementStatus;
 }
 /**
  * @see
  *     org.kuali.kfs.module.ar.document.service.CustomerInvoiceDocumentService#updateReportedDate(String)
  */
 @Override
 public void updateReportedDate(String docNumber) {
   HashMap<String, String> criteria = new HashMap<String, String>();
   criteria.put("documentNumber", docNumber);
   CustomerInvoiceDocument customerInvoiceDocument =
       businessObjectService.findByPrimaryKey(CustomerInvoiceDocument.class, criteria);
   Date reportedDate = dateTimeService.getCurrentSqlDate();
   if (ObjectUtils.isNotNull(customerInvoiceDocument)) {
     customerInvoiceDocument.setReportedDate(reportedDate);
     businessObjectService.save(customerInvoiceDocument);
   }
 }
예제 #9
0
 /**
  * . This is the Setter Method for siteInvestigator
  *
  * @param siteInvestigator The siteInvestigator to set.
  */
 public void setSiteInvestigator(Integer siteInvestigator) {
   if (siteInvestigator != null) {
     BusinessObjectService businessObjectService =
         KraServiceLocator.getService(BusinessObjectService.class);
     this.rolodex =
         (NonOrganizationalRolodex)
             businessObjectService.findByPrimaryKey(
                 NonOrganizationalRolodex.class,
                 getIdentifierMap(ROLODEX_ID_FIELD_NAME, siteInvestigator));
     this.siteInvestigatorId = rolodex.getRolodexId().toString();
   }
   this.siteInvestigator = siteInvestigator;
 }
예제 #10
0
 /**
  * . This is the Getter Method for siteinvestigator
  *
  * @return Returns the siteInvestigator.
  */
 public Integer getSiteInvestigator() {
   if (siteInvestigator != null) {
     BusinessObjectService businessObjectService =
         KraServiceLocator.getService(BusinessObjectService.class);
     this.rolodex =
         (Rolodex)
             businessObjectService.findByPrimaryKey(
                 Rolodex.class, getIdentifierMap(ROLODEX_ID_FIELD_NAME, siteInvestigator));
     this.siteInvestigatorId = rolodex.getRolodexId().toString();
   } else {
     this.rolodex = null;
   }
   return siteInvestigator;
 }
예제 #11
0
  @Test
  public void testGroupKeySetExtraction() {
    PayTypeBo pstnRptGrpBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "1"));
    Assert.assertFalse(pstnRptGrpBo.getGroupKeySet().isEmpty());
    Set<String> extractedGroupKeyCodeWithIdSet = new HashSet<String>();
    Set<HrGroupKeyBo> extractedGroupKeySet = pstnRptGrpBo.getGroupKeySet();
    for (HrGroupKeyBo extractedGroupKey : extractedGroupKeySet) {
      extractedGroupKeyCodeWithIdSet.add(
          extractedGroupKey.getGroupKeyCode() + "-" + extractedGroupKey.getId());
    }
    Assert.assertEquals(extractedGroupKeyCodeWithIdSet.size(), 2);
    Assert.assertTrue(extractedGroupKeyCodeWithIdSet.contains("ISU-IA-8"));
    Assert.assertTrue(extractedGroupKeyCodeWithIdSet.contains("UGA-GA-7"));

    pstnRptGrpBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "5"));
    Assert.assertFalse(pstnRptGrpBo.getGroupKeySet().isEmpty());
    extractedGroupKeyCodeWithIdSet = new HashSet<String>();
    extractedGroupKeySet = pstnRptGrpBo.getGroupKeySet();
    for (HrGroupKeyBo extractedGroupKey : extractedGroupKeySet) {
      extractedGroupKeyCodeWithIdSet.add(
          extractedGroupKey.getGroupKeyCode() + "-" + extractedGroupKey.getId());
    }
    Assert.assertEquals(extractedGroupKeyCodeWithIdSet.size(), 2);
    Assert.assertTrue(extractedGroupKeyCodeWithIdSet.contains("IU-IN-5"));
    Assert.assertTrue(extractedGroupKeyCodeWithIdSet.contains("UGA-GA-7"));

    pstnRptGrpBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "2"));
    extractedGroupKeySet = pstnRptGrpBo.getGroupKeySet();
    Assert.assertTrue((extractedGroupKeySet == null) || extractedGroupKeySet.isEmpty());
    pstnRptGrpBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "4"));
    extractedGroupKeySet = pstnRptGrpBo.getGroupKeySet();
    Assert.assertTrue((extractedGroupKeySet == null) || extractedGroupKeySet.isEmpty());
  }
  /**
   * @see
   *     org.kuali.kra.proposaldevelopment.service.ObjectCodeToBudgetCategoryCodeService#getBudgetCategoryCodeForCostElment(java.lang.String)
   */
  public String getBudgetCategoryCodeForCostElment(String objectCode) {
    String budgetCategoryCode = null;

    Map<String, String> primaryKeys = new HashMap<String, String>();
    if (StringUtils.isNotEmpty(objectCode)) {
      primaryKeys.put("costElement", objectCode);
      CostElement costElement =
          (CostElement) businessObjectService.findByPrimaryKey(CostElement.class, primaryKeys);
      if (costElement != null) {
        budgetCategoryCode = costElement.getBudgetCategoryCode();
      }
    }

    return budgetCategoryCode;
  }
예제 #13
0
  /**
   * This overridden method retrieves a function by the given name and namespace.
   *
   * @see
   *     org.kuali.rice.krms.impl.repository.FunctionBoService#getFunctionByNameAndNamespace(java.lang.String,
   *     java.lang.String)
   */
  public FunctionDefinition getFunctionByNameAndNamespace(String name, String namespace) {
    if (StringUtils.isBlank(name)) {
      throw new IllegalArgumentException("name is null or blank");
    }
    if (StringUtils.isBlank(namespace)) {
      throw new IllegalArgumentException("namespace is null or blank");
    }

    final Map<String, Object> map = new HashMap<String, Object>();
    map.put("name", name);
    map.put("namespace", namespace);
    FunctionBo functionBo =
        businessObjectService.findByPrimaryKey(FunctionBo.class, Collections.unmodifiableMap(map));
    return FunctionBo.to(functionBo);
  }
 /**
  * @see
  *     org.kuali.kfs.module.cam.document.service.AssetPaymentService#extractPostedDatePeriod(org.kuali.kfs.module.cam.businessobject.AssetPaymentDetail)
  */
 public boolean extractPostedDatePeriod(AssetPaymentDetail assetPaymentDetail) {
   boolean valid = true;
   Map<String, Object> primaryKeys = new HashMap<String, Object>();
   primaryKeys.put(
       KFSPropertyConstants.UNIVERSITY_DATE,
       assetPaymentDetail.getExpenditureFinancialDocumentPostedDate());
   UniversityDate universityDate =
       (UniversityDate) businessObjectService.findByPrimaryKey(UniversityDate.class, primaryKeys);
   if (universityDate != null) {
     assetPaymentDetail.setPostingYear(universityDate.getUniversityFiscalYear());
     assetPaymentDetail.setPostingPeriodCode(universityDate.getUniversityFiscalAccountingPeriod());
     return true;
   } else {
     return false;
   }
 }
예제 #15
0
  public List<Long> retrieveValidAssetNumberForLocking(
      Integer poId, String capitalAssetSystemTypeCode, PurApItem purApItem) {
    List<Long> capitalAssetNumbers = new ArrayList<Long>();
    CapitalAssetSystem capitalAssetSystem = null;

    if (PurapConstants.CapitalAssetTabStrings.INDIVIDUAL_ASSETS.equalsIgnoreCase(
        capitalAssetSystemTypeCode)) {
      // If PurAp sets the CAMS as INDIVIDUAL system
      capitalAssetSystem = getCapitalAssetSystemForIndividual(poId, purApItem);

    } else if (PurapConstants.CapitalAssetTabStrings.ONE_SYSTEM.equalsIgnoreCase(
        capitalAssetSystemTypeCode)) {
      capitalAssetSystem =
          this.getPurchaseOrderService().retrieveCapitalAssetSystemForOneSystem(poId);
    } else if (PurapConstants.CapitalAssetTabStrings.MULTIPLE_SYSTEMS.equalsIgnoreCase(
        capitalAssetSystemTypeCode)) {
      List<CapitalAssetSystem> capitalAssetSystems =
          this.getPurchaseOrderService().retrieveCapitalAssetSystemsForMultipleSystem(poId);
      if (ObjectUtils.isNotNull(capitalAssetSystems) && !capitalAssetSystems.isEmpty()) {
        // PurAp doesn't support multiple system asset information for KFS3.0. It works as One
        // system.
        capitalAssetSystem = capitalAssetSystems.get(0);
      }
    }

    if (ObjectUtils.isNotNull(capitalAssetSystem)
        && capitalAssetSystem.getItemCapitalAssets() != null
        && !capitalAssetSystem.getItemCapitalAssets().isEmpty()) {
      for (ItemCapitalAsset itemCapitalAsset : capitalAssetSystem.getItemCapitalAssets()) {
        if (itemCapitalAsset.getCapitalAssetNumber() != null) {
          Map pKeys = new HashMap<String, Object>();
          // Asset must be valid and capital active 'A','C','S','U'
          pKeys.put(
              CamsPropertyConstants.Asset.CAPITAL_ASSET_NUMBER,
              itemCapitalAsset.getCapitalAssetNumber());

          Asset asset = (Asset) businessObjectService.findByPrimaryKey(Asset.class, pKeys);
          if (ObjectUtils.isNotNull(asset)
              && getAssetService().isCapitalAsset(asset)
              && !getAssetService().isAssetRetired(asset)) {
            capitalAssetNumbers.add(itemCapitalAsset.getCapitalAssetNumber());
          }
        }
      }
    }
    return capitalAssetNumbers;
  }
예제 #16
0
  /**
   * @see
   *     org.kuali.kfs.module.endow.document.service.CurrentTaxLotService#getByPrimaryKey(java.lang.String,
   *     java.lang.String, java.lang.String, int, java.lang.String)
   */
  public CurrentTaxLotBalance getByPrimaryKey(
      String kemid,
      String securityId,
      String registrationCode,
      KualiInteger lotNumber,
      String ipIndicator) {
    Map<String, String> primaryKeys = new HashMap<String, String>();

    primaryKeys.put(EndowPropertyConstants.CURRENT_TAX_LOT_KEMID, kemid);
    primaryKeys.put(EndowPropertyConstants.CURRENT_TAX_LOT_SECURITY_ID, securityId);
    primaryKeys.put(EndowPropertyConstants.CURRENT_TAX_LOT_REGIS_CD, registrationCode);
    primaryKeys.put(EndowPropertyConstants.CURRENT_TAX_LOT_LOT_NBR, String.valueOf(lotNumber));
    primaryKeys.put(EndowPropertyConstants.CURRENT_TAX_LOT_IP_IND, ipIndicator);

    return (CurrentTaxLotBalance)
        businessObjectService.findByPrimaryKey(CurrentTaxLotBalance.class, primaryKeys);
  }
예제 #17
0
  /**
   * This method retrieves a rule from the repository given the name of the rule and namespace.
   *
   * @see org.kuali.rice.krms.impl.repository.RuleBoService#getRuleByRuleId(java.lang.String)
   */
  @Override
  public RuleDefinition getRuleByNameAndNamespace(String name, String namespace) {
    if (StringUtils.isBlank(name)) {
      throw new IllegalArgumentException("name is blank");
    }
    if (StringUtils.isBlank(namespace)) {
      throw new IllegalArgumentException("namespace is blank");
    }

    final Map<String, Object> map = new HashMap<String, Object>();
    map.put("name", name);
    map.put("namespace", namespace);

    RuleBo myRule =
        businessObjectService.findByPrimaryKey(RuleBo.class, Collections.unmodifiableMap(map));
    return RuleBo.to(myRule);
  }
 /**
  * @see
  *     org.kuali.kfs.module.ar.document.service.CustomerInvoiceDocumentService#updateReportedInvoiceInfo(CustomerStatementResultHolder)
  */
 @Override
 public void updateReportedInvoiceInfo(CustomerStatementResultHolder data) {
   HashMap<String, String> criteria = new HashMap<String, String>();
   criteria.put("customerNumber", data.getCustomerNumber());
   CustomerBillingStatement customerBillingStatement =
       businessObjectService.findByPrimaryKey(CustomerBillingStatement.class, criteria);
   if (ObjectUtils.isNotNull(customerBillingStatement)) {
     customerBillingStatement.setPreviouslyBilledAmount(data.getCurrentBilledAmount());
     customerBillingStatement.setReportedDate(dateTimeService.getCurrentSqlDate());
   } else {
     customerBillingStatement = new CustomerBillingStatement();
     customerBillingStatement.setCustomerNumber(data.getCustomerNumber());
     customerBillingStatement.setPreviouslyBilledAmount(data.getCurrentBilledAmount());
     customerBillingStatement.setReportedDate(dateTimeService.getCurrentSqlDate());
   }
   businessObjectService.save(customerBillingStatement);
 }
예제 #19
0
 protected void getEmailParameterList(
     Map<String, String> primaryKeys,
     ContractsGrantsInvoiceDocument invoice,
     CustomerAddress customerAddress) {
   String[] orgCode =
       invoice
           .getAward()
           .getAwardPrimaryFundManager()
           .getFundManager()
           .getPrimaryDepartmentCode()
           .split("-");
   Map<String, Object> key = new HashMap<String, Object>();
   key.put(KFSPropertyConstants.ORGANIZATION_CODE, orgCode[0].trim());
   key.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, orgCode[1].trim());
   Organization org = businessObjectService.findByPrimaryKey(Organization.class, key);
   primaryKeys.put(
       "grantNumber", returnProperStringValue(invoice.getAward().getProposal().getGrantNumber()));
   primaryKeys.put("proposalNumber", returnProperStringValue(invoice.getProposalNumber()));
   primaryKeys.put("invoiceNumber", returnProperStringValue(invoice.getDocumentNumber()));
   primaryKeys.put(
       "customerName", returnProperStringValue(customerAddress.getCustomer().getCustomerName()));
   primaryKeys.put(
       "addressName", returnProperStringValue(customerAddress.getCustomerAddressName()));
   primaryKeys.put(
       "name",
       returnProperStringValue(
           invoice.getAward().getAwardPrimaryFundManager().getFundManager().getName()));
   primaryKeys.put(
       "title",
       returnProperStringValue(
           invoice.getAward().getAwardPrimaryFundManager().getAwardFundManagerProjectTitle()));
   if (ObjectUtils.isNotNull(org)) {
     primaryKeys.put("department", returnProperStringValue(org.getOrganizationName()));
   }
   primaryKeys.put(
       "phone",
       returnProperStringValue(
           invoice.getAward().getAwardPrimaryFundManager().getFundManager().getPhoneNumber()));
   primaryKeys.put(
       "email",
       returnProperStringValue(
           invoice.getAward().getAwardPrimaryFundManager().getFundManager().getEmailAddress()));
 }
  /**
   * @see
   *     org.kuali.kfs.module.endow.document.service.RegistrationCodeService#getByPrimaryKey(java.lang.String)
   */
  public RegistrationCode getByPrimaryKey(String code) {
    RegistrationCode registrationCode = null;

    if (StringUtils.isNotBlank(code)) {
      Map criteria = new HashMap();

      if (SpringContext.getBean(DataDictionaryService.class)
          .getAttributeForceUppercase(
              RegistrationCode.class, EndowPropertyConstants.KUALICODEBASE_CODE)) {
        code = code.toUpperCase();
      }

      criteria.put("code", code);
      registrationCode =
          (RegistrationCode)
              businessObjectService.findByPrimaryKey(RegistrationCode.class, criteria);
    }
    return registrationCode;
  }
  /**
   * Refactor to have all the setters in here.
   *
   * @see
   *     org.kuali.kfs.module.ar.document.service.CustomerInvoiceDocumentService#setupDefaultValuesForNewCustomerInvoiceDocument(org.kuali.kfs.module.ar.document.CustomerInvoiceDocument)
   */
  @Override
  public void setupDefaultValuesForNewCustomerInvoiceDocument(CustomerInvoiceDocument document) {

    setupBasicDefaultValuesForCustomerInvoiceDocument(document);

    // set up the default values for the AR DOC Header

    AccountsReceivableDocumentHeader accountsReceivableDocumentHeader =
        accountsReceivableDocumentHeaderService
            .getNewAccountsReceivableDocumentHeaderForCurrentUser();
    accountsReceivableDocumentHeader.setDocumentNumber(document.getDocumentNumber());
    document.setAccountsReceivableDocumentHeader(accountsReceivableDocumentHeader);

    // set up the primary key for AR_INV_RCURRNC_DTL_T
    CustomerInvoiceRecurrenceDetails recurrenceDetails = new CustomerInvoiceRecurrenceDetails();
    recurrenceDetails.setInvoiceNumber(document.getDocumentNumber());
    // recurrenceDetails.setCustomerNumber(document.getCustomer().getCustomerNumber());
    document.setCustomerInvoiceRecurrenceDetails(recurrenceDetails);

    Map<String, String> criteria = new HashMap<String, String>();
    criteria.put(
        KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, document.getBillByChartOfAccountCode());
    criteria.put(KFSPropertyConstants.ORGANIZATION_CODE, document.getBilledByOrganizationCode());
    OrganizationOptions organizationOptions =
        businessObjectService.findByPrimaryKey(OrganizationOptions.class, criteria);

    if (ObjectUtils.isNotNull(organizationOptions)) {
      document.setPrintInvoiceIndicator(organizationOptions.getPrintInvoiceIndicator());
      document.setInvoiceTermsText(organizationOptions.getOrganizationPaymentTermsText());
    }

    // If document is using receivable option, set receivable accounting line for customer invoice
    // document
    String receivableOffsetOption =
        parameterService.getParameterValueAsString(
            CustomerInvoiceDocument.class, ArConstants.GLPE_RECEIVABLE_OFFSET_GENERATION_METHOD);
    boolean isUsingReceivableFAU =
        ArConstants.GLPE_RECEIVABLE_OFFSET_GENERATION_METHOD_FAU.equals(receivableOffsetOption);
    if (isUsingReceivableFAU) {
      receivableAccountingLineService.setReceivableAccountingLineForCustomerInvoiceDocument(
          document);
    }
  }
예제 #22
0
  /**
   * This method is used to return the cfda number of an award.
   *
   * @see org.kuali.kra.external.Cfda.service.CfdaNumberService#getCfdaNumber(java.lang.String)
   */
  public List<CfdaDTO> getCfdaNumber(
      String financialAccountNumber, String financialChartOfAccounts) {

    List<Award> awards = getAwards(financialAccountNumber, financialChartOfAccounts);
    List<CfdaDTO> cfdaNumbers = new ArrayList<CfdaDTO>();
    if (ObjectUtils.isNotNull(awards)) {
      for (Award award : awards) {
        HashMap<String, String> searchCriteria = new HashMap<String, String>();
        searchCriteria.put("cfdaNumber", award.getCfdaNumber());
        if (ObjectUtils.isNotNull(award.getCfdaNumber())) {
          CFDA cfda = (CFDA) businessObjectService.findByPrimaryKey(CFDA.class, searchCriteria);
          if (ObjectUtils.isNotNull(cfda)) {
            CfdaDTO cfdaDTO = boToDTO(cfda);
            cfdaDTO.setAwardId(award.getAwardId() + "");
            cfdaNumbers.add(cfdaDTO);
          }
        }
      }
      return cfdaNumbers;
    } else {
      return null;
    }
  }
예제 #23
0
  @Override
  public void updateSponsorProposalNumber(
      Long institutionalProposalId, String sponsorProposalNumber) {
    if (institutionalProposalId == null) {
      throw new IllegalArgumentException("institutionalProposalId is null");
    }

    if (StringUtils.isBlank(sponsorProposalNumber)) {
      throw new IllegalArgumentException("sponsorProposalNumber is blank");
    }

    final InstitutionalProposal ip =
        businessObjectService.findByPrimaryKey(
            InstitutionalProposal.class,
            Collections.singletonMap("proposalId", institutionalProposalId));

    if (ip != null) {
      if (StringUtils.isBlank(ip.getSponsorProposalNumber())) {
        ip.setSponsorProposalNumber(sponsorProposalNumber);
        businessObjectService.save(ip);
      }
    }
  }
예제 #24
0
  /**
   * Set CAB line item information from PurAp PaymentRequestItem or CreditMemoItem.
   *
   * @param purchasingAccountsPayableItemAsset
   * @param docTypeCode
   */
  public void setAccountsPayableItemsFromPurAp(
      PurchasingAccountsPayableItemAsset purchasingAccountsPayableItemAsset, String docTypeCode) {
    Map<String, Object> pKeys = new HashMap<String, Object>();
    pKeys.put(
        PurapPropertyConstants.ITEM_IDENTIFIER,
        purchasingAccountsPayableItemAsset.getAccountsPayableLineItemIdentifier());

    // Access PurAp data based on item type(PREQ or CM).
    if (CabConstants.PREQ.equalsIgnoreCase(docTypeCode)) {
      // for PREQ document
      PaymentRequestItem item =
          (PaymentRequestItem)
              businessObjectService.findByPrimaryKey(PaymentRequestItem.class, pKeys);
      if (ObjectUtils.isNull(item)) {
        throw new PurApDocumentUnavailableException(
            "PaymentRequestItem with id = "
                + purchasingAccountsPayableItemAsset.getAccountsPayableLineItemIdentifier()
                + " doesn't exist in table.");
      }

      purchasingAccountsPayableItemAsset.setItemLineNumber(item.getItemLineNumber());
      if (item.getItemType() != null) {
        purchasingAccountsPayableItemAsset.setAdditionalChargeNonTradeInIndicator(
            item.getItemType().isAdditionalChargeIndicator()
                & !CabConstants.TRADE_IN_TYPE_CODE.equalsIgnoreCase(item.getItemTypeCode()));
        purchasingAccountsPayableItemAsset.setTradeInAllowance(
            item.getItemType().isAdditionalChargeIndicator()
                & CabConstants.TRADE_IN_TYPE_CODE.equalsIgnoreCase(item.getItemTypeCode()));
        purchasingAccountsPayableItemAsset.setItemTypeCode(item.getItemTypeCode());
      }
      purchasingAccountsPayableItemAsset.setItemAssignedToTradeInIndicator(
          item.getItemAssignedToTradeInIndicator());
      // PurchaseOrderItemIdentifier will be used when populate PurAp asset data
      PurchaseOrderItem poi = item.getPurchaseOrderItem();
      if (poi != null) {
        purchasingAccountsPayableItemAsset.setPurchaseOrderItemIdentifier(poi.getItemIdentifier());
      }
    } else {
      // for CM document
      CreditMemoItem item =
          (CreditMemoItem) businessObjectService.findByPrimaryKey(CreditMemoItem.class, pKeys);
      if (ObjectUtils.isNull(item)) {
        throw new PurApDocumentUnavailableException(
            "CreditMemoItem with id = "
                + purchasingAccountsPayableItemAsset.getAccountsPayableLineItemIdentifier()
                + " doesn't exist in table.");
      }

      purchasingAccountsPayableItemAsset.setItemLineNumber(item.getItemLineNumber());
      if (item.getItemType() != null) {
        purchasingAccountsPayableItemAsset.setAdditionalChargeNonTradeInIndicator(
            item.getItemType().isAdditionalChargeIndicator()
                & !CabConstants.TRADE_IN_TYPE_CODE.equalsIgnoreCase(item.getItemTypeCode()));
        purchasingAccountsPayableItemAsset.setTradeInAllowance(
            item.getItemType().isAdditionalChargeIndicator()
                & CabConstants.TRADE_IN_TYPE_CODE.equalsIgnoreCase(item.getItemTypeCode()));
        purchasingAccountsPayableItemAsset.setItemTypeCode(item.getItemTypeCode());
      }
      purchasingAccountsPayableItemAsset.setItemAssignedToTradeInIndicator(
          item.getItemAssignedToTradeInIndicator());
      // PurchaseOrderItemIdentifier will be used when populate PurAp asset data
      PurchaseOrderItem poi = getPurchaseOrderItemfromCreditMemoItem(item);
      if (poi != null) {
        purchasingAccountsPayableItemAsset.setPurchaseOrderItemIdentifier(poi.getItemIdentifier());
      }
      // if PREQ Credit Memo document
      VendorCreditMemoDocument cmDoc = (VendorCreditMemoDocument) item.getPurapDocument();
      if (ObjectUtils.isNotNull(cmDoc) && cmDoc.isSourceDocumentPaymentRequest()) {
        purchasingAccountsPayableItemAsset.setPaymentRequestIdentifier(
            cmDoc.getPaymentRequestIdentifier());
      }
    }
  }
 private Questionnaire getQuestionnaire(Long questionnaireRefId) {
   Map pkMap = new HashMap();
   pkMap.put("questionnaireRefId", questionnaireRefId);
   return (Questionnaire) businessObjectService.findByPrimaryKey(Questionnaire.class, pkMap);
 }
예제 #26
0
  @Test
  public void testEffectiveKeySetAndListLoad() {
    PayTypeBo payTypeBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "1"));
    Assert.assertNotNull(payTypeBo);

    List<PayTypeKeyBo> effectiveKeyList = payTypeBo.getEffectiveKeyList();
    Assert.assertNotNull(effectiveKeyList);
    Assert.assertEquals(effectiveKeyList.size(), 2);

    Set<PayTypeKeyBo> effectiveKeySet = payTypeBo.getEffectiveKeySet();
    Assert.assertNotNull(effectiveKeySet);
    Assert.assertEquals(effectiveKeySet.size(), 2);
    Set<String> idSet = new HashSet<String>();
    for (PayTypeKeyBo keyBo : effectiveKeySet) {
      idSet.add(keyBo.getId());
      Assert.assertTrue(effectiveKeyList.contains(keyBo));
      Assert.assertTrue(
          ((keyBo.getId().equals("kpme_paytype_test_1000"))
                  && (keyBo.getGroupKeyCode().equalsIgnoreCase("ISU-IA")))
              || ((keyBo.getId().equals("kpme_paytype_test_1001"))
                  && (keyBo.getGroupKeyCode().equalsIgnoreCase("UGA-GA"))));
    }
    Assert.assertTrue(idSet.contains("kpme_paytype_test_1000"));
    Assert.assertTrue(idSet.contains("kpme_paytype_test_1001"));

    payTypeBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "5"));
    Assert.assertNotNull(payTypeBo);

    effectiveKeyList = payTypeBo.getEffectiveKeyList();
    Assert.assertNotNull(effectiveKeyList);
    Assert.assertEquals(2, effectiveKeyList.size());

    effectiveKeySet = payTypeBo.getEffectiveKeySet();
    Assert.assertNotNull(effectiveKeySet);
    Assert.assertEquals(effectiveKeySet.size(), 2);
    idSet = new HashSet<String>();
    for (PayTypeKeyBo keyBo : effectiveKeySet) {
      Assert.assertEquals(keyBo.getOwnerId(), "5");
      idSet.add(keyBo.getId());
      Assert.assertTrue(effectiveKeyList.contains(keyBo));
      Assert.assertTrue(
          ((keyBo.getId().equals("kpme_paytype_test_1002"))
                  && (keyBo.getGroupKeyCode().equalsIgnoreCase("UGA-GA")))
              || ((keyBo.getId().equals("kpme_paytype_test_1003"))
                  && (keyBo.getGroupKeyCode().equalsIgnoreCase("IU-IN"))));
    }
    Assert.assertTrue(idSet.contains("kpme_paytype_test_1002"));
    Assert.assertTrue(idSet.contains("kpme_paytype_test_1003"));

    payTypeBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "2"));
    Assert.assertNotNull(payTypeBo);
    effectiveKeyList = payTypeBo.getEffectiveKeyList();
    Assert.assertTrue((effectiveKeyList == null) || effectiveKeyList.isEmpty());
    effectiveKeySet = payTypeBo.getEffectiveKeySet();
    Assert.assertTrue((effectiveKeySet == null) || effectiveKeySet.isEmpty());

    payTypeBo =
        boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "4"));
    Assert.assertNotNull(payTypeBo);
    effectiveKeyList = payTypeBo.getEffectiveKeyList();
    Assert.assertTrue((effectiveKeyList == null) || effectiveKeyList.isEmpty());
    effectiveKeySet = payTypeBo.getEffectiveKeySet();
    Assert.assertTrue((effectiveKeySet == null) || effectiveKeySet.isEmpty());
  }
 protected ProtocolCorrespondence getCorrespondence(Long correspondenceId) {
   Map pkMap = new HashMap();
   pkMap.put("correspondenceId", correspondenceId);
   return businessObjectService.findByPrimaryKey(ProtocolCorrespondence.class, pkMap);
 }
 @Override
 public <T> T findByPrimaryKey(Class<T> clazz, Map<String, ?> primaryKeys) {
   return (T) businessObjectService.findByPrimaryKey((Class<BusinessObject>) clazz, primaryKeys);
 }