From 586e197e2f8aa2ea8960120f895f2272256b6c81 Mon Sep 17 00:00:00 2001 From: rkv Date: Tue, 26 Feb 2013 08:04:25 +0000 Subject: [PATCH] Simulation context type selection is fixed in study search. Lucene is no more used for study search. Study indexing is deprecated. --- .../src/org/splat/service/SearchService.java | 9 +- .../org/splat/service/SearchServiceImpl.java | 158 ++++++++- .../src/org/splat/service/dto/StudyDTO.java | 128 ++++++++ .../test/splat/service/TestSearchService.java | 302 ++++++++++++++++++ .../splat/util/TestEntitiesGenerator.java | 4 +- Workspace/Siman/WebContent/js/search.js | 21 -- .../Siman/WebContent/study/searchStudy.jsp | 2 +- .../splat/simer/AbstractSearchBaseAction.java | 1 + .../org/splat/simer/SearchStudyAction.java | 10 +- .../simer/admin/DatabaseIndexingAction.java | 1 + 10 files changed, 596 insertions(+), 40 deletions(-) create mode 100644 Workspace/Siman-Common/src/org/splat/service/dto/StudyDTO.java create mode 100644 Workspace/Siman-Common/src/test/splat/service/TestSearchService.java diff --git a/Workspace/Siman-Common/src/org/splat/service/SearchService.java b/Workspace/Siman-Common/src/org/splat/service/SearchService.java index 18a024d..95e72d6 100644 --- a/Workspace/Siman-Common/src/org/splat/service/SearchService.java +++ b/Workspace/Siman-Common/src/org/splat/service/SearchService.java @@ -51,11 +51,16 @@ public interface SearchService { /** * Find studies with given properties. * + * @param allCriteria + * if true then search for all criteria (AND), otherwise search for any criteria + * @param allContexts + * if true then search for all simulation contexts (AND), otherwise search for any simulation contexts * @param sprop * search filter parameters - * @return the list of found studies as proxiy results of lucene search + * @return the list of found studies as proxy results */ - List selectStudiesWhere(Study.Properties... sprop); + List selectStudiesWhere(boolean allCriteria, boolean allContexts, + Study.Properties sprop); /** * Refresh lucene index for a study. diff --git a/Workspace/Siman-Common/src/org/splat/service/SearchServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/SearchServiceImpl.java index 8fcb669..beaf1af 100644 --- a/Workspace/Siman-Common/src/org/splat/service/SearchServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/SearchServiceImpl.java @@ -30,6 +30,14 @@ import org.apache.lucene.search.TermsFilter; import org.apache.lucene.search.TopFieldDocs; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; +import org.hibernate.Criteria; +import org.hibernate.Hibernate; +import org.hibernate.criterion.DetachedCriteria; +import org.hibernate.criterion.Disjunction; +import org.hibernate.criterion.Junction; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.hibernate.type.Type; import org.splat.dal.bo.kernel.User; import org.splat.dal.bo.som.KnowledgeElement; import org.splat.dal.bo.som.KnowledgeElementType; @@ -38,9 +46,11 @@ import org.splat.dal.bo.som.Scenario; import org.splat.dal.bo.som.SimulationContext; import org.splat.dal.bo.som.Study; import org.splat.dal.bo.som.Visibility; +import org.splat.dal.bo.som.Study.Properties; import org.splat.dal.dao.som.StudyDAO; import org.splat.service.dto.ImportedStudyDTO; import org.splat.service.dto.Proxy; +import org.splat.service.dto.StudyDTO; import org.splat.service.technical.IndexService; import org.splat.service.technical.IndexServiceImpl; import org.splat.service.technical.RepositoryService; @@ -79,9 +89,10 @@ public class SearchServiceImpl implements SearchService { /** * Get a list of studies which are currently not presented in the lucene index. + * * @return list of ImportedStudy DTO */ - @Transactional(readOnly=true) + @Transactional(readOnly = true) public List selectStudies() { List table = new ArrayList(); Study.Properties sprop = new Study.Properties(); @@ -99,7 +110,7 @@ public class SearchServiceImpl implements SearchService { } catch (Exception error) { continue; } - // Add the study to the list of studies which are + // Add the study to the list of studies which are // currently not presented in the lucene index. table.add(BeanHelper.copyBean(aStudy, ImportedStudyDTO.class)); } @@ -113,6 +124,7 @@ public class SearchServiceImpl implements SearchService { * list of studies id's */ @Transactional(readOnly = true) + @Deprecated public void reindexStudies(final String[] ridlist) { for (int i = 0; i < ridlist.length; i++) { long index = Long.valueOf(ridlist[i].trim()); @@ -253,6 +265,140 @@ public class SearchServiceImpl implements SearchService { * * @see org.splat.service.SearchService#selectStudiesWhere(org.splat.dal.bo.som.Study.Properties[]) */ + public List selectStudiesWhere(final boolean allCriteria, + final boolean allContexts, final Study.Properties sprop) { + List result = new ArrayList(); + + DetachedCriteria query = DetachedCriteria + .forClass(Study.class, "study"); + // Creation of the query + initQuery(query, sprop); + + String title = sprop.getTitle(); // Title + if (title != null) { + // Look for given words in study titles + Junction critext; + if (allCriteria) { // AND + critext = Restrictions.conjunction(); + } else { // OR + critext = Restrictions.disjunction(); + } + + String[] word = title.split(" "); + for (int j = 0; j < word.length; j++) { + critext.add(Restrictions.like("title", "%" + word[j] + "%")); + } + query.add(critext); + } + + List context = sprop.getSimulationContexts(); + if (context != null && (!context.isEmpty())) { + // Get only studies which have given contexts + query.createAlias("contex", "ctx", Criteria.INNER_JOIN); + Junction critctx; + if (allContexts) { // AND + critctx = Restrictions.conjunction(); + } else { // OR + critctx = Restrictions.disjunction(); + } + for (SimulationContext seltext : context) { + // (simctxType = seltext.getType() AND simctxValue = seltext.getValue()) + critctx.add(Restrictions.and(Restrictions.eq("ctx.value", + seltext.getValue()), Restrictions.eq("ctx.type", + seltext.getType()))); + + } + query.add(critctx); + } + + // Group by study + query.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + // Creation of the sort criteria + query.addOrder(Order.asc("title")); + + if (LOG.isInfoEnabled()) { + LOG.info("Searching studies: \"" + query.toString() + "\"."); + } + + // Search + List found = getStudyDAO().getFilteredList(query); + + // Construction of the result list + for (Study std : found) { + result.add(new StudyDTO(std.getIndex(), std.getReference(), std + .getProgressState(), std.getTitle(), std.getAuthor() + .getDisplayName())); + } + return result; + } + + /** + * Initialize query with base criteria. + * + * @param query + * the query + * @param sprop + * the criteria + */ + private void initQuery(final DetachedCriteria query, final Properties sprop) { + ProgressState state = sprop.getProgressState(); // State + if (state != null) { + query.add(Restrictions.eq("state", state)); + } + String refid = sprop.getReference(); // Reference + if (refid != null) { + query.add(Restrictions.eq("sid", refid)); + } + User manager = sprop.getManager(); // Author + if (manager != null) { + query.add(Restrictions.eq("manager", manager)); + } + + User actor = sprop.getActor(); // Contributor, Reviewer or Approver + if (actor == null) { + // User is not logged in - show only public studies + query.add(Restrictions.eq("visibility", Visibility.PUBLIC)); + } else { + // User is loggen in - show public studies and studies where he is participating + Disjunction orCrit = Restrictions.disjunction(); + query + .add(orCrit + .add( + /* If the user is a validation cycle participant */ + Restrictions + .sqlRestriction( + "{alias}.rid in (select vcrel.owner from cycle_rel vcrel inner join cycle vc on vcrel.refer = vc.rid where {alias}.rid = vcrel.owner AND (vc.publisher = ? OR vc.reviewer = ? OR vc.approver = ? OR vc.signatory = ?) group by vcrel.owner)", + new Object[] { + actor.getIndex(), + actor.getIndex(), + actor.getIndex(), + actor.getIndex() }, + new Type[] { + Hibernate.LONG, + Hibernate.LONG, + Hibernate.LONG, + Hibernate.LONG })) + .add( + /* If the user is contributor */ + Restrictions + .sqlRestriction( + "{alias}.rid in (select rel.owner from contributor_rel rel where {alias}.rid = rel.owner AND rel.refer = ?)", + actor.getIndex(), + Hibernate.LONG)).add( + /* If the user is author */ + Restrictions.eq("study.manager", actor)).add( + /* If the study is public */ + Restrictions.eq("study.visibility", + Visibility.PUBLIC))); + } + } + + /** + * {@inheritDoc} + * + * @see org.splat.service.SearchService#selectStudiesWhere(org.splat.dal.bo.som.Study.Properties[]) + */ + @Deprecated public List selectStudiesWhere(final Study.Properties... sprop) { List result = new ArrayList(); int hitsize = 20; @@ -385,6 +531,7 @@ public class SearchServiceImpl implements SearchService { * * @see org.splat.service.SearchService#indexStudy(org.splat.dal.bo.som.Study) */ + @Deprecated public void indexStudy(final Study study) { LOG.debug("Index study: id=" + study.getRid() + "; reference=" + study.getReference()); @@ -401,8 +548,8 @@ public class SearchServiceImpl implements SearchService { IndexService lucin = getIndex(); Scenario[] scenes = study.getScenarii(); - LOG.debug("Number of study " + study.getReference() - + " actors: " + study.getActor().size()); + LOG.debug("Number of study " + study.getReference() + " actors: " + + study.getActor().size()); lucin.add(study); if (study.getProgressState() != ProgressState.inWORK) { for (int i = 0; i < scenes.length; i++) { @@ -411,8 +558,7 @@ public class SearchServiceImpl implements SearchService { for (Iterator j = list.iterator(); j .hasNext();) { lucin.add(j.next()); - LOG.debug("Knowlegge added: id=" - + j.next().getIndex()); + LOG.debug("Knowlegge added: id=" + j.next().getIndex()); } } } diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/StudyDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/StudyDTO.java new file mode 100644 index 0000000..6221a38 --- /dev/null +++ b/Workspace/Siman-Common/src/org/splat/service/dto/StudyDTO.java @@ -0,0 +1,128 @@ +/***************************************************************************** + * Company OPEN CASCADE + * Application SIMAN + * File $Id$ + * Creation date 20.02.2013 + * @author $Author$ + * @version $Revision$ + * @copyright OPEN CASCADE 2012 + *****************************************************************************/ + +package org.splat.service.dto; + +import java.io.Serializable; + +import org.splat.dal.bo.som.ProgressState; + +/** + * Study DTO class. Used in study search results. + * + * @author Roman Kozlov (RKV) + */ +public class StudyDTO implements Proxy, Serializable { + /** + * Study persistent id. + */ + private transient final Long _rid; + /** + * Study reference. + */ + private transient final String _sid; + /** + * Study progress state. + */ + private transient final ProgressState _state; + /** + * Study title. + */ + private transient final String _title; + /** + * Study name. + */ + private transient final String _name; + /** + * Type. + */ + private transient String _type; + /** + * Serialization version id. + */ + private static final long serialVersionUID = -4386494192709562221L; + + /** + * Costructor from properties. + * + * @param id + * study persistent id + * @param reference + * study reference + * @param state + * study progress state + * @param title + * study title + * @param author + * study author display name + */ + public StudyDTO(final Long id, final String reference, + final ProgressState state, final String title, final String author) { + _rid = id; + _sid = reference; + _state = state; + _title = title; + _name = author; + } + + /** + * {@inheritDoc} + * + * @see org.splat.service.dto.Proxy#getAuthorName() + */ + public String getAuthorName() { + return _name; + } + + /** + * {@inheritDoc} + * + * @see org.splat.service.dto.Proxy#getIndex() + */ + public Long getIndex() { + return _rid; + } + + /** + * {@inheritDoc} + * + * @see org.splat.service.dto.Proxy#getProgressState() + */ + public ProgressState getProgressState() { + return _state; + } + + /** + * {@inheritDoc} + * + * @see org.splat.service.dto.Proxy#getReference() + */ + public String getReference() { + return _sid; + } + + /** + * {@inheritDoc} + * + * @see org.splat.service.dto.Proxy#getTitle() + */ + public String getTitle() { + return _title; + } + + /** + * {@inheritDoc} + * + * @see org.splat.service.dto.Proxy#getType() + */ + public String getType() { + return _type; + } +} diff --git a/Workspace/Siman-Common/src/test/splat/service/TestSearchService.java b/Workspace/Siman-Common/src/test/splat/service/TestSearchService.java new file mode 100644 index 0000000..2af3b22 --- /dev/null +++ b/Workspace/Siman-Common/src/test/splat/service/TestSearchService.java @@ -0,0 +1,302 @@ +/***************************************************************************** + * Company OPEN CASCADE + * Application SIMAN + * File $Id$ + * Creation date 12 Oct 2012 + * @author $Author$ + * @version $Revision$ + *****************************************************************************/ +package test.splat.service; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.splat.dal.bo.kernel.User; +import org.splat.dal.bo.som.ContributorRelation; +import org.splat.dal.bo.som.DocumentType; +import org.splat.dal.bo.som.SimulationContext; +import org.splat.dal.bo.som.Study; +import org.splat.dal.bo.som.ValidationCycle; +import org.splat.dal.bo.som.ValidationCycleRelation; +import org.splat.dal.bo.som.ValidationStep; +import org.splat.dal.bo.som.Visibility; +import org.splat.dal.dao.kernel.UserDAO; +import org.splat.dal.dao.som.Database; +import org.splat.dal.dao.som.StudyDAO; +import org.splat.dal.dao.som.ValidationCycleDAO; +import org.splat.exception.BusinessException; +import org.splat.log.AppLogger; +import org.splat.service.DocumentTypeService; +import org.splat.service.PublicationService; +import org.splat.service.SearchService; +import org.splat.service.SimulationContextService; +import org.splat.service.StepService; +import org.splat.service.StudyService; +import org.splat.service.dto.Proxy; +import org.splat.service.technical.ProjectSettingsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.orm.hibernate3.HibernateTemplate; +import org.testng.Assert; +import org.testng.annotations.Test; + +import test.splat.common.BaseTest; +import test.splat.util.TestEntitiesGenerator; + +/** + * Test class for StudyService. + * + * @author Roman Kozlov (RKV) + * + */ +public class TestSearchService extends BaseTest { + + /** + * Logger for the class. + */ + private static final AppLogger LOG = AppLogger + .getLogger(TestSearchService.class); + + /** + * The StudyDAO. Later injected by Spring. + */ + @Autowired + @Qualifier("studyDAO") + private transient StudyDAO _studyDAO; + + /** + * The PublicationService. Later injected by Spring. + */ + @Autowired + @Qualifier("publicationService") + private transient PublicationService _publicationService; + + /** + * The StepService. Later injected by Spring. + */ + @Autowired + @Qualifier("stepService") + private transient StepService _stepService; + + /** + * The ProjectSettingsService. Later injected by Spring. + */ + @Autowired + @Qualifier("projectSettings") + private transient ProjectSettingsService _projectSettings; + + /** + * The DocumentTypeService. Later injected by Spring. + */ + @Autowired + @Qualifier("documentTypeService") + private transient DocumentTypeService _documentTypeService; + + /** + * The StudyService. Later injected by Spring. + */ + @Autowired + @Qualifier("studyService") + private transient StudyService _studyService; + + /** + * The SearchService. Later injected by Spring. + */ + @Autowired + @Qualifier("searchService") + private transient SearchService _searchService; + + /** + * The UserDAO. Later injected by Spring. + */ + @Autowired + @Qualifier("userDAO") + private transient UserDAO _userDAO; + + /** + * The ValidationCycleDAO. Later injected by Spring. + */ + @Autowired + @Qualifier("validationCycleDAO") + private transient ValidationCycleDAO _validationCycleDAO; + + /** + * The SimulationContextService. Later injected by Spring. + */ + @Autowired + @Qualifier("simulationContextService") + private transient SimulationContextService _simulationContextService; + + /** + * Test of searching a study.
+ * Description :
+ * Create studies and try to find them according next document index.
+ * Action :
+ * + *
    + *
  1. Search study by state
  2. + *
  3. Search study by reference
  4. + *
  5. Search study by author
  6. + *
  7. Search study by actor
  8. + *
  9. Search study by title
  10. + *
  11. Search study by simulation contexts
  12. + *
  13. Search study by all criteria
  14. + *
  15. Search study by any criteria
  16. + *
+ *
Test data :
+ * no input parameters
+ * + * Outcome results:
+ * + *
    + *
  • A study must be found according to the given criteria
    + *
  • + *
+ *
+ * + * @throws BusinessException + * if can't create test user or study + */ + @Test + public void testSelectStudiesWhere() throws BusinessException { + LOG.debug(">>>>> BEGIN testGenerateLocalIndex()"); + startNestedTransaction(); + + HibernateTemplate ht = getHibernateTemplate(); + + Database.getInstance().reset(); + _projectSettings.getAllSteps().clear(); // Clear config to be able to load it again + // Load workflow customization + try { + _projectSettings.configure(ClassLoader.getSystemResource( + "test/som.xml").getPath()); + } catch (Exception e) { + Assert.fail("Can't load som.xml: ", e); + } + + User goodUser = TestEntitiesGenerator.getTestUser("goodUser"); + _userDAO.create(goodUser); + User otherUser = TestEntitiesGenerator.getTestUser("otherUser"); + _userDAO.create(otherUser); + User thirdUser = TestEntitiesGenerator.getTestUser("thirdUser"); + _userDAO.create(thirdUser); + + // Create private study + Study aStudy = TestEntitiesGenerator.getTestStudy(goodUser); + aStudy.setTitle("0.This is private study"); + Long privateStudyId = _studyDAO.create(aStudy); + + // Add simulation context to the study 0 + SimulationContext.Properties cprop = new SimulationContext.Properties(); + cprop.setType(_simulationContextService.selectType("product")) + .setValue("Test Simulation Context: Product"); + SimulationContext ctx = _studyService.addProjectContext(aStudy, cprop); + ht.flush(); + + // Create public study with predefined title + aStudy = TestEntitiesGenerator.getTestStudy(goodUser); + aStudy.setVisibility(Visibility.PUBLIC); + aStudy.setTitle("2.This is a public study"); + aStudy.addRelation(new ContributorRelation(aStudy, otherUser)); + Long titleStudyId = _studyDAO.create(aStudy); + + // Add simulation context to the study 2 + SimulationContext.Properties cprop1 = new SimulationContext.Properties(); + cprop.setType(_simulationContextService.selectType("product")) + .setValue("Test Simulation Context: Product1"); + SimulationContext ctx1 = _studyService.addProjectContext(aStudy, cprop); + ht.flush(); + + // Create public study with predefined reference + aStudy = TestEntitiesGenerator.getTestStudy(otherUser); + aStudy.setVisibility(Visibility.PUBLIC); + aStudy.setTitle("1.This is another public study"); + aStudy.setReference("TEST_REF"); + Long refStudyId = _studyDAO.create(aStudy); + + // Create private study of third user with otherUser as a reviewer + aStudy = TestEntitiesGenerator.getTestStudy(thirdUser); + aStudy.setTitle("3.This is a private study of third user"); + Long reviewStudyId = _studyDAO.create(aStudy); + + // Create validation cycle for the last study + ValidationCycle.Properties vprop = new ValidationCycle.Properties(); + DocumentType type = _documentTypeService.selectType("specification"); + vprop.setDocumentType(type); + vprop.setActor(ValidationStep.REVIEW, otherUser); + ValidationCycle cycle = new ValidationCycle(aStudy, vprop); + _validationCycleDAO.create(cycle); + ValidationCycleRelation link = cycle.getContext(); + aStudy.addRelation(link); + ht.flush(); + + // Search by study author + Study.Properties sprop = new Study.Properties(); + sprop.setManager(goodUser); + List res = _searchService.selectStudiesWhere(true, true, sprop); + Assert.assertNotNull(res); + Assert.assertEquals(res.size(), 1); + Assert.assertEquals(res.get(0).getIndex(), titleStudyId); + + // Search for other logged in study contributor + sprop.clear(); + sprop.setActor(otherUser); + res = _searchService.selectStudiesWhere(true, true, sprop); + Assert.assertNotNull(res); + Assert.assertEquals(res.size(), 3); + Assert.assertEquals(res.get(0).getIndex(), refStudyId); // Public study + Assert.assertEquals(res.get(1).getIndex(), titleStudyId); // Public study + Assert.assertEquals(res.get(2).getIndex(), reviewStudyId); // OtherUser is reviewer in this study + + // Search for logged in study contributor + sprop.clear(); + sprop.setActor(goodUser); + res = _searchService.selectStudiesWhere(true, true, sprop); + Assert.assertNotNull(res); + Assert.assertEquals(res.size(), 3); + Assert.assertEquals(res.get(0).getIndex(), privateStudyId); // goodUser is author + Assert.assertEquals(res.get(2).getIndex(), titleStudyId); // Public study + Assert.assertEquals(res.get(1).getIndex(), refStudyId); // Public study + + // Search by study title contents + sprop.clear(); + sprop.setTitle("study public"); + res = _searchService.selectStudiesWhere(true, true, sprop); + Assert.assertNotNull(res); + Assert.assertEquals(res.size(), 2); + Assert.assertEquals(res.get(0).getIndex(), refStudyId); + Assert.assertEquals(res.get(1).getIndex(), titleStudyId); + + // Search by study reference + sprop.clear(); + sprop.setReference("TEST_REF"); + res = _searchService.selectStudiesWhere(true, true, sprop); + Assert.assertNotNull(res); + Assert.assertEquals(res.size(), 1); + Assert.assertEquals(res.get(0).getIndex(), refStudyId); + + // Search a study by simulation context + sprop.clear(); + sprop.setActor(goodUser); + List contexts = new ArrayList(); + contexts.add(ctx); + sprop.setSimulationContexts(contexts); + res = _searchService.selectStudiesWhere(true, true, sprop); + Assert.assertNotNull(res); + Assert.assertEquals(res.size(), 1); + Assert.assertEquals(res.get(0).getIndex(), privateStudyId); + // Check simualtion contexts of the found study + aStudy = _studyService.selectStudy(res.get(0).getIndex()); + Iterator ctxIter = aStudy.SimulationContextIterator(); + contexts.clear(); + while (ctxIter.hasNext()) { + contexts.add(ctxIter.next()); + } + Assert.assertEquals(contexts.size(), 1); + Assert.assertEquals(contexts.get(0), ctx); + + rollbackNestedTransaction(); + LOG.debug(">>>>> END testGenerateLocalIndex()"); + } +} diff --git a/Workspace/Siman-Common/src/test/splat/util/TestEntitiesGenerator.java b/Workspace/Siman-Common/src/test/splat/util/TestEntitiesGenerator.java index d43b932..95783bd 100644 --- a/Workspace/Siman-Common/src/test/splat/util/TestEntitiesGenerator.java +++ b/Workspace/Siman-Common/src/test/splat/util/TestEntitiesGenerator.java @@ -16,7 +16,6 @@ import org.splat.dal.bo.kernel.User; import org.splat.dal.bo.som.ProgressState; import org.splat.dal.bo.som.SimulationContext; import org.splat.dal.bo.som.Study; -import org.splat.dal.bo.som.Visibility; import org.splat.exception.BusinessException; /** @@ -61,8 +60,7 @@ public class TestEntitiesGenerator { .setDate(new Date()) .setReference("test reference") .setSimulationContexts(new ArrayList()) - .setState(ProgressState.inWORK) - .setVisibility(Visibility.PUBLIC); + .setState(ProgressState.inWORK); Study study = new Study(studyProps); return study; } diff --git a/Workspace/Siman/WebContent/js/search.js b/Workspace/Siman/WebContent/js/search.js index 69c905b..a2a28bf 100644 --- a/Workspace/Siman/WebContent/js/search.js +++ b/Workspace/Siman/WebContent/js/search.js @@ -1,28 +1,7 @@ function initialize (result) { - var state = search.state.value; - - if (state == "inWORK" || state == "inDRAFT" || state == "inCHECK") { - search.visibility[0].checked = true; - search.visibility[1].disabled = true; - search.visibility[2].disabled = true; - } if (result == "obsolete") changeFilter(); // Hides the result section and enables the Search button } - function setState () { - var state = search.state.value; - - if (state == "inWORK" || state == "inDRAFT" || state == "inCHECK") { - search.visibility[0].checked = true; - search.visibility[1].disabled = true; - search.visibility[2].disabled = true; - } else if (search.visibility[1].value != "onlypublic") { - search.visibility[1].disabled = false; - search.visibility[2].disabled = false; - } - changeFilter(); - } - function changeFilter () { var result = document.getElementById("resulist"); diff --git a/Workspace/Siman/WebContent/study/searchStudy.jsp b/Workspace/Siman/WebContent/study/searchStudy.jsp index b2280e1..17248fc 100644 --- a/Workspace/Siman/WebContent/study/searchStudy.jsp +++ b/Workspace/Siman/WebContent/study/searchStudy.jsp @@ -63,7 +63,7 @@ $(document).ready(function () {   - " onChange="changeFilter()"> diff --git a/Workspace/Siman/src/org/splat/simer/AbstractSearchBaseAction.java b/Workspace/Siman/src/org/splat/simer/AbstractSearchBaseAction.java index 276ca13..477a447 100644 --- a/Workspace/Siman/src/org/splat/simer/AbstractSearchBaseAction.java +++ b/Workspace/Siman/src/org/splat/simer/AbstractSearchBaseAction.java @@ -154,6 +154,7 @@ public abstract class AbstractSearchBaseAction extends Action { // We keep the previous result search, if valid _result = (List) getSession().get(RESULT_KEY); } + setActionType("setContext"); return "selectype"; } diff --git a/Workspace/Siman/src/org/splat/simer/SearchStudyAction.java b/Workspace/Siman/src/org/splat/simer/SearchStudyAction.java index 423e39c..b331929 100644 --- a/Workspace/Siman/src/org/splat/simer/SearchStudyAction.java +++ b/Workspace/Siman/src/org/splat/simer/SearchStudyAction.java @@ -8,7 +8,6 @@ import org.splat.dal.bo.som.ProgressState; import org.splat.dal.bo.som.SimulationContext; import org.splat.dal.bo.som.SimulationContextType; import org.splat.dal.bo.som.Study; -import org.splat.dal.bo.som.Visibility; import org.splat.kernel.InvalidPropertyException; import org.splat.service.SearchService; import org.splat.service.technical.ProjectSettingsService; @@ -117,14 +116,11 @@ public class SearchStudyAction extends AbstractSearchBaseAction { User him = getUserService().selectUser(index); sprop.setManager(him); } - // Set of the visibility - Study.Properties other = sprop.copy(); - - other.setVisibility(Visibility.PUBLIC); - sprop.setVisibility(Visibility.PRIVATE); sprop.setActor(getConnectedUser()); - _result = getSearchService().selectStudiesWhere(sprop, other); + _result = getSearchService().selectStudiesWhere( + "all".equals(_criteriaMatch), "all".equals(_contextMatch), + sprop); session.put(RESULT_KEY, _result); // For redisplaying the page without re-executing the search return "refresh"; } diff --git a/Workspace/Siman/src/org/splat/simer/admin/DatabaseIndexingAction.java b/Workspace/Siman/src/org/splat/simer/admin/DatabaseIndexingAction.java index 05b5931..7d8671d 100644 --- a/Workspace/Siman/src/org/splat/simer/admin/DatabaseIndexingAction.java +++ b/Workspace/Siman/src/org/splat/simer/admin/DatabaseIndexingAction.java @@ -12,6 +12,7 @@ import org.splat.simer.Action; * * @author Roman Kozlov (RKV) */ +@Deprecated public class DatabaseIndexingAction extends Action { /** -- 2.39.2