changed profile class to ServiceEndpoint

This commit is contained in:
Roberto Cirillo 2023-02-16 14:21:32 +01:00
parent aba203b651
commit 09c6155a45
1 changed files with 13 additions and 11 deletions

View File

@ -87,19 +87,21 @@ public class ServiceEndpointResource {
@POST
@Produces(MediaType.APPLICATION_XML)
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public ServiceEndpoint create(ServiceEndpointProfile resourceProfile) {
public ServiceEndpoint create(ServiceEndpoint resourceProfile) {
log.info("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;
// 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;
registerSE(resourceProfile);
return resourceProfile;
}else{
throw new RuntimeException("ServiceEndpoint profile is null or user not enabled");
}