OKMReport
Basics
You can set several reports formats based in document mime type:
Contants defined into Report class:
- Report.FORMAT_TEXT = "text/plain"
- Report.FORMAT_HTML = "text/html"
- Report.FORMAT_CSV = "text/csv"
- Report.FORMAT_PDF = "application/pdf"
- Report.FORMAT_RTF = "application/rtf"
- Report.FORMAT_ODT = "application/vnd.oasis.opendocument.text"
- Report.FORMAT_XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
- Report.FORMAT_DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
Methods
list
Description:
Method | Return values | Description |
---|---|---|
list(String token, boolean active) |
List<Report> |
Returns a list of reports. |
When variable active when is set to true will be returned only the active reports otherwise all the reports. |
Example:
package com.openkm;
import com.openkm.api.OKMReport;
import com.openkm.bean.Report;
public class Test {
public static void main(String[] args) {
try {
System.out.println(OKMReport.getInstance().list(null, true));
} catch (Exception e) {
e.printStackTrace();
}
}
}
get
Description:
Method | Return values | Description |
---|---|---|
get(String token, long rpId) |
Report |
Returns an object Report. |
The variable rpId is the long value used to identify the report. |
Example:
package com.openkm;
import com.openkm.api.OKMReport;
import com.openkm.bean.Report;
public class Test {
public static void main(String[] args) {
try {
System.out.println(OKMReport.getInstance().get(null, 1));
} catch (Exception e) {
e.printStackTrace();
}
}
}
execute
Description:
Method | Return values | Description |
---|---|---|
execute(String token, long rpId, Map<String, Object> params, String format) |
InputStream |
Returns the inputstream of the report. |
The variable rpId is the long value used to identify the report. |
Example:
package com.openkm;
import com.openkm.api.OKMReport;
import com.openkm.bean.Report;
import java.util;
public class Test {
public static void main(String[] args) {
try {
Map<String, Object> map = new HashMap(); // report parameters
InpustStream is = OKMReport.getInstance().execute(null, 1, map, Report.FORMAT_PDF));
} catch (Exception e) {
e.printStackTrace();
}
}
}