use of org.kuali.kfs.module.cg.businessobject.ProposalOrganization 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);
}
}
}
}
use of org.kuali.kfs.module.cg.businessobject.ProposalOrganization 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;
}
use of org.kuali.kfs.module.cg.businessobject.ProposalOrganization in project cu-kfs by CU-CommunityApps.
the class EzraServiceImpl method createProposalOrganizations.
private List<ProposalOrganization> createProposalOrganizations(String projectId, EzraProject project) {
// EzraProject ep = (EzraProject)businessObjectService.findBySinglePrimaryKey(EzraProject.class, projectId);
String orgCode = project.getProjectDepartmentId();
Map deptFields = new HashMap();
deptFields.put("organizationCode", orgCode);
List<Organization> orgs = (List<Organization>) businessObjectService.findMatching(Organization.class, deptFields);
LOG.info("Retrieved Orgs :" + orgs.size() + " for Proposal " + projectId);
List<ProposalOrganization> propOrgs = new ArrayList<ProposalOrganization>();
for (Organization org : orgs) {
Map primaryKeys = new HashMap();
primaryKeys.put("chartOfAccountsCode", org.getChartOfAccountsCode());
primaryKeys.put("organizationCode", org.getOrganizationCode());
primaryKeys.put("proposalNumber", projectId);
ProposalOrganization po = (ProposalOrganization) businessObjectService.findByPrimaryKey(ProposalOrganization.class, primaryKeys);
if (ObjectUtils.isNull(po)) {
po = new ProposalOrganization();
} else {
po.setVersionNumber(po.getVersionNumber() + 1);
}
po.setChartOfAccountsCode("IT");
po.setOrganizationCode(org.getOrganizationCode());
// EzraProject ep = (EzraProject)businessObjectService.findBySinglePrimaryKey(EzraProject.class, projectId);
if (org.getOrganizationCode().equals(project.getProjectDepartmentId())) {
po.setProposalPrimaryOrganizationIndicator(true);
}
po.setActive(true);
propOrgs.add(po);
}
return propOrgs;
}
Aggregations