Skip to content

Commit da227ba

Browse files
author
TanyaEf
committed
1. Updated JerseyRequest
2. Updated Settings DTOs
1 parent d4e3e7d commit da227ba

File tree

15 files changed

+112
-107
lines changed

15 files changed

+112
-107
lines changed

src/integration-test/java/com/jaspersoft/jasperserver/jaxrs/client/apiadapters/authority/users/UsersServiceIT.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package jaspersoft.jasperserver.jaxrs.client.apiadapters.authority.users;
1+
package com.jaspersoft.jasperserver.jaxrs.client.apiadapters.authority.users;
22

33
import com.jaspersoft.jasperserver.dto.authority.ClientUser;
44
import com.jaspersoft.jasperserver.jaxrs.client.core.JasperserverRestClient;
@@ -20,24 +20,24 @@ public class UsersServiceIT {
2020

2121
@BeforeMethod
2222
public void before() {
23-
RestClientConfiguration cfg = new RestClientConfiguration("http://localhost:8085");
23+
RestClientConfiguration cfg = new RestClientConfiguration("http://localhost:4444/jasperserver-pro");
2424
JasperserverRestClient client = new JasperserverRestClient(cfg);
25-
session = client.authenticate("jasperadmin", "jasperadmin");
25+
session = client.authenticate("superuser", "superuser");
2626
}
2727

2828
@Test
2929
public void shouldReturnAllUsers() {
3030

31-
// When
32-
// List<ClientUser> users = session
33-
// .usersService()
34-
// .allUsers()
35-
// .get()
36-
// .getEntity()
37-
// .getUserList();
31+
// When
32+
List<ClientUser> users = session
33+
.usersService()
34+
.allUsers()
35+
.get()
36+
.getEntity()
37+
.getUserList();
3838

39-
// Then
40-
// Assert.assertTrue(users.size() > 3);
39+
// Then
40+
Assert.assertTrue(users.size() > 3);
4141
}
4242

4343
@AfterMethod

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/core/JerseyRequest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@
2828
import com.jaspersoft.jasperserver.jaxrs.client.core.operationresult.OperationResultFactory;
2929
import com.jaspersoft.jasperserver.jaxrs.client.core.operationresult.OperationResultFactoryImpl;
3030
import com.jaspersoft.jasperserver.jaxrs.client.providers.CustomRepresentationTypeProvider;
31-
import org.glassfish.jersey.jackson.JacksonFeature;
32-
import org.glassfish.jersey.media.multipart.internal.MultiPartWriter;
33-
31+
import java.util.List;
32+
import java.util.Map;
3433
import javax.ws.rs.client.Entity;
3534
import javax.ws.rs.client.Invocation;
3635
import javax.ws.rs.client.WebTarget;
37-
38-
import javax.ws.rs.core.*;
36+
import javax.ws.rs.core.GenericType;
3937
import javax.ws.rs.core.MultivaluedHashMap;
4038
import javax.ws.rs.core.MultivaluedMap;
4139
import javax.ws.rs.core.Response;
42-
43-
import java.util.List;
44-
import java.util.Map;
40+
import org.glassfish.jersey.media.multipart.internal.MultiPartWriter;
4541

4642
import static com.jaspersoft.jasperserver.jaxrs.client.core.MimeType.JSON;
4743
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
4844
import static javax.ws.rs.core.MediaType.APPLICATION_XML;
49-
45+
/**
46+
* @author
47+
* @author Tetiana Iefimenko
48+
*
49+
* */
5050
public class JerseyRequest<ResponseType> implements RequestBuilder<ResponseType> {
5151
private static final int GET = 0;
5252
private static final int DELETE = 1;

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/dto/settings/AwsSettings.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import java.util.List;
55

66
/**
7-
* Created by tetiana.iefimenko on 7/14/2015.
7+
* @author Tetiana Iefimenko
88
*/
99
public class AwsSettings {
1010

@@ -23,7 +23,7 @@ public AwsSettings(AwsSettings other) {
2323
this.productTypeIsEc2 = other.productTypeIsEc2;
2424
this.isEc2Instance = other.isEc2Instance;
2525
this.productTypeIsJrsAmi = other.productTypeIsJrsAmi;
26-
this.awsRegions = new LinkedList<String>(other.awsRegions);
26+
this.awsRegions = (other.awsRegions != null) ? new LinkedList<String>(other.awsRegions) : null;
2727
this.productTypeIsMpAmi = other.productTypeIsMpAmi;
2828
this.suppressEc2CredentialsWarnings = other.suppressEc2CredentialsWarnings;
2929
}
@@ -34,7 +34,7 @@ public Boolean isProductTypeIsEc2() {
3434

3535
public AwsSettings setProductTypeIsEc2(Boolean productTypeIsEc2) {
3636
this.productTypeIsEc2 = productTypeIsEc2;
37-
return this;
37+
return this;
3838
}
3939

4040
public Boolean isEc2Instance() {
@@ -43,7 +43,7 @@ public Boolean isEc2Instance() {
4343

4444
public AwsSettings setIsEc2Instance(Boolean isEc2Instance) {
4545
this.isEc2Instance = isEc2Instance;
46-
return this;
46+
return this;
4747
}
4848

4949
public Boolean isProductTypeIsJrsAmi() {
@@ -52,7 +52,7 @@ public Boolean isProductTypeIsJrsAmi() {
5252

5353
public AwsSettings setProductTypeIsJrsAmi(Boolean productTypeIsJrsAmi) {
5454
this.productTypeIsJrsAmi = productTypeIsJrsAmi;
55-
return this;
55+
return this;
5656
}
5757

5858
public List<String> getAwsRegions() {
@@ -61,7 +61,7 @@ public List<String> getAwsRegions() {
6161

6262
public AwsSettings setAwsRegions(List<String> awsRegions) {
6363
this.awsRegions = awsRegions;
64-
return this;
64+
return this;
6565
}
6666

6767
public Boolean isProductTypeIsMpAmi() {
@@ -70,7 +70,7 @@ public Boolean isProductTypeIsMpAmi() {
7070

7171
public AwsSettings setProductTypeIsMpAmi(Boolean productTypeIsMpAmi) {
7272
this.productTypeIsMpAmi = productTypeIsMpAmi;
73-
return this;
73+
return this;
7474
}
7575

7676
public Boolean isSuppressEc2CredentialsWarnings() {
@@ -79,7 +79,7 @@ public Boolean isSuppressEc2CredentialsWarnings() {
7979

8080
public AwsSettings setSuppressEc2CredentialsWarnings(Boolean suppressEc2CredentialsWarnings) {
8181
this.suppressEc2CredentialsWarnings = suppressEc2CredentialsWarnings;
82-
return this;
82+
return this;
8383
}
8484

8585
@Override
@@ -116,11 +116,6 @@ public int hashCode() {
116116

117117
@Override
118118
public String toString() {
119-
String awsRegions = "";
120-
for (String awsRegiono : this.awsRegions) {
121-
awsRegions += awsRegions + ", ";
122-
}
123-
124119
return "AwsSettings{" +
125120
"productTypeIsEc2=" + productTypeIsEc2 +
126121
", isEc2Instance=" + isEc2Instance +

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/dto/settings/DashboardSettings.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import java.util.List;
55

66
/**
7-
* Created by tetiana.iefimenko on 7/15/2015.
7+
* @author Tetiana Iefimenko
88
*/
99
public class DashboardSettings {
1010

@@ -44,11 +44,8 @@ public int hashCode() {
4444

4545
@Override
4646
public String toString() {
47-
StringBuilder result = new StringBuilder();
48-
result.append("DashBoard settings{ New item registry : ");
49-
for (ItemRegistry item : this.newItemsRegistry) {
50-
result.append(item.toString()).append(" / ");
51-
}
52-
return result.append("}").toString();
47+
return "DashboardSettings{" +
48+
"newItemsRegistry=" + newItemsRegistry +
49+
'}';
5350
}
5451
}

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/dto/settings/DataSourcePatternsSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.jaspersoft.jasperserver.jaxrs.client.dto.settings;
22

33
/**
4-
* Created by tetiana.iefimenko on 7/15/2015.
4+
* @author Tetiana Iefimenko
55
*/
66
public class DataSourcePatternsSettings {
77
private String dbHost;

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/dto/settings/DataSourceType.java

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
package com.jaspersoft.jasperserver.jaxrs.client.dto.settings;
22

33
/**
4-
* Created by tetiana.iefimenko on 7/15/2015.
4+
* @author Tetiana Iefimenko
55
*/
66
public class DataSourceType {
77

88
private String type;
99
private String typeValue;
1010
private String labelMessage;
1111

12+
public DataSourceType() {
13+
}
14+
15+
public DataSourceType(String type, String typeValue, String labelMessage) {
16+
this.type = type;
17+
this.typeValue = typeValue;
18+
this.labelMessage = labelMessage;
19+
}
20+
1221
public String getType() {
1322
return type;
1423
}
@@ -32,4 +41,35 @@ public String getLabelMessage() {
3241
public void setLabelMessage(String labelMessage) {
3342
this.labelMessage = labelMessage;
3443
}
44+
45+
@Override
46+
public boolean equals(Object o) {
47+
if (this == o) return true;
48+
if (!(o instanceof DataSourceType)) return false;
49+
50+
DataSourceType that = (DataSourceType) o;
51+
52+
if (getType() != null ? !getType().equals(that.getType()) : that.getType() != null) return false;
53+
if (getTypeValue() != null ? !getTypeValue().equals(that.getTypeValue()) : that.getTypeValue() != null)
54+
return false;
55+
return !(getLabelMessage() != null ? !getLabelMessage().equals(that.getLabelMessage()) : that.getLabelMessage() != null);
56+
57+
}
58+
59+
@Override
60+
public int hashCode() {
61+
int result = getType() != null ? getType().hashCode() : 0;
62+
result = 31 * result + (getTypeValue() != null ? getTypeValue().hashCode() : 0);
63+
result = 31 * result + (getLabelMessage() != null ? getLabelMessage().hashCode() : 0);
64+
return result;
65+
}
66+
67+
@Override
68+
public String toString() {
69+
return "DataSourceType{" +
70+
"type='" + type + '\'' +
71+
", typeValue='" + typeValue + '\'' +
72+
", labelMessage='" + labelMessage + '\'' +
73+
'}';
74+
}
3575
}

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/dto/settings/DateTimeSettings.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package com.jaspersoft.jasperserver.jaxrs.client.dto.settings;
22

3-
import javax.xml.bind.annotation.XmlRootElement;
4-
53
/**
6-
* Created by tetiana.iefimenko on 7/22/2015.
4+
* @author Tetiana Iefimenko
75
*/
86
public class DateTimeSettings {
97

@@ -14,8 +12,8 @@ public DateTimeSettings() {
1412
}
1513

1614
public DateTimeSettings(DateTimeSettings other) {
17-
this.datepicker = other.datepicker;
18-
this.timepicker = other.timepicker;
15+
this.datepicker = (other.datepicker != null) ? new Datepicker(other.datepicker) : null;
16+
this.timepicker = (other.timepicker != null) ? new Timepicker(other.timepicker) : null;
1917
}
2018

2119
public Datepicker getDatepicker() {

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/dto/settings/Datepicker.java

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.util.List;
66

77
/**
8-
* Created by tetiana.iefimenko on 7/22/2015.
8+
* @author Tetiana Iefimenko
99
*/
1010
public class Datepicker {
1111
private String closeText;
@@ -32,11 +32,11 @@ public Datepicker(Datepicker other) {
3232
this.prevText = other.prevText;
3333
this.nextText = other.nextText;
3434
this.currentText = other.currentText;
35-
this.monthNames = new LinkedList<String>(other.monthNames);
36-
this.monthNamesShort = new LinkedList<String>(other.monthNamesShort);
37-
this.dayNames = new LinkedList<String>(other.dayNames);
38-
this.dayNamesShort = new LinkedList<String>(other.dayNamesShort);
39-
this.dayNamesMin = new LinkedList<String>(other.dayNamesMin);
35+
this.monthNames = (other.monthNames != null) ? new LinkedList<String>(other.monthNames) : null;
36+
this.monthNamesShort = (other.monthNamesShort != null) ? new LinkedList<String>(other.monthNamesShort) : null;
37+
this.dayNames = (other.dayNames != null) ? new LinkedList<String>(other.dayNames) : null;
38+
this.dayNamesShort = (other.dayNamesShort != null) ? new LinkedList<String>(other.dayNamesShort) : null;
39+
this.dayNamesMin = (other.dayNamesMin != null) ? new LinkedList<String>(other.dayNamesMin) : null;
4040
this.weekHeader = other.weekHeader;
4141
this.dateFormat = other.dateFormat;
4242
this.firstDay = other.firstDay;
@@ -240,30 +240,7 @@ public int hashCode() {
240240

241241
@Override
242242
public String toString() {
243-
244-
String monthNames = "";
245-
String monthNamesShort = "";
246-
String dayNames = "";
247-
String dayNamesShort = "";
248-
String dayNamesMin = "";
249-
250-
for (String monthName : this.monthNames) {
251-
monthNames += monthName + ", ";
252-
}
253-
254-
for (String monthNameShort : this.monthNamesShort) {
255-
monthNamesShort += monthNameShort + ", ";
256-
}
257-
258-
for (String dayName : this.dayNames) {
259-
dayNames += dayName + ", ";
260-
}
261-
262-
for (String dayNameMin : this.dayNamesMin) {
263-
dayNamesMin += dayNameMin + ", ";
264-
}
265-
266-
return "DatePicker{" +
243+
return "Datepicker{" +
267244
"closeText='" + closeText + '\'' +
268245
", prevText='" + prevText + '\'' +
269246
", nextText='" + nextText + '\'' +

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/dto/settings/DecimalFormatSymbolsSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.jaspersoft.jasperserver.jaxrs.client.dto.settings;
22

33
/**
4-
* Created by tetiana.iefimenko on 7/15/2015.
4+
* @author Tetiana Iefimenko
55
*/
66
public class DecimalFormatSymbolsSettings {
77
private String zeroDigit;

src/main/java/com/jaspersoft/jasperserver/jaxrs/client/dto/settings/GlobalConfigurationSettings.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import java.util.Map;
77

88
/**
9-
* Created by tetiana.iefimenko on 7/15/2015.
9+
* @author
10+
* @author Tetiana Iefimenko
1011
*/
1112
public class GlobalConfigurationSettings {
1213
private Map<String, String> messages;
@@ -56,8 +57,12 @@ public GlobalConfigurationSettings() {
5657
}
5758

5859
public GlobalConfigurationSettings(GlobalConfigurationSettings other) {
59-
this.messages = new LinkedHashMap<String, String>();
60-
messages.putAll(other.messages);
60+
if (other.messages != null) {
61+
this.messages = new LinkedHashMap<String, String>();
62+
messages.putAll(other.messages);
63+
} else {
64+
this.messages = null;
65+
}
6166
this.paginatorItemsPerPage = other.paginatorItemsPerPage;
6267
this.paginatorPagesRange = other.paginatorPagesRange;
6368
this.reportLevelConfigurable = other.reportLevelConfigurable;
@@ -71,9 +76,9 @@ public GlobalConfigurationSettings(GlobalConfigurationSettings other) {
7176
this.userNameSeparator = other.userNameSeparator;
7277
this.defaultRole = other.defaultRole;
7378
this.passwordMask = other.passwordMask;
74-
this.viewReportsFilterList = new LinkedList<String>(other.viewReportsFilterList);
75-
this.outputFolderFilterList = new LinkedList<String>(other.outputFolderFilterList);
76-
this.outputFolderFilterPatterns = new LinkedList<String>(other.outputFolderFilterPatterns);
79+
this.viewReportsFilterList = (other.viewReportsFilterList != null) ? new LinkedList<String>(other.viewReportsFilterList) : null;
80+
this.outputFolderFilterList = (other.outputFolderFilterList != null) ? new LinkedList<String>(other.outputFolderFilterList) : null;
81+
this.outputFolderFilterPatterns = (other.outputFolderFilterPatterns != null) ? new LinkedList<String>(other.outputFolderFilterPatterns) : null;
7782
this.tenantNameNotSupportedSymbols = other.tenantNameNotSupportedSymbols;
7883
this.tenantIdNotSupportedSymbols = other.tenantIdNotSupportedSymbols;
7984
this.resourceIdNotSupportedSymbols = other.resourceIdNotSupportedSymbols;
@@ -97,9 +102,13 @@ public GlobalConfigurationSettings(GlobalConfigurationSettings other) {
97102
this.forceDomainDependentsUseACL = other.forceDomainDependentsUseACL;
98103
this.defaultDomainDependentsBlockAndUpdate = other.defaultDomainDependentsBlockAndUpdate;
99104
this.defaultDontUpdateDomainDependents = other.defaultDontUpdateDomainDependents;
100-
this.dataSourceTypes = new LinkedList<DataSourceType>(other.dataSourceTypes);
101-
this.allFileResourceTypes = new LinkedHashMap<String, String>();
102-
allFileResourceTypes.putAll(other.allFileResourceTypes);
105+
this.dataSourceTypes = (other.dataSourceTypes != null) ? new LinkedList<DataSourceType>(other.dataSourceTypes) : null;
106+
if (other.allFileResourceTypes != null) {
107+
this.allFileResourceTypes = new LinkedHashMap<String, String>();
108+
allFileResourceTypes.putAll(other.allFileResourceTypes);
109+
} else {
110+
this.allFileResourceTypes = null;
111+
}
103112
}
104113

105114
public Map<String, String> getMessages() {

0 commit comments

Comments
 (0)