Remove GONE API response where unnecessary - 3 MgmtSoftwareModuleRestApi Methods (related to #2880) (#2888)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -485,7 +485,7 @@ public class AccessContext {
|
|||||||
|
|
||||||
private AuthenticationDelegate(final String tenant, final String username, final Authentication delegate) {
|
private AuthenticationDelegate(final String tenant, final String username, final Authentication delegate) {
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
principal = new TenantAwareUser(username, username, delegate != null ? delegate.getAuthorities() : Collections.emptyList(), tenant);
|
principal = new TenantAwareUser(username, username, delegate == null ? Collections.emptyList() : delegate.getAuthorities(), tenant);
|
||||||
tenantAwareAuthenticationDetails = new TenantAwareAuthenticationDetails(tenant, false);
|
tenantAwareAuthenticationDetails = new TenantAwareAuthenticationDetails(tenant, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,12 +507,12 @@ public class AccessContext {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return delegate != null ? delegate.toString() : null;
|
return delegate == null ? null : delegate.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return delegate != null ? delegate.getName() : null;
|
return delegate == null ? null : delegate.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -522,7 +522,7 @@ public class AccessContext {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getCredentials() {
|
public Object getCredentials() {
|
||||||
return delegate != null ? delegate.getCredentials() : null;
|
return delegate == null ? null : delegate.getCredentials();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -537,15 +537,14 @@ public class AccessContext {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAuthenticated() {
|
public boolean isAuthenticated() {
|
||||||
return delegate == null || delegate.isAuthenticated();
|
return delegate != null && delegate.isAuthenticated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAuthenticated(final boolean isAuthenticated) {
|
public void setAuthenticated(final boolean isAuthenticated) {
|
||||||
if (delegate == null) {
|
if (delegate != null) {
|
||||||
return;
|
delegate.setAuthenticated(isAuthenticated);
|
||||||
}
|
}
|
||||||
delegate.setAuthenticated(isAuthenticated);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,8 +85,6 @@ public interface MgmtSoftwareModuleRestApi {
|
|||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Software Module not found",
|
@ApiResponse(responseCode = NOT_FOUND_404, description = "Software Module not found",
|
||||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists",
|
|
||||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
|
||||||
@ApiResponse(responseCode = LOCKED_423, description = "Software module is locked",
|
@ApiResponse(responseCode = LOCKED_423, description = "Software module is locked",
|
||||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Upload / store to storage or encryption failed",
|
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Upload / store to storage or encryption failed",
|
||||||
@@ -113,10 +111,6 @@ public interface MgmtSoftwareModuleRestApi {
|
|||||||
description = "Handles the GET request of retrieving all metadata of artifacts assigned to a " +
|
description = "Handles the GET request of retrieving all metadata of artifacts assigned to a " +
|
||||||
"software module. Required Permission: READ_REPOSITORY")
|
"software module. Required Permission: READ_REPOSITORY")
|
||||||
@GetResponses
|
@GetResponses
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists",
|
|
||||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
|
||||||
})
|
|
||||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||||
ResponseEntity<List<MgmtArtifact>> getArtifacts(
|
ResponseEntity<List<MgmtArtifact>> getArtifacts(
|
||||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||||
@@ -133,10 +127,6 @@ public interface MgmtSoftwareModuleRestApi {
|
|||||||
@Operation(summary = "Return single Artifact metadata",
|
@Operation(summary = "Return single Artifact metadata",
|
||||||
description = "Handles the GET request of retrieving a single Artifact metadata request. Required Permission: READ_REPOSITORY")
|
description = "Handles the GET request of retrieving a single Artifact metadata request. Required Permission: READ_REPOSITORY")
|
||||||
@GetResponses
|
@GetResponses
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists",
|
|
||||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
|
||||||
})
|
|
||||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts/{artifactId}",
|
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts/{artifactId}",
|
||||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
|||||||
Reference in New Issue
Block a user