use of org.kuali.kfs.module.cg.businessobject.AwardOrganization in project cu-kfs by CU-CommunityApps.
the class AwardExtensionRule method checkForDuplicateAwardOrganization.
protected boolean checkForDuplicateAwardOrganization() {
boolean success = true;
String organizationCode;
String organizationChart;
Collection<AwardOrganization> awardOrganizations = newAwardCopy.getAwardOrganizations();
HashSet<String> orgaizationHash = new HashSet<String>();
// validate if the newly entered awardOrganization is already on that award
for (AwardOrganization awardOrganization : awardOrganizations) {
if (awardOrganization != null && StringUtils.isNotEmpty(awardOrganization.getOrganizationCode())) {
organizationCode = awardOrganization.getOrganizationCode();
organizationChart = awardOrganization.getChartOfAccountsCode();
if (!orgaizationHash.add(organizationChart + organizationCode)) {
putFieldError(KFSPropertyConstants.AWARD_ORGRANIZATIONS, CUKFSKeyConstants.ERROR_DUPLICATE_AWARD_ORGANIZATION, organizationChart + "-" + organizationCode);
return false;
}
}
}
return success;
}
use of org.kuali.kfs.module.cg.businessobject.AwardOrganization in project cu-kfs by CU-CommunityApps.
the class CuAward method populateFromProposal.
/**
* This method takes all the applicable attributes from the associated proposal object and sets those attributes into their
* corresponding award attributes.
*
* @param proposal The associated proposal that the award will be linked to.
*/
public void populateFromProposal(Proposal proposal) {
if (ObjectUtils.isNotNull(proposal)) {
setProposalNumber(proposal.getProposalNumber());
setAgencyNumber(proposal.getAgencyNumber());
setAwardProjectTitle(proposal.getProposalProjectTitle());
setAwardDirectCostAmount(proposal.getProposalDirectCostAmount());
setAwardIndirectCostAmount(proposal.getProposalIndirectCostAmount());
setProposalAwardTypeCode(proposal.getProposalAwardTypeCode());
setFederalPassThroughIndicator(proposal.getProposalFederalPassThroughIndicator());
setFederalPassThroughAgencyNumber(proposal.getFederalPassThroughAgencyNumber());
setAwardPurposeCode(proposal.getProposalPurposeCode());
// copy proposal organizations to award organizations
getAwardOrganizations().clear();
for (ProposalOrganization pOrg : proposal.getProposalOrganizations()) {
AwardOrganization awardOrg = new AwardOrganization();
// newCollectionRecord is set to true to allow deletion of this record after being populated from proposal
awardOrg.setNewCollectionRecord(true);
awardOrg.setProposalNumber(pOrg.getProposalNumber());
awardOrg.setChartOfAccountsCode(pOrg.getChartOfAccountsCode());
awardOrg.setOrganizationCode(pOrg.getOrganizationCode());
awardOrg.setAwardPrimaryOrganizationIndicator(pOrg.isProposalPrimaryOrganizationIndicator());
awardOrg.setActive(pOrg.isActive());
awardOrg.setVersionNumber(pOrg.getVersionNumber());
getAwardOrganizations().add(awardOrg);
}
// copy proposal subcontractors to award subcontractors
getAwardSubcontractors().clear();
for (ProposalSubcontractor pSubcontractor : proposal.getProposalSubcontractors()) {
AwardSubcontractor awardSubcontractor = new AwardSubcontractor();
// newCollectionRecord is set to true to allow deletion of this record after being populated from proposal
awardSubcontractor.setNewCollectionRecord(true);
awardSubcontractor.setProposalNumber(pSubcontractor.getProposalNumber());
awardSubcontractor.setAwardSubcontractorNumber(pSubcontractor.getProposalSubcontractorNumber());
awardSubcontractor.setSubcontractorAmount(pSubcontractor.getProposalSubcontractorAmount());
awardSubcontractor.setAwardSubcontractorDescription(pSubcontractor.getProposalSubcontractorDescription());
awardSubcontractor.setSubcontractorNumber(pSubcontractor.getSubcontractorNumber());
awardSubcontractor.setActive(pSubcontractor.isActive());
awardSubcontractor.setVersionNumber(pSubcontractor.getVersionNumber());
getAwardSubcontractors().add(awardSubcontractor);
}
// copy proposal project directors to award propject directors
getAwardProjectDirectors().clear();
// use this to filter out duplicate projectdirectors
Set<String> directors = new HashSet<String>();
for (ProposalProjectDirector pDirector : proposal.getProposalProjectDirectors()) {
if (directors.add(pDirector.getPrincipalId())) {
AwardProjectDirector awardDirector = new AwardProjectDirector();
// newCollectionRecord is set to true to allow deletion of this record after being populated from proposal
awardDirector.setNewCollectionRecord(true);
awardDirector.setProposalNumber(pDirector.getProposalNumber());
awardDirector.setAwardPrimaryProjectDirectorIndicator(pDirector.isProposalPrimaryProjectDirectorIndicator());
awardDirector.setAwardProjectDirectorProjectTitle(pDirector.getProposalProjectDirectorProjectTitle());
awardDirector.setPrincipalId(pDirector.getPrincipalId());
awardDirector.setActive(pDirector.isActive());
awardDirector.setVersionNumber(pDirector.getVersionNumber());
getAwardProjectDirectors().add(awardDirector);
}
}
}
}
Aggregations