Page 1 of 1

Wiki report outdated

PostPosted:Mon Nov 12, 2012 10:52 am
by ciropom
Using the report http://wiki.openkm.com/images/f/f0/Lock ... ents.jrxml :

Application error
Class: bsh.EvalError
Message: Sourced file: inline evaluation of: ``import javax.jcr.*; import javax.jcr.query.*; import org.apache.jackrabbit.*; im . . . '' : Typed variable declaration : Attempt to resolve method: getSystemSession() on undefined variable or class name: DirectRepositoryModule
Date: Mon Nov 12 05:21:26 EST 2012

Code: Select all
2012-11-12 05:21:25,126 [http-bio-199.241.145.242-7070-exec-5] ERROR com.openkm.servlet.admin.ReportServlet - Sourced file: inline evaluation of: ``import javax.jcr.*; import javax.jcr.query.*; import org.apache
.jackrabbit.*; im . . . '' : Typed variable declaration : Attempt to resolve method: getSystemSession() on undefined variable or class name: DirectRepositoryModule
Sourced file: inline evaluation of: ``import javax.jcr.*; import javax.jcr.query.*; import org.apache.jackrabbit.*; im . . . '' : Typed variable declaration : Attempt to resolve method: getSystemSession() on und
efined variable or class name: DirectRepositoryModule : at Line: 9 : in file: inline evaluation of: ``import javax.jcr.*; import javax.jcr.query.*; import org.apache.jackrabbit.*; im . . . '' : DirectRepositoryM
odule .getSystemSession ( ) 

        at bsh.UtilEvalError.toEvalError(Unknown Source)
        at bsh.UtilEvalError.toEvalError(Unknown Source)
        at bsh.BSHMethodInvocation.eval(Unknown Source)
        at bsh.BSHPrimaryExpression.eval(Unknown Source)
        at bsh.BSHPrimaryExpression.eval(Unknown Source)
        at bsh.BSHVariableDeclarator.eval(Unknown Source)
        at bsh.BSHTypedVariableDeclaration.eval(Unknown Source)
        at bsh.Interpreter.eval(Unknown Source)
        at bsh.Interpreter.eval(Unknown Source)
        at bsh.Interpreter.eval(Unknown Source)
        at com.openkm.util.ReportUtils.generateReport(ReportUtils.java:159)
        at com.openkm.util.ReportUtils.execute(ReportUtils.java:364)
        at com.openkm.servlet.admin.ReportServlet.execute(ReportServlet.java:263)
        at com.openkm.servlet.admin.ReportServlet.doGet(ReportServlet.java:111)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
The behaviour is similar also for the report http://wiki.openkm.com/images/6/67/Subs ... ents.jrxml

Re: Wiki report outdated

PostPosted:Tue Nov 13, 2012 9:44 pm
by jllort
Not all 5.x reports are compatible with OpenKM 6.x ( I think you're using 5.x under 6.x ), confirm to me.

Re: Wiki report outdated

PostPosted:Wed Nov 14, 2012 7:31 am
by ciropom
I downloaded the sample reports from http://wiki.openkm.com/index.php/Reports
I tried also the parametric one (with .rep extension)
but also this one gives:
Code: Select all
Sourced file: inline evaluation of: ``import javax.jcr.*; import javax.jcr.util.*; import org.apache.jackrabbit.*; imp . . . '' : Typed variable declaration : Attempt to resolve method: getSystemSession() on undefined variable or class name: DirectRepositoryModule
when executed.
Maybe it should be specified in the wiki that the samples works only with version 5.x and lower..
There is some example for version 6.x?
What is the source of the problem here?

Thanks.

Re: Wiki report outdated

PostPosted:Thu Nov 15, 2012 10:50 pm
by jllort
I corrected to indicate that 5.x reports will not be executed under 6.x. I have oppened the tree first reports in wiki, in few days - when I got some extra time - will be all available without restrictions ( to change security restrictions I need some time ).

Re: Wiki report outdated

PostPosted:Sun Jan 06, 2013 4:48 pm
by lou1973
Hi wonderful OpenKM people!

In OpenKM 5.x I make extensive use of reports based on XPath queries.
Now OpenKM 6.x doesn't use Jackrabbit any more, so my scripts for executing XPath query doesn't work in version 6.x

The simplest example is your own example in the Wiki: http://wiki.openkm.com/index.php/Reports#XPath_Report

The important part is this:
Code: Select all
Session jcrSession = DirectRepositoryModule.getSystemSession();
Workspace workspace = jcrSession.getWorkspace();
QueryManager queryManager = workspace.getQueryManager();
Query query = queryManager.createQuery(statement, type);
QueryResult result = query.execute();
Please show me how to translate this to version 6.x ?

Thanks very much

Re: Wiki report outdated

PostPosted:Sun Jan 06, 2013 6:25 pm
by jllort
Here http://wiki.openkm.com/index.php/Utilities you can got actual basic report templates, in your case you should modify java.

To get administration privileges to should use systemToken not session
Code: Select all
String systemToken = DbSessionManager.getInstance().getSystemToken();
And always use query API ( like you can see in examples jrxml in the url )
Code: Select all
Map<String, String> properties = new HashMap<String, String>();
properties.put("okp:test.name", "some_value");
QueryParams queryParams = new QueryParams();
queryParams.setDomain(QueryParams.DOCUMENT);
queryParams.setProperties(properties);
Collection<QueryResult> results = OKMSearch.getInstance().find(null, queryParams);
Here can navigate across actual classes http://doxygen.openkm.com/6.2.x/

For your information I have pending task from last year that's make some video about how reports should be done.

Re: Wiki report outdated

PostPosted:Wed Jan 09, 2013 11:10 am
by lou1973
Hi thanks a lot for your reply.

In the new query API, is there a class which lets me run an XPath or SQL statement directly?
I did it in my OpenKM 5.x reports as follows:
Code: Select all
Query query = queryManager.createQuery(statement, type);
QueryResult result = query.execute();
where "type" is "xpath" or "sql",
and "statement" is the full SQL statement or XPath query string.

In OpenKM 5.x I have some beautiful (but complex) reports to retrieve metadata values,
and I'd like to re-use them again in version 6.x

Or is there another way to retrieve metadata values?

Thanks once again

Re: Wiki report outdated

PostPosted:Sat Jan 12, 2013 9:22 am
by jllort
You should take a look at actual SearchServlet.class
http://doxygen.openkm.com/6.2.x/db/d1c/ ... rvlet.html in this detailed description (http://doxygen.openkm.com/6.2.x/db/d1c/ ... rvlet.html) you can get full source code.

Actually all queries should be done with database structure ( althought you'll xpath will not be reusable at 6.x on future you'll see the actual database structure is more easy to be used to extract information ).