• Wiki report outdated

  • He we will discuss about how to make customization and improvement to the OpenKM source code.
He we will discuss about how to make customization and improvement to the OpenKM source code.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #19288  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
 #19309  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.
 #19311  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.
 #19341  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 ).
 #20603  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
 #20612  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.
 #20656  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
 #20713  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 ).

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.