Difference between revisions of "Reports"
From OpenKM Documentation
Line 14: | Line 14: | ||
Report can use internally Scripting or SQL. The file to uploading must be .jasper | Report can use internally Scripting or SQL. The file to uploading must be .jasper | ||
+ | If you want to create a report which uses an XPath query, use scripting to do the trick. This code will query for locked documents: | ||
+ | |||
+ | <source lang="java"> | ||
+ | import javax.jcr.*; | ||
+ | import javax.jcr.query.*; | ||
+ | import org.apache.jackrabbit.*; | ||
+ | import com.openkm.module.direct.*; | ||
+ | |||
+ | List al = new ArrayList (); | ||
+ | String statement = "/jcr:root/okm:root//element(*,okm:document)[@jcr:lockOwner]/@jcr:lockOwner"; | ||
+ | String type = "xpath"; | ||
+ | Session jcrSession = DirectRepositoryModule.getSystemSession(); | ||
+ | Workspace workspace = jcrSession.getWorkspace(); | ||
+ | QueryManager queryManager = workspace.getQueryManager(); | ||
+ | Query query = queryManager.createQuery(statement, type); | ||
+ | QueryResult result = query.execute(); | ||
+ | |||
+ | for (RowIterator it = result.getRows(); it.hasNext();) { | ||
+ | Map ld = new HashMap(); | ||
+ | javax.jcr.query.Row row = it.nextRow(); | ||
+ | javax.jcr.Value v = row.getValue(JcrConstants.JCR_LOCKOWNER); | ||
+ | ld.put("owner", v==null?"NULL":v.getString()); | ||
+ | v = row.getValue(JcrConstants.JCR_PATH); | ||
+ | ld.put("path", v==null?"NULL":v.getString()); | ||
+ | al.add(ld); | ||
+ | } | ||
+ | |||
+ | return al; | ||
+ | </source> | ||
[[Category: Administration Guide]] | [[Category: Administration Guide]] |
Revision as of 13:53, 25 January 2011
In Report view you can uploading your own jasper reports. Reports are in PDF format.
Add new report
Then make click new report icon
Report can use internally Scripting or SQL. The file to uploading must be .jasper
If you want to create a report which uses an XPath query, use scripting to do the trick. This code will query for locked documents:
import javax.jcr.*;
import javax.jcr.query.*;
import org.apache.jackrabbit.*;
import com.openkm.module.direct.*;
List al = new ArrayList ();
String statement = "/jcr:root/okm:root//element(*,okm:document)[@jcr:lockOwner]/@jcr:lockOwner";
String type = "xpath";
Session jcrSession = DirectRepositoryModule.getSystemSession();
Workspace workspace = jcrSession.getWorkspace();
QueryManager queryManager = workspace.getQueryManager();
Query query = queryManager.createQuery(statement, type);
QueryResult result = query.execute();
for (RowIterator it = result.getRows(); it.hasNext();) {
Map ld = new HashMap();
javax.jcr.query.Row row = it.nextRow();
javax.jcr.Value v = row.getValue(JcrConstants.JCR_LOCKOWNER);
ld.put("owner", v==null?"NULL":v.getString());
v = row.getValue(JcrConstants.JCR_PATH);
ld.put("path", v==null?"NULL":v.getString());
al.add(ld);
}
return al;