-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from paulsmelser/152/service_request_operations
Add service request operations
- Loading branch information
Showing
18 changed files
with
704 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/org/springframework/social/partnercenter/api/support/SupportContact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.springframework.social.partnercenter.api.support; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
||
import org.springframework.social.partnercenter.api.ResourceAttributes; | ||
import org.springframework.social.partnercenter.api.ResourceLinks; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
@JsonInclude(NON_NULL) | ||
public class SupportContact { | ||
private String supportTenantId; | ||
private String supportMpnId; | ||
private String name; | ||
private ResourceLinks links; | ||
private ResourceAttributes attributes; | ||
|
||
public String getSupportTenantId() { | ||
return supportTenantId; | ||
} | ||
|
||
public void setSupportTenantId(String supportTenantId) { | ||
this.supportTenantId = supportTenantId; | ||
} | ||
|
||
public String getSupportMpnId() { | ||
return supportMpnId; | ||
} | ||
|
||
public void setSupportMpnId(String supportMpnId) { | ||
this.supportMpnId = supportMpnId; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public ResourceLinks getLinks() { | ||
return links; | ||
} | ||
|
||
public void setLinks(ResourceLinks links) { | ||
this.links = links; | ||
} | ||
|
||
public ResourceAttributes getAttributes() { | ||
return attributes; | ||
} | ||
|
||
public void setAttributes(ResourceAttributes attributes) { | ||
this.attributes = attributes; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/org/springframework/social/partnercenter/api/support/SupportOperations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.springframework.social.partnercenter.api.support; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.social.partnercenter.api.PartnerCenterResponse; | ||
import org.springframework.social.partnercenter.api.support.managedservice.ManagedService; | ||
import org.springframework.social.partnercenter.api.support.servicerequest.ServiceRequest; | ||
|
||
public interface SupportOperations { | ||
ResponseEntity<SupportContact> getSupportContact(String customerId, String subscriptionId); | ||
ResponseEntity<SupportContact> updateSupportContact(String customerId, String subscriptionId, SupportContact supportContact); | ||
ResponseEntity<PartnerCenterResponse<ManagedService>> getManagedServices(String customerId); | ||
ResponseEntity<PartnerCenterResponse<SupportTopic>> getSupportTopics(); | ||
ResponseEntity<PartnerCenterResponse<ServiceRequest>> getServiceRequests(String customerId); | ||
ResponseEntity<ServiceRequest> updateServiceRequest(ServiceRequest request); | ||
ResponseEntity<ServiceRequest> createServiceRequest(ServiceRequest request); | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/org/springframework/social/partnercenter/api/support/SupportTopic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.springframework.social.partnercenter.api.support; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
||
import org.springframework.social.partnercenter.api.ResourceAttributes; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
@JsonInclude(NON_NULL) | ||
public class SupportTopic { | ||
private String name; | ||
private String description; | ||
private int id; | ||
private ResourceAttributes attribute; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
|
||
public ResourceAttributes getAttribute() { | ||
return attribute; | ||
} | ||
|
||
public void setAttribute(ResourceAttributes attribute) { | ||
this.attribute = attribute; | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
src/main/java/org/springframework/social/partnercenter/api/support/impl/SupportTemplate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package org.springframework.social.partnercenter.api.support.impl; | ||
|
||
import org.springframework.core.ParameterizedTypeReference; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.social.partnercenter.PartnerCenter; | ||
import org.springframework.social.partnercenter.api.AbstractTemplate; | ||
import org.springframework.social.partnercenter.api.PartnerCenterResponse; | ||
import org.springframework.social.partnercenter.api.support.SupportContact; | ||
import org.springframework.social.partnercenter.api.support.SupportOperations; | ||
import org.springframework.social.partnercenter.api.support.SupportTopic; | ||
import org.springframework.social.partnercenter.api.support.managedservice.ManagedService; | ||
import org.springframework.social.partnercenter.api.support.servicerequest.ServiceRequest; | ||
import org.springframework.social.partnercenter.http.client.RestResource; | ||
|
||
public class SupportTemplate extends AbstractTemplate implements SupportOperations { | ||
private static final String CUSTOMERS = "customers"; | ||
private static final String SUBSCRIPTIONS = "subscriptions"; | ||
private static final String SUPPORT_CONTACT = "supportcontact"; | ||
private static final String MANAGED_SERVICES = "managedservices"; | ||
private static final String SERVICE_REQUESTS = "servicerequests"; | ||
|
||
private final RestResource restResource; | ||
|
||
public SupportTemplate(RestResource restResource, boolean isAuthorized) { | ||
super(isAuthorized); | ||
this.restResource = restResource; | ||
} | ||
|
||
@Override | ||
public ResponseEntity<SupportContact> getSupportContact(String customerId, String subscriptionId) { | ||
return restResource.request() | ||
.pathSegment(CUSTOMERS, customerId, SUBSCRIPTIONS, subscriptionId, SUPPORT_CONTACT) | ||
.get(SupportContact.class); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<SupportContact> updateSupportContact(String customerId, String subscriptionId, SupportContact supportContact) { | ||
return restResource.request() | ||
.pathSegment(CUSTOMERS, customerId, SUBSCRIPTIONS, subscriptionId, SUPPORT_CONTACT) | ||
.put(supportContact, SupportContact.class); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<PartnerCenterResponse<ManagedService>> getManagedServices(String customerId) { | ||
return restResource.request() | ||
.pathSegment(CUSTOMERS, customerId, MANAGED_SERVICES) | ||
.get(new ParameterizedTypeReference<PartnerCenterResponse<ManagedService>>() {}); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<PartnerCenterResponse<SupportTopic>> getSupportTopics() { | ||
return restResource.request() | ||
.pathSegment(SERVICE_REQUESTS, "supporttopics") | ||
.get(new ParameterizedTypeReference<PartnerCenterResponse<SupportTopic>>() {}); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<PartnerCenterResponse<ServiceRequest>> getServiceRequests(String customerId) { | ||
return restResource.request() | ||
.pathSegment(CUSTOMERS, customerId, SERVICE_REQUESTS) | ||
.get(new ParameterizedTypeReference<PartnerCenterResponse<ServiceRequest>>() {}); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<ServiceRequest> updateServiceRequest(ServiceRequest request) { | ||
return restResource.request() | ||
.pathSegment(SERVICE_REQUESTS, request.getId()) | ||
.patch(request, ServiceRequest.class); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<ServiceRequest> createServiceRequest(ServiceRequest request) { | ||
return restResource.request() | ||
.pathSegment(SERVICE_REQUESTS) | ||
.post(request, ServiceRequest.class); | ||
} | ||
|
||
@Override | ||
protected String getProviderId() { | ||
return PartnerCenter.PROVIDER_ID; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...a/org/springframework/social/partnercenter/api/support/managedservice/ManagedService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.springframework.social.partnercenter.api.support.managedservice; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
@JsonInclude(NON_NULL) | ||
public class ManagedService { | ||
private String id; | ||
private String name; | ||
private String groupName; | ||
private ManagedServiceLinks links; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getGroupName() { | ||
return groupName; | ||
} | ||
|
||
public void setGroupName(String groupName) { | ||
this.groupName = groupName; | ||
} | ||
|
||
public ManagedServiceLinks getLinks() { | ||
return links; | ||
} | ||
|
||
public void setLinks(ManagedServiceLinks links) { | ||
this.links = links; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
.../springframework/social/partnercenter/api/support/managedservice/ManagedServiceLinks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.springframework.social.partnercenter.api.support.managedservice; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
||
import org.springframework.social.partnercenter.api.Link; | ||
import org.springframework.social.partnercenter.api.ResourceAttributes; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
@JsonInclude(NON_NULL) | ||
public class ManagedServiceLinks { | ||
private Link adminService; | ||
private Link serviceHealth; | ||
private Link serviceTicket; | ||
private ResourceAttributes attributes; | ||
|
||
public Link getAdminService() { | ||
return adminService; | ||
} | ||
|
||
public void setAdminService(Link adminService) { | ||
this.adminService = adminService; | ||
} | ||
|
||
public Link getServiceHealth() { | ||
return serviceHealth; | ||
} | ||
|
||
public void setServiceHealth(Link serviceHealth) { | ||
this.serviceHealth = serviceHealth; | ||
} | ||
|
||
public Link getServiceTicket() { | ||
return serviceTicket; | ||
} | ||
|
||
public void setServiceTicket(Link serviceTicket) { | ||
this.serviceTicket = serviceTicket; | ||
} | ||
|
||
public ResourceAttributes getAttributes() { | ||
return attributes; | ||
} | ||
|
||
public void setAttributes(ResourceAttributes attributes) { | ||
this.attributes = attributes; | ||
} | ||
} |
Oops, something went wrong.