Skip to content

Commit 0e4f51d

Browse files
committed
Merge branch 'develop'
2 parents c503cdd + ac83fa3 commit 0e4f51d

File tree

125 files changed

+3145
-2328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+3145
-2328
lines changed

README.md

Lines changed: 103 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ Import/Export
17831783
###Export service
17841784
The export service works asynchronously: first you request the export with the desired options, then you monitor the state of the export, and finally you request the output file. You must be authenticated as the system admin (superuser) for the export services.
17851785
```java
1786-
OperationResult<StateDto> operationResult =
1786+
OperationResult<State> operationResult =
17871787
client
17881788
.authenticate("jasperadmin", "jasperadmin")
17891789
.exportService()
@@ -1793,19 +1793,64 @@ OperationResult<StateDto> operationResult =
17931793
.parameter(ExportParameter.EVERYTHING)
17941794
.create();
17951795

1796-
StateDto stateDto = operationResult.getEntity();
1796+
State state = operationResult.getEntity();
1797+
1798+
The export parameters you can specify are:
1799+
1800+
`everything `- export everything except audit data: all repository resources, permissions, report jobs, users, and roles. This option is equivalent to:--uris --repository-permissions --report-jobs --users --roles
1801+
(default value is false).
1802+
1803+
`repository-permissions `- when this option is present, repository permissions are exported along with each exported folder and resource. This option should only be used in conjunction with uris (default value is false).
1804+
1805+
`role-users `- when this option is present, each role export triggers the export of all users belonging to the role. This option should only be used in conjunction with --roles (default value is false).
1806+
1807+
`include-access-events `- access events (date, time, and user name of last modification) are exported (default value is false).
1808+
1809+
`include-audit-events `- include audit data for all resources and users in the export (default value is false).
1810+
1811+
`include-monitoring-events `- include monitoring events (default value is false).
1812+
1813+
`include-attributes `- include attributes in export (default value is false).
1814+
1815+
`skip-attribute-values `- skip attributes values to be exported (default value is false).
1816+
1817+
`include-server-settings` - include server settings in export(default value is false).
1818+
1819+
`skip-suborganizations `- if the parameter is set to true, the system will omit all the items(e.g. resources, user, roles, organizations) which belong to "sub organizations" even they are directly specified using corresponding options (default value is false).
1820+
1821+
`skip-dependent-resources `- skip dependent resources (domain, datasource etc.) to be exported (default value is false).
1822+
//TODO task
1823+
Also you can specify:
1824+
`uris` - list of folder or resource URIs in the repository to export.
1825+
`scheduledJobs` - list of repository report unit and folder URIs for which report unit jobs should be exported. For a folder URI, this option exports the scheduled jobs of all reports in the folder and all subfolders.
1826+
`roles` - list of roles to export.
1827+
`users` - list of users to export.
1828+
`resourceTypes` - list of resource types, that will be included in export. If the parameter is null or empty then will include all resource types.
1829+
`organization` - identifier of organization to export together with its sub organizations. If it is specified it also will be the root organization, starting from it system will export all resources, users, roles e.t.c.
1830+
1831+
```java
1832+
OperationResult<State> stateOperationResult = session
1833+
.exportService()
1834+
.newTask()
1835+
.uri("/temp/supermartDomain")
1836+
.user("jasperadmin")
1837+
.role("ROLE_USER")
1838+
.resourceTypes(asList("jdbcDataSource", "reportUnit", "file"))
1839+
.parameter(ExportParameter.EVERYTHING)
1840+
.create();
1841+
```
17971842
```
17981843
####Checking the Export State
17991844
After receiving the export ID, you can check the state of the export operation.
18001845
```java
1801-
OperationResult<StateDto> operationResult =
1846+
OperationResult<State> operationResult =
18021847
client
18031848
.authenticate("jasperadmin", "jasperadmin")
18041849
.exportService()
1805-
.task(stateDto.getId())
1850+
.task(state.getId())
18061851
.state();
18071852
1808-
StateDto state = operationResult.getEntity();
1853+
State state = operationResult.getEntity();
18091854
```
18101855
The body of the response contains the current state of the export operation.
18111856
####Fetching the Export Output
@@ -1815,7 +1860,7 @@ OperationResult<InputStream> operationResult1 =
18151860
client
18161861
.authenticate("jasperadmin", "jasperadmin")
18171862
.exportService()
1818-
.task(stateDto.getId())
1863+
.task(state.getId())
18191864
.fetch();
18201865

