]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Search actions have been improved. Searching by dates has been implemented.
authorrkv <rkv@opencascade.com>
Tue, 5 Mar 2013 09:38:30 +0000 (09:38 +0000)
committerrkv <rkv@opencascade.com>
Tue, 5 Mar 2013 09:38:30 +0000 (09:38 +0000)
15 files changed:
Workspace/Siman-Common/src/org/splat/dal/bo/som/KnowledgeElementType.java
Workspace/Siman-Common/src/org/splat/service/SearchService.java
Workspace/Siman-Common/src/org/splat/service/SearchServiceImpl.java
Workspace/Siman-Common/src/org/splat/service/dto/KnowledgeSearchFilterDTO.java [new file with mode: 0644]
Workspace/Siman-Common/src/org/splat/service/dto/SearchFilterDTO.java [new file with mode: 0644]
Workspace/Siman-Common/src/org/splat/service/dto/StudySearchFilterDTO.java [new file with mode: 0644]
Workspace/Siman/WebContent/study/searchKnowledge.jsp
Workspace/Siman/WebContent/study/searchStudy.jsp
Workspace/Siman/src/org/splat/conversion/DateConverter.java [new file with mode: 0644]
Workspace/Siman/src/org/splat/simer/AbstractSearchBaseAction.java
Workspace/Siman/src/org/splat/simer/SearchKnowledgeAction.java
Workspace/Siman/src/org/splat/simer/SearchStudyAction.java
Workspace/Siman/src/org/splat/wapp/Constants.java
Workspace/Siman/src/spring/applicationContext.xml
Workspace/Siman/src/xwork-conversion.properties [new file with mode: 0644]

index 720944890976b9473c393667e46a98fddaa8fd32..09b3d64c64899d53ce165667f2af094b372d7fc3 100644 (file)
@@ -1,4 +1,5 @@
 package org.splat.dal.bo.som;
+
 /**
  * 
  * @author    Daniel Brunier-Coulin
@@ -7,74 +8,88 @@ package org.splat.dal.bo.som;
 
 import org.splat.dal.bo.kernel.Persistent;
 
-
 public class KnowledgeElementType extends Persistent {
-       
-    private String         name;
-    private ProgressState  state;
 
-//  ==============================================================================================================================
-//  Constructors
-//  ==============================================================================================================================
+       private String name;
+       private ProgressState state;
 
-       //  Database fetch constructor
-    protected KnowledgeElementType () {
-    }
-//  Initialization constructor
-    public KnowledgeElementType (String name) {
-//  --------------------------------------------
-      super();
-      this.name  = name;
-      this.state = ProgressState.inCHECK;
-    }
+       // ==============================================================================================================================
+       // Constructors
+       // ==============================================================================================================================
 
-//  ==============================================================================================================================
-//  Public member functions
-//  ==============================================================================================================================
+       // Database fetch constructor
+       protected KnowledgeElementType() {
+       }
 
-    public boolean equals(Object entity) {
-//  ------------------------------------
-      if (entity == null) return false;
-      if (entity instanceof String) {
-        return this.name.equals((String)entity);   // Names are unique
-      } else
-      if (entity instanceof KnowledgeElementType) {
-        KnowledgeElementType object = (KnowledgeElementType)entity;
-        long   he = object.getIndex();
-        long   me = this.getIndex();
-        if (me*he != 0) return (he == me);
-        else            return this.getName().equals(object.getName());
-      } else {
-        return false;
-      }
-    }
+       // Initialization constructor
+       public KnowledgeElementType(final String name) {
+               super();
+               this.name = name;
+               this.state = ProgressState.inCHECK;
+       }
 
-    public String getName () {
-//  ------------------------
-      return name;
-    }
+       // ==============================================================================================================================
+       // Public member functions
+       // ==============================================================================================================================
 
-    public boolean isApproved () {
-//  ----------------------------
-      return (state == ProgressState.APPROVED);
-    }
+       @Override
+       public boolean equals(final Object entity) {
+               if (entity == null) {
+                       return false;
+               }
+               if (entity instanceof String) {
+                       return this.name.equals(entity); // Names are unique
+               } else if (entity instanceof KnowledgeElementType) {
+                       KnowledgeElementType object = (KnowledgeElementType) entity;
+                       long he = object.getIndex();
+                       long me = this.getIndex();
+                       if (me * he != 0) {
+                               return (he == me);
+                       } else {
+                               return this.getName().equals(object.getName());
+                       }
+               } else {
+                       return false;
+               }
+       }
 
-    public boolean isReserved () {
-//  ----------------------------
-      return (state == ProgressState.inWORK);
-    }
-    /**
+       public String getName() {
+               return name;
+       }
+
+       /**
+        * Get i18n type name key.
+        * 
+        * @return the i18n key
+        */
+       public String getKey() {
+               return "type.knowledge." + name;
+       }
+
+       public boolean isApproved() {
+               return (state == ProgressState.APPROVED);
+       }
+
+       public boolean isReserved() {
+               return (state == ProgressState.inWORK);
+       }
+
+       /**
         * Get the state.
+        * 
         * @return the state
         */
        public ProgressState getState() {
                return state;
        }
+
        /**
         * Set the state.
-        * @param state the state to set
+        * 
+        * @param state
+        *            the state to set
         */
-       public void setState(ProgressState state) {
+       public void setState(final ProgressState state) {
                this.state = state;
        }
 }
\ No newline at end of file
index 95e72d6dfc5d7de1405861ec210c94bbffc47bc6..28dae502576898eddcfc0fc52527b9d07ccf88c1 100644 (file)
@@ -15,6 +15,7 @@ import org.splat.dal.bo.som.KnowledgeElement;
 import org.splat.dal.bo.som.Study;
 import org.splat.service.dto.ImportedStudyDTO;
 import org.splat.service.dto.Proxy;
+import org.splat.service.dto.StudySearchFilterDTO;
 
 /**
  * Search service interface.
@@ -59,8 +60,7 @@ public interface SearchService {
         *            search filter parameters
         * @return the list of found studies as proxy results
         */
-       List<Proxy> selectStudiesWhere(boolean allCriteria, boolean allContexts,
-                       Study.Properties sprop);
+       List<Proxy> selectStudiesWhere(final StudySearchFilterDTO filter);
 
        /**
         * Refresh lucene index for a study.
index beaf1afde47f128c7c9ab20a3bb4668da3772833..f49c14ed72cdcb1b24f3c7e4c2eecb283a7799ec 100644 (file)
@@ -46,11 +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.dto.StudySearchFilterDTO;
 import org.splat.service.technical.IndexService;
 import org.splat.service.technical.IndexServiceImpl;
 import org.splat.service.technical.RepositoryService;
@@ -265,20 +265,20 @@ public class SearchServiceImpl implements SearchService {
         * 
         * @see org.splat.service.SearchService#selectStudiesWhere(org.splat.dal.bo.som.Study.Properties[])
         */
