Skip to content

Commit 5f263bb

Browse files
authored
Merge branch 'master' into feature-user-related-info
2 parents e018c4f + 89ceadd commit 5f263bb

File tree

7 files changed

+336
-27
lines changed

7 files changed

+336
-27
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ History
106106

107107
* 0.5.x - ...
108108

109-
* 0.6.x - Requires Java 8, Upgrade async-http-client to 2.2.0, Jackson to 2.9.3 (+ others updates), Add createTicketAsync method, Add method to inline an article attachment, Add created article,section,category translation, Add suspend user, Add ticket form creation functionality, From now custom field value is an array with multiple value due to Multi-select fields, Changed type of article attachment ID and article ID from int to Long, Include response body in stacktrace message.
109+
* 0.6.x - Requires Java 8, Upgrade async-http-client to 2.2.0, Jackson to 2.9.3 (+ others updates), Add createTicketAsync method, Add method to inline an article attachment, Add created article,section,category translation, Add suspend user, Add ticket form creation functionality, From now custom field value is an array with multiple value due to Multi-select fields, Changed type of article attachment ID and article ID from int to Long, Include response body in stacktrace message,
110+
Added permanently GDPR delete of Tickets and User
111+
112+
* 0.7.x - The Help Center Section creation was fixed, Macro DTO was updated (Id is long), Permanent deletion of a handful of Items was added ( GDPR compliancy )
110113

111114
[zd]: http://zendesk.com

migration2Codeship.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
## Migration to Codeship
2+
3+
It is a temporal file to track the migration steps of moving this project from Jenkins D@C to Codeship Basic project
4+
5+
**Notes**:
6+
7+
* Codeship currently does’t trigger builds for PRs from forked repositories. We have created a RFE for that [PROD-1600](https://cloudbees.atlassian.net/browse/PROD-1600)
8+
* Sonar configuration needs to be move from the `Manage Jenkins > Configure system` to `Codeship Basic > Enviroment Section`
9+
* Maven options has been moved to Setup Commands `export MAVEN_OPTS="-Xmx512m -Djava.awt.headless=true"`
10+
* Sonar configuration is passed by parameters: https://docs.sonarqube.org/display/SONAR/Analysis+Parameters
11+
* Replacing Jenkins `env.BRANCH_NAME` for Codeship `CI_BRANCH`
12+
* Pushing a first commit to your repository to trigger your first build in Codeship
13+
* All groovy needs to be converted into shell format
14+
* Shell format multiline is not supported
15+
* To check line 13 `_ bash: [: too many arguments`
16+
* BUILD SUCCESS but with mvn `verify` goal default
17+
18+
### Setup Commands
19+
20+
```
21+
# We currently support OpenJDK 7, as well as Oracle JDK 7 & 8.
22+
jdk_switcher use oraclejdk8
23+
# Maven
24+
export MAVEN_OPTS="-Xmx512m -Djava.awt.headless=true"
25+
```
26+
27+
### Pipeline
28+
29+
```
30+
export pom_version=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml)
31+
export isSnapshot=false
32+
export deployOrVerity='verify'
33+
if [ "$pom_version" =~ "-SNAPSHOT" ]; then isSnapshot=true; fi
34+
if [ [ "$CI_BRANCH" = "master" ] && [ isSnapshot ] ]; then deployOrVerity='deploy -DdeployAtEnd=true'; fi
35+
## DEBUG
36+
echo "Running: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent ${deployOrVerity} sonar:sonar -Dsonar.organization=cloudbees -Dsonar.branch.name=${CI_BRANCH} -Dsonar.host.url=${SONAR_URL} -Dsonar.login=${SONAR_TOKEN} -Dmaven.test.failure.ignore=true"
37+
## END DEBUG
38+
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent ${deployOrVerity} sonar:sonar -Dsonar.organization=cloudbees -Dsonar.branch.name=${CI_BRANCH} -Dsonar.host.url=${SONAR_URL} -Dsonar.login=${SONAR_TOKEN} -Dmaven.test.failure.ignore=true
39+
```
40+
41+
### Enviroment Variables:
42+
43+
* `SONAR_URL`
44+
* `SONAR_TOKEN`

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<groupId>com.cloudbees.thirdparty</groupId>
2727
<artifactId>zendesk-java-client</artifactId>
28-
<version>0.6.3-SNAPSHOT</version>
28+
<version>0.7.1-SNAPSHOT</version>
2929

3030
<name>zendesk-java-client</name>
3131
<description>Java client for the Zendesk API</description>

src/main/java/org/zendesk/client/v2/Zendesk.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.zendesk.client.v2.model.Automation;
2828
import org.zendesk.client.v2.model.Brand;
2929
import org.zendesk.client.v2.model.Comment;
30+
import org.zendesk.client.v2.model.ComplianceDeletionStatus;
3031
import org.zendesk.client.v2.model.Field;
3132
import org.zendesk.client.v2.model.Forum;
3233
import org.zendesk.client.v2.model.Group;
@@ -268,6 +269,11 @@ public List<User> getTicketCollaborators(long id) {
268269
handleList(User.class, "users")));
269270
}
270271

