Sergiu Dumitriu,
Using this tip, i had print the className and got this result :
System.out.println("search return (" + searchResult.getClass() + ")");
[stdout] search return (class [Ljava.lang.Object;)
I was wrong because i was thinking that this was a basic Object but
it's an array of Object (not a List)...
So proceeding this way i got my array of results (Map []) with
confluence "SearchResult" attributes)
Here is a sample wich display the first result title (assume that
there is one result) :
Object searchResult = client.execute("confluence1.search",
new Object[] { p_token, p_query, new Integer(p_maxResults) });
// System.out.println("search return (" + searchResult.getClass() + ")");
// searchResult != null
Object[] searchResults = (Object[]) searchResult;
// searchResult != null && searchResults.length > 0
String firstObjectTitle = (String) ((Map)searchResults[0]).get("title");
System.out.println("firstObjectTitle =" + firstObjectTitle);
Relevant (confluence) SearchResult attributes :
Key Type Value
title String the feed's title
url String the remote URL needed to view this search result online
excerpt String a short excerpt of this result if it makes sense
type String the type of this result - page, comment, spacedesc,
attachment, userinfo, blogpost
id String the long ID of this result (if the type has one)
FYI, here is a test result :
[stdout] search return (class [Ljava.lang.Object;)
[stdout] firstObjectTitle=Main.WebHome
[stdout] firstObjectUrl=
[stdout] firstObjectExcerpt=
[stdout] firstObjectType=pageid
[stdout] firstObjectId=Main.WebHome
Thanks :)
Regards
Brice Vandeputte
-----Message d'origine-----
De : users-bounces(a)xwiki.org [mailto:users-bounces@xwiki.org] De la
part de Sergiu Dumitriu
Envoyé : jeudi 6 novembre 2008 04:53
À : XWiki Users
Objet : Re: [xwiki-users] [XML/RPC] trying execute
"confluence1.search"without success
VANDEPUTTE Brice ITLABS wrote:
> Hi all,
>
> i'm trying to create a Java XML-RPC Client of my Xwiki instance
> (for now i'm using xwikie1_6m2)
>
> Documentation used :
> - Xwiki XML/RPC doc :
> http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPC
> - Confluence API Specification :
> http://confluence.atlassian.com/display/DOC/Remote+API+Specification
>
> I success with this methods : confluence1.login,
> confluence1.logout, confluence1.getPage, confluence1.storePage,
> confluence1.renderContent
>
> but i got a problem with this one : confluence1.search
>
> Confluence API talk about two ways to use search :
> 1) Vector search(String token, String query, int maxResults) -
> return a list of SearchResults which match a given search query
> (including pages and other content types). This is the same as a
> performing a parameterised search (see below) with an empty
> parameter map.
>
> 2) Vector search(String token, String query, Map parameters, int
> maxResults) - (since 1.3) like the previous search, but you can
> optionally limit your search by adding parameters to the parameter
> map. If you do not include a parameter, the default is used instead.
>
> The second way (with parameters) is not implemented on Xwiki (cf.
> http://jira.xwiki.org/jira/browse/XWIKI-1559 )
>
> So how must we use the first search method (without Map parameters) ?
>
> I'm trying this :
> Vector searchResult = (Vector) client.execute("confluence1.search",
> new Object[] { p_token, p_query,new Integer(p_maxResults) });
> This code return a "ClassCastException" : it's like the returned
> object were not a "Vector".. If then what is it ?
>
I don't know what it is. In Java, the method returns List<String>. To
see what you have there, just use reflection:
Object searchResult = client.execute...
System.out.println(searchResult.getClass())
// Or whatever logging method you use
This will print the exact classname, and from there you can procede further.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
Hi,
trying to get the Excel-Plugin to work. I followed the intructions (hope so)
but I it doesn't seem to work.
XWiki-Enterprises 1.6.1
Java-Version 1.6.0-b09
Excel Plugin 1.0-jdk16
Java Excel API 2.6.9
The Excel file was created with Office 2007 and saved
http://n2.nabble.com/file/n1449684/error.txt error.txt
The error code is:
Error number 4001 in 4: Error while parsing velocity page
Main.WikiHelpInsertExcel Wrapped Exception: Failed to evaluate content with
id Wiki Help Insert Excel
The whole error message is attached.
--
View this message in context: http://n2.nabble.com/Excel-Plugin-not-working-tp1449684p1449684.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi all,
i'm trying to create a Java XML-RPC Client of my Xwiki instance (for
now i'm using xwikie1_6m2)
Documentation used :
- Xwiki XML/RPC doc :
http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPC
- Confluence API Specification :
http://confluence.atlassian.com/display/DOC/Remote+API+Specification
I success with this methods : confluence1.login, confluence1.logout,
confluence1.getPage, confluence1.storePage, confluence1.renderContent
but i got a problem with this one : confluence1.search
Confluence API talk about two ways to use search :
1) Vector search(String token, String query, int maxResults) - return
a list of SearchResults which match a given search query (including
pages and other content types). This is the same as a performing a
parameterised search (see below) with an empty parameter map.
2) Vector search(String token, String query, Map parameters, int
maxResults) - (since 1.3) like the previous search, but you can
optionally limit your search by adding parameters to the parameter
map. If you do not include a parameter, the default is used instead.
The second way (with parameters) is not implemented on Xwiki (cf.
http://jira.xwiki.org/jira/browse/XWIKI-1559 )
So how must we use the first search method (without Map parameters) ?
I'm trying this :
Vector searchResult = (Vector) client.execute("confluence1.search",
new Object[] { p_token, p_query,new Integer(p_maxResults) });
This code return a "ClassCastException" : it's like the returned
object were not a "Vector".. If then what is it ?
Could you help me ?
It's a great feature !
Regards
Brice Vandeputte
Tried looking for ApplicationResources
Where would I find it please
PS sorry I emailed you Sergiu - was supposed to go ti xwikiUsers, not you!
>These are localizable resources, which are defined in
>ApplicationResources.properties. You could just write the text, without
>using $msg.get.
Hello again,
Quick question, regarding the built-in 'Tags' page, that builds a list of
all the tags being used in the XWiki instance.
I would like to have this list being rendered in alphabetical order, instead
of in a random order (or by creation date), but all the 'order by' clauses
I've tried have either not worked at all, not worked in the desired mannor,
or thrown exceptions.
The HQL statement provided by XWiki is as follows:
#set($sql = "select distinct elements(prop.list) from BaseObject as obj,
DBStringListProperty as prop where obj.className='XWiki.TagClass' and
obj.id=prop.id.id and prop.id.name='tags' order by obj asc")
And I've tried the following 'order by' clauses:
order by obj.name asc
order by obj.fullName asc
order by obj asc
order by doc.name asc
order by doc.fullName asc
order by doc asc
order by prop asc
order by prop.value asc
None of these seem to produce the list in alphabetical order, although some
of them do change the order in which the tags are displayed. Any ideas on
how to get this order by clause working to produce the tag list in
alphabetical order?
I have a feeling my difficulty lies in that the property is a
DBStringListProperty in the database, but I'm not sure how to work with
these.
Thanks ahead of time guys.
--
View this message in context: http://n2.nabble.com/Help-with-%27order-by%27-clause-in-HQL-tp1455693p14556…
Sent from the XWiki- Users mailing list archive at Nabble.com.
Hello,
I'm trying to work with the content of wiki page in my plugin Api. I can
access the content through method getContent() called with XWikiDocument.
However I have an object added to the page and I'm using
#includeForm("XWiki.PersonClassSheet")
and this is the problem, because with method getContent() I get literally
"#includeForm("XWiki.PersonClassSheet")"...
Is there any way to get exactly what I see on the page? For example instead
of
#includeForm("XWiki.PersonClassSheet")
I want to see "John Smith" (or whatever I will define in the ClassSheet)?
--
View this message in context: http://n2.nabble.com/How-to-get-%22real%22-content-of-wiki-page-in-plugin-A…
Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi
I have installed the windows standard xwiki with jetty and a HSQLDB
database. I have to edit the user registration to collect some different
info. THis will mean editing the database, probably adding some fields. I
have used mysql and phpmyadmin quite a lot.
Could somebody please point me somewhere that will tell me how to get
started on using the adding fields, etc to the database?
Hi all,
I'm having trouble using Velocity to analyze the boolean value of a property
of a class.
For example, I have class X, with a property Y (I'll call this property
'example_bool' in the lower example code) which is of type 'Boolean'. I've
configured this property to use radio buttons so the user is only able to
choose one value. I've created several objects of this class, making sure
to utilize both the 'Yes' and 'No' values for some of these objects (to
ensure for testing purposes I have some of both).
This class also has another property, a static list, of location strings,
such as 'Location X', 'Location Y', etc.
Now, on a page, I am trying to calculate how many of each location have the
boolean value of Yes and no with the following velocity/HQL statement:
#set ($results = $xwiki.search("select obj.name from BaseObject obj,
StringProperty prop where obj.className='Example.ExampleClass' and
obj.name<>'Example.ExampleClassTemplate' and prop.id.id=obj.id and
prop.name='location' and prop.value='Location X' order by obj.name asc"))
#set ($numTrue = 0)
#set ($numFalse = 0)
#foreach ($item in $results)
#set ($object = $xwiki.getDocument(${item}))
#if (!$object.get("example_bool"))
#set ($numFalse = $numFalse + 1)
#else
#set ($numTrue = $numTrue + 1)
#end
#end
This code is being executed without error, however, the 'True' count is
always being evaluated as the total number of objects, while the 'False'
count always stays at 0, even though I KNOW there are objects in this group
that have the value of 'No' for the 'example_bool' property.
Does anyone know what I'm doing wrong, or have any ideas that might help me
out? Thanks in advance gang.
On a side note, I've also noted that when using the Boolean property, the
user has the choice of 'Yes', 'No' and '---'. What is this later value
('---') and why is it always included? To me, the meaning of Boolean means
'True OR False' and nothing else. Does this third value have a purpose?
And is there a way of excluding it from the choices the user sees?
Thanks again everyone!
--
View this message in context: http://n2.nabble.com/Trouble-assessing-boolean-property-value-of-an-object-…
Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi
We are getting data from external system on to a database, we want to show
that in the form of a list (with pagination), what is the right approach to
do this?
1. HQL with Velocity?
2. Any other options?
--
View this message in context: http://n2.nabble.com/Best-Practise%3A-Showing-the-data-from-DB-tp1453768p14…
Sent from the XWiki- Users mailing list archive at Nabble.com.