Search in sources :

Example 1 with Proposal

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

the class EzraServiceImpl method updateProposals.

public boolean updateProposals() {
    List<EzraProposalAward> proposals = ezraAwardProposalDao.getProposals();
    Map fields = new HashMap();
    for (EzraProposalAward ezraProposal : proposals) {
        String proposalId = ezraProposal.getProjectId();
        fields.clear();
        fields.put("proposalNumber", proposalId);
        Proposal proposal = (Proposal) businessObjectService.findByPrimaryKey(Proposal.class, fields);
        if (ObjectUtils.isNull(proposal)) {
            proposal = createProposal(ezraProposal);
            routeProposalDocument(proposal);
            Award award = createAward(proposal, null, ezraProposal);
            routeAwardDocument(award, null);
        } else {
            if (StringUtils.isNotEmpty(ezraProposal.getSponsorProjectId())) {
                if (StringUtils.isNotEmpty(proposal.getGrantNumber())) {
                    if (!proposal.getGrantNumber().equals(ezraProposal.getSponsorProjectId())) {
                        int sponsorId = ezraProposal.getSponsorProjectId().length();
                        if (sponsorId > grantIdMax) {
                            String grantShort = ezraProposal.getSponsorProjectId().substring(0, 26);
                            if (!grantShort.equalsIgnoreCase(proposal.getGrantNumber())) {
                                proposal.setGrantNumber(grantShort);
                            }
                        } else {
                            proposal.setGrantNumber(ezraProposal.getSponsorProjectId());
                        }
                        businessObjectService.save(proposal);
                    }
                } else {
                    proposal.setGrantNumber(ezraProposal.getSponsorProjectId());
                    businessObjectService.save(proposal);
                }
            }
        }
    }
    return true;
}
Also used : HashMap(java.util.HashMap) Award(org.kuali.kfs.module.cg.businessobject.Award) EzraProposalAward(edu.cornell.kfs.module.ezra.businessobject.EzraProposalAward) CuAward(edu.cornell.kfs.module.cg.businessobject.CuAward) EzraProposalAward(edu.cornell.kfs.module.ezra.businessobject.EzraProposalAward) HashMap(java.util.HashMap) Map(java.util.Map) Proposal(org.kuali.kfs.module.cg.businessobject.Proposal)

Example 2 with Proposal

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

the class AwardExtensionRule method setupBaseConvenienceObjects.

/**
 * @see org.kuali.kfs.kns.maintenance.rules.MaintenanceDocumentRuleBase#setupBaseConvenienceObjects(org.kuali.kfs.kns.document.MaintenanceDocument)
 */
@Override
public void setupBaseConvenienceObjects(MaintenanceDocument document) {
    newAwardCopy = (Award) document.getNewMaintainableObject().getBusinessObject();
    Proposal tempProposal = newAwardCopy.getProposal();
    super.setupBaseConvenienceObjects(document);
    newAwardCopy = (Award) document.getNewMaintainableObject().getBusinessObject();
    newAwardCopy.setProposal(tempProposal);
    super.setNewBo(newAwardCopy);
}
Also used : Proposal(org.kuali.kfs.module.cg.businessobject.Proposal)

Example 3 with Proposal

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

the class CuAwardMaintainableImpl method refreshAward.

/**
 * Load related objects from the database as needed.
 *
 * @param refreshFromLookup
 */
protected void refreshAward(boolean refreshFromLookup) {
    Award award = getAward();
    Proposal tempProposal = getAward().getProposal();
    award.setProposal(tempProposal);
    getNewCollectionLine(AWARD_SUBCONTRACTORS).refreshNonUpdateableReferences();
    getNewCollectionLine(AWARD_PROJECT_DIRECTORS).refreshNonUpdateableReferences();
    getNewCollectionLine(AWARD_ACCOUNTS).refreshNonUpdateableReferences();
    // the org list doesn't need any refresh
    refreshNonUpdateableReferences(award.getAwardOrganizations());
    refreshNonUpdateableReferences(award.getAwardAccounts());
    refreshNonUpdateableReferences(award.getAwardSubcontractors());
    refreshAwardProjectDirectors(refreshFromLookup);
}
Also used : Award(org.kuali.kfs.module.cg.businessobject.Award) Proposal(org.kuali.kfs.module.cg.businessobject.Proposal)

Example 4 with Proposal

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

the class EzraServiceImpl method updateAwardsSince.

public boolean updateAwardsSince(Date date) {
    boolean result = true;
    List<EzraProposalAward> awards = ezraAwardProposalDao.getAwardsUpdatedSince(date);
    Map fields = new HashMap();
    LOG.info("Retrieved : " + awards.size() + " Awards to update since " + date.toString());
    for (EzraProposalAward ezraAward : awards) {
        String proposalId = ezraAward.getProjectId();
        fields.clear();
        fields.put("proposalNumber", proposalId);
        Award award = (CuAward) businessObjectService.findByPrimaryKey(CuAward.class, fields);
        if (award == null) {
            LOG.error("Award: " + proposalId + " is null and probably should have already been created");
        } else {
            Proposal proposal = createProposal(ezraAward);
            Award newAward = createAward(proposal, award, ezraAward);
            routeAwardDocument(newAward, award);
        }
    }
    return result;
}
Also used : HashMap(java.util.HashMap) Award(org.kuali.kfs.module.cg.businessobject.Award) EzraProposalAward(edu.cornell.kfs.module.ezra.businessobject.EzraProposalAward) CuAward(edu.cornell.kfs.module.cg.businessobject.CuAward) EzraProposalAward(edu.cornell.kfs.module.ezra.businessobject.EzraProposalAward) HashMap(java.util.HashMap) Map(java.util.Map) Proposal(org.kuali.kfs.module.cg.businessobject.Proposal) CuAward(edu.cornell.kfs.module.cg.businessobject.CuAward)

Example 5 with Proposal

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

Proposal (org.kuali.kfs.module.cg.businessobject.Proposal)6 HashMap (java.util.HashMap)3 Map (java.util.Map)3 Award (org.kuali.kfs.module.cg.businessobject.Award)3 CuAward (edu.cornell.kfs.module.cg.businessobject.CuAward)2 EzraProposalAward (edu.cornell.kfs.module.ezra.businessobject.EzraProposalAward)2 EzraProject (edu.cornell.kfs.module.ezra.businessobject.EzraProject)1 List (java.util.List)1 Agency (org.kuali.kfs.module.cg.businessobject.Agency)1 CFDA (org.kuali.kfs.module.cg.businessobject.CFDA)1 ProposalOrganization (org.kuali.kfs.module.cg.businessobject.ProposalOrganization)1 ProposalProjectDirector (org.kuali.kfs.module.cg.businessobject.ProposalProjectDirector)1