From 40e1ae3c1518a3768ac9b6f72d221f645e2bfb8a Mon Sep 17 00:00:00 2001 From: Bertie van Hinsbergen Date: Sun, 13 Dec 2020 11:33:19 +0100 Subject: [PATCH 1/4] added /api/dailyjobs/{uid}/incidentTickets/{id} end point --- .../api/dailyjobs/WsDailyJobs.java | 8 ++++ .../WsDailyJobsIncidentTickets.java | 36 +++++++++++++++++ .../details/IncidentTicketDetails.java | 39 +++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java create mode 100644 src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java diff --git a/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/WsDailyJobs.java b/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/WsDailyJobs.java index a862e57..628be7f 100644 --- a/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/WsDailyJobs.java +++ b/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/WsDailyJobs.java @@ -5,6 +5,8 @@ import com.smatechnologies.opcon.restapiclient.WsException; import com.smatechnologies.opcon.restapiclient.WsFactory; import com.smatechnologies.opcon.restapiclient.WsResult; +import com.smatechnologies.opcon.restapiclient.api.dailyjobs.incidentTickets.WsDailyJobsIncidentTickets; +import com.smatechnologies.opcon.restapiclient.api.dailyschedules.properties.WsDailySchedulesProperties; import com.smatechnologies.opcon.restapiclient.model.JobDailyStatusCount; import com.smatechnologies.opcon.restapiclient.model.dailyjob.DailyJob; @@ -62,4 +64,10 @@ public DailyJob put(DailyJob dailyJob) throws WsException { return wsFactory.create(Ws.Type.PUT, dailyJob).path(id).run(DailyJob.class); } + + public WsDailyJobsIncidentTickets incidentTickets(String dailyJobUid) { + return new WsDailyJobsIncidentTickets(wsFactory.path(dailyJobUid)); + } + + } diff --git a/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java b/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java new file mode 100644 index 0000000..c170472 --- /dev/null +++ b/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java @@ -0,0 +1,36 @@ +package com.smatechnologies.opcon.restapiclient.api.dailyjobs.incidentTickets; + +import java.util.List; +import java.util.Objects; + +import com.smatechnologies.opcon.restapiclient.Ws; +import com.smatechnologies.opcon.restapiclient.WsException; +import com.smatechnologies.opcon.restapiclient.WsFactory; +import com.smatechnologies.opcon.restapiclient.model.dailyjob.details.IncidentTicketDetails; + +import javax.ws.rs.core.GenericType; + +public class WsDailyJobsIncidentTickets { + + + private final WsFactory wsFactory; + + public WsDailyJobsIncidentTickets(WsFactory wsFactory) { + this.wsFactory = wsFactory.path("incidentTickets"); + } + + public List get() throws WsException { + return wsFactory.create(Ws.Type.GET).run(new GenericType>() { + + }); + } + + public IncidentTicketDetails put(IncidentTicketDetails incidentTicketDetails) throws WsException { + Objects.requireNonNull(incidentTicketDetails, "IncidentTicketDetails cannot be null"); + String id = Objects.requireNonNull(incidentTicketDetails.getId(), "Id cannot be null"); + + return wsFactory.create(Ws.Type.PUT, incidentTicketDetails).path(id).run(IncidentTicketDetails.class); + } + + +} diff --git a/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java b/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java new file mode 100644 index 0000000..86af453 --- /dev/null +++ b/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java @@ -0,0 +1,39 @@ +package com.smatechnologies.opcon.restapiclient.model.dailyjob.details; + +public class IncidentTicketDetails { + + public static final String RESOURCE = "incidentTickets"; + + public static final String PROPERTY_ID = "id"; + public static final String TICKET_ID = "ticketId"; + public static final String TICKET_URL = "ticketUrl"; + + private String id; + private String ticketId; + private String ticketUrl; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTicketId() { + return ticketId; + } + + public void setTicketId(String ticketId) { + this.ticketId = ticketId; + } + + public String getTicketUrl() { + return ticketUrl; + } + + public void setTicketUrl(String ticketUrl) { + this.ticketUrl = ticketUrl; + } + +} From e9066f69e0b9eca4f99d26d7dee2d5e8d7d45c73 Mon Sep 17 00:00:00 2001 From: Bertie van Hinsbergen Date: Wed, 16 Dec 2020 06:58:05 +0100 Subject: [PATCH 2/4] Added missing PROPERTY_ to defintions --- .../model/dailyjob/details/IncidentTicketDetails.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java b/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java index 86af453..ee2591a 100644 --- a/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java +++ b/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java @@ -5,8 +5,8 @@ public class IncidentTicketDetails { public static final String RESOURCE = "incidentTickets"; public static final String PROPERTY_ID = "id"; - public static final String TICKET_ID = "ticketId"; - public static final String TICKET_URL = "ticketUrl"; + public static final String PROPERTY_TICKET_ID = "ticketId"; + public static final String PROPERTY_TICKET_URL = "ticketUrl"; private String id; private String ticketId; From 076f2076a393a1aa5de2b339e5151313f000dddb Mon Sep 17 00:00:00 2001 From: Bertie van Hinsbergen Date: Wed, 16 Dec 2020 07:17:45 +0100 Subject: [PATCH 3/4] corrected formatting - removed tabs --- .../WsDailyJobsIncidentTickets.java | 3 - .../details/IncidentTicketDetails.java | 57 ++++++++++++------- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java b/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java index c170472..ee834d9 100644 --- a/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java +++ b/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java @@ -12,7 +12,6 @@ public class WsDailyJobsIncidentTickets { - private final WsFactory wsFactory; public WsDailyJobsIncidentTickets(WsFactory wsFactory) { @@ -21,7 +20,6 @@ public WsDailyJobsIncidentTickets(WsFactory wsFactory) { public List get() throws WsException { return wsFactory.create(Ws.Type.GET).run(new GenericType>() { - }); } @@ -31,6 +29,5 @@ public IncidentTicketDetails put(IncidentTicketDetails incidentTicketDetails) th return wsFactory.create(Ws.Type.PUT, incidentTicketDetails).path(id).run(IncidentTicketDetails.class); } - } diff --git a/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java b/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java index ee2591a..3e997dc 100644 --- a/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java +++ b/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java @@ -1,8 +1,10 @@ package com.smatechnologies.opcon.restapiclient.model.dailyjob.details; +import java.util.Objects; + public class IncidentTicketDetails { - public static final String RESOURCE = "incidentTickets"; + public static final String RESOURCE = "incidentTickets"; public static final String PROPERTY_ID = "id"; public static final String PROPERTY_TICKET_ID = "ticketId"; @@ -11,29 +13,46 @@ public class IncidentTicketDetails { private String id; private String ticketId; private String ticketUrl; - + public String getId() { - return id; - } - + return id; + } + public void setId(String id) { - this.id = id; - } - + this.id = id; + } + public String getTicketId() { - return ticketId; - } - + return ticketId; + } + public void setTicketId(String ticketId) { - this.ticketId = ticketId; - } - + this.ticketId = ticketId; + } + public String getTicketUrl() { - return ticketUrl; - } - + return ticketUrl; + } + public void setTicketUrl(String ticketUrl) { - this.ticketUrl = ticketUrl; - } + this.ticketUrl = ticketUrl; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + IncidentTicketDetails that = (IncidentTicketDetails) o; + return Objects.equals(id, that.id) && + Objects.equals(ticketId, that.ticketId) && + Objects.equals(ticketUrl, that.ticketUrl); + } + + @Override + public int hashCode() { + return Objects.hash(id, ticketId, ticketUrl); + } } From 81838e174c98cc192b5b06cb2f9295c3b13dd3c5 Mon Sep 17 00:00:00 2001 From: Bertie van Hinsbergen Date: Fri, 18 Dec 2020 11:37:05 +0100 Subject: [PATCH 4/4] renamed IncidentTicketDetails to IncidentTicketDailyJob --- .../restapiclient/api/dailyjobs/WsDailyJobs.java | 1 - .../WsDailyJobsIncidentTickets.java | 14 +++++++------- ...ketDetails.java => IncidentTicketDailyJob.java} | 6 +++--- 3 files changed, 10 insertions(+), 11 deletions(-) rename src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/{details/IncidentTicketDetails.java => IncidentTicketDailyJob.java} (88%) diff --git a/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/WsDailyJobs.java b/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/WsDailyJobs.java index 628be7f..f9ff2e4 100644 --- a/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/WsDailyJobs.java +++ b/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/WsDailyJobs.java @@ -69,5 +69,4 @@ public WsDailyJobsIncidentTickets incidentTickets(String dailyJobUid) { return new WsDailyJobsIncidentTickets(wsFactory.path(dailyJobUid)); } - } diff --git a/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java b/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java index ee834d9..7804997 100644 --- a/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java +++ b/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java @@ -6,7 +6,7 @@ import com.smatechnologies.opcon.restapiclient.Ws; import com.smatechnologies.opcon.restapiclient.WsException; import com.smatechnologies.opcon.restapiclient.WsFactory; -import com.smatechnologies.opcon.restapiclient.model.dailyjob.details.IncidentTicketDetails; +import com.smatechnologies.opcon.restapiclient.model.dailyjob.IncidentTicketDailyJob; import javax.ws.rs.core.GenericType; @@ -18,16 +18,16 @@ public WsDailyJobsIncidentTickets(WsFactory wsFactory) { this.wsFactory = wsFactory.path("incidentTickets"); } - public List get() throws WsException { - return wsFactory.create(Ws.Type.GET).run(new GenericType>() { + public List get() throws WsException { + return wsFactory.create(Ws.Type.GET).run(new GenericType>() { }); } - public IncidentTicketDetails put(IncidentTicketDetails incidentTicketDetails) throws WsException { - Objects.requireNonNull(incidentTicketDetails, "IncidentTicketDetails cannot be null"); - String id = Objects.requireNonNull(incidentTicketDetails.getId(), "Id cannot be null"); + public IncidentTicketDailyJob put(IncidentTicketDailyJob incidentTicketDailyJob) throws WsException { + Objects.requireNonNull(incidentTicketDailyJob, "IncidentTicketDailyJob cannot be null"); + String id = Objects.requireNonNull(incidentTicketDailyJob.getId(), "Id cannot be null"); - return wsFactory.create(Ws.Type.PUT, incidentTicketDetails).path(id).run(IncidentTicketDetails.class); + return wsFactory.create(Ws.Type.PUT, incidentTicketDailyJob).path(id).run(IncidentTicketDailyJob.class); } } diff --git a/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java b/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/IncidentTicketDailyJob.java similarity index 88% rename from src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java rename to src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/IncidentTicketDailyJob.java index 3e997dc..bdfff00 100644 --- a/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/details/IncidentTicketDetails.java +++ b/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/IncidentTicketDailyJob.java @@ -1,8 +1,8 @@ -package com.smatechnologies.opcon.restapiclient.model.dailyjob.details; +package com.smatechnologies.opcon.restapiclient.model.dailyjob; import java.util.Objects; -public class IncidentTicketDetails { +public class IncidentTicketDailyJob { public static final String RESOURCE = "incidentTickets"; @@ -44,7 +44,7 @@ public boolean equals(Object o) { return true; if (o == null || getClass() != o.getClass()) return false; - IncidentTicketDetails that = (IncidentTicketDetails) o; + IncidentTicketDailyJob that = (IncidentTicketDailyJob) o; return Objects.equals(id, that.id) && Objects.equals(ticketId, that.ticketId) && Objects.equals(ticketUrl, that.ticketUrl);