diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/DataSetQuery.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/DataSetQuery.java new file mode 100644 index 0000000000000000000000000000000000000000..9e4b4a72a46fc3cf3c1194a97cdad384f351e06f --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/DataSetQuery.java @@ -0,0 +1,36 @@ +/* + * 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.server.api.v3.executor.dataset; + +import java.util.List; + +import net.lemnik.eodsql.Select; + +import ch.ethz.sis.openbis.generic.server.api.v3.executor.common.TechIdStringIdentifierRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectQuery; +import ch.systemsx.cisd.common.db.mapper.StringArrayMapper; + +/** + * @author pkupczyk + */ +public interface DataSetQuery extends ObjectQuery +{ + @Select(sql = "select id, code as identifier from data where code = any(?{1})", parameterBindings = + { StringArrayMapper.class }, fetchSize = FETCH_SIZE) + public List<TechIdStringIdentifierRecord> listDataSetTechIdsByPermIds(String[] permIds); + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/IMapDataSetTechIdByIdExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/IMapDataSetTechIdByIdExecutor.java new file mode 100644 index 0000000000000000000000000000000000000000..edf1840c35e3e337ecb8ed470bf29aa68d676e4d --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/IMapDataSetTechIdByIdExecutor.java @@ -0,0 +1,28 @@ +/* + * Copyright 2014 ETH Zuerich, Scientific IT Services + * + * 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.server.api.v3.executor.dataset; + +import ch.ethz.sis.openbis.generic.server.api.v3.executor.common.IMapObjectByIdExecutor; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.IDataSetId; + +/** + * @author pkupczyk + */ +public interface IMapDataSetTechIdByIdExecutor extends IMapObjectByIdExecutor<IDataSetId, Long> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/ISearchDataSetIdExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/ISearchDataSetIdExecutor.java new file mode 100644 index 0000000000000000000000000000000000000000..32addf132234a43e14c4e214b6d075e5abb36ff1 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/ISearchDataSetIdExecutor.java @@ -0,0 +1,28 @@ +/* + * Copyright 2014 ETH Zuerich, Scientific IT Services + * + * 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.server.api.v3.executor.dataset; + +import ch.ethz.sis.openbis.generic.server.api.v3.executor.common.ISearchObjectExecutor; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.search.DataSetSearchCriteria; + +/** + * @author pkupczyk + */ +public interface ISearchDataSetIdExecutor extends ISearchObjectExecutor<DataSetSearchCriteria, Long> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/ListDataSetTechIdByPermId.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/ListDataSetTechIdByPermId.java new file mode 100644 index 0000000000000000000000000000000000000000..d47fb05d27be1d3b87942f226af371efa638cad8 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/ListDataSetTechIdByPermId.java @@ -0,0 +1,50 @@ +/* + * Copyright 2015 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.server.api.v3.executor.dataset; + +import java.util.List; + +import net.lemnik.eodsql.QueryTool; + +import ch.ethz.sis.openbis.generic.server.api.v3.executor.common.TechIdStringIdentifierRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.AbstractListTechIdByPermId; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId; + +/** + * @author pkupczyk + */ +public class ListDataSetTechIdByPermId extends AbstractListTechIdByPermId<DataSetPermId> +{ + @Override + public Class<DataSetPermId> getIdClass() + { + return DataSetPermId.class; + } + + @Override + protected List<TechIdStringIdentifierRecord> queryTechIds(String[] permIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.listDataSetTechIdsByPermIds(permIds); + } + + @Override + protected DataSetPermId createPermId(String permIdAsString) + { + return new DataSetPermId(permIdAsString); + } +} \ No newline at end of file diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/MapDataSetTechIdByIdExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/MapDataSetTechIdByIdExecutor.java new file mode 100644 index 0000000000000000000000000000000000000000..8a59c75a9428ca8ca45b50ef412a96e9ff257980 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/MapDataSetTechIdByIdExecutor.java @@ -0,0 +1,45 @@ +/* + * Copyright 2014 ETH Zuerich, Scientific IT Services + * + * 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.server.api.v3.executor.dataset; + +import java.util.LinkedList; +import java.util.List; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext; +import ch.ethz.sis.openbis.generic.server.api.v3.executor.common.AbstractMapObjectByIdExecutor; +import ch.ethz.sis.openbis.generic.server.api.v3.helper.common.IListObjectById; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.IDataSetId; + +/** + * @author pkupczyk + */ +@Component +public class MapDataSetTechIdByIdExecutor extends AbstractMapObjectByIdExecutor<IDataSetId, Long> implements IMapDataSetTechIdByIdExecutor +{ + + @Override + protected List<IListObjectById<? extends IDataSetId, Long>> createListers(IOperationContext context) + { + List<IListObjectById<? extends IDataSetId, Long>> listers = + new LinkedList<IListObjectById<? extends IDataSetId, Long>>(); + listers.add(new ListDataSetTechIdByPermId()); + return listers; + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SearchDataSetIdExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SearchDataSetIdExecutor.java new file mode 100644 index 0000000000000000000000000000000000000000..c04b858679de84c3dcb53154c602dc415aa36fee --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/SearchDataSetIdExecutor.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.server.api.v3.executor.dataset; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext; +import ch.ethz.sis.openbis.generic.server.api.v3.executor.common.AbstractSearchObjectExecutor; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.search.DataSetSearchCriteria; +import ch.systemsx.cisd.openbis.generic.server.business.search.DataSetSearchManager; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DetailedSearchCriteria; + +/** + * @author pkupczyk + */ +@Component +public class SearchDataSetIdExecutor extends AbstractSearchObjectExecutor<DataSetSearchCriteria, Long> implements + ISearchDataSetIdExecutor +{ + + @Override + protected List<Long> doSearch(IOperationContext context, DetailedSearchCriteria criteria) + { + DataSetSearchManager searchManager = + new DataSetSearchManager(daoFactory.getHibernateSearchDAO(), + businessObjectFactory.createDatasetLister(context.getSession())); + + Collection<Long> dataIds = + searchManager.searchForDataSetIds(context.getSession().getUserName(), criteria); + + return new ArrayList<Long>(dataIds); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/MapDataSetMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/MapDataSetMethodExecutor.java index c35c7582843444f0ebdd71c9b50e806af43f8b7d..4511ecb3027dfc3ae4f4480e2d2c71e528355cf1 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/MapDataSetMethodExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/MapDataSetMethodExecutor.java @@ -17,7 +17,6 @@ package ch.ethz.sis.openbis.generic.server.api.v3.executor.method; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; import ch.ethz.sis.openbis.generic.server.api.v3.executor.common.IMapObjectByIdExecutor; import ch.ethz.sis.openbis.generic.server.api.v3.executor.dataset.IMapDataSetByIdExecutor; @@ -31,8 +30,9 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; /** * @author pkupczyk */ -@Component -public class MapDataSetMethodExecutor extends AbstractMapMethodExecutor<IDataSetId, DataPE, DataSet, DataSetFetchOptions> implements IMapDataSetMethodExecutor +// @Component +public class MapDataSetMethodExecutor extends AbstractMapMethodExecutor<IDataSetId, DataPE, DataSet, DataSetFetchOptions> implements + IMapDataSetMethodExecutor { @Autowired diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/MapDataSetSqlMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/MapDataSetSqlMethodExecutor.java new file mode 100644 index 0000000000000000000000000000000000000000..45a9405beb59495848e84ad0548e06f1f3f0c3d6 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/MapDataSetSqlMethodExecutor.java @@ -0,0 +1,56 @@ +/* + * Copyright 2015 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.server.api.v3.executor.method; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.executor.common.IMapObjectByIdExecutor; +import ch.ethz.sis.openbis.generic.server.api.v3.executor.dataset.IMapDataSetTechIdByIdExecutor; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.ITranslator; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.dataset.sql.IDataSetSqlTranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSet; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetFetchOptions; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.IDataSetId; + +/** + * @author pkupczyk + */ +@Component +public class MapDataSetSqlMethodExecutor extends AbstractMapMethodExecutor<IDataSetId, Long, DataSet, DataSetFetchOptions> implements + IMapDataSetMethodExecutor +{ + + @Autowired + private IMapDataSetTechIdByIdExecutor mapExecutor; + + @Autowired + private IDataSetSqlTranslator translator; + + @Override + protected IMapObjectByIdExecutor<IDataSetId, Long> getMapExecutor() + { + return mapExecutor; + } + + @Override + protected ITranslator<Long, DataSet, DataSetFetchOptions> getTranslator() + { + return translator; + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/SearchDataSetMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/SearchDataSetMethodExecutor.java index 92b524a2a77248a0a9179b7175906ee4ac3eda68..46f64d623bd13c0b7ea5b7d4f1b8df530368afdf 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/SearchDataSetMethodExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/SearchDataSetMethodExecutor.java @@ -17,7 +17,6 @@ package ch.ethz.sis.openbis.generic.server.api.v3.executor.method; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; import ch.ethz.sis.openbis.generic.server.api.v3.executor.common.ISearchObjectExecutor; import ch.ethz.sis.openbis.generic.server.api.v3.executor.dataset.ISearchDataSetExecutor; @@ -31,7 +30,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; /** * @author pkupczyk */ -@Component +// @Component public class SearchDataSetMethodExecutor extends AbstractSearchMethodExecutor<DataSet, DataPE, DataSetSearchCriteria, DataSetFetchOptions> implements ISearchDataSetMethodExecutor diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/SearchDataSetSqlMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/SearchDataSetSqlMethodExecutor.java new file mode 100644 index 0000000000000000000000000000000000000000..1be622149c52eb095acd98b88f2cc15955935725 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/SearchDataSetSqlMethodExecutor.java @@ -0,0 +1,57 @@ +/* + * Copyright 2015 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.server.api.v3.executor.method; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.executor.common.ISearchObjectExecutor; +import ch.ethz.sis.openbis.generic.server.api.v3.executor.dataset.ISearchDataSetIdExecutor; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.ITranslator; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.dataset.sql.IDataSetSqlTranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSet; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetFetchOptions; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.search.DataSetSearchCriteria; + +/** + * @author pkupczyk + */ +@Component +public class SearchDataSetSqlMethodExecutor extends + AbstractSearchMethodExecutor<DataSet, Long, DataSetSearchCriteria, DataSetFetchOptions> + implements ISearchDataSetMethodExecutor +{ + + @Autowired + private ISearchDataSetIdExecutor searchExecutor; + + @Autowired + private IDataSetSqlTranslator translator; + + @Override + protected ISearchObjectExecutor<DataSetSearchCriteria, Long> getSearchExecutor() + { + return searchExecutor; + } + + @Override + protected ITranslator<Long, DataSet, DataSetFetchOptions> getTranslator() + { + return translator; + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectBaseTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectBaseTranslator.java index fc8c5a6cf47f68670f22758b804b13dd3ada666b..eb0efe7bae55e2ab52ba974382bd78e3fd4dc495 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectBaseTranslator.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectBaseTranslator.java @@ -31,7 +31,7 @@ import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.EmptyFetchOpti * @author pkupczyk */ public abstract class ObjectBaseTranslator<RECORD extends ObjectBaseRecord> extends - AbstractCachingTranslator<Long, ObjectHolder<RECORD>, EmptyFetchOptions> + AbstractCachingTranslator<Long, ObjectHolder<RECORD>, EmptyFetchOptions> implements IObjectBaseTranslator<RECORD> { @Override diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/ILocatorTypeTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/ILocatorTypeTranslator.java index 493c8e2b607fe89dae346d0928f1a5998d507d3e..120e5f87d5f735d8baf8f07b3c64de90d18305dd 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/ILocatorTypeTranslator.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/ILocatorTypeTranslator.java @@ -16,7 +16,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.dataset; -import ch.ethz.sis.openbis.generic.server.api.v3.translator.ITranslator; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.ITranslator; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.LocatorType; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.LocatorTypeFetchOptions; import ch.systemsx.cisd.openbis.generic.shared.dto.LocatorTypePE; diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetAuthorizationRecord.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetAuthorizationRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..db147c49e864538ba1da5f322c5802d85830df1a --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetAuthorizationRecord.java @@ -0,0 +1,41 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +/** + * @author pkupczyk + */ +public class DataSetAuthorizationRecord +{ + + public Long id; + + public Boolean isStorageConfirmed; + + public String sampleCode; + + public String sampleSpaceCode; + + public String sampleContainerCode; + + public String experimentCode; + + public String experimentProjectCode; + + public String experimentSpaceCode; + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetAuthorizationSqlValidator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetAuthorizationSqlValidator.java new file mode 100644 index 0000000000000000000000000000000000000000..97e22c2fe6eb7d4472471a2e4b79594a25d4d329 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetAuthorizationSqlValidator.java @@ -0,0 +1,104 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentIdentifier; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.SampleIdentifier; +import ch.systemsx.cisd.openbis.generic.server.authorization.validator.AbstractDataSetByExperimentOrSampleIdentifierValidator; +import ch.systemsx.cisd.openbis.generic.server.authorization.validator.AbstractValidator; +import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; + +/** + * @author pkupczyk + */ +@Component +public class DataSetAuthorizationSqlValidator implements IDataSetAuthorizationSqlValidator +{ + + @Override + public Set<Long> validate(PersonPE person, Collection<Long> dataSetIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + List<DataSetAuthorizationRecord> records = query.getAuthorizations(new LongOpenHashSet(dataSetIds)); + AbstractValidator<DataSetAuthorizationRecord> validator = + new AbstractDataSetByExperimentOrSampleIdentifierValidator<DataSetAuthorizationRecord>() + { + + @Override + protected boolean isStorageConfirmed(DataSetAuthorizationRecord record) + { + if (record.isStorageConfirmed != null) + { + return record.isStorageConfirmed; + } else + { + return true; + } + } + + @Override + protected String getExperimentIdentifier(DataSetAuthorizationRecord record) + { + if (record.experimentCode != null) + { + return new ExperimentIdentifier(record.experimentSpaceCode, record.experimentProjectCode, record.experimentCode) + .getIdentifier(); + } else + { + return null; + } + } + + @Override + protected String getSampleIdentifier(DataSetAuthorizationRecord record) + { + if (record.sampleCode != null) + { + return new SampleIdentifier(record.sampleSpaceCode, record.sampleContainerCode, record.sampleCode).getIdentifier(); + } else + { + return null; + } + } + + }; + + Set<Long> result = new HashSet<Long>(); + + for (DataSetAuthorizationRecord record : records) + { + if (validator.doValidation(person, record)) + { + result.add(record.id); + } + } + + return result; + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetBaseRecord.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetBaseRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..eac68b23a5644a80fa38430b55727642e6229ba2 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetBaseRecord.java @@ -0,0 +1,41 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import java.util.Date; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectBaseRecord; + +/** + * @author pkupczyk + */ +public class DataSetBaseRecord extends ObjectBaseRecord +{ + + public String code; + + public Boolean isDerived; + + public Boolean isPlaceholder; + + public Date accessDate; + + public Date modificationDate; + + public Date registrationDate; + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetBaseSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetBaseSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..99c78000226d7e627804b7498e2566ef01ebcc51 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetBaseSqlTranslator.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import org.springframework.stereotype.Component; + +import net.lemnik.eodsql.QueryTool; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectBaseTranslator; + +/** + * @author pkupczyk + */ +@Component +public class DataSetBaseSqlTranslator extends ObjectBaseTranslator<DataSetBaseRecord> implements IDataSetBaseSqlTranslator +{ + + @Override + protected List<DataSetBaseRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getDataSets(new LongOpenHashSet(objectIds)); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetChildSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetChildSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..708a161b90de56077af3e29f69ef1861c7b35d8e --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetChildSqlTranslator.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import org.springframework.stereotype.Component; + +import net.lemnik.eodsql.QueryTool; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; + +/** + * @author pkupczyk + */ +@Component +public class DataSetChildSqlTranslator extends ObjectToDataSetsSqlTranslator implements IDataSetChildSqlTranslator +{ + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getChildIds(new LongOpenHashSet(objectIds)); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetContainedSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetContainedSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..5ad4500939d5ea0161b04f09f4acbeb41ef21fd4 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetContainedSqlTranslator.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; + +/** + * @author pkupczyk + */ +@Component +public class DataSetContainedSqlTranslator extends ObjectToDataSetsSqlTranslator implements IDataSetContainedSqlTranslator +{ + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getContainedIds(new LongOpenHashSet(objectIds)); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetContainerSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetContainerSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..d9b5200f79f754bf05180f22931dae43b390217a --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetContainerSqlTranslator.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; + +/** + * @author pkupczyk + */ +@Component +public class DataSetContainerSqlTranslator extends ObjectToDataSetsSqlTranslator implements IDataSetContainerSqlTranslator +{ + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getContainerIds(new LongOpenHashSet(objectIds)); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetExperimentSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetExperimentSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..e7c4177e6d578f7bb32bbb4fbe390997fa16aba8 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetExperimentSqlTranslator.java @@ -0,0 +1,44 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.experiment.sql.ObjectToExperimentSqlTranslator; + +/** + * @author pkupczyk + */ +@Component +public class DataSetExperimentSqlTranslator extends ObjectToExperimentSqlTranslator implements IDataSetExperimentSqlTranslator +{ + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getExperimentIds(new LongOpenHashSet(objectIds)); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetExternalDataSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetExternalDataSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..b525f63c9e2d40a4885d0db2befd3be9bdd91347 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetExternalDataSqlTranslator.java @@ -0,0 +1,61 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectToOneRelationTranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.ExternalData; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.ExternalDataFetchOptions; + +/** + * @author pkupczyk + */ +@Component +public class DataSetExternalDataSqlTranslator extends ObjectToOneRelationTranslator<ExternalData, ExternalDataFetchOptions> implements + IDataSetExternalDataSqlTranslator +{ + + @Autowired + private IExternalDataSqlTranslator externalDataTranslator; + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getExternalDataIds(objectIds); + } + + @Override + protected Map<Long, ExternalData> translateRelated(TranslationContext context, Collection<Long> relatedIds, + ExternalDataFetchOptions relatedFetchOptions) + { + return externalDataTranslator.translate(context, relatedIds, relatedFetchOptions); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetMaterialPropertySqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetMaterialPropertySqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..60080c68b8542cd21f64f7d5c4b9e84c7b216a66 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetMaterialPropertySqlTranslator.java @@ -0,0 +1,45 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.Collection; +import java.util.List; + +import org.springframework.stereotype.Component; + +import net.lemnik.eodsql.QueryTool; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.property.sql.MaterialPropertyRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.property.sql.MaterialPropertySqlTranslator; + +/** + * @author pkupczyk + */ +@Component +public class DataSetMaterialPropertySqlTranslator extends MaterialPropertySqlTranslator implements IDataSetMaterialPropertySqlTranslator +{ + + @Override + protected List<MaterialPropertyRecord> loadMaterialProperties(Collection<Long> objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getMaterialProperties(new LongOpenHashSet(objectIds)); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetModifierSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetModifierSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..8a68cd1bd4bb1770e0dfa478eefac1f7b8b67ef7 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetModifierSqlTranslator.java @@ -0,0 +1,44 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.person.sql.ObjectToPersonSqlTranslator; + +/** + * @author pkupczyk + */ +@Component +public class DataSetModifierSqlTranslator extends ObjectToPersonSqlTranslator implements IDataSetModifierSqlTranslator +{ + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getModifierIds(new LongOpenHashSet(objectIds)); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetParentSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetParentSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..3b69e741fad45076469080066714c449e79e594b --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetParentSqlTranslator.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; + +/** + * @author pkupczyk + */ +@Component +public class DataSetParentSqlTranslator extends ObjectToDataSetsSqlTranslator implements IDataSetParentSqlTranslator +{ + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getParentIds(new LongOpenHashSet(objectIds)); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetPropertySqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetPropertySqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..d8e9a1eb6ef914a74f97e9949f3e90d562aaa740 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetPropertySqlTranslator.java @@ -0,0 +1,45 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.Collection; +import java.util.List; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.property.sql.PropertyRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.property.sql.PropertySqlTranslator; + +/** + * @author pkupczyk + */ +@Component +public class DataSetPropertySqlTranslator extends PropertySqlTranslator implements IDataSetPropertySqlTranslator +{ + + @Override + protected List<PropertyRecord> loadProperties(Collection<Long> entityIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getProperties(new LongOpenHashSet(entityIds)); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetQuery.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetQuery.java index b91be9d56c33739b9bd309c456bd57a337e6ad7e..9a36b7e2336acd83ad475762818388842e50c079 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetQuery.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetQuery.java @@ -25,6 +25,8 @@ import net.lemnik.eodsql.Select; import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectQuery; import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.history.sql.HistoryPropertyRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.property.sql.MaterialPropertyRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.property.sql.PropertyRecord; import ch.systemsx.cisd.common.db.mapper.LongSetMapper; /** @@ -33,11 +35,76 @@ import ch.systemsx.cisd.common.db.mapper.LongSetMapper; public interface DataSetQuery extends ObjectQuery { - @Select(sql = "select dph.ds_id as objectId, dph.pers_id_author as authorId, pt.code as propertyCode, dph.value as propertyValue, dph.material as materialPropertyValue, dph.vocabulary_term as vocabularyPropertyValue, dph.valid_from_timestamp as validFrom, dph.valid_until_timestamp as validTo " - + "from data_set_properties_history dph " - + "left join data_set_type_property_types dtpt on dph.dstpt_id = dtpt.id " - + "left join property_types pt on dtpt.prty_id = pt.id " - + "where dph.ds_id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + @Select(sql = "select d.id, ed.storage_confirmation as isStorageConfirmed, s.code as sampleCode, sc.code as sampleContainerCode, ss.code as sampleSpaceCode, " + + "e.code as experimentCode, ep.code as experimentProjectCode, es.code as experimentSpaceCode from data d " + + "left join external_data ed on d.id = ed.data_id " + + "left join samples s on d.samp_id = s.id " + + "left join samples sc on s.samp_id_part_of = sc.id " + + "left join spaces ss on s.space_id = ss.id " + + "left join experiments e on d.expe_id = e.id " + + "left join projects ep on e.proj_id = ep.id " + + "left join spaces es on ep.space_id = es.id " + + "where d.id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<DataSetAuthorizationRecord> getAuthorizations(LongSet dataSetIds); + + @Select(sql = "select d.id, d.code, d.is_derived as isDerived, d.is_placeholder as isPlaceholder, d.access_timestamp as accessDate, d.modification_timestamp as modificationDate, d.registration_timestamp as registrationDate " + + "from data d where d.id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<DataSetBaseRecord> getDataSets(LongSet dataSetIds); + + @Select(sql = "select ed.data_id as objectId, ed.data_id as relatedId from external_data ed where ed.data_id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getExternalDataIds(LongSet dataSetIds); + + @Select(sql = "select ed.data_id as id, ed.share_id as shareId, ed.location, ed.size, ed.status, ed.is_complete as isComplete, ed.present_in_archive as isPresentInArchive, ed.storage_confirmation as isStorageConfirmed, ed.speed_hint as speedHint " + + "from external_data ed where ed.data_id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ExternalDataBaseRecord> getExternalDatas(LongSet dataSetIds); + + @Select(sql = "select ed.data_id as objectId, ed.ffty_id as relatedId from external_data ed where ed.data_id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getFileFormatTypeIds(LongSet dataSetIds); + + @Select(sql = "select fft.id, fft.code, fft.description from file_format_types fft where fft.id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<FileFormatTypeBaseRecord> getFileFormatTypes(LongSet fileFormatTypeIds); + + @Select(sql = "select ed.data_id as objectId, ed.loty_id as relatedId from external_data ed where ed.data_id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getLocatorTypeIds(LongSet dataSetIds); + + @Select(sql = "select lt.id, lt.code, lt.description from locator_types lt where lt.id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<LocatorTypeBaseRecord> getLocatorTypes(LongSet locatorTypeIds); + + @Select(sql = "select ed.data_id as objectId, ed.cvte_id_stor_fmt as relatedId from external_data ed where ed.data_id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getStorageFormatIds(LongSet dataSetIds); + + @Select(sql = "select d.id as objectId, d.dsty_id as relatedId from data d where d.id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getTypeIds(LongSet dataSetIds); + + @Select(sql = "select dt.id, dt.code, dt.data_set_kind as kind, dt.description, dt.modification_timestamp as modificationDate from data_set_types dt where dt.id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<DataSetTypeBaseRecord> getTypes(LongSet dataSetTypeIds); + + // PropertyQueryGenerator was used to generate this query + @Select(sql = "select p.ds_id as objectId, pt.code as propertyCode, p.value as propertyValue, m.code as materialPropertyValueCode, mt.code as materialPropertyValueTypeCode, cvt.code as vocabularyPropertyValue " + + "from data_set_properties p " + + "left join materials m on p.mate_prop_id = m.id " + + "left join controlled_vocabulary_terms cvt on p.cvte_id = cvt.id " + + "left join material_types mt on m.maty_id = mt.id " + + "join data_set_type_property_types etpt on p.dstpt_id = etpt.id " + + "join property_types pt on etpt.prty_id = pt.id " + + "where p.ds_id = any(?{1})" + , parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<PropertyRecord> getProperties(LongSet dataSetIds); + + // PropertyQueryGenerator was used to generate this query + @Select(sql = "select p.ds_id as objectId, pt.code as propertyCode, p.mate_prop_id as propertyValue " + + "from data_set_properties p " + + "join data_set_type_property_types etpt on p.dstpt_id = etpt.id " + + "join property_types pt on etpt.prty_id = pt.id " + + "where p.mate_prop_id is not null and p.ds_id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<MaterialPropertyRecord> getMaterialProperties(LongSet dataSetIds); + + // PropertyQueryGenerator was used to generate this query + @Select(sql = "select ph.ds_id as objectId, ph.pers_id_author as authorId, pt.code as propertyCode, ph.value as propertyValue, ph.material as materialPropertyValue, ph.vocabulary_term as vocabularyPropertyValue, ph.valid_from_timestamp as validFrom, ph.valid_until_timestamp as validTo " + + "from data_set_properties_history ph " + + "join data_set_type_property_types etpt on ph.dstpt_id = etpt.id " + + "join property_types pt on etpt.prty_id = pt.id " + + "where ph.ds_id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) public List<HistoryPropertyRecord> getPropertiesHistory(LongSet dataSetIds); @Select(sql = "select drh.main_data_id as objectId, drh.pers_id_author as authorId, drh.relation_type as relationType, " @@ -52,4 +119,36 @@ public interface DataSetQuery extends ObjectQuery @Select(sql = "select d.id as objectId, d.samp_id as relatedId from data d where d.id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) public List<ObjectRelationRecord> getSampleIds(LongSet dataSetIds); + @Select(sql = "select d.id as objectId, d.expe_id as relatedId from data d where d.id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getExperimentIds(LongSet dataSetIds); + + @Select(sql = "select dr.data_id_child as objectId, dr.data_id_parent as relatedId from " + + "data_set_relationships dr, relationship_types rt " + + "where dr.relationship_id = rt.id and rt.code = 'PARENT_CHILD' and dr.data_id_child = any(?{1}) order by dr.ordinal", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getParentIds(LongSet dataSetIds); + + @Select(sql = "select dr.data_id_parent as objectId, dr.data_id_child as relatedId from " + + "data_set_relationships dr, relationship_types rt " + + "where dr.relationship_id = rt.id and rt.code = 'PARENT_CHILD' and dr.data_id_parent = any(?{1}) order by dr.ordinal", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getChildIds(LongSet dataSetIds); + + @Select(sql = "select dr.data_id_child as objectId, dr.data_id_parent as relatedId from " + + "data_set_relationships dr, relationship_types rt " + + "where dr.relationship_id = rt.id and rt.code = 'CONTAINER_COMPONENT' and dr.data_id_child = any(?{1}) order by dr.ordinal", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getContainerIds(LongSet dataSetIds); + + @Select(sql = "select dr.data_id_parent as objectId, dr.data_id_child as relatedId from " + + "data_set_relationships dr, relationship_types rt " + + "where dr.relationship_id = rt.id and rt.code = 'CONTAINER_COMPONENT' and dr.data_id_parent = any(?{1}) order by dr.ordinal", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getContainedIds(LongSet dataSetIds); + + @Select(sql = "select ma.data_id as objectId, ma.mepr_id as relatedId from metaproject_assignments ma where ma.data_id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getTagIds(LongSet dataSetIds); + + @Select(sql = "select d.id as objectId, d.pers_id_registerer as relatedId from data d where d.id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getRegistratorIds(LongSet dataSetIds); + + @Select(sql = "select d.id as objectId, d.pers_id_modifier as relatedId from data d where d.id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE) + public List<ObjectRelationRecord> getModifierIds(LongSet dataSetIds); + } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetRegistratorSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetRegistratorSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..2af0f44b069d2922360110566ddfa2146c2ee24c --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetRegistratorSqlTranslator.java @@ -0,0 +1,44 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.person.sql.ObjectToPersonSqlTranslator; + +/** + * @author pkupczyk + */ +@Component +public class DataSetRegistratorSqlTranslator extends ObjectToPersonSqlTranslator implements IDataSetRegistratorSqlTranslator +{ + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getRegistratorIds(new LongOpenHashSet(objectIds)); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..91e30564ef43d6d1f1ffbdf88c62757367f7a3ae --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetSqlTranslator.java @@ -0,0 +1,291 @@ +/* + * 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.server.api.v3.translator.entity.dataset.sql; + +import java.util.Collection; +import java.util.List; +import java.util.Set; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.AbstractCachingTranslator; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationResults; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSet; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.tag.Tag; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetFetchOptions; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId; + +/** + * @author pkupczyk + */ +@Component +public class DataSetSqlTranslator extends AbstractCachingTranslator<Long, DataSet, DataSetFetchOptions> implements IDataSetSqlTranslator +{ + + @Autowired + private IDataSetAuthorizationSqlValidator authorizationValidator; + + @Autowired + private IDataSetBaseSqlTranslator baseTranslator; + + @Autowired + private IDataSetTypeRelationSqlTranslator typeTranslator; + + @Autowired + private IDataSetPropertySqlTranslator propertyTranslator; + + @Autowired + private IDataSetMaterialPropertySqlTranslator materialPropertyTranslator; + + @Autowired + private IDataSetExternalDataSqlTranslator externalDataTranslator; + + @Autowired + private IDataSetSampleSqlTranslator sampleTranslator; + + @Autowired + private IDataSetExperimentSqlTranslator experimentTranslator; + + @Autowired + private IDataSetParentSqlTranslator parentTranslator; + + @Autowired + private IDataSetChildSqlTranslator childTranslator; + + @Autowired + private IDataSetContainerSqlTranslator containerTranslator; + + @Autowired + private IDataSetContainedSqlTranslator containedTranslator; + + @Autowired + private IDataSetTagSqlTranslator tagTranslator; + + @Autowired + private IDataSetHistorySqlTranslator historyTranslator; + + @Autowired + private IDataSetRegistratorSqlTranslator registratorTranslator; + + @Autowired + private IDataSetModifierSqlTranslator modifierTranslator; + + @Autowired + private IDataSetPostRegisteredSqlTranslator postRegisteredTranslator; + + @Override + protected Set<Long> shouldTranslate(TranslationContext context, Collection<Long> dataSetIds, DataSetFetchOptions fetchOptions) + { + return authorizationValidator.validate(context.getSession().tryGetPerson(), dataSetIds); + } + + @Override + protected DataSet createObject(TranslationContext context, Long dataSetId, DataSetFetchOptions fetchOptions) + { + final DataSet dataSet = new DataSet(); + dataSet.setFetchOptions(new DataSetFetchOptions()); + return dataSet; + } + + @Override + protected TranslationResults getObjectsRelations(TranslationContext context, Collection<Long> dataSetIds, DataSetFetchOptions fetchOptions) + { + TranslationResults relations = new TranslationResults(); + + relations.put(IDataSetBaseSqlTranslator.class, baseTranslator.translate(context, dataSetIds, null)); + relations.put(IDataSetPostRegisteredSqlTranslator.class, postRegisteredTranslator.translate(context, dataSetIds, null)); + + if (fetchOptions.hasType()) + { + relations.put(IDataSetTypeRelationSqlTranslator.class, typeTranslator.translate(context, dataSetIds, fetchOptions.withType())); + } + + if (fetchOptions.hasProperties()) + { + relations.put(IDataSetPropertySqlTranslator.class, propertyTranslator.translate(context, dataSetIds, fetchOptions.withProperties())); + } + + if (fetchOptions.hasMaterialProperties()) + { + relations.put(IDataSetMaterialPropertySqlTranslator.class, + materialPropertyTranslator.translate(context, dataSetIds, fetchOptions.withMaterialProperties())); + } + + if (fetchOptions.hasExternalData()) + { + relations.put(IDataSetExternalDataSqlTranslator.class, + externalDataTranslator.translate(context, dataSetIds, fetchOptions.withExternalData())); + } + + if (fetchOptions.hasSample()) + { + relations.put(IDataSetSampleSqlTranslator.class, sampleTranslator.translate(context, dataSetIds, fetchOptions.withSample())); + } + + if (fetchOptions.hasExperiment()) + { + relations.put(IDataSetExperimentSqlTranslator.class, experimentTranslator.translate(context, dataSetIds, fetchOptions.withExperiment())); + } + + if (fetchOptions.hasContainers()) + { + relations.put(IDataSetContainerSqlTranslator.class, containerTranslator.translate(context, dataSetIds, fetchOptions.withContainers())); + } + + if (fetchOptions.hasContained()) + { + relations.put(IDataSetContainedSqlTranslator.class, containedTranslator.translate(context, dataSetIds, fetchOptions.withContained())); + } + + if (fetchOptions.hasParents()) + { + relations.put(IDataSetParentSqlTranslator.class, parentTranslator.translate(context, dataSetIds, fetchOptions.withParents())); + } + + if (fetchOptions.hasChildren()) + { + relations.put(IDataSetChildSqlTranslator.class, childTranslator.translate(context, dataSetIds, fetchOptions.withChildren())); + } + + if (fetchOptions.hasTags()) + { + relations.put(IDataSetTagSqlTranslator.class, tagTranslator.translate(context, dataSetIds, fetchOptions.withTags())); + } + + if (fetchOptions.hasHistory()) + { + relations.put(IDataSetHistorySqlTranslator.class, historyTranslator.translate(context, dataSetIds, fetchOptions.withHistory())); + } + + if (fetchOptions.hasRegistrator()) + { + relations + .put(IDataSetRegistratorSqlTranslator.class, registratorTranslator.translate(context, dataSetIds, fetchOptions.withRegistrator())); + } + + if (fetchOptions.hasModifier()) + { + relations.put(IDataSetModifierSqlTranslator.class, modifierTranslator.translate(context, dataSetIds, fetchOptions.withModifier())); + } + + return relations; + } + + @Override + protected void updateObject(TranslationContext context, Long dataSetId, DataSet result, Object objectRelations, DataSetFetchOptions fetchOptions) + { + TranslationResults relations = (TranslationResults) objectRelations; + DataSetBaseRecord baseRecord = relations.get(IDataSetBaseSqlTranslator.class, dataSetId); + + result.setPermId(new DataSetPermId(baseRecord.code)); + result.setCode(baseRecord.code); + result.setDerived(baseRecord.isDerived); + result.setPlaceholder(baseRecord.isPlaceholder); + result.setAccessDate(baseRecord.accessDate); + result.setModificationDate(baseRecord.modificationDate); + result.setRegistrationDate(baseRecord.registrationDate); + result.setPostRegistered(relations.get(IDataSetPostRegisteredSqlTranslator.class, dataSetId)); + + if (fetchOptions.hasType()) + { + result.setType(relations.get(IDataSetTypeRelationSqlTranslator.class, dataSetId)); + result.getFetchOptions().withTypeUsing(fetchOptions.withType()); + } + + if (fetchOptions.hasProperties()) + { + result.setProperties(relations.get(IDataSetPropertySqlTranslator.class, dataSetId)); + result.getFetchOptions().withPropertiesUsing(fetchOptions.withProperties()); + } + + if (fetchOptions.hasMaterialProperties()) + { + result.setMaterialProperties(relations.get(IDataSetMaterialPropertySqlTranslator.class, dataSetId)); + result.getFetchOptions().withMaterialPropertiesUsing(fetchOptions.withMaterialProperties()); + } + + if (fetchOptions.hasExternalData()) + { + result.setExternalData(relations.get(IDataSetExternalDataSqlTranslator.class, dataSetId)); + result.getFetchOptions().withExternalDataUsing(fetchOptions.withExternalData()); + } + + if (fetchOptions.hasSample()) + { + result.setSample(relations.get(IDataSetSampleSqlTranslator.class, dataSetId)); + result.getFetchOptions().withSampleUsing(fetchOptions.withSample()); + } + + if (fetchOptions.hasExperiment()) + { + result.setExperiment(relations.get(IDataSetExperimentSqlTranslator.class, dataSetId)); + result.getFetchOptions().withExperimentUsing(fetchOptions.withExperiment()); + } + + if (fetchOptions.hasContainers()) + { + result.setContainers((List<DataSet>) relations.get(IDataSetContainerSqlTranslator.class, dataSetId)); + result.getFetchOptions().withContainersUsing(fetchOptions.withContainers()); + } + + if (fetchOptions.hasContained()) + { + result.setContained((List<DataSet>) relations.get(IDataSetContainedSqlTranslator.class, dataSetId)); + result.getFetchOptions().withContainedUsing(fetchOptions.withContained()); + } + + if (fetchOptions.hasParents()) + { + result.setParents((List<DataSet>) relations.get(IDataSetParentSqlTranslator.class, dataSetId)); + result.getFetchOptions().withParentsUsing(fetchOptions.withParents()); + } + + if (fetchOptions.hasChildren()) + { + result.setChildren((List<DataSet>) relations.get(IDataSetChildSqlTranslator.class, dataSetId)); + result.getFetchOptions().withChildrenUsing(fetchOptions.withChildren()); + } + + if (fetchOptions.hasTags()) + { + result.setTags((Set<Tag>) relations.get(IDataSetTagSqlTranslator.class, dataSetId)); + result.getFetchOptions().withTagsUsing(fetchOptions.withTags()); + } + + if (fetchOptions.hasHistory()) + { + result.setHistory(relations.get(IDataSetHistorySqlTranslator.class, dataSetId)); + result.getFetchOptions().withHistoryUsing(fetchOptions.withHistory()); + } + + if (fetchOptions.hasRegistrator()) + { + result.setRegistrator(relations.get(IDataSetRegistratorSqlTranslator.class, dataSetId)); + result.getFetchOptions().withRegistratorUsing(fetchOptions.withRegistrator()); + } + + if (fetchOptions.hasModifier()) + { + result.setModifier(relations.get(IDataSetModifierSqlTranslator.class, dataSetId)); + result.getFetchOptions().withModifierUsing(fetchOptions.withModifier()); + } + + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTagSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTagSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..44a8eeac60be253679b405d978069161dfabeedd --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTagSqlTranslator.java @@ -0,0 +1,44 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.tag.sql.ObjectToTagsSqlTranslator; + +/** + * @author pkupczyk + */ +@Component +public class DataSetTagSqlTranslator extends ObjectToTagsSqlTranslator implements IDataSetTagSqlTranslator +{ + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getTagIds(objectIds); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTypeBaseRecord.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTypeBaseRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..c79d22ed188196ff2e26fff90ff58381b612e392 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTypeBaseRecord.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import java.util.Date; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectBaseRecord; + +/** + * @author pkupczyk + */ +public class DataSetTypeBaseRecord extends ObjectBaseRecord +{ + + public String code; + + public String kind; + + public String description; + + public Date modificationDate; + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTypeBaseSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTypeBaseSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..ed5594b7668f4a1813cddae8082c28e7983fb082 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTypeBaseSqlTranslator.java @@ -0,0 +1,42 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectBaseTranslator; + +/** + * @author pkupczyk + */ +@Component +public class DataSetTypeBaseSqlTranslator extends ObjectBaseTranslator<DataSetTypeBaseRecord> implements IDataSetTypeBaseSqlTranslator +{ + + @Override + protected List<DataSetTypeBaseRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getTypes(objectIds); + } +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTypeRelationSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTypeRelationSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..adc12d60982378933edca0239536436d7bb112b2 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTypeRelationSqlTranslator.java @@ -0,0 +1,61 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectToOneRelationTranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetType; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetTypeFetchOptions; + +/** + * @author pkupczyk + */ +@Component +public class DataSetTypeRelationSqlTranslator extends ObjectToOneRelationTranslator<DataSetType, DataSetTypeFetchOptions> implements + IDataSetTypeRelationSqlTranslator +{ + + @Autowired + private IDataSetTypeSqlTranslator typeTranslator; + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getTypeIds(objectIds); + } + + @Override + protected Map<Long, DataSetType> translateRelated(TranslationContext context, Collection<Long> relatedIds, + DataSetTypeFetchOptions relatedFetchOptions) + { + return typeTranslator.translate(context, relatedIds, relatedFetchOptions); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTypeSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTypeSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..c0b5ec11a95f2dfc18991da068f77a6709e8ea49 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/DataSetTypeSqlTranslator.java @@ -0,0 +1,75 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import java.util.Collection; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.AbstractCachingTranslator; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationResults; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetKind; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetType; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetTypeFetchOptions; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.entitytype.EntityTypePermId; + +/** + * @author pkupczyk + */ +@Component +public class DataSetTypeSqlTranslator extends AbstractCachingTranslator<Long, DataSetType, DataSetTypeFetchOptions> implements + IDataSetTypeSqlTranslator +{ + + @Autowired + private IDataSetTypeBaseSqlTranslator baseTranslator; + + @Override + protected DataSetType createObject(TranslationContext context, Long typeId, DataSetTypeFetchOptions fetchOptions) + { + final DataSetType type = new DataSetType(); + type.setFetchOptions(new DataSetTypeFetchOptions()); + return type; + } + + @Override + protected TranslationResults getObjectsRelations(TranslationContext context, Collection<Long> typeIds, DataSetTypeFetchOptions fetchOptions) + { + TranslationResults relations = new TranslationResults(); + + relations.put(IDataSetTypeBaseSqlTranslator.class, baseTranslator.translate(context, typeIds, null)); + + return relations; + } + + @Override + protected void updateObject(TranslationContext context, Long typeId, DataSetType result, Object objectRelations, + DataSetTypeFetchOptions fetchOptions) + { + TranslationResults relations = (TranslationResults) objectRelations; + DataSetTypeBaseRecord baseRecord = relations.get(IDataSetTypeBaseSqlTranslator.class, typeId); + + result.setPermId(new EntityTypePermId(baseRecord.code)); + result.setCode(baseRecord.code); + result.setKind(DataSetKind.valueOf(baseRecord.kind)); + result.setDescription(baseRecord.description); + result.setModificationDate(baseRecord.modificationDate); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataBaseRecord.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataBaseRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..7bf08d4af5cfabeb4f49127f73b63f768b5dda54 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataBaseRecord.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectBaseRecord; + +/** + * @author pkupczyk + */ +public class ExternalDataBaseRecord extends ObjectBaseRecord +{ + + public String shareId; + + public String location; + + public Long size; + + public String status; + + public String isComplete; + + public Boolean isPresentInArchive; + + public Boolean isStorageConfirmed; + + public Integer speedHint; + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataBaseSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataBaseSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..2aec9cbf6a38271b41410f1efabef11d7726d24c --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataBaseSqlTranslator.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import org.springframework.stereotype.Component; + +import net.lemnik.eodsql.QueryTool; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectBaseTranslator; + +/** + * @author pkupczyk + */ +@Component +public class ExternalDataBaseSqlTranslator extends ObjectBaseTranslator<ExternalDataBaseRecord> implements IExternalDataBaseSqlTranslator +{ + + @Override + protected List<ExternalDataBaseRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getExternalDatas(new LongOpenHashSet(objectIds)); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataFileFormatTypeSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataFileFormatTypeSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..ee641287b8a191f81d07b121e09037e8fa39779f --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataFileFormatTypeSqlTranslator.java @@ -0,0 +1,61 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectToOneRelationTranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.FileFormatType; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.FileFormatTypeFetchOptions; + +/** + * @author pkupczyk + */ +@Component +public class ExternalDataFileFormatTypeSqlTranslator extends ObjectToOneRelationTranslator<FileFormatType, FileFormatTypeFetchOptions> implements + IExternalDataFileFormatTypeSqlTranslator +{ + + @Autowired + private IFileFormatTypeSqlTranslator fileFormatTypeTranslator; + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getFileFormatTypeIds(objectIds); + } + + @Override + protected Map<Long, FileFormatType> translateRelated(TranslationContext context, Collection<Long> relatedIds, + FileFormatTypeFetchOptions relatedFetchOptions) + { + return fileFormatTypeTranslator.translate(context, relatedIds, relatedFetchOptions); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataLocatorTypeSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataLocatorTypeSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..56278d831f5bb21287145eed450f702a21a522f9 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataLocatorTypeSqlTranslator.java @@ -0,0 +1,61 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectToOneRelationTranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.LocatorType; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.LocatorTypeFetchOptions; + +/** + * @author pkupczyk + */ +@Component +public class ExternalDataLocatorTypeSqlTranslator extends ObjectToOneRelationTranslator<LocatorType, LocatorTypeFetchOptions> implements + IExternalDataLocatorTypeSqlTranslator +{ + + @Autowired + private ILocatorTypeSqlTranslator locatorTypeTranslator; + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getLocatorTypeIds(objectIds); + } + + @Override + protected Map<Long, LocatorType> translateRelated(TranslationContext context, Collection<Long> relatedIds, + LocatorTypeFetchOptions relatedFetchOptions) + { + return locatorTypeTranslator.translate(context, relatedIds, relatedFetchOptions); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..74dab4cc17ccf33d6d2c745dfa0b971958f77b0c --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataSqlTranslator.java @@ -0,0 +1,170 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import java.util.Collection; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.AbstractCachingTranslator; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationResults; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.ArchivingStatus; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.Complete; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.ExternalData; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.ExternalDataFetchOptions; + +/** + * @author pkupczyk + */ +@Component +public class ExternalDataSqlTranslator extends AbstractCachingTranslator<Long, ExternalData, ExternalDataFetchOptions> implements + IExternalDataSqlTranslator +{ + + @Autowired + private IExternalDataBaseSqlTranslator baseTranslator; + + @Autowired + private IExternalDataFileFormatTypeSqlTranslator fileFormatTypeTranslator; + + @Autowired + private IExternalDataLocatorTypeSqlTranslator locatorTypeTranslator; + + @Autowired + private IExternalDataStorageFormatSqlTranslator storageFormatTranslator; + + @Override + protected ExternalData createObject(TranslationContext context, Long dataSetId, ExternalDataFetchOptions fetchOptions) + { + ExternalData externalData = new ExternalData(); + externalData.setFetchOptions(new ExternalDataFetchOptions()); + return externalData; + } + + @Override + protected TranslationResults getObjectsRelations(TranslationContext context, Collection<Long> dataSetIds, ExternalDataFetchOptions fetchOptions) + { + TranslationResults relations = new TranslationResults(); + + relations.put(IExternalDataBaseSqlTranslator.class, baseTranslator.translate(context, dataSetIds, null)); + + if (fetchOptions.hasFileFormatType()) + { + relations.put(IExternalDataFileFormatTypeSqlTranslator.class, + fileFormatTypeTranslator.translate(context, dataSetIds, fetchOptions.withFileFormatType())); + } + + if (fetchOptions.hasLocatorType()) + { + relations.put(IExternalDataLocatorTypeSqlTranslator.class, + locatorTypeTranslator.translate(context, dataSetIds, fetchOptions.withLocatorType())); + } + + if (fetchOptions.hasStorageFormat()) + { + relations.put(IExternalDataStorageFormatSqlTranslator.class, + storageFormatTranslator.translate(context, dataSetIds, fetchOptions.withStorageFormat())); + } + + return relations; + } + + @Override + protected void updateObject(TranslationContext context, Long dataSetId, ExternalData result, Object objectRelations, + ExternalDataFetchOptions fetchOptions) + { + TranslationResults relations = (TranslationResults) objectRelations; + ExternalDataBaseRecord baseRecord = relations.get(IExternalDataBaseSqlTranslator.class, dataSetId); + + result.setShareId(baseRecord.shareId); + result.setLocation(baseRecord.location); + result.setSize(baseRecord.size); + result.setComplete(translateComplete(baseRecord.isComplete)); + result.setStatus(translateStatus(baseRecord.status)); + result.setPresentInArchive(baseRecord.isPresentInArchive); + result.setStorageConfirmation(baseRecord.isStorageConfirmed); + result.setSpeedHint(baseRecord.speedHint); + + if (fetchOptions.hasFileFormatType()) + { + result.setFileFormatType(relations.get(IExternalDataFileFormatTypeSqlTranslator.class, dataSetId)); + result.getFetchOptions().withFileFormatTypeUsing(fetchOptions.withFileFormatType()); + } + + if (fetchOptions.hasLocatorType()) + { + result.setLocatorType(relations.get(IExternalDataLocatorTypeSqlTranslator.class, dataSetId)); + result.getFetchOptions().withLocatorTypeUsing(fetchOptions.withLocatorType()); + } + + if (fetchOptions.hasStorageFormat()) + { + result.setStorageFormat(relations.get(IExternalDataStorageFormatSqlTranslator.class, dataSetId)); + result.getFetchOptions().withStorageFormatUsing(fetchOptions.withStorageFormat()); + } + + } + + private Complete translateComplete(String value) + { + if (value != null) + { + switch (value) + { + case "T": + return Complete.YES; + case "F": + return Complete.NO; + case "U": + return Complete.UNKNOWN; + default: + throw new IllegalArgumentException("Unknown value: " + value); + } + } + + return null; + } + + private ArchivingStatus translateStatus(String value) + { + if (value != null) + { + switch (value) + { + case "ARCHIVE_PENDING": + return ArchivingStatus.ARCHIVE_PENDING; + case "ARCHIVED": + return ArchivingStatus.ARCHIVED; + case "AVAILABLE": + return ArchivingStatus.AVAILABLE; + case "BACKUP_PENDING": + return ArchivingStatus.BACKUP_PENDING; + case "LOCKED": + return ArchivingStatus.LOCKED; + case "UNARCHIVE_PENDING": + return ArchivingStatus.UNARCHIVE_PENDING; + default: + throw new IllegalArgumentException("Unknown value: " + value); + } + } + + return null; + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataStorageFormatSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataStorageFormatSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..8fb0a08a12146fefd081e358884d578fcc57348d --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ExternalDataStorageFormatSqlTranslator.java @@ -0,0 +1,58 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectRelationRecord; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectToOneRelationTranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.vocabulary.VocabularyTerm; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.vocabulary.VocabularyTermFetchOptions; + +/** + * @author pkupczyk + */ +@Component +public class ExternalDataStorageFormatSqlTranslator extends ObjectToOneRelationTranslator<VocabularyTerm, VocabularyTermFetchOptions> implements + IExternalDataStorageFormatSqlTranslator +{ + + @Override + protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getStorageFormatIds(objectIds); + } + + @Override + protected Map<Long, VocabularyTerm> translateRelated(TranslationContext context, Collection<Long> relatedIds, + VocabularyTermFetchOptions relatedFetchOptions) + { + return new HashMap<Long, VocabularyTerm>(); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/FileFormatTypeBaseRecord.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/FileFormatTypeBaseRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..f1fbdb6d9d6c57a1249c2fd5370692422552a11b --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/FileFormatTypeBaseRecord.java @@ -0,0 +1,31 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectBaseRecord; + +/** + * @author pkupczyk + */ +public class FileFormatTypeBaseRecord extends ObjectBaseRecord +{ + + public String code; + + public String description; + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/FileFormatTypeBaseSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/FileFormatTypeBaseSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..7c493a19d98ec1b908acd5d4dcf4a272d8524ddc --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/FileFormatTypeBaseSqlTranslator.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import org.springframework.stereotype.Component; + +import net.lemnik.eodsql.QueryTool; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectBaseTranslator; + +/** + * @author pkupczyk + */ +@Component +public class FileFormatTypeBaseSqlTranslator extends ObjectBaseTranslator<FileFormatTypeBaseRecord> implements IFileFormatTypeBaseSqlTranslator +{ + + @Override + protected List<FileFormatTypeBaseRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getFileFormatTypes(objectIds); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/FileFormatTypeSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/FileFormatTypeSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..ea8ddff0c584a8b4e10c90637075285483ea0b22 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/FileFormatTypeSqlTranslator.java @@ -0,0 +1,70 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import java.util.Collection; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.AbstractCachingTranslator; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationResults; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.FileFormatType; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.FileFormatTypeFetchOptions; + +/** + * @author pkupczyk + */ +@Component +public class FileFormatTypeSqlTranslator extends AbstractCachingTranslator<Long, FileFormatType, FileFormatTypeFetchOptions> implements + IFileFormatTypeSqlTranslator +{ + + @Autowired + private IFileFormatTypeBaseSqlTranslator baseTranslator; + + @Override + protected FileFormatType createObject(TranslationContext context, Long fileFormatTypeId, FileFormatTypeFetchOptions fetchOptions) + { + FileFormatType type = new FileFormatType(); + type.setFetchOptions(new FileFormatTypeFetchOptions()); + return type; + } + + @Override + protected Object getObjectsRelations(TranslationContext context, Collection<Long> fileFormatTypeIds, FileFormatTypeFetchOptions fetchOptions) + { + TranslationResults relations = new TranslationResults(); + + relations.put(IFileFormatTypeBaseSqlTranslator.class, baseTranslator.translate(context, fileFormatTypeIds, null)); + + return relations; + } + + @Override + protected void updateObject(TranslationContext context, Long fileFormatTypeId, FileFormatType result, Object objectRelations, + FileFormatTypeFetchOptions fetchOptions) + { + TranslationResults relations = (TranslationResults) objectRelations; + FileFormatTypeBaseRecord baseRecord = relations.get(IFileFormatTypeBaseSqlTranslator.class, fileFormatTypeId); + + result.setCode(baseRecord.code); + result.setDescription(baseRecord.description); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetAuthorizationSqlValidator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetAuthorizationSqlValidator.java new file mode 100644 index 0000000000000000000000000000000000000000..460b0cfe5e1c0273fae384d4198bf41c2ce1e158 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetAuthorizationSqlValidator.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.IObjectAuthorizationValidator; + +/** + * @author pkupczyk + */ +public interface IDataSetAuthorizationSqlValidator extends IObjectAuthorizationValidator +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetBaseSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetBaseSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..9274699df147d92c443f1da92c032ab658297299 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetBaseSqlTranslator.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.IObjectBaseTranslator; + +/** + * @author pkupczyk + */ +public interface IDataSetBaseSqlTranslator extends IObjectBaseTranslator<DataSetBaseRecord> +{ + +} diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/AbstractTimeZoneValue.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetChildSqlTranslator.java similarity index 71% rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/AbstractTimeZoneValue.java rename to openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetChildSqlTranslator.java index 19be55b05e31a1a6dc153a7d76ab268704d299e5..994cf5a1da99eedc3c2c1d0f3c4c097442dfd210 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/AbstractTimeZoneValue.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetChildSqlTranslator.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 ETH Zuerich, CISD + * Copyright 2015 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. @@ -14,15 +14,12 @@ * limitations under the License. */ -package ch.ethz.sis.openbis.generic.shared.api.v3.dto.search; - -import ch.systemsx.cisd.base.annotation.JsonObject; +package ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.dataset.sql; /** * @author pkupczyk */ -@JsonObject("dto.search.AbstractTimeZoneValue") -public class AbstractTimeZoneValue +public interface IDataSetChildSqlTranslator extends IObjectToDataSetsSqlTranslator { } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetContainedSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetContainedSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..a53ceea2711096a9fd0b237df0ae8686d8e12efe --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetContainedSqlTranslator.java @@ -0,0 +1,25 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +/** + * @author pkupczyk + */ +public interface IDataSetContainedSqlTranslator extends IObjectToDataSetsSqlTranslator +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetContainerSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetContainerSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..93bc2683802e8dc9fea99fbfa92bd22aeaff932d --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetContainerSqlTranslator.java @@ -0,0 +1,25 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +/** + * @author pkupczyk + */ +public interface IDataSetContainerSqlTranslator extends IObjectToDataSetsSqlTranslator +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetExperimentSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetExperimentSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..23480dc226f44af6e52dce9b4d521487620e6703 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetExperimentSqlTranslator.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.experiment.sql.IObjectToExperimentSqlTranslator; + +/** + * @author pkupczyk + */ +public interface IDataSetExperimentSqlTranslator extends IObjectToExperimentSqlTranslator +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetExternalDataSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetExternalDataSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..3bbbb7d99824247a405a94df75c052862ffaca39 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetExternalDataSqlTranslator.java @@ -0,0 +1,29 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.IObjectToOneRelationTranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.ExternalData; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.ExternalDataFetchOptions; + +/** + * @author pkupczyk + */ +public interface IDataSetExternalDataSqlTranslator extends IObjectToOneRelationTranslator<ExternalData, ExternalDataFetchOptions> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetMaterialPropertySqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetMaterialPropertySqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..afcf28d7dc91f372802eb433a78d6ad8268ff9bb --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetMaterialPropertySqlTranslator.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.property.sql.IMaterialPropertySqlTranslator; + +/** + * @author pkupczyk + */ +public interface IDataSetMaterialPropertySqlTranslator extends IMaterialPropertySqlTranslator +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetModifierSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetModifierSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..481c75dd3cb9686d40f83b664eb1fda841766bf7 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetModifierSqlTranslator.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.person.sql.IObjectToPersonSqlTranslator; + +/** + * @author pkupczyk + */ +public interface IDataSetModifierSqlTranslator extends IObjectToPersonSqlTranslator +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetParentSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetParentSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..1af2dc6265bd61964fe8ee00530bcc68f49a08d3 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetParentSqlTranslator.java @@ -0,0 +1,25 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +/** + * @author pkupczyk + */ +public interface IDataSetParentSqlTranslator extends IObjectToDataSetsSqlTranslator +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetPropertySqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetPropertySqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..e4294f4de7c26a706db379948ca26148b319e7be --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetPropertySqlTranslator.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.property.sql.IPropertySqlTranslator; + +/** + * @author pkupczyk + */ +public interface IDataSetPropertySqlTranslator extends IPropertySqlTranslator +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetRegistratorSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetRegistratorSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..af7ffbbde4fd512395ae5f59e74569422b10853e --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetRegistratorSqlTranslator.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.person.sql.IObjectToPersonSqlTranslator; + +/** + * @author pkupczyk + */ +public interface IDataSetRegistratorSqlTranslator extends IObjectToPersonSqlTranslator +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetTagSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetTagSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..3a4973f513fcd1f20d32ec440cc140e00500cd4d --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetTagSqlTranslator.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.tag.sql.IObjectToTagsSqlTranslator; + +/** + * @author pkupczyk + */ +public interface IDataSetTagSqlTranslator extends IObjectToTagsSqlTranslator +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetTypeBaseSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetTypeBaseSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..841d1c21bd451029b21321480967b2fbc04b5a6a --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetTypeBaseSqlTranslator.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.IObjectBaseTranslator; + +/** + * @author pkupczyk + */ +public interface IDataSetTypeBaseSqlTranslator extends IObjectBaseTranslator<DataSetTypeBaseRecord> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetTypeRelationSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetTypeRelationSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..34cf37756592e42061e30c3bd1bc7924ddc40103 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetTypeRelationSqlTranslator.java @@ -0,0 +1,29 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.IObjectToOneRelationTranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetType; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetTypeFetchOptions; + +/** + * @author pkupczyk + */ +public interface IDataSetTypeRelationSqlTranslator extends IObjectToOneRelationTranslator<DataSetType, DataSetTypeFetchOptions> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetTypeSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetTypeSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..4fd950557504bdc26baf1e7e8959bd24da43f109 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IDataSetTypeSqlTranslator.java @@ -0,0 +1,29 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.ITranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetType; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetTypeFetchOptions; + +/** + * @author pkupczyk + */ +public interface IDataSetTypeSqlTranslator extends ITranslator<Long, DataSetType, DataSetTypeFetchOptions> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataBaseSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataBaseSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..69bd5472fe1fb2d63a2442ba8a704e18c8c237a1 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataBaseSqlTranslator.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.IObjectBaseTranslator; + +/** + * @author pkupczyk + */ +public interface IExternalDataBaseSqlTranslator extends IObjectBaseTranslator<ExternalDataBaseRecord> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataFileFormatTypeSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataFileFormatTypeSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..51b2e4670e3755526f6f74896b9f346c34a49f9b --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataFileFormatTypeSqlTranslator.java @@ -0,0 +1,29 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.IObjectToOneRelationTranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.FileFormatType; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.FileFormatTypeFetchOptions; + +/** + * @author pkupczyk + */ +public interface IExternalDataFileFormatTypeSqlTranslator extends IObjectToOneRelationTranslator<FileFormatType, FileFormatTypeFetchOptions> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataLocatorTypeSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataLocatorTypeSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..7c7819f6b0d087d3883a6fecd6041ea5b94ea74b --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataLocatorTypeSqlTranslator.java @@ -0,0 +1,29 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.IObjectToOneRelationTranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.LocatorType; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.LocatorTypeFetchOptions; + +/** + * @author pkupczyk + */ +public interface IExternalDataLocatorTypeSqlTranslator extends IObjectToOneRelationTranslator<LocatorType, LocatorTypeFetchOptions> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..34af983f63d1cf125cc79eb2ddd717a2928f675e --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataSqlTranslator.java @@ -0,0 +1,29 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.ITranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.ExternalData; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.ExternalDataFetchOptions; + +/** + * @author pkupczyk + */ +public interface IExternalDataSqlTranslator extends ITranslator<Long, ExternalData, ExternalDataFetchOptions> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataStorageFormatSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataStorageFormatSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..ea2e2833a973fbf0f1d5908b38a974bacafa8fea --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IExternalDataStorageFormatSqlTranslator.java @@ -0,0 +1,29 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.IObjectToOneRelationTranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.vocabulary.VocabularyTerm; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.vocabulary.VocabularyTermFetchOptions; + +/** + * @author pkupczyk + */ +public interface IExternalDataStorageFormatSqlTranslator extends IObjectToOneRelationTranslator<VocabularyTerm, VocabularyTermFetchOptions> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IFileFormatTypeBaseSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IFileFormatTypeBaseSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..17483a09a98e298b4b91ae7e912acf67a5c430ad --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IFileFormatTypeBaseSqlTranslator.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.IObjectBaseTranslator; + +/** + * @author pkupczyk + */ +public interface IFileFormatTypeBaseSqlTranslator extends IObjectBaseTranslator<FileFormatTypeBaseRecord> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IFileFormatTypeSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IFileFormatTypeSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..7e345cf52405fde1af21af3e128669fc988c2c36 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/IFileFormatTypeSqlTranslator.java @@ -0,0 +1,29 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.ITranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.FileFormatType; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.FileFormatTypeFetchOptions; + +/** + * @author pkupczyk + */ +public interface IFileFormatTypeSqlTranslator extends ITranslator<Long, FileFormatType, FileFormatTypeFetchOptions> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ILocatorTypeBaseSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ILocatorTypeBaseSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..45a46f5aa3ed1327c4be7be5e4b2d16c7022790f --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ILocatorTypeBaseSqlTranslator.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.IObjectBaseTranslator; + +/** + * @author pkupczyk + */ +public interface ILocatorTypeBaseSqlTranslator extends IObjectBaseTranslator<LocatorTypeBaseRecord> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ILocatorTypeSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ILocatorTypeSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..c68fbc0227567fa602fc7b55f3ed52a8186e1cbc --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ILocatorTypeSqlTranslator.java @@ -0,0 +1,29 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.ITranslator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.LocatorType; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.LocatorTypeFetchOptions; + +/** + * @author pkupczyk + */ +public interface ILocatorTypeSqlTranslator extends ITranslator<Long, LocatorType, LocatorTypeFetchOptions> +{ + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/LocatorTypeBaseRecord.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/LocatorTypeBaseRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..c00395793867441d41729697ebb8ed1c30d8f0f2 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/LocatorTypeBaseRecord.java @@ -0,0 +1,31 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectBaseRecord; + +/** + * @author pkupczyk + */ +public class LocatorTypeBaseRecord extends ObjectBaseRecord +{ + + public String code; + + public String description; + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/LocatorTypeBaseSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/LocatorTypeBaseSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..58f55ace491a5a013c7e74b5e2b598bfbd935893 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/LocatorTypeBaseSqlTranslator.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + +import java.util.List; + +import net.lemnik.eodsql.QueryTool; + +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectBaseTranslator; + +/** + * @author pkupczyk + */ +@Component +public class LocatorTypeBaseSqlTranslator extends ObjectBaseTranslator<LocatorTypeBaseRecord> implements ILocatorTypeBaseSqlTranslator +{ + + @Override + protected List<LocatorTypeBaseRecord> loadRecords(LongOpenHashSet objectIds) + { + DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class); + return query.getLocatorTypes(objectIds); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/LocatorTypeSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/LocatorTypeSqlTranslator.java new file mode 100644 index 0000000000000000000000000000000000000000..1cf1848c4014581862f8cad72318d4617e9e6525 --- /dev/null +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/LocatorTypeSqlTranslator.java @@ -0,0 +1,70 @@ +/* + * Copyright 2015 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.server.api.v3.translator.entity.dataset.sql; + +import java.util.Collection; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import ch.ethz.sis.openbis.generic.server.api.v3.translator.AbstractCachingTranslator; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext; +import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationResults; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.LocatorType; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.LocatorTypeFetchOptions; + +/** + * @author pkupczyk + */ +@Component +public class LocatorTypeSqlTranslator extends AbstractCachingTranslator<Long, LocatorType, LocatorTypeFetchOptions> implements + ILocatorTypeSqlTranslator +{ + + @Autowired + private ILocatorTypeBaseSqlTranslator baseTranslator; + + @Override + protected LocatorType createObject(TranslationContext context, Long locatorTypeId, LocatorTypeFetchOptions fetchOptions) + { + LocatorType type = new LocatorType(); + type.setFetchOptions(new LocatorTypeFetchOptions()); + return type; + } + + @Override + protected Object getObjectsRelations(TranslationContext context, Collection<Long> locatorTypeIds, LocatorTypeFetchOptions fetchOptions) + { + TranslationResults relations = new TranslationResults(); + + relations.put(ILocatorTypeBaseSqlTranslator.class, baseTranslator.translate(context, locatorTypeIds, null)); + + return relations; + } + + @Override + protected void updateObject(TranslationContext context, Long locatorTypeId, LocatorType result, Object objectRelations, + LocatorTypeFetchOptions fetchOptions) + { + TranslationResults relations = (TranslationResults) objectRelations; + LocatorTypeBaseRecord baseRecord = relations.get(ILocatorTypeBaseSqlTranslator.class, locatorTypeId); + + result.setCode(baseRecord.code); + result.setDescription(baseRecord.description); + } + +} diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ObjectToDataSetsSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ObjectToDataSetsSqlTranslator.java index 88467b2705ce71520dd64879ae9fc0c7f3164eb5..45293bc884ea581cb31f48219394df894469be27 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ObjectToDataSetsSqlTranslator.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/dataset/sql/ObjectToDataSetsSqlTranslator.java @@ -18,19 +18,15 @@ package ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.dataset.sql; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; -import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext; import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.common.sql.ObjectToManyRelationTranslator; -import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.dataset.IDataSetTranslator; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSet; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetFetchOptions; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; -import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; /** * @author pkupczyk @@ -43,20 +39,12 @@ public abstract class ObjectToDataSetsSqlTranslator extends ObjectToManyRelation private IDAOFactory daoFactory; @Autowired - private IDataSetTranslator dataSetTranslator; + private IDataSetSqlTranslator dataSetTranslator; @Override protected Map<Long, DataSet> translateRelated(TranslationContext context, Collection<Long> relatedIds, DataSetFetchOptions relatedFetchOptions) { - List<DataPE> related = daoFactory.getDataDAO().listByIDs(relatedIds); - Map<DataPE, DataSet> translated = dataSetTranslator.translate(context, related, relatedFetchOptions); - Map<Long, DataSet> result = new HashMap<Long, DataSet>(); - - for (Map.Entry<DataPE, DataSet> entry : translated.entrySet()) - { - result.put(entry.getKey().getId(), entry.getValue()); - } - return result; + return dataSetTranslator.translate(context, relatedIds, relatedFetchOptions); } @Override diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/property/sql/PropertyQueryGenerator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/property/sql/PropertyQueryGenerator.java index ab9fc94f7c4b581555c7a87861199d66ce9d8c80..cd9a699d3c213f6175d141fce94c9328e9b1ce4e 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/property/sql/PropertyQueryGenerator.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/property/sql/PropertyQueryGenerator.java @@ -28,6 +28,8 @@ public class PropertyQueryGenerator createExperimentPropertyHistoryQuery(); createSamplePropertyQuery(); createSamplePropertyHistoryQuery(); + createDataSetPropertyQuery(); + createDataSetPropertyHistoryQuery(); createMaterialPropertyQuery(); createMaterialPropertyHistoryQuery(); } @@ -74,6 +76,27 @@ public class PropertyQueryGenerator System.out.println("Sample property history: \n" + createPropertyHistoryQuery(params)); } + private static void createDataSetPropertyQuery() + { + PropertyQueryParams params = new PropertyQueryParams(); + params.propertyTable = "data_set_properties"; + params.propertyTableEntityIdColumn = "ds_id"; + params.propertyTableEntityTypePropertyTypeIdColumn = "dstpt_id"; + params.entityTypePropertyTypeTable = "data_set_type_property_types"; + System.out.println("DataSet property: \n" + createPropertyQuery(params)); + System.out.println("DataSet material property: \n" + createMaterialPropertyQuery(params)); + } + + private static void createDataSetPropertyHistoryQuery() + { + PropertyHistoryQueryParams params = new PropertyHistoryQueryParams(); + params.propertyHistoryTable = "data_set_properties_history"; + params.propertyHistoryTableEntityIdColumn = "ds_id"; + params.propertyHistoryTableEntityTypePropertyTypeIdColumn = "dstpt_id"; + params.entityTypePropertyTypeTable = "data_set_type_property_types"; + System.out.println("DataSet property history: \n" + createPropertyHistoryQuery(params)); + } + private static void createMaterialPropertyQuery() { PropertyQueryParams params = new PropertyQueryParams(); @@ -99,7 +122,7 @@ public class PropertyQueryGenerator { StringBuilder sb = new StringBuilder(); sb.append("select "); - sb.append("p." + params.propertyTableEntityIdColumn + " as entityId, "); + sb.append("p." + params.propertyTableEntityIdColumn + " as objectId, "); sb.append("pt.code as propertyCode, "); sb.append("p.value as propertyValue, "); sb.append("m.code as materialPropertyValueCode, "); @@ -121,7 +144,7 @@ public class PropertyQueryGenerator { StringBuilder sb = new StringBuilder(); sb.append("select "); - sb.append("p." + params.propertyTableEntityIdColumn + " as entityId, "); + sb.append("p." + params.propertyTableEntityIdColumn + " as objectId, "); sb.append("pt.code as propertyCode, "); sb.append("p.mate_prop_id as propertyValue \n"); sb.append("from "); @@ -137,7 +160,7 @@ public class PropertyQueryGenerator { StringBuilder sb = new StringBuilder(); sb.append("select "); - sb.append("ph." + params.propertyHistoryTableEntityIdColumn + " as entityId, "); + sb.append("ph." + params.propertyHistoryTableEntityIdColumn + " as objectId, "); sb.append("ph.pers_id_author as authorId, "); sb.append("pt.code as propertyCode, "); sb.append("ph.value as propertyValue, "); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/sample/sql/SampleAuthorizationRecord.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/sample/sql/SampleAuthorizationRecord.java index 4e8893a4956b53c47da375765ae456fb4e5b37d8..cb1acbe87ac6871df304f7fd4341cb8873702804 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/sample/sql/SampleAuthorizationRecord.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/sample/sql/SampleAuthorizationRecord.java @@ -28,6 +28,6 @@ public class SampleAuthorizationRecord public String spaceCode; - public String containedCode; + public String containerCode; } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/sample/sql/SampleAuthorizationSqlValidator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/sample/sql/SampleAuthorizationSqlValidator.java index 0db2f2e42106997a8857c2f65327be7de877a8be..04b1e2902add7a4d731db23edf7841439c6d1191 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/sample/sql/SampleAuthorizationSqlValidator.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/sample/sql/SampleAuthorizationSqlValidator.java @@ -56,7 +56,7 @@ public class SampleAuthorizationSqlValidator implements ISampleAuthorizationSqlV @Override public String getIdentifier() { - return new SampleIdentifier(theRecord.spaceCode, theRecord.containedCode, theRecord.code).getIdentifier(); + return new SampleIdentifier(theRecord.spaceCode, theRecord.containerCode, theRecord.code).getIdentifier(); } })) { diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/UpdateDataSetTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/UpdateDataSetTest.java index ec63047ed70cc469a795c066394478c196216242..c2159d7372ec3163569b496231a8c7d16efc8573 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/UpdateDataSetTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/UpdateDataSetTest.java @@ -512,7 +512,6 @@ public class UpdateDataSetTest extends AbstractSampleTest }, "Circular dependency found: 20081105092259000-8"); } - @SuppressWarnings("unchecked") @Test public void testUpdateWithComponentAddRemove() { @@ -538,7 +537,6 @@ public class UpdateDataSetTest extends AbstractSampleTest AssertionUtil.assertCollectionContainsOnly(dataSetCodes(result.getContained()), "COMPONENT_1B", "COMPONENT_2A"); } - @SuppressWarnings("unchecked") @Test public void testUpdateWithContainerAddRemove() { @@ -596,7 +594,6 @@ public class UpdateDataSetTest extends AbstractSampleTest }, containerId); } - @SuppressWarnings("unchecked") @Test public void testUpdateWithTagsWithSetAddRemove() { diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/IDate.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/IDate.java index 2cc14302768b59db6c8396e88a9feb28ce58f726..c3c9c122d39dc45b54caa3add85c06ffee3ef5d6 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/IDate.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/IDate.java @@ -16,13 +16,15 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.search; +import java.io.Serializable; + import ch.systemsx.cisd.base.annotation.JsonObject; /** * @author pkupczyk */ @JsonObject("dto.search.IDate") -public interface IDate +public interface IDate extends Serializable { } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/IDateFormat.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/IDateFormat.java index d10158ed78fb2abb2f9df2fa9912f4e456b9e5f5..e2cbd66e6abeed052f736abbe8ea686bf13c2bfa 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/IDateFormat.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/IDateFormat.java @@ -16,13 +16,15 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.search; +import java.io.Serializable; + import ch.systemsx.cisd.base.annotation.JsonObject; /** * @author pkupczyk */ @JsonObject("dto.search.IDateFormat") -public interface IDateFormat +public interface IDateFormat extends Serializable { public String getFormat(); diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/ITimeZone.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/ITimeZone.java index 608ca8698c6c247441d6e7c1d5d707e38ea14d31..2fe9951ac608b54bfdabfb2f2febf1a3c2e9a035 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/ITimeZone.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/ITimeZone.java @@ -16,13 +16,15 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.search; +import java.io.Serializable; + import ch.systemsx.cisd.base.annotation.JsonObject; /** * @author pkupczyk */ @JsonObject("dto.search.ITimeZone") -public interface ITimeZone +public interface ITimeZone extends Serializable { } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/LongDateFormat.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/LongDateFormat.java index bf9dba54beb8a368d1f5d1fe8f6418a4466295f6..e2b9398781848701f4965ac6aa17346f2196624c 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/LongDateFormat.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/LongDateFormat.java @@ -25,12 +25,14 @@ import ch.systemsx.cisd.base.annotation.JsonObject; public class LongDateFormat implements IDateFormat { + private static final long serialVersionUID = 1L; + @Override public String getFormat() { return "y-M-d HH:mm:ss"; } - + @Override public String toString() { diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/NormalDateFormat.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/NormalDateFormat.java index 561a17b27b60879beda51ffed07c57bb5e37db60..d3afd05d9d3fe47bd00ad4738a070837be12ee38 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/NormalDateFormat.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/NormalDateFormat.java @@ -25,6 +25,8 @@ import ch.systemsx.cisd.base.annotation.JsonObject; public class NormalDateFormat implements IDateFormat { + private static final long serialVersionUID = 1L; + @Override public String getFormat() { diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/SearchCriteriaToStringBuilder.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/SearchCriteriaToStringBuilder.java index 3b7fa2db6f462ce66d309315c8287c732e3bd109..b2812fe0b74f6097aa2d95f841e259705029ea8d 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/SearchCriteriaToStringBuilder.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/SearchCriteriaToStringBuilder.java @@ -71,15 +71,15 @@ public class SearchCriteriaToStringBuilder sb.append(indentation + "with operator '" + operator + "'\n"); } - for (ISearchCriteria criteria : criteria) + for (ISearchCriteria aCriteria : criteria) { - if (criteria instanceof AbstractCompositeSearchCriteria) + if (aCriteria instanceof AbstractCompositeSearchCriteria) { - AbstractCompositeSearchCriteria compositeCriteria = (AbstractCompositeSearchCriteria) criteria; + AbstractCompositeSearchCriteria compositeCriteria = (AbstractCompositeSearchCriteria) aCriteria; sb.append(compositeCriteria.toString(indentation)); } else { - sb.append(indentation + criteria.toString() + "\n"); + sb.append(indentation + aCriteria.toString() + "\n"); } } return sb.toString(); diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/ServerTimeZone.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/ServerTimeZone.java index d8e7270395ad505a8b6a512d978552dbc6b2bfbc..e75733b2ecea42956d9147bf5e522d9b486697cb 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/ServerTimeZone.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/ServerTimeZone.java @@ -26,4 +26,6 @@ import ch.systemsx.cisd.base.annotation.JsonObject; public class ServerTimeZone implements ITimeZone { + private static final long serialVersionUID = 1L; + } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/ShortDateFormat.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/ShortDateFormat.java index 7663f5513ae953e65070b68ba4b59ff19e6ec30d..023a5e4b5be0731e0eaa8ff0295403f88847b53f 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/ShortDateFormat.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/ShortDateFormat.java @@ -25,6 +25,8 @@ import ch.systemsx.cisd.base.annotation.JsonObject; public class ShortDateFormat implements IDateFormat { + private static final long serialVersionUID = 1L; + @Override public String getFormat() { diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/TimeZone.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/TimeZone.java index 5bf9272a9e9ebc0ea8180c1b428316ff3a6a0867..ea3d9c09669486bc82ebfcb1bb0e180022326dad 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/TimeZone.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/TimeZone.java @@ -26,6 +26,8 @@ import ch.systemsx.cisd.base.annotation.JsonObject; public class TimeZone implements ITimeZone { + private static final long serialVersionUID = 1L; + private int hourOffset; public TimeZone(int hourOffset)