18211866
InputStream inputStream = operationResult1.getEntity();
@@ -1824,27 +1869,74 @@ InputStream inputStream = operationResult1.getEntity();
18241869
Use the following service to upload a catalog as a zip file and import it with the given options. Specify options as arguments from `com.jaspersoft.jasperserver.jaxrs.client.apiadapters.importexport.importservice.ImportParameter`. Arguments that are omitted are assumed to be false. You must be authenticated as the system admin (superuser) for the import service. Jaspersoft does not recommend uploading files greater than 2 gigabytes.
18251870
```java
18261871
URL url = ImportService.class.getClassLoader().getResource("testExportArchive.zip");
1827-
OperationResult<StateDto> operationResult =
1872+
OperationResult<State> operationResult =
18281873
client
18291874
.authenticate("jasperadmin", "jasperadmin")
18301875
.importService()
18311876
.newTask()
18321877
.parameter(ImportParameter.INCLUDE_ACCESS_EVENTS, true)
18331878
.create(new File(url.toURI()));
18341879

1835-
StateDto stateDto = operationResult.getEntity();
1880+
State state = operationResult.getEntity();
1881+
```
1882+
Available parameters are:
1883+
`includeAccessEvents` - access events (date, time, and user name of last modification) are exported (default value is false).
1884+
`includeAuditEvents` - include audit data for all resources and users in the export (default value is false).
1885+
`update` - resources in the catalog replace those in the repository if their URIs and typesmatch (default value is false).
1886+
`skipUserUpdate` - when used with --update, users in the catalog are not imported or updated. Use this option to import catalogs without overwriting currently defined user (default value is false).
1887+
`includeMonitoringEvents` - include monitoring events (default value is false).
1888+
`includeServerSettings` - include server settings (default value is false).
1889+
`mergeOrganization` - allows merging of exported organization/resource into organization with different identifier. In the case if it is false, then system will throw an exception, if exportedOrganizationId != organizationId_we_import_Into (default value is false).
1890+
`brokenDependencies` - defines strategy with broken dependencies. Available values are - fail, skip, include (default value is fail).
1891+
1892+
Also you can set:
1893+
`brokenDependencies` - defines strategy with broken dependencies. Available values are:
1894+
1895+
fail - server will give an error (errorCode=import.broken.dependencies) if import archive contain broken dependent resources.
1896+
skip - import will skip from import broken resources.
1897+
include - import will proceed with broken dependencies. In this case server will try to import broken dependent resources. a) In the case when in target environment there are already dependent resources import of target resource will be success, and resource will be skipped from import if there are no dependent resources to recover dependency chain.
1898+
`parameters` - list of import parameters.
1899+
`organization` - organization identifier we import into.
1900+
```java
1901+
18361902
```
18371903
####Checking the Import State
18381904
After receiving the import ID, you can check the state of the import operation.
18391905
```java
1840-
OperationResult<StateDto> operationResult =
1906+
OperationResult<State> operationResult =
18411907
client
18421908
.authenticate("jasperadmin", "jasperadmin")
18431909
.importService()
1844-
.task(stateDto.getId())
1910+
.task(state.getId())
18451911
.state();
18461912

1847-
StateDto state = operationResult.getEntity();
1913+
State state = operationResult.getEntity();
1914+
```
1915+
####Getting and restarting import task
1916+
1917+
To get import task metadata you can use next code example:
1918+
```java
1919+
OperationResult<State> operationResult = session
1920+
.importService()
1921+
.newTask()
1922+
.parameter(ImportParameter.INCLUDE_ACCESS_EVENTS, true)
1923+
.parameter(ImportParameter.UPDATE, true)
1924+
.create(new File("\\import.zip"));
1925+
State state = operationResult.getEntity();
1926+
1927+
ImportTask task = session
1928+
.importService()
1929+
.task(state.getId())
1930+
.getTask()
1931+
.getEntity();
1932+
```
1933+
Also you can restart import task:
1934+
```java
1935+
1936+
ImportTask task = importService.
1937+
task(state.getId())
1938+
.restartTask(new ImportTask().setBrokenDependencies("false"))
1939+
.getEntity();
18481940
```
18491941

