Monday, October 29, 2012

Digging into the Back of the Closet… How Can I Retrieve Content That’s Not the Latest Revision?


This question periodically comes up in forum posts.  The poster is usually looking to search through ALL revisions of content.

Content Server doesn’t work that way.  When using GET_SEARCH_RESULTS, only the latest released content is searched and returned.

If the need is to only search metadata about an older item, and not the full text of the content, a pretty nice workaround can be used. 

Content Server operates under the covers with some type of SQL query, and a piece of logic called a “data source”.  The concept can be leveraged for this scenario by using an out of the box Content Server service called “GET_DATARESULTSET”. http://docs.oracle.com/cd/E14571_01/doc.1111/e11011/c05_core002.htm#BABDCGHD

A basic knowledge of the database tables is necessary, and a working knowledge of the available data sources is required.

The documentation describes the service as below.


GET_DATARESULTSET

This service executes a Select query against the database. The query is built from the dataSource parameter. The service returns the following information:
  • The resultset containing the results of the query.
  • An indication if the results were truncated. If the dataSource was defined so it cannot exceed the maximum number of rows and if the query returns more than the maximum allowed, the copyAborted key is set to 1 (true). This indicates that the returned resultset only contains a subset of the query.
Any query that tries to select against certain core Content Server tables have a security clause applied. In particular, Documents, Revisions, and Users tables have extra security clauses applied.

Location: IdcHomeDir/resources/core/templates/std_services.htm

Additional Required Service Parameters

  • dataSource: A Select query with a potential WHERE clause and ORDER BY clause that is provided by the caller. The dataSource is a Content Server resource, defined in the DataSources table (see the resource.htm file for the standard list of dataSources.)
Optional Service Parameters

  • whereClause: The WHERE clause to the Select query.
  • orderClause: If set to true, orders the query by clause.
  • resultName: specifies the name to use for the resultset of the query.



As a very basic example, the following shows how to retrieve content that is NOT the latest revision of a given content item from a URL (replace <the content id> with a valid content id):


IdcService=GET_DATARESULTSET&dataSource=Documents&whereClause=dRevRank>0 and Revisions.dDocName='<the content id>'&resultName=MyOldResults&IsSoap=1


Adding “IsSoap” to the URL forces the return of the response in a SOAP format, because the service does not have a template page associated with it.  (Otherwise an error is thrown.)  If you look in the result set “MyOldResults”, the information about the old revisions is shown.  It’s now a simple matter to construct a GET_FILE service call to retrieve the old item.

RIDC would look something like this:


binder.putLocal("IdcService","GET_DATARESULTSET");
binder.putLocal("dataSource","Documents");
binder.putLocal("whereClause","dRevRank>0 and Revisions.dDocName='<the content id>'");
binder.putLocal("resultName","MyOldResults");
ServiceResponse response = client.sendRequest(userContext, binder);


The caveats are:
  • The number of results returned is limited to the system’s MaxResults setting.
  • The results returned are restricted to the user’s security privilege.  This is a GOOD caveat, as this isn’t a back door to retrieve content.




18 comments:

  1. A Select query with a proper potential WHERE clause and ORDER BY clause that is provided by the upcoming caller. The dataSource is a Content Server resource, defined in the DataSources table

    ReplyDelete
  2. Shop Online at BangJackets.com for Best Quality Cowhide, Sheepskin, Lambskin 100% Genuine Leather Jackets and Coats One Of The Top Rated 100% Genuine Leather Outfits Online Store.

    Other Relevant Links Pages:
    Bang Jackets !! Mens Jackets !! Womens Jackets !! Movies Jackets !! Mens Cafe Racer Jackets !! Mens Slim Fit Jackets !! Mens Celebrity Jackets !! Mens Winter Jackets !! Womens Motorcycle Jackets !! Womens Winter Coats !!

    ReplyDelete
  3. This piece explicitly states each logical premise in order, allowing them to build to their conclusion. Evidence is provided for each premise.

    ReplyDelete
  4. Thousands of years ago, only aristocrats who didn’t have to work hard in the field could afford to have thai mail order brides soft pale skin. Today, any girl can take proper care of her skin, and so they do, – because the stereotype persists. They use plenty of natural cosmetics and avoid being in the sun to preserve their smooth skin that is so desired by Western gentlemen.

    ReplyDelete
  5. Content is the information and experiences; directed at an end-user or audience in publishing, art, and communication. Content is delivered via different media including, the Internet, cinema, television, radio, smartphones, audio CDs, books, e-books, magazines, and live events.

    ReplyDelete
  6. My brother suggested I might like this web site. He was entirely right. This post actually made my day. You cann’t imagine simply how much time I had spent for this information! Thanks!

    ReplyDelete
  7. the process of changing a document, book, etc. in order to improve it, correct mistakes, or make it contain the most recent information: New software will enable 1,000 new word revisions to be added online to the dictionary every three months.

    ReplyDelete
  8. The most dependable paper composing administration is where you can pay somebody to compose your paper. We are giving top composing administrations to help understudies in accomplishing high grades by submitting great papers. We've been in this business for quite a while.

    ReplyDelete
  9. The style absolutely superb. These types of tiny facts usually are fashioned using lots of story practical knowledge. I'd prefer everthing appreciably nytimes wordle

    ReplyDelete
  10. By doing this, we can guaranteeEarthwork service texas in houston that your project will be completed in accordance with your specifications, on time, and within your budget.

    ReplyDelete
  11. Arix Digital's engineers and E-commerce web development dubaistrategists are motivated people who work to perfect mission-critical software solutions.

    ReplyDelete
  12. From the first mouthful, you'll best chocolate in saudibe hooked on our assortment of delicious chocolates.

    ReplyDelete
  13. which can be played on a range404 tournament in Dubai of platforms, including PCs and mobile devices, will be featured in the tournament.

    ReplyDelete
  14. Great article Lot’s of information to Read…Great Keep Posting and update to People..Thanks

    ReplyDelete