Search in sources :

Example 1 with AwardProjectDirector

use of org.kuali.kfs.module.cg.businessobject.AwardProjectDirector in project cu-kfs by CU-CommunityApps.

the class AwardExtensionRule method checkForDuplicateAwardProjectDirector.

protected boolean checkForDuplicateAwardProjectDirector() {
    boolean success = true;
    String principalId;
    Collection<AwardProjectDirector> awardProjectDirectors = newAwardCopy.getAwardProjectDirectors();
    HashSet<String> principalIdHash = new HashSet<String>();
    // validate if the newly entered AwardProjectDirector is already on that award
    for (AwardProjectDirector projectDirector : awardProjectDirectors) {
        if (projectDirector != null && StringUtils.isNotEmpty(projectDirector.getPrincipalId())) {
            principalId = projectDirector.getPrincipalId();
            if (!principalIdHash.add(principalId)) {
                putFieldError(KFSPropertyConstants.AWARD_PROJECT_DIRECTORS, CUKFSKeyConstants.ERROR_DUPLICATE_AWARD_PROJECT_DIRECTOR, principalId);
                return false;
            }
        }
    }
    return success;
}
Also used : AwardProjectDirector(org.kuali.kfs.module.cg.businessobject.AwardProjectDirector) HashSet(java.util.HashSet)

Example 2 with AwardProjectDirector

use of org.kuali.kfs.module.cg.businessobject.AwardProjectDirector 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)

Example 3 with AwardProjectDirector

use of org.kuali.kfs.module.cg.businessobject.AwardProjectDirector 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;
}
Also used : AwardProjectDirector(org.kuali.kfs.module.cg.businessobject.AwardProjectDirector) Compliance(edu.cornell.kfs.module.ezra.businessobject.Compliance) HashMap(java.util.HashMap) AwardAccount(org.kuali.kfs.module.cg.businessobject.AwardAccount) AwardExtendedAttribute(edu.cornell.kfs.module.cg.businessobject.AwardExtendedAttribute) Award(org.kuali.kfs.module.cg.businessobject.Award) EzraProposalAward(edu.cornell.kfs.module.ezra.businessobject.EzraProposalAward) CuAward(edu.cornell.kfs.module.cg.businessobject.CuAward) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) CuAward(edu.cornell.kfs.module.cg.businessobject.CuAward) Deliverable(edu.cornell.kfs.module.ezra.businessobject.Deliverable)

Aggregations

AwardProjectDirector (org.kuali.kfs.module.cg.businessobject.AwardProjectDirector)3 HashSet (java.util.HashSet)2 AwardExtendedAttribute (edu.cornell.kfs.module.cg.businessobject.AwardExtendedAttribute)1 CuAward (edu.cornell.kfs.module.cg.businessobject.CuAward)1 Compliance (edu.cornell.kfs.module.ezra.businessobject.Compliance)1 Deliverable (edu.cornell.kfs.module.ezra.businessobject.Deliverable)1 EzraProposalAward (edu.cornell.kfs.module.ezra.businessobject.EzraProposalAward)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Award (org.kuali.kfs.module.cg.businessobject.Award)1 AwardAccount (org.kuali.kfs.module.cg.businessobject.AwardAccount)1 AwardOrganization (org.kuali.kfs.module.cg.businessobject.AwardOrganization)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 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)1