[Registry-dev] Comment queries
Chathura C. Ekanayake
chathura at wso2.com
Thu Dec 13 20:44:27 PST 2007
Hi Jonathan,
As you have mentioned, you have to write SQL that return COMMENT.CM_IDs
to search for comments. Then you have specify the query return type as
"comments" in the query resource.
q1.setProperty(RegistryConstants.RESULT_TYPE_PROPERTY_NAME,
RegistryConstants.COMMENTS_RESULT_TYPE);
Once you execute the query, you will get a collection resource
containing paths of comment resources (Registry maps the comments as
resources). Then you can perform registry.get(...) on each of the
returned comment paths to get the matching comments as resources.
Comments are mapped to resources as follows:
resource content -> comment text
author -> commented user
created time -> commented time
resource.getProperty("resourcePath") -> path of the resource that is
commented using this comment
There is a test case, which demonstrate the comment queries in
org.wso2.registry.jdbc.JDBCRegistryTest.testUserDefinedCommentsQuery().
Thanks,
Chathura
Jonathan Marsh wrote:
>
> I’ve started to look at hooking up comment queries, e.g. comments from
> (user, everyone) containing (searchphrase).
>
> I’m not sure how executeQuery works with comments. If I write SQL that
> returns COMMENTS.CM_IDs will that work or does executeQuery only
> return resource paths? Once I get a CM_ID value, how do I look up the
> comment itself to find the time, author, artifact id, and comment text?
>
> *Jonathan Marsh* - http://www.wso2.com -
> http://auburnmarshes.spaces.live.com
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Registry-dev mailing list
> Registry-dev at wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/registry-dev
>
More information about the Registry-dev
mailing list