use of org.kuali.kfs.module.cg.businessobject.AwardAccount in project cu-kfs by CU-CommunityApps.
the class AwardExtensionRule method checkForDuplicateAccoutnts.
protected boolean checkForDuplicateAccoutnts() {
boolean success = true;
String accountNumber;
String accountChart;
Collection<AwardAccount> awardAccounts = newAwardCopy.getAwardAccounts();
HashSet<String> accountHash = new HashSet<String>();
// validate if the newly entered award account is already on that award
for (AwardAccount account : awardAccounts) {
if (account != null && StringUtils.isNotEmpty(account.getAccountNumber())) {
accountNumber = account.getAccountNumber();
accountChart = account.getChartOfAccountsCode();
if (!accountHash.add(accountChart + accountNumber)) {
putFieldError(KFSPropertyConstants.AWARD_ACCOUNTS, CUKFSKeyConstants.ERROR_DUPLICATE_AWARD_ACCOUNT, accountChart + "-" + accountNumber);
return false;
}
}
}
return success;
}
use of org.kuali.kfs.module.cg.businessobject.AwardAccount in project cu-kfs by CU-CommunityApps.
the class AwardExtensionRule method processCustomAddCollectionLineBusinessRules.
/**
* @see org.kuali.kfs.module.cg.document.validation.impl.AwardRule#processCustomAddCollectionLineBusinessRules(org.kuali.kfs.kns.document.MaintenanceDocument, java.lang.String, org.kuali.kfs.krad.bo.PersistableBusinessObject)
*/
@Override
public boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document, String collectionName, PersistableBusinessObject bo) {
boolean success = super.processCustomAddCollectionLineBusinessRules(document, collectionName, bo);
if (bo instanceof AwardAccount) {
AwardAccount awardAccount = (AwardAccount) bo;
success &= checkAccountNotUsedOnOtherAwards(awardAccount);
}
return success;
}
use of org.kuali.kfs.module.cg.businessobject.AwardAccount in project cu-kfs by CU-CommunityApps.
the class AwardExtensionRule method checkAccountsNotUsedOnOtherAwards.
/**
* Checks that none of the accounts on the award are being used on an award.
*
* @return true if not used, false otherwise
*/
protected boolean checkAccountsNotUsedOnOtherAwards() {
boolean success = true;
Collection<AwardAccount> awardAccounts = newAwardCopy.getAwardAccounts();
// validate if the accounts on the award are not already used on another award
for (AwardAccount account : awardAccounts) {
success &= checkAccountNotUsedOnOtherAwards(account);
}
return success;
}
use of org.kuali.kfs.module.cg.businessobject.AwardAccount in project cu-kfs by CU-CommunityApps.
the class EzraServiceImpl method createAward.
protected Award createAward(Proposal proposal, Award oldAward, EzraProposalAward ezraAward) {
Award award = new CuAward(proposal);
award.setProposal(proposal);
award.setAwardStatusCode(proposal.getProposalStatusCode());
award.setAwardBeginningDate(proposal.getProposalBeginningDate());
award.setAwardEndingDate(proposal.getProposalEndingDate());
award.setAwardDirectCostAmount(proposal.getProposalDirectCostAmount());
award.setAwardIndirectCostAmount(KualiDecimal.ZERO);
award.setGrantDescriptionCode(getGrantDescriptionMap().get(ezraAward.getAwardDescriptionCode()));
award.setAwardEntryDate(dateTimeService.getCurrentSqlDate());
if (ObjectUtils.isNull(oldAward)) {
List<AwardAccount> accounts = getAwardAccounts(proposal);
award.setAwardAccounts(accounts);
award.setActive(true);
} else {
award.setAwardAccounts(oldAward.getAwardAccounts());
setAwardOrgVersionNumbers(oldAward.getAwardOrganizations(), award.getAwardOrganizations());
award.setVersionNumber(oldAward.getVersionNumber());
award.setLetterOfCreditFundCode(oldAward.getLetterOfCreditFundCode());
((CuAward) award).setLetterOfCreditFundGroupCode(((CuAward) oldAward).getLetterOfCreditFundGroupCode());
AwardExtendedAttribute awardEA = (AwardExtendedAttribute) award.getExtension();
awardEA.setLocAccountId(((AwardExtendedAttribute) oldAward.getExtension()).getLocAccountId());
award.setActive(oldAward.isActive());
awardEA.setProposalNumber(((AwardExtendedAttribute) oldAward.getExtension()).getProposalNumber());
awardEA.setVersionNumber(((AwardExtendedAttribute) oldAward.getExtension()).getVersionNumber());
awardEA.setEverify(((AwardExtendedAttribute) oldAward.getExtension()).isEverify());
}
for (AwardProjectDirector apd : award.getAwardProjectDirectors()) {
Map primaryKeys = new HashMap();
primaryKeys.put("principalId", apd.getPrincipalId());
primaryKeys.put("proposalNumber", apd.getProposalNumber());
AwardProjectDirector projDir = (AwardProjectDirector) businessObjectService.findByPrimaryKey(AwardProjectDirector.class, primaryKeys);
if (ObjectUtils.isNotNull(projDir)) {
apd.setVersionNumber(projDir.getVersionNumber());
}
}
award.refreshReferenceObject("extension");
Map fieldValues = new HashMap();
fieldValues.put("projectId", award.getProposalNumber());
fieldValues.put("deliverableType", 'F');
fieldValues.put("finalIndicator", 'Y');
List<Deliverable> deliverables = (List<Deliverable>) businessObjectService.findMatching(Deliverable.class, fieldValues);
if (deliverables.size() == 1) {
Deliverable deliverable = deliverables.get(0);
if (ObjectUtils.isNotNull(deliverable)) {
AwardExtendedAttribute aea = (AwardExtendedAttribute) award.getExtension();
aea.setFinalFiscalReportDate(deliverable.getDueDate());
aea.setFinalFinancialReportRequired(true);
}
}
KualiDecimal costShareRequired = KualiDecimal.ZERO;
if (ezraAward.getCsVolClg() != null) {
costShareRequired = costShareRequired.add(ezraAward.getCsVolClg());
}
if (ezraAward.getCsVolCntr() != null) {
costShareRequired = costShareRequired.add(ezraAward.getCsVolCntr());
}
if (ezraAward.getCsVolDept() != null) {
costShareRequired = costShareRequired.add(ezraAward.getCsVolDept());
}
if (ezraAward.getCsVolExt() != null) {
costShareRequired = costShareRequired.add(ezraAward.getCsVolExt());
}
if (ezraAward.getCsVolUniv() != null) {
costShareRequired = costShareRequired.add(ezraAward.getCsVolUniv());
}
if (ezraAward.getCsMandClg() != null) {
costShareRequired = costShareRequired.add(ezraAward.getCsMandClg());
}
if (ezraAward.getCsMandCntr() != null) {
costShareRequired = costShareRequired.add(ezraAward.getCsMandCntr());
}
if (ezraAward.getCsMandDept() != null) {
costShareRequired = costShareRequired.add(ezraAward.getCsMandDept());
}
if (ezraAward.getCsMandExt() != null) {
costShareRequired = costShareRequired.add(ezraAward.getCsMandExt());
}
if (ezraAward.getCsMandUniv() != null) {
costShareRequired = costShareRequired.add(ezraAward.getCsMandUniv());
}
AwardExtendedAttribute aea = (AwardExtendedAttribute) award.getExtension();
if (costShareRequired.isNonZero()) {
aea.setCostShareRequired(true);
} else {
aea.setCostShareRequired(false);
}
aea.setBudgetBeginningDate(ezraAward.getBudgetStartDate());
aea.setBudgetEndingDate(ezraAward.getBudgetStopDate());
aea.setBudgetTotalAmount(ezraAward.getBudgetAmt());
Compliance ezraCompliance = getEzraCompliance(ezraAward);
if (ObjectUtils.isNotNull(ezraCompliance)) {
boolean everify = Boolean.TRUE.equals(ezraCompliance.getEverify());
aea.setEverify(everify);
}
award.refreshReferenceObject("proposal");
award.refreshNonUpdateableReferences();
award.setExtension(aea);
return award;
}
use of org.kuali.kfs.module.cg.businessobject.AwardAccount in project cu-kfs by CU-CommunityApps.
the class EzraServiceImpl method getAwardAccounts.
private List<AwardAccount> getAwardAccounts(Proposal proposal) {
List<AwardAccount> awardAccounts = new ArrayList<AwardAccount>();
String principalId = parameterService.getParameterValueAsString("KFS-EZRA", "Award", "DEFAULT_PROJECT_DIRECTOR");
String[] chartAcct = parameterService.getParameterValueAsString("KFS-EZRA", "Award", "DEFAULT_AWARD_ACCOUNT").split(":");
String chart = chartAcct[0];
String acct = chartAcct[1];
AwardAccount account = new AwardAccount();
account.setProposalNumber(proposal.getProposalNumber());
account.setChartOfAccountsCode(chart);
account.setAccountNumber(acct);
account.setPrincipalId(principalId);
awardAccounts.add(account);
return awardAccounts;
}
Aggregations