While exploring options to develop an upload-to-database feature, I came across repeated suggestions that using Oracle MultiMedia (previously InterMedia) datatypes (OrdDoc, OrdImage, etc.) was the way to go. A few forums started me off in the right direction. This one for e.g. However, it wasn’t as straightforward to get it working especially given that there was no documentation whatsoever around OrdDomain types in the Fusion guides. So these are the steps that need to be done.
- Configure the OrdPlayMediaServlet in your web.xml and map it to the url-pattern “ordDeliveryMedia”
<servlet> <servlet-name>ordPlayMediaServlet</servlet-name> <servlet-class>oracle.ord.html.OrdPlayMediaServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>ordPlayMediaServlet</servlet-name> <url-pattern>ordDeliveryMedia</url-pattern> </servlet-mapping> - Map the adfBindings filter to this servlet
<filter-mapping> <filter-name>adfBindings</filter-name> <servlet-name>ordPlayMediaServlet</servlet-name> </filter-mapping> -
Ensure that the entity uses the Ord types – oracle.ord.im.OrdDocDomain, oracle.ord.im.OrdImage, etc. – for the document attribute. I had JDeveloper go crazy on me a few times when it automatically created some custom domain types for the “ORDSYS.ORDDOC” column. These were unusable as they exposed only the metadata related to the Ord type – mime type, location, etc. I don’t know what triggered that behaviour but after deleting and recreating some of the objects it was alright.
- Set the usesUpload attribute on the af:form to true.
- Create the inputFile element and bind it to the view attribute. For e.g #{bindings.Doc.inputValue}
- Add the binding:convertOrdDomain converter to the inputFile. To do this, first
a) Add the BC4J HTML library to the ViewController Project and
b) add the “ADF Faces Bindings 1.0″ tag library to the component palette.<af:inputFile value="#{bindings.Doc.inputValue}" label="#{bindings.Doc.hints.label}" required="#{bindings.Doc.hints.mandatory}" columns="#{bindings.Doc.hints.displayWidth}" shortDesc="#{bindings.Doc.hints.tooltip}" id="it2"> <f:validator binding="#{bindings.Doc.validator}"/> <binding:convertOrdDomain bindingRef="#{bindings.Doc}"/> </af:inputFile> -
In the pageDef, set the CustomInputHandler for the view object attribute binding to OrdDomainValueHandler
<attributeValues IterBinding="TestDocView1Iterator" id="Doc" CustomInputHandler="OrdDomainValueHandler"> <AttrNames> <Item Value="Doc"/> </AttrNames> </attributeValues>
Recent Comments