11package org .openmrs .module .attachments .web .controller ;
22
3+ import static org .openmrs .module .attachments .AttachmentsContext .getContentFamily ;
4+
5+ import java .io .IOException ;
6+ import java .util .Iterator ;
7+
8+ import javax .servlet .http .HttpServletResponse ;
9+
310import org .apache .commons .lang .StringUtils ;
411import org .apache .commons .logging .Log ;
512import org .apache .commons .logging .LogFactory ;
13+ import org .openmrs .Encounter ;
614import org .openmrs .Obs ;
715import org .openmrs .Patient ;
816import org .openmrs .Provider ;
917import org .openmrs .Visit ;
10- import org .openmrs .Encounter ;
1118import org .openmrs .module .attachments .AttachmentsConstants ;
1219import org .openmrs .module .attachments .AttachmentsContext ;
1320import org .openmrs .module .attachments .ComplexObsSaver ;
1421import org .openmrs .module .attachments .VisitCompatibility ;
1522import org .openmrs .module .attachments .obs .AttachmentComplexData ;
23+ import org .openmrs .module .attachments .obs .ComplexViewHelper ;
1624import org .openmrs .module .attachments .obs .ValueComplex ;
1725import org .openmrs .module .attachments .rest .AttachmentBytesResource1_10 ;
1826import org .openmrs .module .webservices .rest .web .ConversionUtil ;
2836import org .springframework .web .multipart .MultipartFile ;
2937import org .springframework .web .multipart .MultipartHttpServletRequest ;
3038
31- import javax .servlet .http .HttpServletResponse ;
32- import java .io .IOException ;
33- import java .util .Iterator ;
34-
35- import static org .openmrs .module .attachments .AttachmentsContext .getContentFamily ;
36-
3739/*
3840 * @Deprecated and replaced by
3941 * {@link org.openmrs.module.attachments.rest.AttachmentBytesResource1_10 AttachmentBytesResource}
@@ -56,6 +58,10 @@ public class AttachmentsController {
5658 @ Qualifier (AttachmentsConstants .COMPONENT_COMPLEXOBS_SAVER )
5759 protected ComplexObsSaver obsSaver ;
5860
61+ @ Autowired
62+ @ Qualifier (AttachmentsConstants .COMPONENT_COMPLEXVIEW_HELPER )
63+ protected ComplexViewHelper complexViewHelper ;
64+
5965 protected final Log log = LogFactory .getLog (getClass ());
6066
6167 @ RequestMapping (value = AttachmentsConstants .LEGACY_UPLOAD_ATTACHMENT_URL , method = RequestMethod .POST )
@@ -110,7 +116,7 @@ public void downloadDocument(@RequestParam("obs") String obsUuid,
110116
111117 // Getting the Core/Platform complex data object
112118 Obs obs = context .getObsService ().getObsByUuid (obsUuid );
113- Obs complexObs = context .getObsService ().getComplexObs (obs .getObsId (), view );
119+ Obs complexObs = context .getObsService ().getComplexObs (obs .getObsId (), complexViewHelper . getView ( obs , view ) );
114120 ComplexData complexData = complexObs .getComplexData ();
115121
116122 // Switching to our complex data object
0 commit comments