Search in sources :

Example 1 with CFDA

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

the class EzraServiceImpl method createProposal.

protected Proposal createProposal(EzraProposalAward ezraProposal) {
    String proposalId = ezraProposal.getProjectId();
    Proposal proposal = new Proposal();
    proposal.setProposalNumber(proposalId);
    LOG.info("Creating Proposal: " + proposalId);
    if (ezraProposal.getSponsorNumber() != null) {
        Agency agency = businessObjectService.findBySinglePrimaryKey(Agency.class, ezraProposal.getSponsorNumber().toString());
        if (ObjectUtils.isNull(agency)) {
            agency = createAgency(ezraProposal.getSponsorNumber());
            routeAgencyDocument(agency, null);
        }
        proposal.setAgencyNumber(ezraProposal.getSponsorNumber().toString());
    }
    EzraProject project = (EzraProject) businessObjectService.findBySinglePrimaryKey(EzraProject.class, proposal.getProposalNumber());
    List<ProposalProjectDirector> ppds = createProjectDirectors(proposal.getProposalNumber(), project);
    proposal.setProposalProjectDirectors(ppds);
    List<ProposalOrganization> propOrgs = createProposalOrganizations(proposal.getProposalNumber(), project);
    proposal.setProposalOrganizations(propOrgs);
    // check to see if this is a real cfda
    String myCfdaNumber = "";
    if (ObjectUtils.isNotNull(ezraProposal.getCfdaNumber())) {
        myCfdaNumber = ezraProposal.getCfdaNumber().trim();
        CFDA cfda = businessObjectService.findBySinglePrimaryKey(CFDA.class, myCfdaNumber);
        if (ObjectUtils.isNotNull(cfda)) {
            proposal.setCfdaNumber(myCfdaNumber);
        } else {
            proposal.setCfdaNumber(UNKNOWN_DEFAULT_CFDA_NUMBER);
            LOG.info("UNKNOWN CFDA NUMBER for Proposal Id: " + proposalId + ".  CFDA Number from EZRA is: " + myCfdaNumber + ".  Using " + UNKNOWN_DEFAULT_CFDA_NUMBER + " instead.");
        }
    } else
        LOG.info("CFDA NUMBER for Proposal Id: " + proposalId + " was not provided from EZRA.");
    if (project.getProjectTitle() != null) {
        proposal.setProposalProjectTitle(project.getProjectTitle().trim());
    }
    if (ObjectUtils.isNotNull(ezraProposal.getSponsorProjectId())) {
        int sponsorId = ezraProposal.getSponsorProjectId().length();
        if (sponsorId > grantIdMax) {
            proposal.setGrantNumber(ezraProposal.getSponsorProjectId().substring(0, 26));
        } else {
            proposal.setGrantNumber(ezraProposal.getSponsorProjectId());
        }
    }
    proposal.setProposalStatusCode(getProposalStatusMap().get(ezraProposal.getStatus()));
    proposal.setProposalPurposeCode(getProposalPurposeMap().get(ezraProposal.getPurpose()));
    proposal.setProposalBeginningDate(ezraProposal.getStartDate());
    proposal.setProposalEndingDate(ezraProposal.getStopDate());
    proposal.setProposalDirectCostAmount(ezraProposal.getTotalAmt());
    proposal.setProposalIndirectCostAmount(KualiDecimal.ZERO);
    if (ezraProposal.getFederalPassThroughAgencyNumber() != null) {
        Agency agency = businessObjectService.findBySinglePrimaryKey(Agency.class, ezraProposal.getFederalPassThroughAgencyNumber().toString());
        if (ObjectUtils.isNull(agency)) {
            agency = createAgency(ezraProposal.getFederalPassThroughAgencyNumber());
            routeAgencyDocument(agency, null);
        }
        proposal.setFederalPassThroughAgencyNumber(ezraProposal.getFederalPassThroughAgencyNumber().toString());
    }
    proposal.setProposalFederalPassThroughIndicator(ezraProposal.getFederalPassThroughBoolean());
    proposal.setProposalAwardTypeCode("Z");
    proposal.setActive(true);
    return proposal;
}
Also used : ProposalOrganization(org.kuali.kfs.module.cg.businessobject.ProposalOrganization) Agency(org.kuali.kfs.module.cg.businessobject.Agency) ProposalProjectDirector(org.kuali.kfs.module.cg.businessobject.ProposalProjectDirector) EzraProject(edu.cornell.kfs.module.ezra.businessobject.EzraProject) Proposal(org.kuali.kfs.module.cg.businessobject.Proposal) CFDA(org.kuali.kfs.module.cg.businessobject.CFDA)

Aggregations

EzraProject (edu.cornell.kfs.module.ezra.businessobject.EzraProject)1 Agency (org.kuali.kfs.module.cg.businessobject.Agency)1 CFDA (org.kuali.kfs.module.cg.businessobject.CFDA)1 Proposal (org.kuali.kfs.module.cg.businessobject.Proposal)1 ProposalOrganization (org.kuali.kfs.module.cg.businessobject.ProposalOrganization)1 ProposalProjectDirector (org.kuali.kfs.module.cg.businessobject.ProposalProjectDirector)1