19 feb 2013

Using CMIS query with boolean metadata

Often we create boolean type metadata on WebCenter Content. This type of metadata in fact is an integer type metadata, but uses a system internal view called "YesNoView".

Check screenshots above to see the default configuration of this kind of metadata.



If we check the standard "Check-in" page, the metadata is represented with a "combo-box" input.





You can use this metatada to perform searchs over UCM and retrive the contents that are checked as "hidden" (in this example).


Since WebCenter PS3 was released, you can show content on WebCenter Portal/Spaces with "Content-Presenter (CP)" taskflow. This component shows contents stored at content server (UCM).

CP allows the user to define a query that searchs on content-server the items that matches your query. This is done over CMIS standard instead UCM query syntax.

Now, we try to add a content-presenter on a page, and query filtering with the new metadata (Hidden content). This is the CP wizard screenshot.


Remember to check that the new metadata is in "Filters" section. And save/close the wizard...

The system will show some error stacktrace, this is a summary

Caused by: oracle.webcenter.content.integration.RepositoryException: 19-feb-2013 17:00:46 oracle.webcenter.content.integration.spi.ucm.search.SearchService search
GRAVE: Se ha producido un error al buscar el repositorio ucm. Se ha recibido el código de estado -1 al llamar al servicio GET_SEARCH_RESULTS, como usuario weblogic y registro de hora 19/02/13 17:00. La búsqueda es Search[repositoryId=ucm, max to return=5, useFullTextSearch=true, useCache=true, sort="toProperty('dDocTitle') ASC", fullText="
 Metadata criteria((cm_contentType equals IDC:GlobalProfile)AND(xHiddenContent [any] equals true))
 isOr=false"] y la asignación de parámetros es {ResultCount=5, FolderPathInSearchResults=1, SortField=dDocTitle, IdcService=GET_SEARCH_RESULTS, SortOrder=ASC, vcrAppendObjectClassInfo=1, StartRow=1, QueryText=(xHiddenContent  `true`), vcrContentType=IDC:GlobalProfile}.


If you have installed WebCenter Spaces, we can try the Web-interface to test the CMIS queries. In my case I tried the following URLs:
  • http://owc:8888/rest/api/cmis/query/q/ucm?q=SELECT * FROM ora:t:IDC:GlobalProfile WHERE ora:p:xTuiHiddenContent = TRUE
  • http://owc:8888/rest/api/cmis/query/q/ucm?q=SELECT * FROM ora:t:IDC:GlobalProfile WHERE ora:p:xTuiHiddenContent = 1

And the following errors were launched

oracle.webcenter.content.integration.cmis.query.ParseException: Feb 19, 2013 5:19:27 PM oracle.webcenter.content.integration.cmis.query.VcrExpressionSearchDelegate fixLiteral
SEVERE: Comparing boolean property [xHiddenContent] to non-Boolean literal [1]


oracle.webcenter.content.integration.RepositoryException: Feb 19, 2013 5:19:33 PM oracle.webcenter.content.integration.spi.ucm.search.SearchService search
SEVERE: An error occurred when searching repository ucm.  When calling service GET_SEARCH_RESULTS, as user anonymous, at timestamp 2/19/13 5:19 PM, received status code -1.   The search was Search[repositoryId=ucm, max to return=26, useFullTextSearch=false, useCache=true, expr="(toProperty('xHiddenContent') == true && toProperty('cm_contentType') == 'IDC:GlobalProfile')"] and the parameter map was {ResultCount=26, FolderPathInSearchResults=1, SortField=dInDate, IdcService=GET_SEARCH_RESULTS, SortOrder=Desc, vcrAppendObjectClassInfo=1, StartRow=1, QueryText=(xHiddenContent  `1`), vcrContentType=IDC:GlobalProfile}.

To solve this, there is a workaround that we can do, without affecting the content already stored at UCM.

First create a table in UCM (using ConfigurationManager Applet), this table should have a structure similar to this one:



After that, we create a view that uses that table, similar to this one:



Next you should add the values for true/false.


And finally, attach the new view created to the metadata, replacing the system "YesNoView" with the "YesNoCustomView" just created.


Now, restart WebCenter Spaces and try with this URL:

  • http://owc:8888/rest/api/cmis/query/q/ucm?q=SELECT * FROM ora:t:IDC:GlobalProfile WHERE ora:p:xHiddenContent = 1
Now the query is correctly performed over CMIS standard. And if you try CP Wizard now also works without problems.

I hope this information helps on your project.

Related Information