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;
}
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);
}
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);
}
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;
}
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;
}
Aggregations