18501942
####DomainMetadata Service

pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<dependency>
3939
<groupId>com.jaspersoft.jasperserver</groupId>
4040
<artifactId>jasperserver-dto</artifactId>
41-
<version>6.2.0</version>
41+
<version>6.2.1</version>
4242
</dependency>
4343

4444
<!-- Jersey-->
@@ -62,6 +62,11 @@
6262
<artifactId>jersey-media-json-jackson</artifactId>
6363
<version>2.22.1</version>
6464
</dependency>
65+
<dependency>
66+
<groupId>org.glassfish.jersey.media</groupId>
67+
<artifactId>jersey-media-jaxb</artifactId>
68+
<version>2.22.1</version>
69+
</dependency>
6570

6671
<!-- TestNG -->
6772
<dependency>

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/apiadapters/attributes/BatchAttributeAdapter.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.jaspersoft.jasperserver.jaxrs.client.core.exceptions.MandatoryParameterNotFoundException;
3333
import com.jaspersoft.jasperserver.jaxrs.client.core.exceptions.handling.DefaultErrorHandler;
3434
import com.jaspersoft.jasperserver.jaxrs.client.core.operationresult.OperationResult;
35+
import java.util.ArrayList;
3536
import java.util.Collection;
3637
import java.util.Iterator;
3738
import java.util.LinkedList;
@@ -47,27 +48,25 @@
4748
*/
4849
public class BatchAttributeAdapter extends AbstractAdapter {
4950

51+
public static final String SERVICE_URI = "attributes";
52+
private static final String SEPARATOR = "/";
5053
private MultivaluedMap<String, String> params = new MultivaluedHashMap<String, String>();
5154
private Boolean includePermissions = false;
52-
private String holderUri;
5355
private String userName;
5456
private String organizationId;
55-
private final String SEPARATOR = "/";
57+
private ArrayList<String> path = new ArrayList<String>();
5658

5759
public BatchAttributeAdapter(String organizationId, String userName, SessionStorage sessionStorage) {
5860
super(sessionStorage);
59-
StringBuilder builder = new StringBuilder(SEPARATOR);
61+
6062
if (!"/" .equals(organizationId) && organizationId != null) {
61-
builder.append("organizations/");
62-
builder.append(organizationId);
63-
builder.append(SEPARATOR);
63+
path.add("organizations");
64+
path.add(organizationId);
6465
}
6566
if (userName != null) {
66-
builder.append("users/");
67-
builder.append(userName);
68-
builder.append(SEPARATOR);
67+
path.add("users");
68+
path.add(userName);
6969
}
70-
this.holderUri = builder.toString();
7170
this.organizationId = organizationId;
7271
this.userName = userName;
7372
}
@@ -195,10 +194,11 @@ public void run() {
195194
}
196195

197196
private JerseyRequest<HypermediaAttributesListWrapper> buildRequest() {
197+
path.add(SERVICE_URI);
198198
JerseyRequest<HypermediaAttributesListWrapper> request = JerseyRequest.buildRequest(
199199
sessionStorage,
200200
HypermediaAttributesListWrapper.class,
201-
new String[]{holderUri, "attributes"}, new DefaultErrorHandler());
201+
path.toArray(new String[path.size()]), new DefaultErrorHandler());
202202
if (includePermissions) {
203203
request.setAccept(MimeTypeUtil.toCorrectAcceptMime(sessionStorage.getConfiguration(), "application/hal+{mime}"));
204204
request.addParam("_embedded", "permission");
@@ -211,7 +211,7 @@ private JerseyRequest<HypermediaAttributesListWrapper> buildSearchRequest() {
211211
JerseyRequest<HypermediaAttributesListWrapper> request = JerseyRequest.buildRequest(
212212
sessionStorage,
213213
HypermediaAttributesListWrapper.class,
214-
new String[]{"attributes"}, new DefaultErrorHandler());
214+
new String[]{SERVICE_URI}, new DefaultErrorHandler());
215215
if (includePermissions) {
216216
request.addParam("_embedded", "permission");
217217
}

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/apiadapters/attributes/SingleAttributeAdapter.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.jaspersoft.jasperserver.jaxrs.client.core.ThreadPoolUtil;
3232
import com.jaspersoft.jasperserver.jaxrs.client.core.exceptions.handling.DefaultErrorHandler;
3333
import com.jaspersoft.jasperserver.jaxrs.client.core.operationresult.OperationResult;
34+
import java.util.ArrayList;
3435

3536
/**
3637
* @author Alex Krasnyanskiy
@@ -40,24 +41,22 @@
4041

4142
public class SingleAttributeAdapter extends AbstractAdapter {
4243

43-
private String attributeName;
4444
private Boolean includePermissions = false;
45-
private String holderUri;
45+
private ArrayList<String> path = new ArrayList<String>();
4646

4747
public SingleAttributeAdapter(String organizationId, String userName, SessionStorage sessionStorage, String attributeName) {
4848
super(sessionStorage);
49-
StringBuilder builder = new StringBuilder("/");
49+
5050
if (!"/".equals(organizationId) && organizationId != null) {
51-
builder.append("organizations/");
52-
builder.append(organizationId);
53-
builder.append("/");
51+
path.add("organizations");
52+
path.add(organizationId);
5453
}
5554
if (userName != null) {
56-
builder.append("users/");
57-
builder.append(userName);
55+
path.add("users");
56+
path.add(userName);
5857
}
59-
this.holderUri = builder.toString();
60-
this.attributeName = attributeName;
58+
this.path.add("attributes");
59+
this.path.add(attributeName);
6160
}
6261

6362
public SingleAttributeAdapter setIncludePermissions(Boolean includePermissions) {
@@ -133,8 +132,9 @@ public void run() {
133132

134133
private JerseyRequest<HypermediaAttribute> buildRequest() {
135134

135+
String[] uri = path.toArray(new String[path.size()]);
136136
JerseyRequest<HypermediaAttribute> request = JerseyRequest.buildRequest(sessionStorage,HypermediaAttribute.class,
137-
new String[]{holderUri,"/attributes/",attributeName}, new DefaultErrorHandler());
137+
uri, new DefaultErrorHandler());
138138
if (includePermissions) {
139139
request.setAccept(MimeTypeUtil.toCorrectAcceptMime(sessionStorage.getConfiguration(), "application/hal+{mime}"));
140140
request.addParam("_embedded", "permission");

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/apiadapters/authority/organizations/BatchOrganizationsAdapter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
public class BatchOrganizationsAdapter extends AbstractAdapter {
3737

38+
public static final String SERVICE_URI = "organizations";
3839
private final MultivaluedMap<String, String> params;
3940

4041
public BatchOrganizationsAdapter(SessionStorage sessionStorage) {
@@ -75,7 +76,7 @@ public void run() {
7576

7677
private <T> JerseyRequest<T> buildRequest(Class<T> responseType) {
7778
return JerseyRequest.buildRequest(sessionStorage, responseType,
78-
new String[]{"/organizations"},
79+
new String[]{SERVICE_URI},
7980
new DefaultErrorHandler());
8081
}
8182
}

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/apiadapters/authority/organizations/SingleOrganizationAdapter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
public class SingleOrganizationAdapter extends AbstractAdapter {
3737

38+
public static final String SERVICE_URI = "organizations";
3839
private final ClientTenant clientTenant;
3940
private final MultivaluedHashMap<String, String> params;
4041

@@ -127,7 +128,7 @@ private JerseyRequest<ClientTenant> buildRequest() {
127128
return JerseyRequest.buildRequest(
128129
sessionStorage,
129130
ClientTenant.class,
130-
new String[]{"/organizations",
131+
new String[]{SERVICE_URI,
131132
(clientTenant.getId() == null) ? clientTenant.getAlias() : clientTenant.getId()},
132133
new DefaultErrorHandler()
133134
);
@@ -137,7 +138,7 @@ private JerseyRequest<ClientTenant> request() {
137138
return JerseyRequest.buildRequest(
138139
sessionStorage,
139140
ClientTenant.class,
140-
new String[]{"/organizations"},
141+
new String[]{SERVICE_URI},
141142
new DefaultErrorHandler()
142143
);
143144
}

0 commit comments

Comments
 (0)