-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
96 changed files
with
1,955 additions
and
420 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
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
99 changes: 99 additions & 0 deletions
99
...rc/main/java/bio/terra/pearl/api/admin/controller/export/ExportIntegrationController.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,99 @@ | ||
package bio.terra.pearl.api.admin.controller.export; | ||
|
||
import bio.terra.pearl.api.admin.api.ExportIntegrationApi; | ||
import bio.terra.pearl.api.admin.service.auth.AuthUtilService; | ||
import bio.terra.pearl.api.admin.service.auth.context.PortalStudyEnvAuthContext; | ||
import bio.terra.pearl.api.admin.service.export.ExportIntegrationExtService; | ||
import bio.terra.pearl.core.model.EnvironmentName; | ||
import bio.terra.pearl.core.model.admin.AdminUser; | ||
import bio.terra.pearl.core.model.export.ExportIntegration; | ||
import bio.terra.pearl.core.model.export.ExportIntegrationJob; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import java.util.List; | ||
import java.util.UUID; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
|
||
@Controller | ||
public class ExportIntegrationController implements ExportIntegrationApi { | ||
private final AuthUtilService authUtilService; | ||
private final HttpServletRequest request; | ||
private final ExportIntegrationExtService exportIntegrationExtService; | ||
private final ObjectMapper objectMapper; | ||
|
||
public ExportIntegrationController( | ||
AuthUtilService authUtilService, | ||
HttpServletRequest request, | ||
ExportIntegrationExtService exportIntegrationExtService, | ||
ObjectMapper objectMapper) { | ||
this.authUtilService = authUtilService; | ||
this.request = request; | ||
this.exportIntegrationExtService = exportIntegrationExtService; | ||
this.objectMapper = objectMapper; | ||
} | ||
|
||
@Override | ||
public ResponseEntity<Object> findByStudy( | ||
String portalShortcode, String studyShortcode, String envName) { | ||
AdminUser operator = authUtilService.requireAdminUser(request); | ||
EnvironmentName environmentName = EnvironmentName.valueOfCaseInsensitive(envName); | ||
List<ExportIntegration> integrations = | ||
exportIntegrationExtService.list( | ||
PortalStudyEnvAuthContext.of( | ||
operator, portalShortcode, studyShortcode, environmentName)); | ||
return ResponseEntity.ok(integrations); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<Object> get( | ||
String portalShortcode, String studyShortcode, String envName, UUID id) { | ||
AdminUser operator = authUtilService.requireAdminUser(request); | ||
EnvironmentName environmentName = EnvironmentName.valueOfCaseInsensitive(envName); | ||
ExportIntegration integration = | ||
exportIntegrationExtService.find( | ||
PortalStudyEnvAuthContext.of( | ||
operator, portalShortcode, studyShortcode, environmentName), | ||
id); | ||
return ResponseEntity.ok(integration); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<Object> run( | ||
String portalShortcode, String studyShortcode, String envName, UUID id) { | ||
AdminUser operator = authUtilService.requireAdminUser(request); | ||
EnvironmentName environmentName = EnvironmentName.valueOfCaseInsensitive(envName); | ||
ExportIntegrationJob job = | ||
exportIntegrationExtService.run( | ||
PortalStudyEnvAuthContext.of( | ||
operator, portalShortcode, studyShortcode, environmentName), | ||
id); | ||
return ResponseEntity.ok(job); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<Object> create( | ||
String portalShortcode, String studyShortcode, String envName, Object body) { | ||
AdminUser adminUser = authUtilService.requireAdminUser(request); | ||
EnvironmentName environmentName = EnvironmentName.valueOfCaseInsensitive(envName); | ||
ExportIntegration integration = objectMapper.convertValue(body, ExportIntegration.class); | ||
ExportIntegration newIntegration = | ||
exportIntegrationExtService.create( | ||
PortalStudyEnvAuthContext.of( | ||
adminUser, portalShortcode, studyShortcode, environmentName), | ||
integration); | ||
return ResponseEntity.ok(newIntegration); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<Object> findJobsByStudy( | ||
String portalShortcode, String studyShortcode, String envName) { | ||
AdminUser operator = authUtilService.requireAdminUser(request); | ||
EnvironmentName environmentName = EnvironmentName.valueOfCaseInsensitive(envName); | ||
List<ExportIntegrationJob> integrations = | ||
exportIntegrationExtService.listJobs( | ||
PortalStudyEnvAuthContext.of( | ||
operator, portalShortcode, studyShortcode, environmentName)); | ||
return ResponseEntity.ok(integrations); | ||
} | ||
} |
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
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
6 changes: 3 additions & 3 deletions
6
...min/service/DataRepoExportExtService.java → ...vice/export/DataRepoExportExtService.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
15 changes: 4 additions & 11 deletions
15
...min/service/EnrolleeExportExtService.java → ...vice/export/EnrolleeExportExtService.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
Oops, something went wrong.