File tree Expand file tree Collapse file tree 2 files changed +20
-7
lines changed
api-2.0/src/main/java/org/openmrs/module/attachments/obs
omod-1.10/src/main/java/org/openmrs/module/attachments/rest Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 11package org .openmrs .module .attachments .obs ;
22
3+ import static org .openmrs .obs .ComplexObsHandler .RAW_VIEW ;
4+
5+ import org .apache .commons .logging .Log ;
6+ import org .apache .commons .logging .LogFactory ;
37import org .openmrs .Obs ;
48import org .openmrs .annotation .OpenmrsProfile ;
59import org .openmrs .api .ObsService ;
1216@ OpenmrsProfile (openmrsPlatformVersion = "2.0.0" )
1317public class ComplexViewHelper2_0 implements ComplexViewHelper {
1418
19+ private final Log log = LogFactory .getLog (getClass ());
20+
1521 @ Autowired
1622 private ObsService obsService ;
1723
1824 @ Override
1925 public String getView (Obs obs , String view ) {
2026
21- if (obsService .getHandler (obs ).supportsView (view )) {
27+ ComplexObsHandler handler = obsService .getHandler (obs );
28+
29+ if (handler .supportsView (view )) {
2230 return view ;
31+ } else {
32+ log .warn ("The requested view '" + view + "' is not supported by the complex obs handler '"
33+ + handler .getClass ().getCanonicalName () + "', reverting to the default view '" + RAW_VIEW + "'." );
2334 }
2435
25- return ComplexObsHandler . RAW_VIEW ;
36+ return RAW_VIEW ;
2637
2738 }
2839}
Original file line number Diff line number Diff line change 11package org .openmrs .module .attachments .rest ;
22
3+ import static org .openmrs .module .attachments .AttachmentsContext .getContentFamily ;
4+
5+ import java .io .IOException ;
6+
7+ import javax .servlet .http .HttpServletResponse ;
8+
39import org .apache .commons .io .FilenameUtils ;
410import org .apache .commons .logging .Log ;
511import org .apache .commons .logging .LogFactory ;
814import org .openmrs .module .attachments .AttachmentsConstants ;
915import org .openmrs .module .attachments .AttachmentsContext ;
1016import org .openmrs .module .attachments .obs .AttachmentComplexData ;
17+ import org .openmrs .module .attachments .obs .ComplexViewHelper ;
1118import org .openmrs .module .attachments .obs .ValueComplex ;
1219import org .openmrs .module .webservices .rest .web .RestConstants ;
1320import org .openmrs .module .webservices .rest .web .response .GenericRestException ;
2128import org .springframework .web .bind .annotation .RequestMethod ;
2229import org .springframework .web .bind .annotation .RequestParam ;
2330
24- import javax .servlet .http .HttpServletResponse ;
25- import java .io .IOException ;
26-
27- import static org .openmrs .module .attachments .AttachmentsContext .getContentFamily ;
28-
2931@ Controller
3032@ RequestMapping (value = "/rest/" + RestConstants .VERSION_1 + "/" + AttachmentsConstants .ATTACHMENT_URI )
3133public class AttachmentBytesResource1_10 extends BaseRestController {
You can’t perform that action at this time.
0 commit comments