protected FormGenerationResult generateAndValidateForms(Forms forms,
			List<AttachmentData> attList, ProposalDevelopmentDocumentContract pdDoc) throws S2SException {
		boolean validationSucceeded = true;
		DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
		List<? extends S2sOppFormsContract> opportunityForms = developmentProposal.getS2sOppForms();

		if (attList == null) {
		    attList = new ArrayList<>();
		}

        List<AuditError> auditErrors = new ArrayList<>();
        getNarrativeService().deleteSystemGeneratedNarratives(pdDoc.getDevelopmentProposal().getNarratives());
		for (S2sOppFormsContract opportunityForm : opportunityForms) {
			if (!opportunityForm.getInclude()) {
				continue;
			}
            FormMappingInfo info = formMappingService.getFormInfo(opportunityForm.getOppNameSpace(),developmentProposal.getProposalNumber());
            if(info==null) continue;
			String namespace = info.getNameSpace();
            S2SFormGenerator s2sFormGenerator = s2SFormGeneratorService.getS2SGenerator(developmentProposal.getProposalNumber(),namespace);
			try {
				XmlObject formObject = s2sFormGenerator.getFormObject(pdDoc);
                auditErrors.addAll(s2sFormGenerator.getAuditErrors());
				if (s2SValidatorService.validate(formObject, auditErrors, info.getFormName())) {
					if (forms != null) {
						setFormObject(forms, formObject);
					}
				} else {
					validationSucceeded = false;
				}
				attList.addAll(s2sFormGenerator.getAttachments());
			} catch (Exception ex) {
				LOG.error(
						"Unknown error from " + opportunityForm.getFormName(),
						ex);
				throw new S2SException("Could not generate form for "
						+ opportunityForm.getFormName(), ex);
			}
		}
        FormGenerationResult result = new FormGenerationResult();
        result.setValid(validationSucceeded);
        result.setErrors(auditErrors);
        result.setAttachments(attList);
		return result;
	}
protected FormGenerationResult generateAndValidateForms ( Forms forms , List < AttachmentData > attList , ProposalDevelopmentDocumentContract pdDoc ) throws S2SException { boolean validationSucceeded = true ; DevelopmentProposalContract developmentProposal = pdDoc . getDevelopmentProposal ( ) ; List < ? extends S2sOppFormsContract > opportunityForms = developmentProposal . getS2sOppForms ( ) ; if ( attList == null ) { attList = new ArrayList < > ( ) ; } List < AuditError > auditErrors = new ArrayList < > ( ) ; getNarrativeService ( ) . deleteSystemGeneratedNarratives ( pdDoc . getDevelopmentProposal ( ) . getNarratives ( ) ) ; for ( S2sOppFormsContract opportunityForm : opportunityForms ) { if ( ! opportunityForm . getInclude ( ) ) { continue ; } FormMappingInfo info = formMappingService . getFormInfo ( opportunityForm . getOppNameSpace ( ) , developmentProposal . getProposalNumber ( ) ) ; if ( info == null ) continue ; String namespace = info . getNameSpace ( ) ; S2SFormGenerator s2sFormGenerator = s2SFormGeneratorService . getS2SGenerator ( developmentProposal . getProposalNumber ( ) , namespace ) ; try { XmlObject formObject = s2sFormGenerator . getFormObject ( pdDoc ) ; auditErrors . addAll ( s2sFormGenerator . getAuditErrors ( ) ) ; if ( s2SValidatorService . validate ( formObject , auditErrors , info . getFormName ( ) ) ) { if ( forms != null ) { setFormObject ( forms , formObject ) ; } } else { validationSucceeded = false ; } attList . addAll ( s2sFormGenerator . getAttachments ( ) ) ; } catch ( Exception ex ) { LOG . error ( "Unknown error from " + opportunityForm . getFormName ( ) , ex ) ; throw new S2SException ( "Could not generate form for " + opportunityForm . getFormName ( ) , ex ) ; } } FormGenerationResult result = new FormGenerationResult ( ) ; result . setValid ( validationSucceeded ) ; result . setErrors ( auditErrors ) ; result . setAttachments ( attList ) ; return result ; }
This method is to generate and validate the generated forms.

@param forms
Forms
@param attList
List of attachments.
@param pdDoc
Proposal Development Document.