Skip to content
Snippets Groups Projects
Commit ef58ddac authored by buczekp's avatar buczekp
Browse files

[LMS-2148] minor: renaming

SVN: 20424
parent 2183d3d6
No related branches found
No related tags found
No related merge requests found
Showing with 32 additions and 38 deletions
......@@ -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);
}
......
......@@ -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");
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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()
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment