/** * Binds the model to the request attributes. * * @param enrollment the model to bind from * @param mv the model and view to bind to * @param readOnly true if the view is read only */ public void bindToPage( CMSUser user, EnrollmentType enrollment, Map<String, Object> mv, boolean readOnly) { attr(mv, "bound", "Y"); ProviderInformationType provider = XMLUtility.nsGetProvider(enrollment); AttachedDocumentsType attachments = XMLUtility.nsGetAttachments(provider); List<DocumentType> attachment = attachments.getAttachment(); for (DocumentType doc : attachment) { if (DocumentNames.COMMUNITY_HEALTH_BOARD_DHS_CONTRACT.value().equals(doc.getName())) { attr(mv, "dhsContract", doc.getObjectId()); } } FacilityCredentialsType creds = XMLUtility.nsGetFacilityCredentials(enrollment); attr(mv, "chbIndicator", creds.getCommunityHealthBoard()); }
/** * Binds the request to the model. * * @param enrollment the model to bind to * @param request the request containing the form fields * @throws BinderException if the format of the fields could not be bound properly */ @SuppressWarnings("unchecked") public List<BinderException> bindFromPage( CMSUser user, EnrollmentType enrollment, HttpServletRequest request) { ProviderInformationType provider = XMLUtility.nsGetProvider(enrollment); AttachedDocumentsType attachments = XMLUtility.nsGetAttachments(provider); String attachmentId = (String) request.getAttribute(NAMESPACE + "dhsContract"); if (attachmentId != null) { replaceDocument( attachments, attachmentId, DocumentNames.COMMUNITY_HEALTH_BOARD_DHS_CONTRACT.value()); } FacilityCredentialsType creds = XMLUtility.nsGetFacilityCredentials(enrollment); if (param(request, "chbIndicator") != null) { creds.setCommunityHealthBoard("Y"); } else { creds.setCommunityHealthBoard("N"); } return Collections.EMPTY_LIST; }