Skip to content
Snippets Groups Projects
Verified Commit e17bf4eb authored by Tobias Grantner's avatar Tobias Grantner
Browse files

Removed dependencies on docker from identifier service

parent f4a4a823
No related branches found
No related tags found
6 merge requests!231CI: Remove build for log-service,!228Better error message handling in the frontend,!223Release of version 1.4.0,!177Updated keycloak realms to only allow creation of containers for developers,...,!176Hotfix views,!166Resolve "Independence of deployment environment"
Showing
with 58 additions and 86 deletions
......@@ -26,7 +26,6 @@
<java.version>17</java.version>
<spring-cloud.version>4.0.2</spring-cloud.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<docker.version>3.3.0</docker.version>
<jacoco.version>0.8.10</jacoco.version>
<jwt.version>4.3.0</jwt.version>
<hibernate-c3po.version>5.6.3.Final</hibernate-c3po.version>
......@@ -35,6 +34,7 @@
<super-csv.version>2.4.0</super-csv.version>
<jsql.version>4.6</jsql.version>
<springdoc-openapi.version>2.1.0</springdoc-openapi.version>
<hsqldb.version>2.7.2</hsqldb.version>
<opensearch-client.version>1.1.0</opensearch-client.version>
</properties>
......@@ -108,19 +108,6 @@
<artifactId>spring-data-opensearch-starter</artifactId>
<version>${opensearch-client.version}</version>
</dependency>
<!-- Docker -->
<dependency>
<groupId>com.github.docker-java</groupId>
<artifactId>docker-java</artifactId>
<version>${docker.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.docker-java</groupId>
<artifactId>docker-java-transport-httpclient5</artifactId>
<version>${docker.version}</version>
<scope>test</scope>
</dependency>
<!-- Swagger -->
<dependency>
<groupId>org.springdoc</groupId>
......@@ -164,8 +151,9 @@
</exclusions>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${hsqldb.version}</version>
<scope>test</scope>
</dependency>
<dependency>
......
......@@ -152,7 +152,7 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
final ResponseEntity<?> response = generic_find(null, null);
assertEquals(HttpStatus.MOVED_PERMANENTLY, response.getStatusCode());
assertNotNull(response.getHeaders().get("Location"));
assertEquals(endpointConfig.getWebsiteUrl() + "/container/" + IDENTIFIER_1_CONTAINER_ID + "/database/"
assertEquals(endpointConfig.getWebsiteUrl() + "/database/"
+ IDENTIFIER_1_DATABASE_ID, response.getHeaders().getFirst("Location"));
}
......@@ -162,7 +162,7 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
/* test */
assertThrows(AccessDeniedException.class, () -> {
generic_create(CONTAINER_1_ID, DATABASE_1_ID, DATABASE_1, null, IDENTIFIER_1_DTO_REQUEST, null, null, null, null, null);
generic_create(DATABASE_1_ID, DATABASE_1, null, IDENTIFIER_1_DTO_REQUEST, null, null, null, null, null);
});
}
......@@ -177,7 +177,7 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
.thenReturn(Optional.of(DATABASE_1_USER_1_READ_ACCESS));
/* test */
generic_create(CONTAINER_1_ID, DATABASE_1_ID, DATABASE_1, DATABASE_1_USER_1_READ_ACCESS, IDENTIFIER_1_DTO_REQUEST, IDENTIFIER_1, USER_1_PRINCIPAL, USER_1_ID, USER_1_USERNAME, USER_1);
generic_create(DATABASE_1_ID, DATABASE_1, DATABASE_1_USER_1_READ_ACCESS, IDENTIFIER_1_DTO_REQUEST, IDENTIFIER_1, USER_1_PRINCIPAL, USER_1_ID, USER_1_USERNAME, USER_1);
}
@Test
......@@ -186,7 +186,7 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
/* test */
assertThrows(NotAllowedException.class, () -> {
generic_create(CONTAINER_1_ID, DATABASE_1_ID, DATABASE_1, null, IDENTIFIER_1_DTO_REQUEST, IDENTIFIER_1, USER_1_PRINCIPAL, USER_1_ID, USER_1_USERNAME, USER_1);
generic_create(DATABASE_1_ID, DATABASE_1, null, IDENTIFIER_1_DTO_REQUEST, IDENTIFIER_1, USER_1_PRINCIPAL, USER_1_ID, USER_1_USERNAME, USER_1);
});
}
......@@ -196,7 +196,7 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
/* test */
assertThrows(AccessDeniedException.class, () -> {
generic_create(CONTAINER_2_ID, DATABASE_2_ID, DATABASE_2, null, IDENTIFIER_2_DTO_REQUEST, IDENTIFIER_2, null, null, null, null);
generic_create(DATABASE_2_ID, DATABASE_2, null, IDENTIFIER_2_DTO_REQUEST, IDENTIFIER_2, null, null, null, null);
});
}
......@@ -208,7 +208,7 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
at.tuwien.exception.AccessDeniedException {
/* test */
generic_create(CONTAINER_2_ID, DATABASE_2_ID, DATABASE_2, DATABASE_2_USER_1_READ_ACCESS, IDENTIFIER_2_DTO_REQUEST, IDENTIFIER_2, USER_2_PRINCIPAL, USER_2_ID, USER_2_USERNAME, USER_2);
generic_create(DATABASE_2_ID, DATABASE_2, DATABASE_2_USER_1_READ_ACCESS, IDENTIFIER_2_DTO_REQUEST, IDENTIFIER_2, USER_2_PRINCIPAL, USER_2_ID, USER_2_USERNAME, USER_2);
}
@Test
......@@ -216,7 +216,6 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
public void create_invalidSubset_fails() {
final IdentifierCreateDto request = IdentifierCreateDto.builder()
.qid(null) // <--
.cid(IDENTIFIER_1_CONTAINER_ID)
.dbid(IDENTIFIER_1_DATABASE_ID)
.description(IDENTIFIER_1_DESCRIPTION)
.title(IDENTIFIER_1_TITLE)
......@@ -230,7 +229,7 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
/* test */
assertThrows(IdentifierRequestException.class, () -> {
generic_create(CONTAINER_1_ID, DATABASE_1_ID, DATABASE_1, DATABASE_1_USER_1_READ_ACCESS, request, null, USER_1_PRINCIPAL, USER_1_ID, USER_1_USERNAME, USER_1);
generic_create(DATABASE_1_ID, DATABASE_1, DATABASE_1_USER_1_READ_ACCESS, request, null, USER_1_PRINCIPAL, USER_1_ID, USER_1_USERNAME, USER_1);
});
}
......@@ -239,7 +238,6 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
public void create_invalidDatabase_fails() {
final IdentifierCreateDto request = IdentifierCreateDto.builder()
.qid(IDENTIFIER_1_QUERY_ID) // <--
.cid(IDENTIFIER_1_CONTAINER_ID)
.dbid(IDENTIFIER_1_DATABASE_ID)
.description(IDENTIFIER_1_DESCRIPTION)
.title(IDENTIFIER_1_TITLE)
......@@ -254,7 +252,7 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
/* test */
assertThrows(IdentifierRequestException.class, () -> {
generic_create(CONTAINER_1_ID, DATABASE_1_ID, DATABASE_1, DATABASE_1_USER_1_READ_ACCESS, request, null, USER_1_PRINCIPAL, USER_1_ID, USER_1_USERNAME, USER_1);
generic_create(DATABASE_1_ID, DATABASE_1, DATABASE_1_USER_1_READ_ACCESS, request, null, USER_1_PRINCIPAL, USER_1_ID, USER_1_USERNAME, USER_1);
});
}
......@@ -264,7 +262,7 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
/* test */
assertThrows(NotAllowedException.class, () -> {
generic_create(CONTAINER_2_ID, DATABASE_2_ID, DATABASE_2, null, IDENTIFIER_2_DTO_REQUEST, IDENTIFIER_2, USER_1_PRINCIPAL, USER_1_ID, USER_1_USERNAME, USER_1);
generic_create(DATABASE_2_ID, DATABASE_2, null, IDENTIFIER_2_DTO_REQUEST, IDENTIFIER_2, USER_1_PRINCIPAL, USER_1_ID, USER_1_USERNAME, USER_1);
});
}
......@@ -272,7 +270,7 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
/* ## GENERIC TEST CASES ## */
/* ################################################################################################### */
protected void generic_create(Long containerId, Long databaseId, Database database, DatabaseAccess access,
protected void generic_create(Long databaseId, Database database, DatabaseAccess access,
IdentifierCreateDto data, Identifier identifier, Principal principal, UUID userId,
String username, User user) throws QueryNotFoundException, RemoteUnavailableException,
IdentifierAlreadyExistsException, UserNotFoundException, DatabaseNotFoundException,
......@@ -297,7 +295,7 @@ public class IdentifierEndpointUnitTest extends BaseUnitTest {
.when(accessService)
.find(databaseId, userId);
}
when(queryServiceGateway.find(containerId, databaseId, data, "ABC"))
when(queryServiceGateway.find(databaseId, data, "ABC"))
.thenReturn(QUERY_1_DTO);
when(identifierService.create(data, principal, "ABC"))
.thenReturn(identifier);
......
......@@ -105,7 +105,6 @@ public class PersistenceEndpointUnitTest extends BaseUnitTest {
assertEquals(compare.getId(), body.getId());
assertEquals(compare.getTitle(), body.getTitle());
assertEquals(compare.getDescription(), body.getDescription());
assertEquals(compare.getContainerId(), body.getContainerId());
assertEquals(compare.getDatabaseId(), body.getDatabaseId());
assertEquals(compare.getCreated(), body.getCreated());
assertEquals(compare.getLastModified(), body.getLastModified());
......@@ -137,7 +136,6 @@ public class PersistenceEndpointUnitTest extends BaseUnitTest {
assertEquals(compare.getId(), body.getId());
assertEquals(compare.getTitle(), body.getTitle());
assertEquals(compare.getDescription(), body.getDescription());
assertEquals(compare.getContainerId(), body.getContainerId());
assertEquals(compare.getDatabaseId(), body.getDatabaseId());
assertEquals(compare.getCreated(), body.getCreated());
assertEquals(compare.getLastModified(), body.getLastModified());
......
......@@ -65,7 +65,7 @@ public class QueryServiceGatewayUnitTest extends BaseUnitTest {
.thenReturn(mock);
/* test */
final QueryDto response = queryServiceGateway.find(CONTAINER_1_ID, DATABASE_1_ID, IDENTIFIER_1_DTO_REQUEST, null);
final QueryDto response = queryServiceGateway.find(DATABASE_1_ID, IDENTIFIER_1_DTO_REQUEST, null);
assertNotNull(response);
assertEquals(QUERY_1_ID, response.getId());
}
......@@ -81,7 +81,7 @@ public class QueryServiceGatewayUnitTest extends BaseUnitTest {
/* test */
assertThrows(QueryNotFoundException.class, () -> {
queryServiceGateway.find(CONTAINER_1_ID, DATABASE_1_ID, IDENTIFIER_1_DTO_REQUEST, null);
queryServiceGateway.find(DATABASE_1_ID, IDENTIFIER_1_DTO_REQUEST, null);
});
}
......@@ -97,7 +97,7 @@ public class QueryServiceGatewayUnitTest extends BaseUnitTest {
/* test */
assertThrows(RemoteUnavailableException.class, () -> {
queryServiceGateway.find(CONTAINER_1_ID, DATABASE_1_ID, IDENTIFIER_1_DTO_REQUEST, null);
queryServiceGateway.find(DATABASE_1_ID, IDENTIFIER_1_DTO_REQUEST, null);
});
}
......@@ -112,7 +112,7 @@ public class QueryServiceGatewayUnitTest extends BaseUnitTest {
/* test */
assertThrows(RemoteUnavailableException.class, () -> {
queryServiceGateway.find(CONTAINER_1_ID, DATABASE_1_ID, IDENTIFIER_1_DTO_REQUEST, null);
queryServiceGateway.find(DATABASE_1_ID, IDENTIFIER_1_DTO_REQUEST, null);
});
}
......@@ -127,7 +127,7 @@ public class QueryServiceGatewayUnitTest extends BaseUnitTest {
.thenReturn(mock);
/* test */
final byte[] response = queryServiceGateway.export(CONTAINER_1_ID, DATABASE_1_ID, QUERY_1_ID);
final byte[] response = queryServiceGateway.export(DATABASE_1_ID, QUERY_1_ID);
assertNotNull(response);
assertEquals(bytes, response);
}
......@@ -143,7 +143,7 @@ public class QueryServiceGatewayUnitTest extends BaseUnitTest {
/* test */
assertThrows(QueryNotFoundException.class, () -> {
queryServiceGateway.export(CONTAINER_1_ID, DATABASE_1_ID, QUERY_1_ID);
queryServiceGateway.export(DATABASE_1_ID, QUERY_1_ID);
});
}
......@@ -158,7 +158,7 @@ public class QueryServiceGatewayUnitTest extends BaseUnitTest {
/* test */
assertThrows(RemoteUnavailableException.class, () -> {
queryServiceGateway.export(CONTAINER_1_ID, DATABASE_1_ID, QUERY_1_ID);
queryServiceGateway.export(DATABASE_1_ID, QUERY_1_ID);
});
}
......@@ -172,7 +172,7 @@ public class QueryServiceGatewayUnitTest extends BaseUnitTest {
/* test */
assertThrows(RemoteUnavailableException.class, () -> {
queryServiceGateway.export(CONTAINER_1_ID, DATABASE_1_ID, QUERY_1_ID);
queryServiceGateway.export(DATABASE_1_ID, QUERY_1_ID);
});
}
......
......@@ -95,7 +95,7 @@ public class IdentifierServiceIntegrationTest extends BaseUnitTest {
/* mock */
when(restTemplate.exchange(anyString(), any(HttpMethod.class), any(HttpEntity.class), eq(QueryDto.class)))
.thenReturn(ResponseEntity.ok(QUERY_2_DTO));
when(queryServiceGateway.find(CONTAINER_2_ID, DATABASE_2_ID, IDENTIFIER_2_DTO_REQUEST, bearer))
when(queryServiceGateway.find(DATABASE_2_ID, IDENTIFIER_2_DTO_REQUEST, bearer))
.thenReturn(QUERY_2_DTO);
when(identifierIdxRepository.save(any(IdentifierDto.class)))
.thenReturn(IDENTIFIER_2_DTO);
......@@ -107,7 +107,6 @@ public class IdentifierServiceIntegrationTest extends BaseUnitTest {
assertEquals(IDENTIFIER_2_DESCRIPTION, response.getDescription());
assertEquals(IDENTIFIER_2_DOI, response.getDoi());
assertEquals(IDENTIFIER_2_PUBLISHER, response.getPublisher());
assertEquals(IDENTIFIER_2_CONTAINER_ID, response.getContainerId());
assertEquals(IDENTIFIER_2_DATABASE_ID, response.getDatabaseId());
assertNull(response.getLanguage());
assertEquals(IDENTIFIER_2_PUBLICATION_YEAR, response.getPublicationYear());
......
......@@ -8,15 +8,15 @@ spring.cloud.discovery.enabled = false
spring.cloud.config.discovery.enabled = false
spring.cloud.config.enabled = false
# disable datasource
# spring 6 fix https://github.com/h2database/h2database/issues/3363
spring.datasource.url=jdbc:h2:mem:testdb;NON_KEYWORDS=VALUE,KEY;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS FDA
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.show-sql=false
# internal datasource
spring.datasource.driver-class-name=org.hsqldb.jdbc.JDBCDriver
spring.datasource.url=jdbc:hsqldb:mem:testdb;db_close_delay=-1;sql.syntax_mys=true
spring.jpa.database-platform=org.hibernate.dialect.HSQLDialect
spring.datasource.username=root
spring.datasource.password=dbrepo
spring.sql.init.mode=always
spring.sql.init.schema-locations=classpath*:init/schema.sql
spring.jpa.hibernate.ddl-auto=create
# datacite
fda.datacite.url: https://api.test.datacite.org/
......
CREATE SCHEMA IF NOT EXISTS fda;
\ No newline at end of file
{
"id": 4,
"container_id": 4,
"database_id": 4,
"type": "database",
"title": "Sweden weather data",
......
{
"id": 1,
"container_id": 1,
"database_id": 1,
"query_id": 1,
"type": "subset",
......
......@@ -12,7 +12,6 @@ public interface QueryServiceGateway {
/**
* Finds a query by given id from the query service that internally looks in the query store of a container.
*
* @param containerId The container id.
* @param databaseId The database id.
* @param identifier The identifier containing the query id and database id.
* @param authorization The authorization token.
......@@ -20,19 +19,18 @@ public interface QueryServiceGateway {
* @throws QueryNotFoundException The query was not found.
* @throws RemoteUnavailableException The remote service is not available.
*/
QueryDto find(Long containerId, Long databaseId, IdentifierCreateDto identifier, String authorization)
QueryDto find(Long databaseId, IdentifierCreateDto identifier, String authorization)
throws QueryNotFoundException, RemoteUnavailableException;
/**
* Exports a query by given id.
*
* @param containerId The container id.
* @param databaseId The database id.
* @param queryId The query id.
* @return The exported resource as bytes.
* @throws RemoteUnavailableException The remote service is not available.
* @throws QueryNotFoundException The query was not found.
*/
byte[] export(Long containerId, Long databaseId, Long queryId) throws RemoteUnavailableException,
byte[] export(Long databaseId, Long queryId) throws RemoteUnavailableException,
QueryNotFoundException;
}
......@@ -25,29 +25,29 @@ public class QueryServiceGatewayImpl implements QueryServiceGateway {
}
@Override
public QueryDto find(Long containerId, Long databaseId, IdentifierCreateDto identifier, String authorization) throws QueryNotFoundException,
public QueryDto find(Long databaseId, IdentifierCreateDto identifier, String authorization) throws QueryNotFoundException,
RemoteUnavailableException {
final HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", authorization);
final String url =
"/api/container/" + containerId + "/database/" + databaseId + "/query/" + identifier.getQid();
"/api/database/" + databaseId + "/query/" + identifier.getQid();
final ResponseEntity<QueryDto> response;
try {
log.trace("call gateway path {}", url);
response = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(null, headers), QueryDto.class);
} catch (ResourceAccessException | HttpServerErrorException.ServiceUnavailable e) {
log.error("Query service not available for container with id {} and database with id {} for query with id {}, reason {}",
containerId, databaseId, identifier.getQid(), e.getMessage());
log.error("Query service not available for database with id {} for query with id {}, reason {}",
databaseId, identifier.getQid(), e.getMessage());
throw new RemoteUnavailableException("Query service not available", e);
}
if (response.getStatusCode().equals(HttpStatus.NOT_FOUND)) {
log.error("Query not found for container with id {} and database with id {} for query with id {}",
containerId, databaseId, identifier.getQid());
log.error("Query not found for and database with id {} for query with id {}",
databaseId, identifier.getQid());
throw new QueryNotFoundException("Query not found");
}
if (response.getStatusCode().equals(HttpStatus.UNAUTHORIZED)) {
log.error("Query not authorized for container with id {} and database with id {} for query with id {}",
containerId, databaseId, identifier.getQid());
log.error("Query not authorized for and database with id {} for query with id {}",
databaseId, identifier.getQid());
throw new RemoteUnavailableException("Query not authorized");
}
log.debug("found query {}", response.getBody());
......@@ -55,9 +55,9 @@ public class QueryServiceGatewayImpl implements QueryServiceGateway {
}
@Override
public byte[] export(Long containerId, Long databaseId, Long queryId)
public byte[] export(Long databaseId, Long queryId)
throws RemoteUnavailableException, QueryNotFoundException {
final String url = "/api/container/" + containerId + "/database/" + databaseId + "/query/" + queryId + "/export";
final String url = "/database/" + databaseId + "/query/" + queryId + "/export";
final HttpHeaders headers = new HttpHeaders();
headers.add("Accept", "text/csv");
final ResponseEntity<byte[]> response;
......@@ -69,13 +69,13 @@ public class QueryServiceGatewayImpl implements QueryServiceGateway {
throw new RemoteUnavailableException("Query service not available", e);
}
if (response.getStatusCode().equals(HttpStatus.NOT_FOUND)) {
log.error("Query not found for container with id {} and database with id {} for query with id {}",
containerId, databaseId, queryId);
log.error("Query not found for and database with id {} for query with id {}",
databaseId, queryId);
throw new QueryNotFoundException("Query not found");
}
if (response.getStatusCode().equals(HttpStatus.UNAUTHORIZED)) {
log.error("Query not authorized for container with id {} and database with id {} for query with id {}",
containerId, databaseId, queryId);
log.error("Query not authorized for and database with id {} for query with id {}",
databaseId, queryId);
throw new RemoteUnavailableException("Query not authorized");
}
log.debug("found query {}", response.getBody());
......
......@@ -15,14 +15,12 @@ public interface IdentifierMapper {
IdentifierDto identifierToIdentifierDto(Identifier data);
@Mappings({
@Mapping(target = "containerId", source = "cid"),
@Mapping(target = "databaseId", source = "dbid"),
@Mapping(target = "queryId", source = "qid"),
})
Identifier identifierCreateDtoToIdentifier(IdentifierCreateDto data);
@Mappings({
@Mapping(target = "containerId", source = "cid"),
@Mapping(target = "databaseId", source = "dbid"),
@Mapping(target = "queryId", source = "qid"),
})
......@@ -44,9 +42,9 @@ public interface IdentifierMapper {
default String identifierToLocationUrl(String baseUrl, Identifier data) {
if (data.getType().equals(IdentifierType.SUBSET)) {
return baseUrl + "/container/" + data.getContainerId() + "/database/" + data.getDatabaseId() + "/query/" + data.getQueryId();
return baseUrl + "/database/" + data.getDatabaseId() + "/query/" + data.getQueryId();
} else if (data.getType().equals(IdentifierType.DATABASE)) {
return baseUrl + "/container/" + data.getContainerId() + "/database/" + data.getDatabaseId();
return baseUrl + "/database/" + data.getDatabaseId();
} else {
return null;
}
......
......@@ -2,17 +2,9 @@ package at.tuwien.repository.mdb;
import at.tuwien.entities.database.Database;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface DatabaseRepository extends JpaRepository<Database, Long> {
@Query(value = "select d from Database d where d.container.id = :containerId and d.id = :databaseId")
Optional<Database> findByContainerAndDatabaseId(@Param("containerId") Long containerId,
@Param("databaseId") Long databaseId);
}
package at.tuwien.service.impl;
import at.tuwien.api.database.query.QueryDto;
import at.tuwien.api.identifier.*;
import at.tuwien.api.identifier.BibliographyTypeDto;
import at.tuwien.api.identifier.IdentifierCreateDto;
import at.tuwien.api.identifier.IdentifierTypeDto;
import at.tuwien.api.identifier.IdentifierUpdateDto;
import at.tuwien.config.EndpointConfig;
import at.tuwien.entities.database.Database;
import at.tuwien.entities.identifier.Creator;
......@@ -117,7 +120,7 @@ public class IdentifierServiceImpl implements IdentifierService {
tmp.setCreators(List.of());
if (data.getType().equals(IdentifierTypeDto.SUBSET)) {
log.debug("identifier describes a subset");
final QueryDto query = queryServiceGateway.find(data.getCid(), data.getDbid(), data, authorization);
final QueryDto query = queryServiceGateway.find(data.getDbid(), data, authorization);
tmp.setQuery(query.getQuery());
tmp.setQueryId(query.getId());
tmp.setQueryNormalized(query.getQueryNormalized());
......@@ -241,8 +244,7 @@ public class IdentifierServiceImpl implements IdentifierService {
throw new IdentifierRequestException("Failed to find identifier");
}
/* subset */
final byte[] file = queryServiceGateway.export(identifier.getContainerId(),
identifier.getDatabaseId(), identifier.getQueryId());
final byte[] file = queryServiceGateway.export(identifier.getDatabaseId(), identifier.getQueryId());
final InputStreamResource resource = new InputStreamResource(new ByteArrayInputStream(file));
log.trace("found resource {}", resource);
return resource;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment