]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman/src/org/splat/simer/SearchKnowledgeAction.java
Salome HOME
Sort study and knowledge results functionalities are implemented
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / SearchKnowledgeAction.java
index 8222dc2da0ef92a21c02ddc2c5ee6a73ce712254..661acd124b65b193a36867bd1b3688bd8ed40679 100644 (file)
@@ -11,6 +11,7 @@ import org.splat.kernel.InvalidPropertyException;
 import org.splat.service.KnowledgeElementTypeService;
 import org.splat.service.SearchService;
 import org.splat.service.dto.KnowledgeSearchFilterDTO;
+import org.splat.simer.AbstractSearchBaseAction.SortCriterion;
 import org.splat.wapp.Constants;
 
 /**
@@ -42,16 +43,9 @@ public class SearchKnowledgeAction extends
        // ==============================================================================================================================
 
        /**
-        * The action initialization.
-        * 
-        * @return SUCCESS if succeeded, ERROR if doSearch() is failed
+        * Common initialization for doInitialize() and doSetOrder() methods.
         */
-       public String doInitialize() {
-
-               initializationFullScreenContext(Constants.OPEN, Constants.NONE,
-                               Constants.OPEN);
-
-               String res = SUCCESS;
+       private void commonInit() {
                // Final initialization of the form
                _knowledgeTypes = buildKnowledgeTypesOptions();
                setCandidates(); // not selected by default
@@ -62,6 +56,20 @@ public class SearchKnowledgeAction extends
                if (ktypeId != null) {
                        getFilter().setKtype(String.valueOf(ktypeId));
                }
+       }
+       
+       /**
+        * The action initialization.
+        * 
+        * @return SUCCESS if succeeded, ERROR if doSearch() is failed
+        */
+       public String doInitialize() {
+
+               initializationFullScreenContext(Constants.OPEN, Constants.NONE,
+                               Constants.OPEN);
+
+               String res = SUCCESS;
+               commonInit();
                try {
                        doSearch();
                } catch (Exception error) {
@@ -71,6 +79,16 @@ public class SearchKnowledgeAction extends
                }
                return res;
        }
+       
+       /** 
+        * {@inheritDoc}
+        * @see org.splat.simer.AbstractSearchBaseAction#doSetOrder()
+        */
+       @Override
+       public String doSetOrder() {
+               commonInit();
+               return super.doSetOrder();
+       }
 
        /**
         * Build the map of translated knowledge types available for selection.
@@ -100,6 +118,9 @@ public class SearchKnowledgeAction extends
                }
                _result = getSearchService().selectKnowledgeElementsWhere(getFilter());
                getSession().put(RESULT_KEY, _result); // For redisplaying the page without re-executing the search
+               getSession().put(RESULT_KEY, _result); // For redisplaying the page without re-executing the search
+               getSession().put(ORDER_KEY, false);
+               getSession().put(CRITERION_KEY, SortCriterion.NAME);
                return "refresh";
        }