Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dwh-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AKTIN
dwh-api
Commits
b071cfc8
Commit
b071cfc8
authored
Jan 10, 2017
by
R.W.Majeed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
report API updated
parent
e1cee569
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
116 additions
and
34 deletions
+116
-34
src/main/java/org/aktin/report/ArchivedReport.java
src/main/java/org/aktin/report/ArchivedReport.java
+9
-0
src/main/java/org/aktin/report/BasicReportInfo.java
src/main/java/org/aktin/report/BasicReportInfo.java
+36
-0
src/main/java/org/aktin/report/GeneratedReport.java
src/main/java/org/aktin/report/GeneratedReport.java
+1
-30
src/main/java/org/aktin/report/Report.java
src/main/java/org/aktin/report/Report.java
+5
-0
src/main/java/org/aktin/report/ReportArchive.java
src/main/java/org/aktin/report/ReportArchive.java
+7
-4
src/main/java/org/aktin/report/ReportInfo.java
src/main/java/org/aktin/report/ReportInfo.java
+36
-0
src/main/java/org/aktin/report/ReportManager.java
src/main/java/org/aktin/report/ReportManager.java
+22
-0
No files found.
src/main/java/org/aktin/report/ArchivedReport.java
View file @
b071cfc8
package
org.aktin.report
;
import
java.time.Instant
;
import
org.aktin.report.GeneratedReport
;
/**
...
...
@@ -8,10 +10,17 @@ import org.aktin.report.GeneratedReport;
*
*/
public
interface
ArchivedReport
extends
GeneratedReport
{
public
enum
Status
{
Waiting
,
Completed
,
Failed
}
/**
* Get the id of the generated report within the archive.
* @return unique id
*/
int
getId
();
String
getUserId
();
Instant
getCreatedTimestamp
();
Status
getStatus
();
}
src/main/java/org/aktin/report/BasicReportInfo.java
0 → 100644
View file @
b071cfc8
package
org.aktin.report
;
import
java.time.Instant
;
import
java.util.HashMap
;
import
java.util.Map
;
class
BasicReportInfo
implements
ReportInfo
{
private
Report
report
;
private
Instant
start
;
private
Instant
end
;
private
Map
<
String
,
String
>
prefs
;
public
BasicReportInfo
(
Report
report
,
Instant
startTime
,
Instant
endTime
){
this
.
report
=
report
;
this
.
start
=
startTime
;
this
.
end
=
endTime
;
this
.
prefs
=
new
HashMap
<>();
}
@Override
public
Instant
getStartTimestamp
()
{
return
start
;
}
@Override
public
Instant
getEndTimestamp
()
{
return
end
;
}
@Override
public
String
getTemplateId
()
{
return
report
.
getId
();
}
@Override
public
String
getTemplateVersion
()
{
return
report
.
getVersion
();
}
@Override
public
Map
<
String
,
String
>
getPreferences
()
{
return
prefs
;
}
}
src/main/java/org/aktin/report/GeneratedReport.java
View file @
b071cfc8
...
...
@@ -2,9 +2,8 @@ package org.aktin.report;
import
java.nio.file.Path
;
import
java.time.Instant
;
import
java.util.Map
;
public
interface
GeneratedReport
{
public
interface
GeneratedReport
extends
ReportInfo
{
/**
* Media Type (MIME) for the report data.
* @return media type
...
...
@@ -15,37 +14,9 @@ public interface GeneratedReport {
* @return path location of the report data.
*/
Path
getLocation
();
/**
* Start timestamp of the report interval
* @return timestamp
*/
Instant
getStartTimestamp
();
/**
* End timestamp of the report interval
* @return timestamp
*/
Instant
getEndTimestamp
();
/**
* Timestamp when the report was generated
* @return timestamp
*/
Instant
getDataTimestamp
();
/**
* Get the report template id. For the version, see {@link #getTemplateVersion()}.
* @return template id
*/
String
getTemplateId
();
/**
* Get the version string for the report template indicated by {@link #getTemplateId()}
* @return version string
*/
String
getTemplateVersion
();
/**
* Preferences used for the generation of the report. The preferences consist of
* key value pairs and include system preferences requested by the report template
* as well as configuration options which can be specified by the user (e.g. display
* configurations).
* @return preference map
*/
Map
<
String
,
String
>
getPreferences
();
}
src/main/java/org/aktin/report/Report.java
View file @
b071cfc8
...
...
@@ -3,6 +3,7 @@ package org.aktin.report;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.file.Path
;
import
java.time.Instant
;
import
java.time.Period
;
import
java.util.Arrays
;
...
...
@@ -108,6 +109,10 @@ public interface Report {
default
String
[]
getRequiredPreferenceKeys
(){
return
new
String
[]{};
}
default
ReportInfo
createReportInfo
(
Instant
start
,
Instant
end
){
return
new
BasicReportInfo
(
this
,
start
,
end
);
}
/**
* Copies all scripts and resource needed for the Rscript invocation
* to the specified working directory. The file names of all copied
...
...
src/main/java/org/aktin/report/ReportArchive.java
View file @
b071cfc8
...
...
@@ -11,14 +11,17 @@ import org.aktin.report.GeneratedReport;
*
*/
public
interface
ReportArchive
{
void
setReportFailure
(
int
id
,
Throwable
cause
)
throws
IOException
;
ArchivedReport
setReportResult
(
int
id
,
GeneratedReport
report
)
throws
IOException
;
/**
* Add a generated report to the archive. Returns unique id string.
* @param generated report
* Add a report to the archive. Returns unique id. The report may not have been generated yet.
* @param report report info to create
* @param userId user id
* @return report id within the archive
* @throws IOException if the report could not be added
*/
ArchivedReport
addReport
(
GeneratedReport
report
)
throws
IOException
;
ArchivedReport
addReport
(
ReportInfo
report
,
String
userId
)
throws
IOException
;
/**
* Retrieve a report by it's id
...
...
src/main/java/org/aktin/report/ReportInfo.java
0 → 100644
View file @
b071cfc8
package
org.aktin.report
;
import
java.time.Instant
;
import
java.util.Map
;
public
interface
ReportInfo
{
/**
* Start timestamp of the report interval
* @return timestamp
*/
Instant
getStartTimestamp
();
/**
* End timestamp of the report interval
* @return timestamp
*/
Instant
getEndTimestamp
();
/**
* Get the report template id. For the version, see {@link #getTemplateVersion()}.
* @return template id
*/
String
getTemplateId
();
/**
* Get the version string for the report template indicated by {@link #getTemplateId()}
* @return version string
*/
String
getTemplateVersion
();
/**
* Preferences used for the generation of the report. The preferences consist of
* key value pairs and include system preferences requested by the report template
* as well as configuration options which can be specified by the user (e.g. display
* configurations).
* @return preference map
*/
Map
<
String
,
String
>
getPreferences
();
}
src/main/java/org/aktin/report/ReportManager.java
View file @
b071cfc8
...
...
@@ -11,7 +11,29 @@ public interface ReportManager {
Report
getReport
(
String
id
);
/**
* Generate a report asynchronously.
*
* @param report report template
* @param fromTimestamp start timestamp
* @param endTimestamp end timestamp
* @param reportDestination destination for the generated report. Usually a file name.
* @return completable future receiving the report
* @throws IOException IO error
*/
@Deprecated
CompletableFuture
<?
extends
GeneratedReport
>
generateReport
(
Report
report
,
Instant
fromTimestamp
,
Instant
endTimestamp
,
Path
reportDestination
)
throws
IOException
;
/**
* Generate a report asynchronously.
*
* @param report report information
* @param reportDestination destination. Can be {@code null} to let the report manager create a temporary file/folder
* @return completable future
* @throws IOException IO Error
* @throws IllegalArgumentException if the reportInfo can not be used for report generation. e.g. a non-existing template id
*/
CompletableFuture
<?
extends
GeneratedReport
>
generateReport
(
ReportInfo
reportInfo
,
Path
reportDestination
)
throws
IOException
,
IllegalArgumentException
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment