Search in sources :

Example 1 with AwardSubcontractor

use of org.kuali.kfs.module.cg.businessobject.AwardSubcontractor 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);
            }
        }
    }
}
Also used : ProposalOrganization(org.kuali.kfs.module.cg.businessobject.ProposalOrganization) ProposalSubcontractor(org.kuali.kfs.module.cg.businessobject.ProposalSubcontractor) AwardSubcontractor(org.kuali.kfs.module.cg.businessobject.AwardSubcontractor) AwardProjectDirector(org.kuali.kfs.module.cg.businessobject.AwardProjectDirector) AwardOrganization(org.kuali.kfs.module.cg.businessobject.AwardOrganization) ProposalProjectDirector(org.kuali.kfs.module.cg.businessobject.ProposalProjectDirector) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 AwardOrganization (org.kuali.kfs.module.cg.businessobject.AwardOrganization)1 AwardProjectDirector (org.kuali.kfs.module.cg.businessobject.AwardProjectDirector)1 AwardSubcontractor (org.kuali.kfs.module.cg.businessobject.AwardSubcontractor)1 ProposalOrganization (org.kuali.kfs.module.cg.businessobject.ProposalOrganization)1 ProposalProjectDirector (org.kuali.kfs.module.cg.businessobject.ProposalProjectDirector)1 ProposalSubcontractor (org.kuali.kfs.module.cg.businessobject.ProposalSubcontractor)1