diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dssapi/v3/DataStoreServerApi.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dssapi/v3/DataStoreServerApi.java index b37cbfe8740d237c5f994bbee79a956b70d32568..df07a8c792233ee022a5bcdbf667f9200eed580b 100644 --- a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dssapi/v3/DataStoreServerApi.java +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dssapi/v3/DataStoreServerApi.java @@ -44,6 +44,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.search.DataSetSearchCrit import ch.ethz.sis.openbis.generic.dssapi.v3.IDataStoreServerApi; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.download.DataSetFileDownloadOptions; +import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions.DataSetFileFetchOptions; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.id.DataSetFilePermId; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.id.IDataSetFileId; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria; @@ -128,7 +129,7 @@ public class DataStoreServerApi extends AbstractDssServiceRpc<IDataStoreServerAp @Transactional(readOnly = true) @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) @Override - public List<DataSetFile> searchFiles(String sessionToken, DataSetFileSearchCriteria searchCriteria) + public SearchResult<DataSetFile> searchFiles(String sessionToken, DataSetFileSearchCriteria searchCriteria, DataSetFileFetchOptions fetchOptions) { getOpenBISService().checkSession(sessionToken); @@ -187,7 +188,7 @@ public class DataStoreServerApi extends AbstractDssServiceRpc<IDataStoreServerAp } } - return result; + return new SearchResult<DataSetFile>(result, result.size()); } @Transactional(readOnly = true) diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dssapi/v3/DataStoreServerApiLogger.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dssapi/v3/DataStoreServerApiLogger.java index 07427f727c5ba528e982c0eae3729aacefe4225b..1bf30c172b25256caa3a8b211c1ace212a7b1884 100644 --- a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dssapi/v3/DataStoreServerApiLogger.java +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dssapi/v3/DataStoreServerApiLogger.java @@ -3,9 +3,11 @@ package ch.ethz.sis.openbis.generic.server.dssapi.v3; import java.io.InputStream; import java.util.List; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.SearchResult; import ch.ethz.sis.openbis.generic.dssapi.v3.IDataStoreServerApi; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.download.DataSetFileDownloadOptions; +import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions.DataSetFileFetchOptions; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.id.IDataSetFileId; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria; import ch.systemsx.cisd.openbis.common.spring.IInvocationLoggerContext; @@ -32,7 +34,7 @@ public class DataStoreServerApiLogger extends AbstractServerLogger implements } @Override - public List<DataSetFile> searchFiles(String sessionToken, DataSetFileSearchCriteria searchCriteria) + public SearchResult<DataSetFile> searchFiles(String sessionToken, DataSetFileSearchCriteria searchCriteria, DataSetFileFetchOptions fetchOptions) { logAccess(sessionToken, "search-files", "SEARCH_CRITERION:\n%s\n", searchCriteria); return null; diff --git a/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/SearchFileTest.java b/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/SearchFileTest.java index 6f55d2f12258b5d56def94eb8d6d280070438ef0..7ccd6982ca5eae137f0c449ba49b86cd5c4b4390 100644 --- a/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/SearchFileTest.java +++ b/datastore_server/sourceTest/java/ch/ethz/sis/openbis/generic/dss/systemtest/api/v3/SearchFileTest.java @@ -7,7 +7,9 @@ import java.util.List; import org.testng.annotations.Test; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.SearchResult; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile; +import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions.DataSetFileFetchOptions; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria; public class SearchFileTest extends AbstractFileTest @@ -19,7 +21,8 @@ public class SearchFileTest extends AbstractFileTest DataSetFileSearchCriteria sc = new DataSetFileSearchCriteria(); sc.withDataSet().withPermId().thatEquals(dataSetCode); - List<DataSetFile> searchFiles = dss.searchFiles(sessionToken, sc); + SearchResult<DataSetFile> searchResult = dss.searchFiles(sessionToken, sc, new DataSetFileFetchOptions()); + List<DataSetFile> searchFiles = searchResult.getObjects(); assertThat(searchFiles, containsAll(filesAndDirectories)); /* directory structure [dataset id]/original/[root folder] */ diff --git a/datastore_server/sourceTest/java/tests.xml b/datastore_server/sourceTest/java/tests.xml index 3bbcfc2ffb3d44b13bfd6d640256963912c7865f..4f8401125cd124826766cc530ccd1e15f7be47e3 100644 --- a/datastore_server/sourceTest/java/tests.xml +++ b/datastore_server/sourceTest/java/tests.xml @@ -11,6 +11,7 @@ <package name="ch.systemsx.cisd.etlserver.*" /> <package name="ch.systemsx.cisd.openbis.dss.*" /> <package name="ch.systemsx.cisd.openbis.datastoreserver.*" /> + <package name="ch.ethz.sis.openbis.generic.dss.*" /> </packages> </test> </suite> diff --git a/datastore_server/sourceTest/java/tests_v3_api.xml b/datastore_server/sourceTest/java/tests_v3_api.xml new file mode 100644 index 0000000000000000000000000000000000000000..f737a552942f07e4306bfd6e44aa20751202abd6 --- /dev/null +++ b/datastore_server/sourceTest/java/tests_v3_api.xml @@ -0,0 +1,14 @@ +<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" > + +<suite name="V3" verbose="1"> + <test name="V3"> + <groups> + <run> + <exclude name="broken" /> + </run> + </groups> + <packages> + <package name="ch.ethz.sis.openbis.generic.dss.systemtest.api.v3.*" /> + </packages> + </test> +</suite> diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/IDataStoreServerApi.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/IDataStoreServerApi.java index 29c204bc309ff6f0cf6b6458bdb69ff138ed4d84..c30634a75cb6bd0e2d0aaded95fb90eb5f876ded 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/IDataStoreServerApi.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/IDataStoreServerApi.java @@ -19,8 +19,10 @@ package ch.ethz.sis.openbis.generic.dssapi.v3; import java.io.InputStream; import java.util.List; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.SearchResult; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.download.DataSetFileDownloadOptions; +import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions.DataSetFileFetchOptions; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.id.IDataSetFileId; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria; import ch.systemsx.cisd.common.api.IRpcService; @@ -42,7 +44,7 @@ public interface IDataStoreServerApi extends IRpcService public static final String JSON_SERVICE_URL = SERVICE_URL + ".json"; - public List<DataSetFile> searchFiles(String sessionToken, DataSetFileSearchCriteria searchCriteria); + public SearchResult<DataSetFile> searchFiles(String sessionToken, DataSetFileSearchCriteria searchCriteria, DataSetFileFetchOptions fetchOptions); public InputStream downloadFiles(String sessionToken, List<? extends IDataSetFileId> fileIds, DataSetFileDownloadOptions downloadOptions); diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/dto/datasetfile/fetchoptions/DataSetFileFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/dto/datasetfile/fetchoptions/DataSetFileFetchOptions.java new file mode 100644 index 0000000000000000000000000000000000000000..ccf178295eeb7a2d7e20e30bb8e086f4517850ab --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/dto/datasetfile/fetchoptions/DataSetFileFetchOptions.java @@ -0,0 +1,52 @@ +/* + * Copyright 2014 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptions; +import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile; +import ch.systemsx.cisd.base.annotation.JsonObject; + +/** + * @author pkupczyk + */ +@JsonObject("dss.dto.datasetfile.fetchoptions.DataSetFileFetchOptions") +public class DataSetFileFetchOptions extends FetchOptions<DataSetFile> implements Serializable +{ + private static final long serialVersionUID = 1L; + + @JsonProperty + private DataSetFileSortOptions sort; + + @Override + public DataSetFileSortOptions sortBy() + { + if (sort == null) + { + sort = new DataSetFileSortOptions(); + } + return sort; + } + + @Override + public DataSetFileSortOptions getSortBy() + { + return sort; + } +} diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/dto/datasetfile/fetchoptions/DataSetFileSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/dto/datasetfile/fetchoptions/DataSetFileSortOptions.java new file mode 100644 index 0000000000000000000000000000000000000000..7ef00b475010d65ce230bbadb9d96d241914f7da --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/dssapi/v3/dto/datasetfile/fetchoptions/DataSetFileSortOptions.java @@ -0,0 +1,30 @@ +/* + * Copyright 2015 ETH Zuerich, SIS + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions; + +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.SortOptions; +import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile; +import ch.systemsx.cisd.base.annotation.JsonObject; + +/** + * @author pkupczyk + */ +@JsonObject("dss.dto.datasetfile.fetchoptions.DataSetFileSortOptions") +public class DataSetFileSortOptions extends SortOptions<DataSetFile> +{ + private static final long serialVersionUID = 1L; +} diff --git a/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt b/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt index 7584a2d14e64dc59c226ddc24adb51f235152057..715d6bb47653b6d5b0cbbbc1c942d780135b44e7 100644 --- a/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt +++ b/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt @@ -996,7 +996,6 @@ getDataProducer getDataProductionDate setDataProducer setDataProductionDate - Custom AS Service Custom AS Service Code Custom AS Service Context @@ -1008,3 +1007,5 @@ execute Custom AS Service I Custom AS Service Executor I Custom AS Service Id search Custom AS Services +DataSetFileFetchOptions +DataSetFileSortOptions \ No newline at end of file