diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/OpenbisServiceFacadeTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/OpenbisServiceFacadeTest.java index 1366bbfdd6f5f332ebe2f1903ccae486ae4a4752..f50d9bc922088fad58acbb9a47d85d4aa5cb4ea8 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/OpenbisServiceFacadeTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/OpenbisServiceFacadeTest.java @@ -413,7 +413,7 @@ public class OpenbisServiceFacadeTest extends SystemTestCase DataSet dataSet = serviceFacade.putDataSet(newDataset, exampleDataSet); String code = dataSet.getCode(); // Because serviceFacade.getDataSet() relies on updated lucene index (which is done - // asynchronously) we tried it for ten second to retrieve the just created data set. + // asynchronously) we tried it for 60 second to retrieve the just created data set. for (int i = 0; i < 60; i++) { DataSet retrievedDataSet = serviceFacade.getDataSet(code); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/AuthorizationDataProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/AuthorizationDataProvider.java index fb59556ee5ed6b110487340d7475743a60770552..d403691262bac4997542d33c9d7d9ec3a89ab532 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/AuthorizationDataProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/AuthorizationDataProvider.java @@ -35,6 +35,24 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier; // TODO 2010-07-14, Piotr Buczek: write tests for nontrivial methods final public class AuthorizationDataProvider implements IAuthorizationDataProvider { + private static final class PermId2StringMapper implements IMapper<List<PermId>, List<?>> + { + @Override + public List<?> map(List<PermId> permIds) + { + return PermId.asStrings(permIds); + } + } + + private static final class TechId2LongMapper implements IMapper<List<TechId>, List<?>> + { + @Override + public List<?> map(List<TechId> techIds) + { + return TechId.asLongs(techIds); + } + } + private final IAuthorizationDAOFactory daoFactory; public AuthorizationDataProvider(IAuthorizationDAOFactory daoFactory) @@ -192,14 +210,7 @@ final public class AuthorizationDataProvider implements IAuthorizationDataProvid public Set<DataSetAccessPE> getDatasetCollectionAccessDataByTechIds(final List<TechId> dataSetTechIds) { return getEntityCollectionAccessData("dataset", DataSetAccessPE.DATASET_ACCESS_BY_TECH_IDS_QUERY_NAME, - DataSetAccessPE.DATA_SET_IDS_PARAMETER_NAME, dataSetTechIds, new IMapper<List<TechId>, List<?>>() - { - @Override - public List<?> map(List<TechId> techIds) - { - return TechId.asLongs(techIds); - } - }); + DataSetAccessPE.DATA_SET_IDS_PARAMETER_NAME, dataSetTechIds, new TechId2LongMapper()); } @Override @@ -213,70 +224,35 @@ final public class AuthorizationDataProvider implements IAuthorizationDataProvid public Set<DataSetAccessPE> getDeletedDatasetCollectionAccessData(final List<TechId> deletionIds) { return getEntityCollectionAccessData("deletion", DataSetAccessPE.DELETED_DATASET_ACCESS_QUERY_NAME, - DataSetAccessPE.DELETION_IDS_PARAMETER_NAME, deletionIds, new IMapper<List<TechId>, List<?>>() - { - @Override - public List<?> map(List<TechId> techIds) - { - return TechId.asLongs(techIds); - } - }); + DataSetAccessPE.DELETION_IDS_PARAMETER_NAME, deletionIds, new TechId2LongMapper()); } @Override public Set<SampleAccessPE> getSampleCollectionAccessDataByTechIds(List<TechId> sampleTechIds) { return getEntityCollectionAccessData("sample", SampleAccessPE.SAMPLE_ACCESS_BY_TECH_IDS_QUERY_NAME, - SampleAccessPE.SAMPLE_IDS_PARAMETER_NAME, sampleTechIds, new IMapper<List<TechId>, List<?>>() - { - @Override - public List<?> map(List<TechId> techIds) - { - return TechId.asLongs(techIds); - } - }); + SampleAccessPE.SAMPLE_IDS_PARAMETER_NAME, sampleTechIds, new TechId2LongMapper()); } @Override public Set<SampleAccessPE> getSampleCollectionAccessDataByPermIds(List<PermId> samplePermIds) { return getEntityCollectionAccessData("sample", SampleAccessPE.SAMPLE_ACCESS_BY_PERM_IDS_QUERY_NAME, - SampleAccessPE.SAMPLE_IDS_PARAMETER_NAME, samplePermIds, new IMapper<List<PermId>, List<?>>() - { - @Override - public List<?> map(List<PermId> permIds) - { - return PermId.asStrings(permIds); - } - }); + SampleAccessPE.SAMPLE_IDS_PARAMETER_NAME, samplePermIds, new PermId2StringMapper()); } @Override public Set<SampleAccessPE> getDeletedSampleCollectionAccessData(List<TechId> deletionIds) { return getEntityCollectionAccessData("deletion", SampleAccessPE.DELETED_SAMPLE_ACCESS_QUERY_NAME, - SampleAccessPE.DELETION_IDS_PARAMETER_NAME, deletionIds, new IMapper<List<TechId>, List<?>>() - { - @Override - public List<?> map(List<TechId> techIds) - { - return TechId.asLongs(techIds); - } - }); + SampleAccessPE.DELETION_IDS_PARAMETER_NAME, deletionIds, new TechId2LongMapper()); } @Override public Set<ExperimentAccessPE> getExperimentCollectionAccessData(final List<TechId> experimentIds) { return getEntityCollectionAccessData("experiment", ExperimentAccessPE.EXPERIMENT_ACCESS_QUERY_NAME, - ExperimentAccessPE.EXPERIMENT_IDS_PARAMETER_NAME, experimentIds, new IMapper<List<TechId>, List<?>>() - { - @Override - public List<?> map(List<TechId> techIds) - { - return TechId.asLongs(techIds); - } - }); + ExperimentAccessPE.EXPERIMENT_IDS_PARAMETER_NAME, experimentIds, new TechId2LongMapper()); } @Override @@ -284,14 +260,7 @@ final public class AuthorizationDataProvider implements IAuthorizationDataProvid final List<TechId> deletionIds) { return getEntityCollectionAccessData("deletion", ExperimentAccessPE.DELETED_EXPERIMENT_ACCESS_QUERY_NAME, - ExperimentAccessPE.DELETION_IDS_PARAMETER_NAME, deletionIds, new IMapper<List<TechId>, List<?>>() - { - @Override - public List<?> map(List<TechId> techIds) - { - return TechId.asLongs(techIds); - } - }); + ExperimentAccessPE.DELETION_IDS_PARAMETER_NAME, deletionIds, new TechId2LongMapper()); } private <V, R> Set<R> getEntityCollectionAccessData(String entityName, String queryName, String parameterName, List<V> values,