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 @POST
@Produces(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML)
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @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()); log.info("Try to create new serviceEndpoint profile {} in {}",resourceProfile, ScopeProvider.instance.get());
if (Objects.nonNull(resourceProfile) && isRoleEnabled()){ if (Objects.nonNull(resourceProfile) && isRoleEnabled()){
ServiceEndpoint newResource= new ServiceEndpoint(); // ServiceEndpoint newResource= new ServiceEndpoint();
ServiceEndpoint.Profile profile=newResource.newProfile().category(resourceProfile.getCategory()).name(resourceProfile.getName()); // 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. platform=profile.newPlatform().name(resourceProfile.getPlatform()).version(1).minorVersion(0).platformVersion(0).revisionVersion(0).buildVersion(0);
ServiceEndpoint.AccessPoint ap=new ServiceEndpoint.AccessPoint(); // ServiceEndpoint.AccessPoint ap=new ServiceEndpoint.AccessPoint();
ap.name(resourceProfile.getAccessPointName()); // ap.name(resourceProfile.getAccessPointName());
ap.address(resourceProfile.getAccessPointAddress()); // ap.address(resourceProfile.getAccessPointAddress());
ap.credentials(resourceProfile.getAccessPointPass(), resourceProfile.getAccessPointUsername()); // ap.credentials(resourceProfile.getAccessPointPass(), resourceProfile.getAccessPointUsername());
profile.accessPoints().add(ap); // profile.accessPoints().add(ap);
registerSE(newResource); // registerSE(newResource);
return newResource; // return newResource;
registerSE(resourceProfile);
return resourceProfile;
}else{ }else{
throw new RuntimeException("ServiceEndpoint profile is null or user not enabled"); throw new RuntimeException("ServiceEndpoint profile is null or user not enabled");
} }