From ef58ddaca5748b90a69aeb0d4e3b1ccb5f3ca8b1 Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Mon, 21 Mar 2011 14:14:20 +0000 Subject: [PATCH] [LMS-2148] minor: renaming SVN: 20424 --- ...riaToDetailedSearchCriteriaTranslator.java | 14 ++++++------- .../search/detailed/IndexFieldNameHelper.java | 6 +++--- ...ityKind.java => AssociatedEntityKind.java} | 14 +++++++------ .../DetailedSearchAssociationCriteria.java | 6 +++--- .../basic/dto/DetailedSearchSubCriteria.java | 6 +++--- ...oDetailedSearchCriteriaTranslatorTest.java | 20 ++++++------------- .../dataaccess/db/HibernateSearchDAOTest.java | 4 ++-- 7 files changed, 32 insertions(+), 38 deletions(-) rename openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/{SearchableEntityKind.java => AssociatedEntityKind.java} (72%) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/SearchCriteriaToDetailedSearchCriteriaTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/SearchCriteriaToDetailedSearchCriteriaTranslator.java index 351c347d764..7023576eb94 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/SearchCriteriaToDetailedSearchCriteriaTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/SearchCriteriaToDetailedSearchCriteriaTranslator.java @@ -28,6 +28,7 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchCl import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.PropertyMatchClause; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchSubCriteria; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchableEntityKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AssociatedEntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DetailedSearchCriteria; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DetailedSearchCriterion; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DetailedSearchField; @@ -73,19 +74,18 @@ class SearchCriteriaToDetailedSearchCriteriaTranslator attribute, entityKind)); } - private static ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchableEntityKind translateEntityKind( - SearchableEntityKind entityKind) + private static AssociatedEntityKind convertToAssociatedEntityKind(SearchableEntityKind entityKind) { switch (entityKind) { case SAMPLE: - return ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchableEntityKind.SAMPLE; + return AssociatedEntityKind.SAMPLE; case EXPERIMENT: - return ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchableEntityKind.EXPERIMENT; + return AssociatedEntityKind.EXPERIMENT; case SAMPLE_CONTAINER: - return ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchableEntityKind.SAMPLE_CONTAINER; + return AssociatedEntityKind.SAMPLE_CONTAINER; case SAMPLE_PARENT: - return ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchableEntityKind.SAMPLE_PARENT; + return AssociatedEntityKind.SAMPLE_PARENT; } return null; // can't happen } @@ -177,7 +177,7 @@ class SearchCriteriaToDetailedSearchCriteriaTranslator final SearchableEntityKind targetEntityKind = subCriteria.getTargetEntityKind(); final DetailedSearchCriteria detailedSearchCriteria = convertToDetailedSearchCriteria(targetEntityKind, criteria); - return new DetailedSearchSubCriteria(translateEntityKind(targetEntityKind), + return new DetailedSearchSubCriteria(convertToAssociatedEntityKind(targetEntityKind), detailedSearchCriteria); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/detailed/IndexFieldNameHelper.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/detailed/IndexFieldNameHelper.java index 3f61c69d3b3..c8a9f4ca752 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/detailed/IndexFieldNameHelper.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/detailed/IndexFieldNameHelper.java @@ -24,7 +24,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentAttributeSearchFieldKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialAttributeSearchFieldKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleAttributeSearchFieldKind; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchableEntityKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AssociatedEntityKind; import ch.systemsx.cisd.openbis.generic.shared.dto.hibernate.SearchFieldConstants; /** @@ -37,7 +37,7 @@ class IndexFieldNameHelper // associations static String getAssociationIndexField(EntityKind entityKind, - SearchableEntityKind associationKind) + AssociatedEntityKind associationKind) { switch (associationKind) { @@ -67,7 +67,7 @@ class IndexFieldNameHelper } private static RuntimeException createAssociationNotHandledException(EntityKind entityKind, - SearchableEntityKind associationKind) + AssociatedEntityKind associationKind) { return InternalErr.error("Associations between " + entityKind + " and " + associationKind + " are not supported"); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchableEntityKind.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AssociatedEntityKind.java similarity index 72% rename from openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchableEntityKind.java rename to openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AssociatedEntityKind.java index d6b17762af5..f5bea334d9e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchableEntityKind.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AssociatedEntityKind.java @@ -24,19 +24,21 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.ISerializable; * * @author Piotr Buczek */ -public enum SearchableEntityKind implements ISerializable // AssociatedEntityKind +public enum AssociatedEntityKind implements ISerializable { - SAMPLE("Sample", EntityKind.SAMPLE), EXPERIMENT("Experiment", EntityKind.EXPERIMENT), - // sample subcriteria - SAMPLE_CONTAINER("Container", EntityKind.SAMPLE), SAMPLE_PARENT("Parent", EntityKind.SAMPLE); // SAMPLE_CHILD + SAMPLE("Sample", EntityKind.SAMPLE), - // MATERIAL("Material"), EXPERIMENT("Experiment"), SAMPLE("Sample"), DATA_SET("Data Set"); + EXPERIMENT("Experiment", EntityKind.EXPERIMENT), + + SAMPLE_CONTAINER("Container", EntityKind.SAMPLE), + + SAMPLE_PARENT("Parent", EntityKind.SAMPLE); private final String description; private final EntityKind entityKind; - private SearchableEntityKind(final String description, final EntityKind entityKind) + private AssociatedEntityKind(final String description, final EntityKind entityKind) { this.description = description; this.entityKind = entityKind; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchAssociationCriteria.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchAssociationCriteria.java index 14346eebca1..fe71e3e5691 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchAssociationCriteria.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchAssociationCriteria.java @@ -29,11 +29,11 @@ public class DetailedSearchAssociationCriteria implements ISerializable { private static final long serialVersionUID = ServiceVersionHolder.VERSION; - private SearchableEntityKind entityKind; + private AssociatedEntityKind entityKind; private Collection<Long> ids; - public DetailedSearchAssociationCriteria(SearchableEntityKind entityKind, Collection<Long> ids) + public DetailedSearchAssociationCriteria(AssociatedEntityKind entityKind, Collection<Long> ids) { this.entityKind = entityKind; this.ids = ids; @@ -44,7 +44,7 @@ public class DetailedSearchAssociationCriteria implements ISerializable return ids; } - public SearchableEntityKind getEntityKind() + public AssociatedEntityKind getEntityKind() { return entityKind; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchSubCriteria.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchSubCriteria.java index d0af539356b..979ce58dc59 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchSubCriteria.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchSubCriteria.java @@ -29,9 +29,9 @@ public class DetailedSearchSubCriteria implements ISerializable private DetailedSearchCriteria criteria; - private SearchableEntityKind targetEntityKind; + private AssociatedEntityKind targetEntityKind; - public DetailedSearchSubCriteria(SearchableEntityKind targetEntityKind, + public DetailedSearchSubCriteria(AssociatedEntityKind targetEntityKind, DetailedSearchCriteria criteria) { this.targetEntityKind = targetEntityKind; @@ -43,7 +43,7 @@ public class DetailedSearchSubCriteria implements ISerializable return criteria; } - public SearchableEntityKind getTargetEntityKind() + public AssociatedEntityKind getTargetEntityKind() { return targetEntityKind; } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/api/v1/SearchCriteriaToDetailedSearchCriteriaTranslatorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/api/v1/SearchCriteriaToDetailedSearchCriteriaTranslatorTest.java index 699d3985f79..055d936b893 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/api/v1/SearchCriteriaToDetailedSearchCriteriaTranslatorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/api/v1/SearchCriteriaToDetailedSearchCriteriaTranslatorTest.java @@ -26,6 +26,7 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchCl import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.SearchOperator; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchSubCriteria; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchableEntityKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AssociatedEntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DetailedSearchCriteria; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DetailedSearchSubCriteria; @@ -146,8 +147,7 @@ public class SearchCriteriaToDetailedSearchCriteriaTranslatorTest extends Assert private static String EXPECTED_BASIC_QUERY_SUFFIX = "ATTRIBUTE CODE: a code AND " + "PROPERTY MY_PROPERTY: a property value " + "(with wildcards)"; - private void testConvertToDetailedSearchSubCriteria( - ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchableEntityKind expectedEntityKind, + private void testConvertToDetailedSearchSubCriteria(AssociatedEntityKind expectedEntityKind, SearchSubCriteria subCriteria) { DetailedSearchSubCriteria detailedSearchSubCriteria = @@ -163,9 +163,7 @@ public class SearchCriteriaToDetailedSearchCriteriaTranslatorTest extends Assert { SearchCriteria criteria = createBasicSearchCriteria(); SearchSubCriteria subCriteria = SearchSubCriteria.createSampleCriteria(criteria); - testConvertToDetailedSearchSubCriteria( - ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchableEntityKind.SAMPLE, - subCriteria); + testConvertToDetailedSearchSubCriteria(AssociatedEntityKind.SAMPLE, subCriteria); } @Test @@ -173,9 +171,7 @@ public class SearchCriteriaToDetailedSearchCriteriaTranslatorTest extends Assert { SearchCriteria criteria = createBasicSearchCriteria(); SearchSubCriteria subCriteria = SearchSubCriteria.createSampleParentCriteria(criteria); - testConvertToDetailedSearchSubCriteria( - ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchableEntityKind.SAMPLE_PARENT, - subCriteria); + testConvertToDetailedSearchSubCriteria(AssociatedEntityKind.SAMPLE_PARENT, subCriteria); } @Test @@ -183,9 +179,7 @@ public class SearchCriteriaToDetailedSearchCriteriaTranslatorTest extends Assert { SearchCriteria criteria = createBasicSearchCriteria(); SearchSubCriteria subCriteria = SearchSubCriteria.createSampleContainerCriteria(criteria); - testConvertToDetailedSearchSubCriteria( - ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchableEntityKind.SAMPLE_CONTAINER, - subCriteria); + testConvertToDetailedSearchSubCriteria(AssociatedEntityKind.SAMPLE_CONTAINER, subCriteria); } @Test @@ -193,9 +187,7 @@ public class SearchCriteriaToDetailedSearchCriteriaTranslatorTest extends Assert { SearchCriteria criteria = createBasicSearchCriteria(); SearchSubCriteria subCriteria = SearchSubCriteria.createExperimentCriteria(criteria); - testConvertToDetailedSearchSubCriteria( - ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchableEntityKind.EXPERIMENT, - subCriteria); + testConvertToDetailedSearchSubCriteria(AssociatedEntityKind.EXPERIMENT, subCriteria); } private SearchCriteria createBasicSearchCriteria() diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAOTest.java index c093b373fdd..4cb784101e4 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAOTest.java @@ -48,7 +48,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DetailedSearchField; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MatchingEntity; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchCriteriaConnection; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SearchableEntityKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AssociatedEntityKind; import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetPropertyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.EntityPropertyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataPE; @@ -362,7 +362,7 @@ public final class HibernateSearchDAOTest extends AbstractDAOTest DetailedSearchCriterion criterion = createSimpleFieldCriterion(); DetailedSearchCriteria criteria = createAndDatasetQuery(criterion); DetailedSearchAssociationCriteria association = - new DetailedSearchAssociationCriteria(SearchableEntityKind.EXPERIMENT, + new DetailedSearchAssociationCriteria(AssociatedEntityKind.EXPERIMENT, Collections.singleton(new Long(2L))); // compared to testSearchForDataSetsSimpleField() DSLoc.LOC3 should be filtered // because of different experiment -- GitLab