272+
public JobStatus permanentlyDeleteTicket(Ticket ticket) {
273+
checkHasId(ticket);
274+
return permanentlyDeleteTicket(ticket.getId());
275+
}
276+
271277
public void deleteTicket(Ticket ticket) {
272278
checkHasId(ticket);
273279
deleteTicket(ticket.getId());
@@ -277,6 +283,14 @@ public void deleteTicket(long id) {
277283
complete(submit(req("DELETE", tmpl("/tickets/{id}.json").set("id", id)), handleStatus()));
278284
}
279285

286+
public JobStatus permanentlyDeleteTicket(long id) {
287+
deleteTicket(id);
288+
return complete(submit(
289+
req("DELETE", tmpl("/deleted_tickets/{id}.json").set("id", id)),
290+
handleJobStatus(JobStatus.class))
291+
);
292+
}
293+
280294
public ListenableFuture<JobStatus<Ticket>> queueCreateTicketAsync(Ticket ticket) {
281295
return submit(req("POST", cnst("/tickets.json?async=true"),
282296
JSON, json(Collections.singletonMap("ticket", ticket))),
@@ -327,6 +341,16 @@ public void deleteTickets(long id, long... ids) {
327341
handleStatus()));
328342
}
329343

344+
public JobStatus permanentlyDeleteTickets(long id, long... ids) {
345+
deleteTickets(id, ids);
346+
347+
return complete(
348+
submit(
349+
req("DELETE", tmpl("/deleted_tickets/destroy_many.json{?ids}").set("ids", idArray(id, ids))),
350+
handleJobStatus(JobStatus.class))
351+
);
352+
}
353+
330354
public Iterable<Ticket> getTickets() {
331355
return new PagedIterable<>(cnst("/tickets.json"), handleList(Ticket.class, "tickets"));
332356
}
@@ -413,6 +437,11 @@ public Iterable<Ticket> getUserRequestedTickets(long userId) {
413437
handleList(Ticket.class, "tickets"));
414438
}
415439

