Monday, September 12, 2011

UCM 11g: Retreiving a Rendition Path within a Component

It's been a while since my last useful post, so here's a quick capture of a note that was worked out on the yahoo intradoc_users group. Bob was looking for a way to get the actual filesystem path to a native file. The LegacyDirectoryLocator class only worked out for legacy paths (i.e., without the additional dispersion paths that are enabled by default in newer Patch Set releases of UCM), but the below method seemed to work out:


That's the ticket, Ryan. Note that the method also needs an ExecutionContext arg. I have successfully retrieved a path string to the web viewable or the primary file, and successfully opened and read each:

String filePath = m_service.m_fileUtils.computeRenditionPath(serviceBinder,"webViewableFile",m_service.m_fileUtils.m_context);

String filePath = m_service.m_fileUtils.computeRenditionPath(serviceBinder,"primaryFile",m_service.m_fileUtils.m_context);

Thanks!
Bob Metzger

Ryan Sullivan - ECM Consultant <ecmconsultant@...> wrote:
>
> Hey there, Bob, give this a try.
>
>
>
> Register your service as a FileService so that your m_service obj will have
> access to the FileService classes. Then, try this:
>
>
>
> String rendition path =
> m_service.m_fileUtils.computeRenditionPath(serviceBinder,
> "webViewableFile");
>
>
>
> Where "serviceBinder" contains a DOC_INFO resultset for the item for which
> you're trying to get a path.
>
>
>
> I've used the "webViewableFile" string for a rendition and I do not know all
> of the possible options. Give "primaryFile" a shot to retrieve the Native
> rendition.
>
>
>
> You can also use this to get an IdcFileDescriptor obj which contains
> additional information about a specific rendition:
>
>
>
> IdcFileDescriptor ifd =
> m_service.m_fileUtils.createDescriptorForRendition(serviceBinder,"webViewabl
> eFile");
>
>
>
>
>
>
>
> Thanks,
>
> -ryan


I hope this helps out!
-ryan

No comments:

Post a Comment