add separated method for consuming json
This commit is contained in:
parent
e35f2cd199
commit
26f9460cf3
|
@ -88,20 +88,10 @@ public class ServiceEndpointResource {
|
|||
|
||||
@POST
|
||||
@Produces(MediaType.APPLICATION_XML)
|
||||
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
|
||||
@Consumes(MediaType.APPLICATION_XML)
|
||||
public ServiceEndpoint create(ServiceEndpoint resourceProfile) {
|
||||
log.debug("Try to create new serviceEndpoint profile {} in {}",resourceProfile, ScopeProvider.instance.get());
|
||||
if (Objects.nonNull(resourceProfile) && isRoleEnabled()){
|
||||
// ServiceEndpoint newResource= new ServiceEndpoint();
|
||||
// ServiceEndpoint.Profile profile=newResource.newProfile().category(resourceProfile.getCategory()).name(resourceProfile.getName());
|
||||
// ServiceEndpoint. platform=profile.newPlatform().name(resourceProfile.getPlatform()).version(1).minorVersion(0).platformVersion(0).revisionVersion(0).buildVersion(0);
|
||||
// ServiceEndpoint.AccessPoint ap=new ServiceEndpoint.AccessPoint();
|
||||
// ap.name(resourceProfile.getAccessPointName());
|
||||
// ap.address(resourceProfile.getAccessPointAddress());
|
||||
// ap.credentials(resourceProfile.getAccessPointPass(), resourceProfile.getAccessPointUsername());
|
||||
// profile.accessPoints().add(ap);
|
||||
// registerSE(newResource);
|
||||
// return newResource;
|
||||
log.debug("going to encrypt and push");
|
||||
registerSE(encryptResource(resourceProfile));
|
||||
log.debug("pushed on IS");
|
||||
|
@ -112,6 +102,30 @@ public class ServiceEndpointResource {
|
|||
|
||||
}
|
||||
|
||||
@POST
|
||||
@Produces(MediaType.APPLICATION_XML)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public ServiceEndpoint create(ServiceEndpointProfile resourceProfile) {
|
||||
log.debug("Try to create new serviceEndpoint profile {} in {}",resourceProfile, ScopeProvider.instance.get());
|
||||
if (Objects.nonNull(resourceProfile) && isRoleEnabled()){
|
||||
ServiceEndpoint newResource= new ServiceEndpoint();
|
||||
ServiceEndpoint.Profile profile=newResource.newProfile().category(resourceProfile.getCategory()).name(resourceProfile.getName());
|
||||
profile.newPlatform().name(resourceProfile.getPlatform()).version(1).minorVersion(0).platformVersion(0).revisionVersion(0).buildVersion(0);
|
||||
ServiceEndpoint.AccessPoint ap=new ServiceEndpoint.AccessPoint();
|
||||
ap.name(resourceProfile.getAccessPointName());
|
||||
ap.address(resourceProfile.getAccessPointAddress());
|
||||
ap.credentials(resourceProfile.getAccessPointPass(), resourceProfile.getAccessPointUsername());
|
||||
profile.accessPoints().add(ap);
|
||||
log.debug("going to encrypt and push");
|
||||
registerSE(encryptResource(newResource));
|
||||
log.debug("pushed on IS");
|
||||
return newResource;
|
||||
}else{
|
||||
throw new RuntimeException("ServiceEndpoint profile is null or user not enabled");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private SimpleQuery getQuery(String resourceName, String resourceCategory){
|
||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
query.addCondition(String.format("$resource/Profile/Name/text() eq '%s'",resourceName));
|
||||
|
|
Loading…
Reference in New Issue