-       public List<Proxy> selectStudiesWhere(final boolean allCriteria,
-                       final boolean allContexts, final Study.Properties sprop) {
+       public List<Proxy> selectStudiesWhere(final StudySearchFilterDTO filter) {
                List<Proxy> result = new ArrayList<Proxy>();
 
                DetachedCriteria query = DetachedCriteria
                                .forClass(Study.class, "study");
+
                // Creation of the query
-               initQuery(query, sprop);
+               Junction topJunction = initQuery(filter);
 
-               String title = sprop.getTitle(); // Title
+               String title = filter.getWords(); // Title
                if (title != null) {
                        // Look for given words in study titles
                        Junction critext;
-                       if (allCriteria) { // AND
+                       if (filter.isMatchAllCriteria()) { // AND
                                critext = Restrictions.conjunction();
                        } else { // OR
                                critext = Restrictions.disjunction();
@@ -288,15 +288,15 @@ public class SearchServiceImpl implements SearchService {
                        for (int j = 0; j < word.length; j++) {
                                critext.add(Restrictions.like("title", "%" + word[j] + "%"));
                        }
-                       query.add(critext);
+                       topJunction.add(critext);
                }
 
-               List<SimulationContext> context = sprop.getSimulationContexts();
+               List<SimulationContext> context = filter.getSimContexts();
                if (context != null && (!context.isEmpty())) {
                        // Get only studies which have given contexts
                        query.createAlias("contex", "ctx", Criteria.INNER_JOIN);
                        Junction critctx;
-                       if (allContexts) { // AND
+                       if (filter.isMatchAllContexts()) { // AND
                                critctx = Restrictions.conjunction();
                        } else { // OR
                                critctx = Restrictions.disjunction();
@@ -308,9 +308,10 @@ public class SearchServiceImpl implements SearchService {
                                                seltext.getType())));
 
                        }
-                       query.add(critctx);
+                       topJunction.add(critctx);
                }
 
+               query.add(topJunction);
                // Group by study
                query.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
                // Creation of the sort criteria
@@ -335,44 +336,52 @@ public class SearchServiceImpl implements SearchService {
        /**
         * Initialize query with base criteria.
         * 
-        * @param query
-        *            the query
-        * @param sprop
+        * @param filter
         *            the criteria
+        * @return top junction of the search filter
         */
-       private void initQuery(final DetachedCriteria query, final Properties sprop) {
-               ProgressState state = sprop.getProgressState(); // State
-               if (state != null) {
-                       query.add(Restrictions.eq("state", state));
+       private Junction initQuery(final StudySearchFilterDTO filter) {
+               Junction topJunction;
+               if (filter.isMatchAllCriteria()) { // AND
+                       topJunction = Restrictions.conjunction();
+               } else { // OR
+                       topJunction = Restrictions.disjunction();
+               }
+               if (!StudySearchFilterDTO.ANY_STATE.equals(filter.getState())) {
+                       ProgressState state = ProgressState.valueOf(filter.getState()); // State
+                       if (state != null) {
+                               topJunction.add(Restrictions.eq("state", state));
+                       }
                }
-               String refid = sprop.getReference(); // Reference
-               if (refid != null) {
-                       query.add(Restrictions.eq("sid", refid));
+               String refid = filter.getReference(); // Reference
+               if (refid != null && !refid.isEmpty()) {
+                       topJunction.add(Restrictions.eq("sid", refid));
                }
-               User manager = sprop.getManager(); // Author
-               if (manager != null) {
-                       query.add(Restrictions.eq("manager", manager));
+
+               addDatesCriteria(topJunction, filter);
+
+               int authorId = Integer.valueOf(filter.getAuthor());
+               if (authorId > 0) { // Author
+                       topJunction.add(Restrictions.eq("manager.rid", authorId));
                }
 
-               User actor = sprop.getActor(); // Contributor, Reviewer or Approver
-               if (actor == null) {
+               long actorId = filter.getConnectedUserId(); // Contributor, Reviewer or Approver
+               if (actorId > 0) {
                        // User is not logged in - show only public studies
-                       query.add(Restrictions.eq("visibility", Visibility.PUBLIC));
+                       topJunction.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
+                       topJunction
                                        .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 Object[] { actorId,
+                                                                                                                       actorId, actorId,
+                                                                                                                       actorId },
                                                                                                        new Type[] {
                                                                                                                        Hibernate.LONG,
                                                                                                                        Hibernate.LONG,
@@ -383,14 +392,46 @@ public class SearchServiceImpl implements SearchService {
                                                                        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(
+                                                                                                       actorId, Hibernate.LONG))
+                                                       .add(
                                                        /* If the user is author */
-                                                       Restrictions.eq("study.manager", actor)).add(
+                                                       Restrictions.eq("study.manager.rid", actorId)).add(
                                                                        /* If the study is public */
                                                                        Restrictions.eq("study.visibility",
                                                                                        Visibility.PUBLIC)));
                }
+               return topJunction;
+       }
+
+       /**
+        * Add search criteria by dates to the junction filter condition.
+        * 
+        * @param topJunction
+        *            the junction filter condition
+        * @param filter
+        *            search criteria
+        */
+       private void addDatesCriteria(final Junction topJunction,
+                       final StudySearchFilterDTO filter) {
+               // Filter by creation date
+               if (filter.getCreatedAfter() != null) {
+                       topJunction.add(Restrictions
+                                       .gt("credate", filter.getCreatedAfter()));
+               }
+               if (filter.getCreatedBefore() != null) {
+                       topJunction.add(Restrictions.lt("credate", filter
+                                       .getCreatedBefore()));
+               }
+               // Filter by modification date
+               if (filter.getUpdatedAfter() != null) {
+                       topJunction.add(Restrictions
+                                       .gt("lasdate", filter.getUpdatedAfter()));
+               }
+               if (filter.getUpdatedBefore() != null) {
+                       topJunction.add(Restrictions.lt("lasdate", filter
+                                       .getUpdatedBefore()));
+               }
+
        }
 
        /**
diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/KnowledgeSearchFilterDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/KnowledgeSearchFilterDTO.java
new file mode 100644 (file)
index 0000000..2ce6621
--- /dev/null
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Company         OPEN CASCADE
+ * Application     SIMAN
+ * File            $Id$ 
+ * Creation date   05.03.2013
+ * @author         $Author$
+ * @version        $Revision$
+ * @copyright      OPEN CASCADE 2012
+ *****************************************************************************/
+
+package org.splat.service.dto;
+
+/**
+ * Knowledge search criteria.
+ * 
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
+ */
+public class KnowledgeSearchFilterDTO extends SearchFilterDTO {
+
+       /**
+        * Knowledge type index when among all.
+        */
+       private String _ktype = "0";
+
+       /**
+        * Get id of knowledge type to search.
+        * 
+        * @return knowledge type id to search
+        */
+       public String getKtype() {
+               return _ktype;
+       }
+
+       /**
+        * Set id of knowledge type to search.
+        * 
+        * @param value
+        *            knowledge type id to search
+        */
+       public void setKtype(final String value) {
+               this._ktype = value;
+       }
+
+}
diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/SearchFilterDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/SearchFilterDTO.java
new file mode 100644 (file)
index 0000000..1fd296e
--- /dev/null
@@ -0,0 +1,262 @@
+/*****************************************************************************
+ * Company         OPEN CASCADE
+ * Application     SIMAN
+ * File            $Id$ 
+ * Creation date   04.03.2013
+ * @author         $Author$
+ * @version        $Revision$
+ * @copyright      OPEN CASCADE 2012
+ *****************************************************************************/
+
+package org.splat.service.dto;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.splat.dal.bo.som.SimulationContext;
+
+/**
+ * Base search criteria.
+ * 
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
+ */
+public class SearchFilterDTO {
+
+       /**
+        * "all": match all criteria.
+        */
+       public final static String MATCH_ALL = "all";
+       /**
+        * "any": match any criteria.
+        */
+       public final static String MATCH_ANY = "any";
+       /**
+        * Study author id to search.
+        */
+       protected String _author = "0";
+       /**
+        * Current contexts search criteria.
+        */
+       protected transient List<SimulationContext> _simContexts = new ArrayList<SimulationContext>();
+       /**
+        * Simulation context match: "all" or "any".
+        */
+       private String _contextMatch = MATCH_ALL;
+       /**
+        * Criteria match: "all" or "any".
+        */
+       private String _criteriaMatch = MATCH_ALL;
+       /**
+        * Search studies created after this date.
+        */
+       private Date _createdAfter;
+       /**
+        * Search studies created before this date.
+        */
+       private Date _createdBefore;
+       /**
+        * Full text search words.
+        */
+       private String _words = "";
+       /**
+        * Study reference.
+        */
+       private String _reference = "";
+       /**
+        * Currently connected user id.
+        */
+       private long _connectedUserId = 0;
+
+       /**
+        * Get author id of objects to find.
+        * 
+        * @return the author id criteria
+        */
+       public String getAuthor() {
+               return _author;
+       }
+
+       /**
+        * Get context criteria operation (all or any).
+        * 
+        * @return the simulation context criteria operation value
+        */
+       public String getContextMatch() {
+               return _contextMatch;
+       }
+
+       /**
+        * Get the createdAfter.
+        * 
+        * @return the createdAfter
+        */
+       public Date getCreatedAfter() {
+               return _createdAfter;
+       }
+
+       /**
+        * Get the createdBefore.
+        * 
+        * @return the createdBefore
+        */
+       public Date getCreatedBefore() {
+               return _createdBefore;
+       }
+
+       /**
+        * Get main criteria operation (all or any).
+        * 
+        * @return the main criteria operation value
+        */
+       public String getCriteriaMatch() {
+               return _criteriaMatch;
+       }
+
+       /**
+        * Get full text search criterion value.
+        * 
+        * @return the full text search criterion value
+        */
+       public String getWords() {
+               return _words;
+       }
+
+       // ==============================================================================================================================
+       // Setters
+       // ==============================================================================================================================
+
+       /**
+        * Set author id to search.
+        * 
+        * @param index
+        *            persistent user id
+        */
+       public void setAuthor(final String index) {
+               this._author = index;
+       }
+
+       /**
+        * Set context criteria operation (all or any).
+        * 
+        * @param value
+        *            "all" or "any"
+        */
+       public void setContextMatch(final String value) {
+               this._contextMatch = value;
+       }
+
+       /**
+        * Set the createdAfter.
+        * 
+        * @param createdAfter
+        *            the createdAfter to set
+        */
+       public void setCreatedAfter(final Date createdAfter) {
+               _createdAfter = createdAfter;
+       }
+
+       /**
+        * Set the createdBefore.
+        * 
+        * @param createdBefore
+        *            the createdBefore to set
+        */
+       public void setCreatedBefore(final Date createdBefore) {
+               _createdBefore = createdBefore;
+       }
+
+       /**
+        * Set main criteria operation (all or any).
+        * 
+        * @param value
+        *            "all" or "any"
+        */
+       public void setCriteriaMatch(final String value) {
+               this._criteriaMatch = value;
+       }
+
+       /**
+        * Set full text search criterion value.
+        * 
+        * @param value
+        *            the full text search criterion value
+        */
+       public void setWords(final String value) {
+               this._words = value;
+       }
+
+       /**
+        * Get the context.
+        * 
+        * @return the context
+        */
+       public List<SimulationContext> getSimContexts() {
+               return _simContexts;
+       }
+
+       /**
+        * Check if it is necessary to satisfy all main criteria.
+        * 
+        * @return true if it is necessary to satisfy all main criteria
+        */
+       public boolean isMatchAllCriteria() {
+               return MATCH_ALL.equals(getCriteriaMatch());
+       }
+
+       /**
+        * Check if it is necessary to satisfy all simulation contexts criteria.
+        * 
+        * @return true if it is necessary to satisfy all simulation contexts criteria
+        */
+       public boolean isMatchAllContexts() {
+               return MATCH_ALL.equals(getContextMatch());
+       }
+
+       // ==============================================================================================================================
+       // Getters
+       // ==============================================================================================================================
+       
+       /**
+        * Get study reference criteria.
+        * 
+        * @return study reference to search
+        */
+       public String getReference() {
+               return _reference;
+       }
+
+       /**
+        * Set study reference criteria.
+        * 
+        * @param value
+        *            the study reference to search
+        */
+       public void setReference(final String value) {
+               this._reference = value;
+       }
+
+       /**
+        * Set the simContexts.
+        * @param simContexts the simContexts to set
+        */
+       public void setSimContexts(final List<SimulationContext> simContexts) {
+               _simContexts = simContexts;
+       }
+
+       /**
+        * Get the connectedUserId.
+        * @return the connectedUserId
+        */
+       public long getConnectedUserId() {
+               return _connectedUserId;
+       }
+
+       /**
+        * Set the connectedUserId.
+        * @param connectedUserId the connectedUserId to set
+        */
+       public void setConnectedUserId(final long connectedUserId) {
+               _connectedUserId = connectedUserId;
+       }
+}
diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/StudySearchFilterDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/StudySearchFilterDTO.java
new file mode 100644 (file)
index 0000000..93d7ef4
--- /dev/null
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * Company         OPEN CASCADE
+ * Application     SIMAN
+ * File            $Id$ 
+ * Creation date   05.03.2013
+ * @author         $Author$
+ * @version        $Revision$
+ * @copyright      OPEN CASCADE 2012
+ *****************************************************************************/
+
+package org.splat.service.dto; 
+
+import java.util.Date;
+
+/**
+ * Study search criteria.
+ *
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
+ */
+public class StudySearchFilterDTO extends SearchFilterDTO {
+
+       /**
+        * "ANY": match any status.
+        */
+       public final static String ANY_STATE = "ANY";
+       /**
+        * "In-Work", "In-Draft", "In-Check"...
+        */
+       private String _state = ANY_STATE;
+       /**
+        * Search studies updated after this date.
+        */
+       private Date _updatedAfter;
+       /**
+        * Search studies updated before this date.
+        */
+       private Date _updatedBefore;
+
+       // ==============================================================================================================================
+       // Getters
+       // ==============================================================================================================================
+       
+       /**
+        * Get progress state criteria.
+        * 
+        * @return study progress state to search
+        */
+       public String getState() {
+               return _state;
+       }
+
+       /**
+        * Set progress state criteria.
+        * 
+        * @param value
+        *            the progress state to search
+        */
+       public void setState(final String value) {
+               this._state = value;
+       }
+
+       /**
+        * Get the updatedAfter.
+        * 
+        * @return the updatedAfter
+        */
+       public Date getUpdatedAfter() {
+               return _updatedAfter;
+       }
+
+       /**
+        * Get the updatedBefore.
+        * 
+        * @return the updatedBefore
+        */
+       public Date getUpdatedBefore() {
+               return _updatedBefore;
+       }
+
+       /**
+        * Set the updatedAfter.
+        * 
+        * @param updatedAfter
+        *            the updatedAfter to set
+        */
+       public void setUpdatedAfter(final Date updatedAfter) {
+               _updatedAfter = updatedAfter;
+       }
+
+       /**
+        * Set the updatedBefore.
+        * 
+        * @param updatedBefore
+        *            the updatedBefore to set
+        */
+       public void setUpdatedBefore(final Date updatedBefore) {
+               _updatedBefore = updatedBefore;
+       }
+       
+}
index 22eec3fde8cb53f856c91710a09f3276ccb889cd..d4ec04a805a6e1bc4085a39183710483a78022b4 100644 (file)
@@ -1,12 +1,12 @@
 <%@page language="java" contentType="text/html; charset=ISO-8859-1"
-    pageEncoding="ISO-8859-1"
-%>
+       pageEncoding="ISO-8859-1"%>
 <%@taglib prefix="s" uri="/struts-tags"%>
 
 <!-- Initialization of the context
      =============================================================================================================================
   -->
-<script language="JavaScript" type="text/javascript" src="../js/search.js"></script>
+<script language="JavaScript" type="text/javascript"
+       src="../js/search.js"></script>
 
 <script>
 $(document).ready(function () {
@@ -21,188 +21,198 @@ $(document).ready(function () {
 <!-- Search criteria section
      =============================================================================================================================
   -->
-      <div id=article-box>
-        <div id=section><s:text name="title.criteria"/></div>
-        <div id="article-body">
-          <form name="search" action="refresh-knowledge" method="post">
-          <input type="hidden" name="contextIndex" />
-          <s:set var="type"   value="state"/>
+<div id=article-box>
+<div id=section><s:text name="title.criteria" /></div>
+<div id="article-body">
+<form name="search" action="refresh-knowledge" method="post"><input
+       type="hidden" name="contextIndex" />
 
-          <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
-            <tr height="20">
-              <td width="40%">
-                <b><s:text name="field.among"/></b>&nbsp;&nbsp;&nbsp;
-                <s:radio theme="simple" list="matchOptions" name="criteriaMatch"
-            onclick="changeFilter()" />
-              </td>
-              <td width="60%">|&nbsp;&nbsp;
-                <b><s:text name="field.context"/></b>&nbsp;&nbsp;&nbsp;
-                <s:radio theme="simple" list="matchOptions" name="contextMatch"
-            onclick="changeFilter()" />
-              </td>
-            </tr>
-            <tr height="1" bgcolor="#AAAAAA"><td colspan="2"></td></tr>
-          </table>
+<table width="100%" cellpadding="0" cellspacing="0" border="0"
+       class="text">
+       <tr height="20">
+               <td width="40%"><b><s:text name="field.among" /></b>&nbsp;&nbsp;&nbsp;
+               <s:radio theme="simple" list="matchOptions"
+                       name="filter.criteriaMatch" onclick="changeFilter()" /></td>
+               <td width="60%">|&nbsp;&nbsp; <b><s:text name="field.context" /></b>&nbsp;&nbsp;&nbsp;
+               <s:radio theme="simple" list="matchOptions" name="filter.contextMatch"
+                       onclick="changeFilter()" /></td>
+       </tr>
+       <tr height="1" bgcolor="#AAAAAA">
+               <td colspan="2"></td>
+       </tr>
+</table>
 
-          <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
-            <tr valign="top">
-              <td width="40%">
-              <table cellpadding="0" cellspacing="0" border="0" class="text">
-                <tr>
-                  <td colspan="2"><s:text name="criterion.knowledge"/>&nbsp;</td>
-                  <td colspan="3" align="center">
-                <select name="state" style="width: <s:text name="size.search.select"/>" onChange="changeFilter()">
-                  <s:iterator value="knowledgeTypes">
-                    <s:if test="%{index == #type}">
-                      <option value="<s:property value="index"/>" selected><s:text name="type.knowledge.%{name}" /></option>
-                    </s:if><s:else>
-                      <option value="<s:property value="index"/>"><s:text name="type.knowledge.%{name}" /></option>
-                    </s:else>
-                  </s:iterator>
-                </select>
-                  </td>
-                </tr>
-                <tr>
-                  <td colspan="2"><s:text name="criterion.author"/>&nbsp;</td>
-                  <td colspan="3" align="center">
-                <select name="author" style="width: <s:text name="size.search.select"/>" onChange="changeFilter()">
-                  <option value="0"><s:text name="criterion.anybody" /></option>
-                  <s:iterator value="candidates">
-                    <s:if test="%{index == author}">
-                      <option value="<s:property value="index"/>" selected><s:property value="toString()"/></option>
-                    </s:if><s:else>
-                      <option value="<s:property value="index"/>"><s:property value="toString()"/></option>
-                    </s:else>
-                  </s:iterator>
-                </select>
-                  </td>
-                </tr>
-                <tr>
-                  <s:set var="tipdate">
-                    <s:text name="help.search.date">
-                      <s:param><s:text name="%{format}"/></s:param>
-                      <s:param><s:text name="%{today}"/></s:param>
-                    </s:text>
-                  </s:set>
-                  <td><s:text name="field.credate"/>&nbsp;</td>
-                  <td><s:text name="field.after"/>&nbsp;</td>
-                  <td><input class="dateinput" onChange="changeFilter()" type="text" name="after" size="7" onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" />&nbsp;</td>
-                  <td><s:text name="field.before"/>&nbsp;</td>
-                  <td><input class="dateinput" onChange="changeFilter()" type="text" name="before" size="7" onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
-                </tr>
-                <tr height=26><td></td></tr>
-              </table>
-              <table cellpadding="0" cellspacing="0" border="0" class="text">
-                <tr>
-                  <td><s:text name="field.contain"/>:&nbsp;</td>
-                  <td><input type="text" name="words" style="width: <s:text name="size.search.input"/>" value="<s:property value="%{words}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.title"/>" /></td>
-                </tr><tr>
-                  <td><s:text name="field.reference"/>:&nbsp;</td>
-                  <td><input type="text" name="reference" style="width: <s:text name="size.search.input"/>" value="<s:property value="%{reference}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.refid"/>" /></td>
-                </tr>
-              </table>
-              </td>
-              <td width="60%">
-                <table cellpadding="0" cellspacing="0" border="0" class="text">
-                  <s:iterator value="simulationContexts">
-                    <tr>
-                      <td><input type="checkbox" checked onClick="removeContext('<s:property value="index"/>')">&nbsp;</td>
-                      <td>
-                        <s:if test="%{type.isApproved()}"><s:text name="type.context.%{type.name}"/>:&nbsp;</s:if>
-                        <s:else><s:property value="%{type.name}"/>:&nbsp;</s:else>
-                      </td>
-                      <td><s:property value="value"/></td>
-                    </tr>
-                  </s:iterator>
+<table width="100%" cellpadding="0" cellspacing="0" border="0"
+       class="text">
+       <tr valign="top">
+               <td width="40%">
+               <table cellpadding="0" cellspacing="0" border="0" class="text">
+                       <tr>
+                               <td colspan="2"><s:text name="criterion.knowledge" />&nbsp;</td>
+                               <td colspan="3" align="center"><s:select theme="simple"
+                                       name="filter.ktype" list="knowledgeTypes"
+                                       cssStyle="width: %{getText('size.search.select')}" onchange="changeFilter()" />
+                               </td>
+                       </tr>
+                       <tr>
+                               <td colspan="2"><s:text name="criterion.author" />&nbsp;</td>
+                               <td colspan="3" align="center"><select name="filter.author"
+                                       style='width: <s:text name="size.search.select"/>' onChange="changeFilter()">
+                                       <option value="0"><s:text name="criterion.anybody" /></option>
+                                       <s:iterator value="candidates">
+                                               <s:if test="%{index == author}">
+                                                       <option value="<s:property value="index"/>" selected><s:property
+                                                               value="toString()" /></option>
+                                               </s:if>
+                                               <s:else>
+                                                       <option value="<s:property value="index"/>"><s:property
+                                                               value="toString()" /></option>
+                                               </s:else>
+                                       </s:iterator>
+                               </select></td>
+                       </tr>
+                       <tr>
+                               <s:set var="tipdate">
+                                       <s:text name="help.search.date">
+                                               <s:param>
+                                                       <s:text name="%{format}" />
+                                               </s:param>
+                                               <s:param>
+                                                       <s:text name="%{today}" />
+                                               </s:param>
+                                       </s:text>
+                               </s:set>
+                               <td><s:text name="field.credate" />&nbsp;</td>
+                               <td><s:text name="field.after" />&nbsp;</td>
+                               <td><s:textfield theme="simple" cssClass="dateinput"
+                                       onchange="changeFilter()" name="filter.createdAfter" size="7"
+                                       onkeydown="changeFilter()" title="%{#tipdate}" />&nbsp;</td>
+                               <td><s:text name="field.before" />&nbsp;</td>
+                               <td><s:textfield theme="simple" cssClass="dateinput"
+                                       onchange="changeFilter()" name="filter.createdBefore" size="7"
+                                       onkeydown="changeFilter()" title="%{#tipdate}" /></td>
+                       </tr>
+                       <tr height=26>
+                               <td></td>
+                       </tr>
+               </table>
+               <table cellpadding="0" cellspacing="0" border="0" class="text">
+                       <tr>
+                               <td><s:text name="field.contain" />:&nbsp;</td>
+                               <td><s:textfield theme="simple" name="filter.words"
+                                       size="%{getText(size.search.input)}" onkeydown="changeFilter()"
+                                       title="%{getText(help.search.title)}" /></td>
+                       </tr>
+                       <tr>
+                               <td><s:text name="field.reference" />:&nbsp;</td>
+                               <td><s:textfield theme="simple" name="filter.reference"
+                                       size="%{getText(size.search.input)}" onkeydown="changeFilter()"
+                                       title="%{getText(help.search.refid)}" /></td>
+                       </tr>
+               </table>
+               </td>
+               <td width="60%">
+               <table cellpadding="0" cellspacing="0" border="0" class="text">
+                       <s:iterator value="filter.simContexts">
+                               <tr>
+                                       <td><input type="checkbox" checked
+                                               onClick="removeContext('<s:property value="index"/>')">&nbsp;</td>
+                                       <td><s:if test="%{type.isApproved()}">
+                                               <s:text name="type.context.%{type.name}" />:&nbsp;</s:if> <s:else>
+                                               <s:property value="%{type.name}" />:&nbsp;</s:else></td>
+                                       <td><s:property value="value" /></td>
+                               </tr>
+                       </s:iterator>
 
-                  <s:if test="%{actionType == 'setContext'}">
-                    <tr>
-                      <td>
-                        <img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="tooltip.cancel"/>" onClick="cancel()" />&nbsp;
-                      </td>
-                      <td>
-                        <s:if test="%{selectedContextType.isApproved()}"><s:text name="type.context.%{selectedContextType.name}"/>:&nbsp;</s:if>
-                        <s:else><s:property value="%{selectedContextType.name}"/>:&nbsp;</s:else>
-                      </td>
-                      <td>
-                        <select name="contextValue" onChange="submit()">
-                          <option value="-1"><s:text name="menu.select"/></option>
-                          <s:iterator value="contextValueOptions">
-                            <option value="<s:property value="index"/>">&nbsp;<s:property value="value" /></option>
-                          </s:iterator>
-                        </select>
-                      </td>
-                    </tr>
-                  </s:if>
-                </table>
+                       <s:if test="%{actionType == 'setContext'}">
+                               <tr>
+                                       <td><img src="<s:url value="/skin/icon.undo.png"/>"
+                                               border="none" title="<s:text name="tooltip.cancel"/>"
+                                               onClick="cancel()" />&nbsp;</td>
+                                       <td><s:if test="%{selectedContextType.isApproved()}">
+                                               <s:text name="type.context.%{selectedContextType.name}" />:&nbsp;</s:if>
+                                       <s:else>
+                                               <s:property value="%{selectedContextType.name}" />:&nbsp;</s:else></td>
+                                       <td><select name="contextValue" onChange="submit()">
+                                               <option value="-1"><s:text name="menu.select" /></option>
+                                               <s:iterator value="contextValueOptions">
+                                                       <option value="<s:property value="index"/>">&nbsp;<s:property
+                                                               value="value" /></option>
+                                               </s:iterator>
+                                       </select></td>
+                               </tr>
+                       </s:if>
+               </table>
 
-                <s:if test="%{actionType != 'setContext'}">
-                        <select name="contextType" onChange="submit()">
-                          <option value="-1"><s:text name="menu.addcontext"/></option>
-                          <s:set var="snum" value="null"/>
-                          <s:iterator value="contextTypeOptions">
-                            <s:if test="%{#snum != attachedStep.number}">
-                              <s:set var="snum" value="%{attachedStep.number}"/>
-                              <optgroup label="&nbsp;<s:text name="folder.step.%{#snum}"/>">
-                            </s:if>
-                              <option value="<s:property value="index"/>">
-                                <s:if test="%{isApproved()}">&nbsp;<s:text name="type.context.%{name}" /></s:if>
-                                <s:else>&nbsp;<s:property value="%{name}" /></s:else>
-                              </option>
-                          </s:iterator>
-                        </select>
-                </s:if>
-              </td>
-            </tr>
-          </table>
+               <s:if test="%{actionType != 'setContext'}">
+                       <select name="contextType" onChange="submit()">
+                               <option value="-1"><s:text name="menu.addcontext" /></option>
+                               <s:set var="snum" value="null" />
+                               <s:iterator value="contextTypeOptions">
+                                       <s:if test="%{#snum != attachedStep.number}">
+                                               <s:set var="snum" value="%{attachedStep.number}" />
+                                               <optgroup label="&nbsp;<s:text name="folder.step.%{#snum}"/>">
+                                       </s:if>
+                                       <option value="<s:property value="index"/>"><s:if
+                                               test="%{isApproved()}">&nbsp;<s:text
+                                                       name="type.context.%{name}" />
+                                       </s:if> <s:else>&nbsp;<s:property value="%{name}" />
+                                       </s:else></option>
+                               </s:iterator>
+                       </select>
+               </s:if></td>
+       </tr>
+</table>
 
-          <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
-            <tr>
-              <td width="40%"></td>
-              <td width="60%" align="left"><input type="submit" name="refresh" value="<s:text name="button.result"/>" disabled/></td>
-            </tr>
-          </table>
+<table width="100%" cellpadding="0" cellspacing="0" border="0"
+       class="text">
+       <tr>
+               <td width="40%"></td>
+               <td width="60%" align="left"><input type="submit" name="refresh"
+                       value="<s:text name="button.result"/>" disabled /></td>
+       </tr>
+</table>
 
-          </form>
-        </div>
-      </div>
+</form>
+</div>
+</div>
 
 <!-- Result list
      =============================================================================================================================
   -->
-      <div id="resulist">
-      <div id="article-box">
-        <div id="section"><s:text name="title.result"/></div>
-        <div id="article-body" class="text">
-
-          <s:if test="result.size > 0">
-            <table width=100% cellpadding="0" cellspacing="0" border="0" class="text">
-            <tr height="20" valign="bottom">
-              <td width="20"></td>
-              <td width="80"><s:text name="label.reference"/></td>
-              <td><s:text name="label.title"/><img src="<s:url value="/skin/icon.sortup.png"/>" border="none"/></td>
-              <td width="150"><s:text name="label.author"/></td>
-            </tr>
-            <tr height="1" bgcolor="#AAAAAA"><td colspan="4"></td></tr>
-              <s:iterator value="result">
-                <tr>
-                  <td><img src="<s:url value="/skin/icon.%{progressState}.png"/>" width="12" height="12" border="none" title=""/></td>
-                  <td><s:property value="reference"/></td>
-                  <td>
-                      <s:url id="open" namespace="/study" action="open-knowledge?selection=0">
-                        <s:param name="index" value="%{index}"/>
-                      </s:url>
-                      <s:a href="%{open}" cssClass="link"><s:property value="title"/></s:a>
-                  </td>
-                  <td><s:property value="authorName"/></td>
-                </tr>
-              </s:iterator>
-            </table>
-          </s:if>
-
-          <s:else>
-            <s:text name="message.noknowledge" />
-          </s:else>
-        </div>
-      </div>
-      </div>
+<div id="resulist">
+<div id="article-box">
+<div id="section"><s:text name="title.result" /></div>
+<div id="article-body" class="text"><s:if test="result.size > 0">
+       <table width=100% cellpadding="0" cellspacing="0" border="0"
+               class="text">
+               <tr height="20" valign="bottom">
+                       <td width="20"></td>
+                       <td width="80"><s:text name="label.reference" /></td>
+                       <td><s:text name="label.title" /><img
+                               src="<s:url value="/skin/icon.sortup.png"/>" border="none" /></td>
+                       <td width="150"><s:text name="label.author" /></td>
+               </tr>
+               <tr height="1" bgcolor="#AAAAAA">
+                       <td colspan="4"></td>
+               </tr>
+               <s:iterator value="result">
+                       <tr>
+                               <td><img src="<s:url value="/skin/icon.%{progressState}.png"/>"
+                                       width="12" height="12" border="none" title="" /></td>
+                               <td><s:property value="reference" /></td>
+                               <td><s:url id="open" namespace="/study"
+                                       action="open-knowledge?selection=0">
+                                       <s:param name="index" value="%{index}" />
+                               </s:url> <s:a href="%{open}" cssClass="link">
+                                       <s:property value="title" />
+                               </s:a></td>
+                               <td><s:property value="authorName" /></td>
+                       </tr>
+               </s:iterator>
+       </table>
+</s:if> <s:else>
+       <s:text name="message.noknowledge" />
+</s:else></div>
+</div>
+</div>
index 0c9f091e9368f57495c65d5bc55be47e2abcb1ab..a6281ff906bd2a08940e29b23ab979c3c6e8ee85 100644 (file)
@@ -1,9 +1,8 @@
 <%@page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
 <%@taglib prefix="s" uri="/struts-tags"%>
-
 <!-- Initialization of the context
-     =============================================================================================================================
+     ===========================================================================
   -->
 <script language="JavaScript" type="text/javascript"
        src="../js/search.js"></script>
@@ -19,7 +18,7 @@ $(document).ready(function () {
 </script>
 
 <!-- Search criteria section
-     =============================================================================================================================
+     ===========================================================================
   -->
 <div id="article-box">
 <div id="section"><s:text name="title.criteria" /></div>
@@ -31,10 +30,10 @@ $(document).ready(function () {
        class="text">
        <tr height="20">
                <td width="40%"><b><s:text name="field.among" /></b>&nbsp;&nbsp;&nbsp;
-               <s:radio theme="simple" list="matchOptions" name="criteriaMatch"
+               <s:radio theme="simple" list="matchOptions" name="filter.criteriaMatch"
                        onclick="changeFilter()" /></td>
                <td width="60%">|&nbsp;&nbsp; <b><s:text name="field.context" /></b>&nbsp;&nbsp;&nbsp;
-               <s:radio theme="simple" list="matchOptions" name="contextMatch"
+               <s:radio theme="simple" list="matchOptions" name="filter.contextMatch"
                        onclick="changeFilter()" /></td>
        </tr>
        <tr height="1" bgcolor="#AAAAAA">
@@ -49,18 +48,18 @@ $(document).ready(function () {
                <table cellpadding="0" cellspacing="0" border="0" class="text">
                        <tr>
                                <td colspan="2"><s:text name="criterion.study" />&nbsp;</td>
-                               <td colspan="3" align="center"><s:select name="state"
+                               <td colspan="3" align="center"><s:select name="filter.state"
                                        list="stateOptions" theme="simple"
-                                       size="%{getText(size.search.select)}" onchange="changeFilter()" />
+                                       cssStyle="width: %{getText('size.search.select')}" onchange="changeFilter()" />
                                </td>
                        </tr>
                        <tr>
                                <td colspan="2"><s:text name="criterion.author" />&nbsp;</td>
-                               <td colspan="3" align="center"><select name="author"
-                                       style='width: &amp; lt;' onChange="changeFilter()">
+                               <td colspan="3" align="center"><select name="filter.author"
+                                       style='width: <s:text name="size.search.select" />' onChange="changeFilter()">
                                        <option value="0"><s:text name="criterion.anybody" /></option>
                                        <s:iterator value="candidates">
-                                               <s:if test="%{index == author}">
+                                               <s:if test="%{index == filter.author}">
                                                        <option value="<s:property value="index"/>" selected><s:property
                                                                value="toString()" /></option>
                                                </s:if>
@@ -84,45 +83,45 @@ $(document).ready(function () {
                                </s:set>
                                <td><s:text name="field.credate" />&nbsp;</td>
                                <td><s:text name="field.after" />&nbsp;</td>
-                               <td><input class="dateinput" onChange="changeFilter()"
-                                       type="text" name=after size="7" onKeydown="changeFilter()"
-                                       title="<s:property value="%{#tipdate}"/>" />&nbsp;</td>
+                               <td><s:textfield theme="simple" cssClass="dateinput"
+                                       onchange="changeFilter()" name="filter.createdAfter" size="7"
+                                       onkeydown="changeFilter()" title="%{#tipdate}" />&nbsp;</td>
                                <td><s:text name="field.before" />&nbsp;</td>
-                               <td><input class="dateinput" onChange="changeFilter()"
-                                       type="text" name=before size="7" onKeydown="changeFilter()"
-                                       title="<s:property value="%{#tipdate}"/>" /></td>
+                               <td><s:textfield theme="simple" cssClass="dateinput" onchange="changeFilter()"
+                                       name="filter.createdBefore" size="7" onkeydown="changeFilter()"
+                                       title="%{#tipdate}" /></td>
                        </tr>
                        <tr>
                                <td><s:text name="field.lasdate" />&nbsp;</td>
                                <td><s:text name="field.after" />&nbsp;</td>
-                               <td><input class="dateinput" onChange="changeFilter()"
-                                       type="text" name=after size="7" onKeydown="changeFilter()"
-                                       title="<s:property value="%{#tipdate}"/>" />&nbsp;</td>
+                               <td><s:textfield theme="simple" cssClass="dateinput"
+                                       onchange="changeFilter()" name="filter.updatedAfter" size="7"
+                                       onkeydown="changeFilter()" title="%{#tipdate}" />&nbsp;</td>
                                <td><s:text name="field.before" />&nbsp;</td>
-                               <td><input class="dateinput" onChange="changeFilter()"
-                                       type="text" name="before" size="7" onKeydown="changeFilter()"
-                                       title="<s:property value="%{#tipdate}"/>" /></td>
+                               <td><s:textfield theme="simple" cssClass="dateinput"
+                                       onchange="changeFilter()" name="filter.updatedBefore" size="7"
+                                       onkeydown="changeFilter()" title="%{#tipdate}" /></td>
                        </tr>
                </table>
                <table cellpadding="0" cellspacing="0" border="0" class="text">
                        <tr>
                                <td><s:text name="field.contain" />:&nbsp;</td>
-                               <td><input type="text" name=words style='width: &amp; lt;'
-                                       value="<s:property value="%{words}"/>" onKeydown="changeFilter()"
-                                       title="<s:text name="help.search.title"/>" /></td>
+                               <td><s:textfield theme="simple" name="filter.words" size="%{getText(size.search.input)}"
+                                       onkeydown="changeFilter()"
+                                       title="%{getText(help.search.title)}" /></td>
                        </tr>
                        <tr>
                                <td><s:text name="field.reference" />:&nbsp;</td>
-                               <td><input type="text" name="reference"
-                                       style='width: &amp; lt;' value="<s:property value="%{reference}"/>"
-                                       onKeydown="changeFilter()"
-                                       title="<s:text name="help.search.refid"/>" /></td>
+                               <td><s:textfield theme="simple" name="filter.reference"
+                                       size="%{getText(size.search.input)}"
+                                       onkeydown="changeFilter()"
+                                       title="%{getText(help.search.refid)}" /></td>
                        </tr>
                </table>
                </td>
                <td width="60%">
                <table cellpadding="0" cellspacing="0" border="0" class="text">
-                       <s:iterator value="simulationContexts">
+                       <s:iterator value="filter.simContexts">
                                <tr>
                                        <td><input type="checkbox" checked
                                                onClick="removeContext('<s:property value="index"/>')">&nbsp;</td>
@@ -182,7 +181,7 @@ $(document).ready(function () {
 </div>
 
 <!-- Result list
-     =============================================================================================================================
+     ===========================================================================
   -->
 <div id="resulist">
 <div id="article-box">
diff --git a/Workspace/Siman/src/org/splat/conversion/DateConverter.java b/Workspace/Siman/src/org/splat/conversion/DateConverter.java
new file mode 100644 (file)
index 0000000..7b4f00a
--- /dev/null
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * Company         OPEN CASCADE
+ * Application     SIMAN
+ * File            $Id$ 
+ * Creation date   01.03.2013
+ * @author         Author: Roman Kozlov
+ * @version        Revision: 
+ *****************************************************************************/
+
+package org.splat.conversion;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateUtils;
+import org.apache.struts2.util.StrutsTypeConverter;
+import org.splat.i18n.I18nUtils;
+
+import com.opensymphony.xwork2.ActionContext;
+
+/**
+ * Date conversion methods for Struts 2.<BR>
+ * To enable the date conversion for all action classes put into the classpath the file <code>xwork-conversion.properties</code>
+ * containing the following line:<BR>
+ * <code>java.util.Date=org.splat.conversion.DateConverter</code><BR>
+ * <BR>
+ * To enable the date conversion for the specific Struts 2 action class, place the file named
+ * <code>{ActionClassName}-conversion.properties</code> to the package of the action class.<BR>
+ * 
+ * For example: <BR>
+ * class: <code>....CustomAction</code><BR>
+ * property file path: <code>classes/.../CustomAction-conversion.properties</code> <BR>
+ * This property file should contain a line for each form property.<BR>
+ * <BR>
+ * For example: <BR>
+ * <code>createdAfter=org.splat.conversion.DateConverter<BR>
+ * filter.createdAfter=org.splat.conversion.DateConverter</code>
+ * 
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
+ */
+public class DateConverter extends StrutsTypeConverter {
+
+       /**
+        * {@inheritDoc}
+        */
+       @SuppressWarnings("unchecked")
+       @Override
+       public Object convertFromString(final Map context, final String[] values,
+                       final Class toClass) { // NOPMD: extends StrutsTypeConverter
+               Object result = null;
+               String value = null;
+               if (null != values && values.length > 0) {
+                       value = values[0];
+               }
+               if (StringUtils.isNotEmpty(value)) {
+                       try {
+                               result = DateUtils.parseDateStrictly(values[0], I18nUtils
+                                               .getMessage(ActionContext.getContext().getLocale(),
+                                                               "date.format"));
+                               if (result == null) {
+                                       // date can not be null so value is not in a good format
+                                       throw new ParseException("Bad format", 0);
+                               }
+                       } catch (ParseException e) {
+                               throw new IllegalArgumentException(
+                                               "Cannot parse: " + values[0], e);
+                       }
+               }
+               return result;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @SuppressWarnings("unchecked")
+       @Override
+       public String convertToString(final Map context, final Object o) { // NOPMD: extends StrutsTypeConverter
+               String result;
+               if (o instanceof Date) {
+                       result = (new SimpleDateFormat(I18nUtils.getMessage(ActionContext
+                                       .getContext().getLocale(), "date.format"), ActionContext
+                                       .getContext().getLocale())).format((Date) o);
+               } else if (null == o) {
+                       result = StringUtils.EMPTY;
+               } else {
+                       result = o.toString();
+               }
+               return result;
+       }
+
+}
index b230240ae74ef527a09b8dae23d6f8dcf2695d1b..a2c12dcaade99511cb40743f944811f032a209d2 100644 (file)
@@ -16,15 +16,18 @@ import org.splat.kernel.Name;
 import org.splat.service.SimulationContextService;
 import org.splat.service.UserService;
 import org.splat.service.dto.Proxy;
+import org.splat.service.dto.SearchFilterDTO;
 import org.splat.service.technical.ProjectSettingsService;
 import org.splat.som.ApplicationRights;
+import org.splat.wapp.Constants;
 
 /**
  * Base search action class used for searching studies and knowledge.
  * 
  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
  */
-public abstract class AbstractSearchBaseAction extends Action {
+public abstract class AbstractSearchBaseAction<FilterClass extends SearchFilterDTO>
+               extends Action {
 
        /**
         * Serial version ID.
@@ -47,9 +50,9 @@ public abstract class AbstractSearchBaseAction extends Action {
         */
        protected transient String _cindex = "";
        /**
-        * Study author to search.
+        * Search criteria.
         */
-       protected String _author = null;
+       private FilterClass _filter;
        /**
         * List of users who can create studies.
         */
@@ -66,10 +69,6 @@ public abstract class AbstractSearchBaseAction extends Action {
         * Addable context types.
         */
        protected transient List<SimulationContextType> _critext;
-       /**
-        * Current contexts search criteria.
-        */
-       protected transient List<SimulationContext> _context;
        /**
         * List of found objects.
         */
@@ -83,18 +82,6 @@ public abstract class AbstractSearchBaseAction extends Action {
         * Injected user service.
         */
        private UserService _userService;
-       /**
-        * Simulation context match: "all" or "any".
-        */
-       private String _contextMatch = null;
-       /**
-        * Criteria match: "all" or "any".
-        */
-       private String _criteriaMatch = null;
-       /**
-        * Full text search words.
-        */
-       private String _words = null;
 
        /**
         * Search action modes enumeration.
@@ -158,7 +145,7 @@ public abstract class AbstractSearchBaseAction extends Action {
         * 
         * @return "selectype"
         */
-       @SuppressWarnings("unchecked")
+       @SuppressWarnings(Constants.UNCHECKED)
        protected String doSelectContextType() {
                SimulationContext.Properties sprop = new SimulationContext.Properties();
 
@@ -185,7 +172,7 @@ public abstract class AbstractSearchBaseAction extends Action {
                SimulationContext selected = getSimulationContextService()
                                .selectSimulationContext(Integer.valueOf(_cvalue));
 
-               _context.add(selected);
+               getFilter().getSimContexts().add(selected);
                setContextTypeOptions(getInvolvedContexts()); // Sets critext
                getSession().remove(RESULT_KEY); // The current result is obsolete
                return "refresh";
@@ -198,8 +185,8 @@ public abstract class AbstractSearchBaseAction extends Action {
         */
        protected String doRemoveContext() {
                long index = Long.valueOf(_cindex);
-               for (Iterator<SimulationContext> selected = _context.iterator(); selected
-                               .hasNext();) {
+               for (Iterator<SimulationContext> selected = getFilter()
+                               .getSimContexts().iterator(); selected.hasNext();) {
                        if (selected.next().getIndex() == index) {
                                selected.remove();
                                break;
@@ -211,10 +198,11 @@ public abstract class AbstractSearchBaseAction extends Action {
        }
 
        /**
+        * Cancel simulation context selection.
         * 
-        * @return
+        * @return "refresh"
         */
-       @SuppressWarnings("unchecked")
+       @SuppressWarnings(Constants.UNCHECKED)
        protected String doCancel() {
                _result = (List<Proxy>) getSession().get(RESULT_KEY); // Current result search
                setContextTypeOptions(getInvolvedContexts()); // Sets critext
@@ -260,10 +248,6 @@ public abstract class AbstractSearchBaseAction extends Action {
                return result;
        }
 
-       public String getAuthor() {
-               return _author;
-       }
-
        public List<Name> getCandidates() {
                return _candidates;
        }
@@ -280,10 +264,6 @@ public abstract class AbstractSearchBaseAction extends Action {
                return _newtype;
        }
 
-       public List<SimulationContext> getSimulationContexts() {
-               return _context;
-       }
-
        /**
         * Get list of found objects.
         * 
@@ -297,16 +277,6 @@ public abstract class AbstractSearchBaseAction extends Action {
        // Setters
        // ==============================================================================================================================
 
-       /**
-        * Set author id to search.
-        * 
-        * @param index
-        *            persistent user id
-        */
-       public void setAuthor(final String index) {
-               this._author = index;
-       }
-
        /**
         * Set applied simulation context type id to search.
         * 
@@ -367,8 +337,8 @@ public abstract class AbstractSearchBaseAction extends Action {
         */
        protected void setContextTypeOptions(
                        final List<SimulationContextType> critext) {
-               for (Iterator<SimulationContext> i = _context.iterator(); i.hasNext();) {
-                       critext.remove(i.next().getType()); // Already used context type
+               for (SimulationContext ctx : getFilter().getSimContexts()) {
+                       critext.remove(ctx.getType()); // Already used context type
                }
                // Ordering by alphabetical order of localized context types
                SimulationContextType[] types = critext
@@ -394,22 +364,81 @@ public abstract class AbstractSearchBaseAction extends Action {
                this._critext = Arrays.asList(types);
        }
 
+       /**
+        * Load the search filter. The filter is taken from the session by its name.
+        * 
+        * @see #getFilterName()
+        * @return the loaded filter
+        */
+       @SuppressWarnings(Constants.UNCHECKED)
+       protected Map<String, Object> loadFilter() {
+               Map<String, Object> filter = (Map<String, Object>) getSession().get(
+                               getFilterName()); // A default filter is supposed being set at start
+
+               setFilter((FilterClass) filter.get("criteria"));
+               return filter;
+       }
+
+       /**
+        * Save search criteria in the session as a map with the defined name.
+        * 
+        * @see #getFilterName()
+        * @return the saved filter
+        */
+       @SuppressWarnings(Constants.UNCHECKED)
+       protected Map<String, Object> saveFilter() {
+               Map<String, Object> filter = (Map<String, Object>) getSession().get(
+                               getFilterName()); // A default filter is supposed being set at start
+
+               FilterClass savedCriteria = (FilterClass) filter.get("criteria");
+               FilterClass newCriteria = getFilter();
+               if (savedCriteria != null) {
+                       // Only contexts are not part of the form so keep them between requests
+                       newCriteria.setSimContexts(savedCriteria.getSimContexts());
+               }
+
+               filter.put("criteria", getFilter());
+               return filter;
+       }
+
        // ==============================================================================================================================
        // Abstract services
        // ==============================================================================================================================
 
+       /**
+        * Search objects according to the given criteria.
+        * 
+        * @return string result key
+        * @throws InvalidPropertyException
+        *             if some criteria values are incorrect
+        */
        protected abstract String doSearch() throws InvalidPropertyException;
 
+       /**
+        * List of context types available for filtering.
+        * 
+        * @return list of simulation context types
+        */
        protected abstract List<SimulationContextType> getInvolvedContexts();
 
-       protected abstract void loadFilter();
+       /**
+        * Get the name of the search criteria filter saved as a map of objects in the session.
+        * 
+        * @return the search filter name in the session
+        */
+       protected abstract String getFilterName();
 
-       protected abstract void saveFilter();
+       /**
+        * Get search filter implementation.
+        * 
+        * @return the search filter
+        */
+       protected abstract FilterClass getNewFilter();
 
        // ==============================================================================================================================
        // Getters and Setters
        // ==============================================================================================================================
-       
+
        /**
         * Get match options.
         * 
@@ -461,27 +490,29 @@ public abstract class AbstractSearchBaseAction extends Action {
                _userService = userService;
        }
 
-       public String getContextMatch() {
-               return _contextMatch;
-       }
-
-       public String getCriteriaMatch() {
-               return _criteriaMatch;
-       }
-       
-       public void setContextMatch(final String value) {
-               this._contextMatch = value;
-       }
-
-       public void setCriteriaMatch(final String value) {
-               this._criteriaMatch = value;
-       }
-
-       public String getWords() {
-               return _words;
+       /**
+        * Get the filter.
+        * 
+        * @return the filter
+        */
+       public FilterClass getFilter() {
+               if (_filter == null) {
+                       _filter = getNewFilter();
+               }
+               return _filter;
        }
 
-       public void setWords(final String value) {
-               this._words = value;
+       /**
+        * Set the filter.
+        * 
+        * @param filter
+        *            the filter to set
+        */
+       public void setFilter(final FilterClass filter) {
+               if (filter == null) {
+                       _filter = getNewFilter();
+               } else {
+                       _filter = filter;
+               }
        }
 }
\ No newline at end of file
index 522480659162fd02489b9bfceb4c2e4f407e0d25..031766ffc2027fdd9748b6b0fd71cf2f2fd23169 100644 (file)
@@ -1,5 +1,6 @@
 package org.splat.simer;
 
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -7,36 +8,29 @@ import org.splat.dal.bo.kernel.User;
 import org.splat.dal.bo.som.KnowledgeElement;
 import org.splat.dal.bo.som.KnowledgeElementType;
 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.Visibility;
 import org.splat.kernel.InvalidPropertyException;
 import org.splat.service.KnowledgeElementTypeService;
 import org.splat.service.SearchService;
+import org.splat.service.dto.KnowledgeSearchFilterDTO;
 import org.splat.wapp.Constants;
 
 /**
  * Action for searching a knowledge in the database.
  */
-public class SearchKnowledgeAction extends AbstractSearchBaseAction {
+public class SearchKnowledgeAction extends
+               AbstractSearchBaseAction<KnowledgeSearchFilterDTO> {
 
        /**
         * Serial version ID.
         */
        private static final long serialVersionUID = -3104321907432838476L;
 
-       /**
-        * Knowledge type index when among all.
-        */
-       private String _state = null;
-       /**
-        * Knowledge reference when among ref.
-        */
-       private String _reference = null;
        /**
         * Available knowledge types filter (initialized below).
         */
-       private transient List<KnowledgeElementType> _knowledgeTypes;
+       private transient Map<Long, String> _knowledgeTypes;
        /**
         * Injected search service.
         */
@@ -66,8 +60,9 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction {
                        doSearch();
 
                        // Final initialization of the form
-                       _knowledgeTypes = getKnowledgeElementTypeService()
-                                       .selectTypesWhere(ProgressState.APPROVED);
+                       _knowledgeTypes = buildKnowledgeTypesOptions();
+                       getKnowledgeElementTypeService().selectTypesWhere(
+                                       ProgressState.APPROVED);
                        setCandidates();
                        setContextTypeOptions(getInvolvedContexts());
                } catch (Exception error) {
@@ -78,40 +73,58 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction {
                return res;
        }
 
+       /**
+        * Build the map of translated knowledge types available for selection.
+        * 
+        * @return the map of translated knowledge types
+        */
+       private Map<Long, String> buildKnowledgeTypesOptions() {
+               Map<Long, String> options = new LinkedHashMap<Long, String>();
+               List<KnowledgeElementType> types = getKnowledgeElementTypeService()
+                               .selectTypesWhere(ProgressState.APPROVED);
+               for (KnowledgeElementType ktype : types) {
+                       options.put(ktype.getIndex(), getText(ktype.getKey()));
+               }
+               return options;
+       }
+
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.simer.AbstractSearchBaseAction#doSearch()
+        */
        @Override
        protected String doSearch() throws InvalidPropertyException {
 
                initializationScreenContext(Constants.OPEN);
-               Map<String, Object> session = getSession();
                KnowledgeElement.Properties sprop = new KnowledgeElement.Properties();
 
                // Search matching all criteria
                sprop.setType(getKnowledgeElementTypeService().selectType(
-                               Integer.valueOf(_state)));
-               if (getWords().length() > 0) {
-                       sprop.setTitle(getWords());
+                               Integer.valueOf(getFilter().getKtype())));
+               if (getFilter().getWords().length() > 0) {
+                       sprop.setTitle(getFilter().getWords());
                }
-               if (_reference.length() > 0) {
-                       sprop.setReference(_reference);
+               if (getFilter().getReference().length() > 0) {
+                       sprop.setReference(getFilter().getReference());
                }
-               if (_context.size() > 0) {
-                       sprop.setSimulationContexts(_context);
+               if (getFilter().getSimContexts().size() > 0) {
+                       sprop.setSimulationContexts(getFilter().getSimContexts());
                }
-               int index = Integer.valueOf(_author);
+               int index = Integer.valueOf(getFilter().getAuthor());
                if (index > 0) {
                        User him = getUserService().selectUser(index);
                        sprop.setAuthor(him);
                }
                // Set of the visibility
-                       KnowledgeElement.Properties other = sprop.copy();
+               KnowledgeElement.Properties other = sprop.copy();
 
-                       other.setVisibility(Visibility.PUBLIC);
-                       sprop.setVisibility(Visibility.PRIVATE);
-                       sprop.setActor(getConnectedUser());
+               other.setVisibility(Visibility.PUBLIC);
+               sprop.setVisibility(Visibility.PRIVATE);
+               sprop.setActor(getConnectedUser());
 
-                       _result = getSearchService().selectKnowledgeElementsWhere(sprop,
-                                       other);
-               session.put(RESULT_KEY, _result); // For redisplaying the page without re-executing the search
+               _result = getSearchService().selectKnowledgeElementsWhere(sprop, other);
+               getSession().put(RESULT_KEY, _result); // For redisplaying the page without re-executing the search
                return "refresh";
        }
 
@@ -119,66 +132,32 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction {
        // Getters
        // ==============================================================================================================================
 
-       public List<KnowledgeElementType> getKnowledgeTypes() {
+       public Map<Long, String> getKnowledgeTypes() {
                return _knowledgeTypes;
        }
 
-       public String getReference() {
-               return _reference;
-       }
-
-       public String getState() {
-               return _state;
-       }
-
-       public void setReference(final String value) {
-               this._reference = value;
-       }
-
-       public void setState(final String value) {
-               this._state = value;
-       }
-
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.simer.AbstractSearchBaseAction#getInvolvedContexts()
+        */
        @Override
        protected List<SimulationContextType> getInvolvedContexts() {
                return getSimulationContextService().selectAllTypes();
        }
 
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.simer.AbstractSearchBaseAction#saveFilter()
+        */
        @Override
-       @SuppressWarnings("unchecked")
-       protected void loadFilter() {
-               Map<String, Object> session = getSession();
-               Map<String, Object> filter = (Map<String, Object>) session
-                               .get("knowledge.filter"); // A default filter is supposed being set at start
-
-               setCriteriaMatch ((String) filter.get("matchamong"));
-               setContextMatch ((String) filter.get("matcontext"));
-               _state = (String) filter.get("type");
-               _author = (String) filter.get("author");
-               _reference = (String) filter.get("reference");
-               setWords ((String) filter.get("title"));
-               _context = (List<SimulationContext>) filter.get("context");
-       }
-
-       @Override
-       @SuppressWarnings("unchecked")
-       protected void saveFilter() {
-               Map<String, Object> session = getSession();
-               Map<String, Object> filter = (Map<String, Object>) session
-                               .get("knowledge.filter"); // A default filter is supposed being set at start
-
-               filter.put("matchamong", getCriteriaMatch());
-               filter.put("matcontext", getContextMatch());
-               filter.put("type", this._state);
-               filter.put("author", this._author);
-               filter.put("reference", "");
-               filter.put("title", getWords());
-
-               _context = (List<SimulationContext>) filter.get("context"); // Only criteria not part of the form
+       protected Map<String, Object> saveFilter() {
+               Map<String, Object> filter = super.saveFilter();
 
                // Initialization required by all do functions
-               _knowledgeTypes = getKnowledgeElementTypeService().selectTypesWhere(
-                               ProgressState.APPROVED);
+               _knowledgeTypes = buildKnowledgeTypesOptions();
+               return filter;
        }
 
        /**
@@ -219,4 +198,24 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction {
                        final KnowledgeElementTypeService knowledgeElementTypeService) {
                _knowledgeElementTypeService = knowledgeElementTypeService;
        }
+
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.simer.AbstractSearchBaseAction#getFilterName()
+        */
+       @Override
+       protected String getFilterName() {
+               return "knowledge.filter";
+       }
+
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.simer.AbstractSearchBaseAction#getNewFilter()
+        */
+       @Override
+       protected KnowledgeSearchFilterDTO getNewFilter() {
+               return new KnowledgeSearchFilterDTO();
+       }
 }
\ No newline at end of file
index 070c1de8773c6e23fbcf6a4f13adf64b56e839c5..61cbe0b72f2b42b042f586b7fc8a1f55e0c20c45 100644 (file)
@@ -4,34 +4,26 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
-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.SimulationContextType;
 import org.splat.dal.bo.som.Study;
 import org.splat.kernel.InvalidPropertyException;
 import org.splat.service.SearchService;
+import org.splat.service.dto.StudySearchFilterDTO;
 import org.splat.service.technical.ProjectSettingsService;
 import org.splat.wapp.Constants;
 
 /**
  * Search studies form action.
  */
-public class SearchStudyAction extends AbstractSearchBaseAction {
+public class SearchStudyAction extends
+               AbstractSearchBaseAction<StudySearchFilterDTO> {
 
        /**
         * Serial version ID.
         */
        private static final long serialVersionUID = -1910481357051393077L;
 
-       /**
-        * "In-Work", "In-Draft", "In-Check"...
-        */
-       private String _state = null;
-       /**
-        * Study reference.
-        */
-       private String _reference = null;
        /**
         * Injected project settings service.
         */
@@ -41,10 +33,6 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
         */
        private SearchService _searchService;
 
-       enum UserAction {
-               refreshResult, selectContextType, selectContextValue, cancelSelect, removeContext
-       }
-
        // ==============================================================================================================================
        // Action methods
        // ==============================================================================================================================
@@ -84,33 +72,11 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
         */
        @Override
        protected String doSearch() throws InvalidPropertyException {
-               Map<String, Object> session = getSession();
-               Study.Properties sprop = new Study.Properties();
-
-               // Search matching all criteria
-               if (!this._state.equals("ANY")) {
-                       sprop.setState(ProgressState.valueOf(this._state));
-               }
-               if (getWords().length() > 0) {
-                       sprop.setTitle(getWords());
-               }
-               if (_reference.length() > 0) {
-                       sprop.setReference(_reference);
-               }
-               if (_context.size() > 0) {
-                       sprop.setSimulationContexts(_context);
-               }
-               int index = Integer.valueOf(_author);
-               if (index > 0) {
-                       User him = getUserService().selectUser(index);
-                       sprop.setManager(him);
+               if (getConnectedUser() != null) {
+                       getFilter().setConnectedUserId(getConnectedUser().getIndex());
                }
-               sprop.setActor(getConnectedUser());
-
-               _result = getSearchService().selectStudiesWhere(
-                               "all".equals(getCriteriaMatch()),
-                               "all".equals(getContextMatch()), sprop);
-               session.put(RESULT_KEY, _result); // For redisplaying the page without re-executing the search
+               _result = getSearchService().selectStudiesWhere(getFilter());
+               getSession().put(RESULT_KEY, _result); // For redisplaying the page without re-executing the search
                return "refresh";
        }
 
@@ -118,22 +84,11 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
        // Getters
        // ==============================================================================================================================
 
-       public String getReference() {
-               return _reference;
-       }
-
-       public String getState() {
-               return _state;
-       }
-
-       public void setReference(final String value) {
-               this._reference = value;
-       }
-
-       public void setState(final String value) {
-               this._state = value;
-       }
-
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.simer.AbstractSearchBaseAction#getInvolvedContexts()
+        */
        @Override
        protected List<SimulationContextType> getInvolvedContexts() {
                List<ProjectSettingsService.Step> steps = getProjectSettings()
@@ -144,40 +99,6 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
                return getSimulationContextService().selectTypesOf(number);
        }
 
-       @Override
-       @SuppressWarnings("unchecked")
-       protected void loadFilter() {
-               Map<String, Object> session = getSession();
-               Map<String, Object> filter = (Map<String, Object>) session
-                               .get("study.filter"); // A default filter is supposed being set at start
-
-               setCriteriaMatch((String) filter.get("matchamong"));
-               setContextMatch((String) filter.get("matcontext"));
-               _state = (String) filter.get("state");
-               _author = (String) filter.get("author");
-               _reference = (String) filter.get("reference");
-               setWords((String) filter.get("title"));
-               _context = (List<SimulationContext>) filter.get("context");
-       }
-
-       @Override
-       @SuppressWarnings("unchecked")
-       protected void saveFilter() {
-               Map<String, Object> session = getSession();
-               Map<String, Object> filter = (Map<String, Object>) session
-                               .get("study.filter"); // A default filter is supposed being set at start
-
-               filter.put("matchamong", getCriteriaMatch());
-               filter.put("matcontext", getContextMatch());
-               filter.put("state", this._state);
-               filter.put("author", this._author);
-               filter.put("reference", this._reference);
-               filter.put("title", getWords());
-
-               _context = (List<SimulationContext>) filter.get("context"); // Only criteria not part of the form
-
-       }
-
        /**
         * Get match options.
         * 
@@ -247,4 +168,24 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
                        final ProjectSettingsService projectSettingsService) {
                _projectSettings = projectSettingsService;
        }
+
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.simer.AbstractSearchBaseAction#getFilterName()
+        */
+       @Override
+       protected String getFilterName() {
+               return "study.filter";
+       }
+
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.simer.AbstractSearchBaseAction#getNewFilter()
+        */
+       @Override
+       protected StudySearchFilterDTO getNewFilter() {
+               return new StudySearchFilterDTO();
+       }
 }
\ No newline at end of file
index e7f4e414de09ab87643416dcef557caf47170715..1011ac95658b5647d21d8fdd10da6b9428852ac7 100644 (file)
@@ -78,4 +78,8 @@ public class Constants {
         * Checked out element icon.
         */
        public static final String IMG_CHECKEDOUT = "icon.checkedout.png";
+       /**
+        * "unchecked" literal constant for annotations.
+        */
+       public static final String UNCHECKED = "unchecked";
 }
index 1481b2ae08fdd87069edca0774348a5fbac1901e..871896c4d238e5ad972862b8a779c17f9afb3935 100644 (file)
@@ -25,7 +25,8 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd">
                class="org.springframework.context.support.ResourceBundleMessageSource">
                <property name="basenames">
                        <list>
-                               <value>conf/log-messages</value>
+                <value>conf/log-messages</value>
+                <value>som</value>
                        </list>
                </property>
        </bean>
diff --git a/Workspace/Siman/src/xwork-conversion.properties b/Workspace/Siman/src/xwork-conversion.properties
new file mode 100644 (file)
index 0000000..621902d
--- /dev/null
@@ -0,0 +1 @@
+java.util.Date=org.splat.conversion.DateConverter
\ No newline at end of file