440+
public Iterable<ComplianceDeletionStatus> getComplianceDeletionStatuses(long userId) {
441+
return new PagedIterable<>(tmpl("/users/{userId}/compliance_deletion_statuses.json").set("userId", userId),
442+
handleList(ComplianceDeletionStatus.class, "compliance_deletion_statuses"));
443+
}
444+
416445
public Iterable<Ticket> getUserCCDTickets(long userId) {
417446
return new PagedIterable<>(tmpl("/users/{userId}/tickets/ccd.json").set("userId", userId),
418447
handleList(Ticket.class, "tickets"));
@@ -779,6 +808,16 @@ public void deleteUser(long id) {
779808
complete(submit(req("DELETE", tmpl("/users/{id}.json").set("id", id)), handleStatus()));
780809
}
781810

811+
public User permanentlyDeleteUser(User user) {
812+
checkHasId(user);
813+
return permanentlyDeleteUser(user.getId());
814+
}
815+
816+
public User permanentlyDeleteUser(long id) {
817+
deleteUser(id);
818+
return complete(submit(req("DELETE", tmpl("/deleted_users/{id}.json").set("id", id)), handle(User.class)));
819+
}
820+
782821
public User suspendUser(long id) {
783822
User user = new User();
784823
user.setId(id);
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package org.zendesk.client.v2.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
import java.io.Serializable;
6+
import java.util.Date;
7+
8+
/**
9+
* https://developer.zendesk.com/rest_api/docs/core/users#show-compliance-deletion-statuses
10+
*/
11+
public class ComplianceDeletionStatus implements Serializable {
12+
13+
private static final long serialVersionUID = 1L;
14+
15+
private String action;
16+
private String application;
17+
@JsonProperty("account_subdomain")
18+
private String accountSubdomain;
19+
@JsonProperty("executer_id")
20+
private long executerId;
21+
@JsonProperty("user_id")
22+
private long userId;
23+
@JsonProperty("account_id")
24+
private long accountId;
25+
@JsonProperty("created_at")
26+
private Date createdAt;
27+
28+
public static long getSerialVersionUID() {
29+
return serialVersionUID;
30+
}
31+
32+
public String getAction() {
33+
return action;
34+
}
35+
36+
public void setAction(String action) {
37+
this.action = action;
38+
}
39+
40+
public String getApplication() {
41+
return application;
42+
}
43+
44+
public void setApplication(String application) {
45+
this.application = application;
46+
}
47+
48+
public String getAccountSubdomain() {
49+
return accountSubdomain;
50+
}
51+
52+
public void setAccountSubdomain(String accountSubdomain) {
53+
this.accountSubdomain = accountSubdomain;
54+
}
55+
56+
public long getExecuterId() {
57+
return executerId;
58+
}
59+
60+
public void setExecuterId(long executerId) {
61+
this.executerId = executerId;
62+
}
63+
64+
public long getUserId() {
65+
return userId;
66+
}
67+
68+
public void setUserId(long userId) {
69+
this.userId = userId;
70+
}
71+
72+
public long getAccountId() {
73+
return accountId;
74+
}
75+
76+
public void setAccountId(long accountId) {
77+
this.accountId = accountId;
78+
}
79+
80+
public Date getCreatedAt() {
81+
return new Date(createdAt.getTime());
82+
}
83+
84+
public void setCreatedAt(Date createdAt) {
85+
this.createdAt = createdAt;
86+
}
87+
88+
@Override
89+
public String toString() {
90+
return "ComplianceDeletionStatus{" +
91+
"action='" + action + '\'' +
92+
", application='" + application + '\'' +
93+
", accountSubdomain='" + accountSubdomain + '\'' +
94+
", executerId=" + executerId +
95+
", userId=" + userId +
96+
", accountId=" + accountId +
97+
", createdAt=" + createdAt +
98+
'}';
99+
}
100+
}

src/main/java/org/zendesk/client/v2/model/Macro.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class Macro implements Serializable {
1717

1818
private static final long serialVersionUID = 1L;
1919

20-
private int id;
20+
private long id;
2121
private String title;
2222
private boolean active;
2323
private List<Action> actions;
@@ -26,11 +26,11 @@ public class Macro implements Serializable {
2626

2727
public Macro() {}
2828

29-
public int getId() {
29+
public long getId() {
3030
return id;
3131
}
3232

33-
public void setId(int id) {
33+
public void setId(long id) {
3434
this.id = id;
3535
}
3636

0 commit comments

Comments
 (0)