protected void populateRequiredFields( Protocol protocol, ProposalDevelopmentDocument proposalDocument) throws Exception { DevelopmentProposal developmentProposal = proposalDocument.getDevelopmentProposal(); developmentProposal.setTitle(protocol.getTitle()); developmentProposal.setOwnedByUnit(protocol.getLeadUnit().getUnit()); developmentProposal.setOwnedByUnitNumber(protocol.getLeadUnitNumber()); developmentProposal.setRequestedStartDateInitial(new Date(System.currentTimeMillis())); ParameterService parameterService = KcServiceLocator.getService(ParameterService.class); String projectEndDateParameter = parameterService.getParameterValueAsString( ProtocolDocument.class, ProtocolProposalDevelopmentDocumentService.PROJECT_END_DATE_NUMBER_OF_YEARS); int numberOfYears = Integer.parseInt(projectEndDateParameter); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.YEAR, numberOfYears); calendar.add(Calendar.DATE, -1); Date projectEndDate = new Date(calendar.getTimeInMillis()); developmentProposal.setRequestedEndDateInitial(projectEndDate); String activityTypeCode = ProposalDevelopmentUtils.getProposalDevelopmentDocumentParameter( ProposalDevelopmentUtils.ACTIVITY_TYPE_CODE_RESEARCH_PARM); String proposalTypeCode = ProposalDevelopmentUtils.getProposalDevelopmentDocumentParameter( ProposalDevelopmentUtils.PROPOSAL_TYPE_CODE_NEW_PARM); developmentProposal.setActivityTypeCode(activityTypeCode); developmentProposal.setProposalTypeCode(proposalTypeCode); // find sponsor from funding source List<ProtocolFundingSourceBase> protocolFundingSources = protocol.getProtocolFundingSources(); ProtocolFundingSource sponsorProtocolFundingSource = null; for (ProtocolFundingSourceBase protocolFundingSource : protocolFundingSources) { if (protocolFundingSource.isSponsorFunding()) { sponsorProtocolFundingSource = (ProtocolFundingSource) protocolFundingSource; break; } } if (sponsorProtocolFundingSource != null) { developmentProposal.setSponsorCode(sponsorProtocolFundingSource.getFundingSourceNumber()); } }
protected boolean isCertificationRequiredOnlyBeforeApproval() { String keyPersonCertDefferalParam = ProposalDevelopmentUtils.getProposalDevelopmentDocumentParameter( ProposalDevelopmentUtils.KEY_PERSON_CERTIFICATION_DEFERRAL_PARM); if (keyPersonCertDefferalParam.equalsIgnoreCase( ProposalDevelopmentConstants.ParameterValues.KEY_PERSON_CERTIFICATION_BEFORE_APPROVE)) { return true; } else { return false; } }