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..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 @@ -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,9 @@ 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..7804997 --- /dev/null +++ b/src/main/java/com/smatechnologies/opcon/restapiclient/api/dailyjobs/incidentTickets/WsDailyJobsIncidentTickets.java @@ -0,0 +1,33 @@ +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.IncidentTicketDailyJob; + +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 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, incidentTicketDailyJob).path(id).run(IncidentTicketDailyJob.class); + } + +} diff --git a/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/IncidentTicketDailyJob.java b/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/IncidentTicketDailyJob.java new file mode 100644 index 0000000..bdfff00 --- /dev/null +++ b/src/main/java/com/smatechnologies/opcon/restapiclient/model/dailyjob/IncidentTicketDailyJob.java @@ -0,0 +1,58 @@ +package com.smatechnologies.opcon.restapiclient.model.dailyjob; + +import java.util.Objects; + +public class IncidentTicketDailyJob { + + public static final String RESOURCE = "incidentTickets"; + + public static final String PROPERTY_ID = "id"; + public static final String PROPERTY_TICKET_ID = "ticketId"; + public static final String PROPERTY_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; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + IncidentTicketDailyJob that = (IncidentTicketDailyJob) 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); + } + +}