Exemple #1
0
 public ObjectCode createObjectCode() {
   ObjectCode objectCode = new ObjectCode();
   objectCode.setUniversityFiscalYear(this.universityFiscalYear);
   objectCode.setChartOfAccountsCode(this.chartOfAccountsCode);
   objectCode.setFinancialObjectCode(this.financialObjectCode);
   return objectCode;
 }
 /**
  * @see
  *     org.kuali.kfs.module.cam.document.service.AssetPaymentService#isPaymentFinancialObjectActive(org.kuali.kfs.module.cam.businessobject.AssetPayment)
  */
 public boolean isPaymentFinancialObjectActive(AssetPayment assetPayment) {
   ObjectCode financialObjectCode = new ObjectCode();
   financialObjectCode.setUniversityFiscalYear(getUniversityDateService().getCurrentFiscalYear());
   financialObjectCode.setChartOfAccountsCode(assetPayment.getChartOfAccountsCode());
   financialObjectCode.setFinancialObjectCode(assetPayment.getFinancialObjectCode());
   financialObjectCode = (ObjectCode) getBusinessObjectService().retrieve(financialObjectCode);
   if (ObjectUtils.isNotNull(financialObjectCode)) {
     return financialObjectCode.isActive();
   }
   return false;
 }
  /**
   * This generates the appropriate maintenance locks for the {@link ObjectCode}
   *
   * @see org.kuali.rice.kns.maintenance.Maintainable#generateMaintenanceLocks()
   */
  @Override
  public List<MaintenanceLock> generateMaintenanceLocks() {
    ObjectCodeGlobal objectCodeGlobal = (ObjectCodeGlobal) getBusinessObject();
    List<MaintenanceLock> maintenanceLocks = new ArrayList();
    SubObjectTrickleDownInactivationService subObjectTrickleDownInactivationService =
        SpringContext.getBean(SubObjectTrickleDownInactivationService.class);

    for (ObjectCodeGlobalDetail detail : objectCodeGlobal.getObjectCodeGlobalDetails()) {
      MaintenanceLock maintenanceLock = new MaintenanceLock();
      StringBuffer lockrep = new StringBuffer();

      lockrep.append(ObjectCode.class.getName() + KFSConstants.Maintenance.AFTER_CLASS_DELIM);
      lockrep.append("universityFiscalYear" + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
      lockrep.append(detail.getUniversityFiscalYear() + KFSConstants.Maintenance.AFTER_VALUE_DELIM);
      lockrep.append("chartOfAccountsCode" + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
      lockrep.append(detail.getChartOfAccountsCode() + KFSConstants.Maintenance.AFTER_VALUE_DELIM);
      lockrep.append("financialObjectCode" + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
      lockrep.append(detail.getFinancialObjectCode());

      maintenanceLock.setDocumentNumber(objectCodeGlobal.getDocumentNumber());
      maintenanceLock.setLockingRepresentation(lockrep.toString());
      maintenanceLocks.add(maintenanceLock);

      ObjectCode objectCode = new ObjectCode();
      objectCode.setUniversityFiscalYear(detail.getUniversityFiscalYear());
      objectCode.setChartOfAccountsCode(detail.getChartOfAccountsCode());
      objectCode.setFinancialObjectCode(detail.getFinancialObjectCode());
      objectCode.setActive(objectCodeGlobal.isFinancialObjectActiveIndicator());

      if (isInactivatingObjectCode(objectCode)) {
        // if it turns out that the object code does not have associated sub-objects (either because
        // the object code doesn't exist or doesn't have sub-objects)
        // then the generateTrickleDownMaintenanceLocks method returns an empty list
        maintenanceLocks.addAll(
            subObjectTrickleDownInactivationService.generateTrickleDownMaintenanceLocks(
                objectCode, getDocumentNumber()));
      }
    }
    return maintenanceLocks;
  }