Simexplorer-si-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
February 2008
- 2 participants
- 701 discussions
r1235 - trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid
by glandais@users.labs.libre-entreprise.org 25 Feb '08
by glandais@users.labs.libre-entreprise.org 25 Feb '08
25 Feb '08
Author: glandais
Date: 2008-02-25 16:54:12 +0000 (Mon, 25 Feb 2008)
New Revision: 1235
Modified:
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
Log:
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 16:52:59 UTC (rev 1234)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 16:54:12 UTC (rev 1235)
@@ -46,9 +46,6 @@
/** The Search query. */
SearchQuery,
- /** The Search query. */
- RightsListing,
-
/** The Elements owned by. */
ElementsOwnedBy;
}
1
0
r1234 - in trunk/simexplorer-is: simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model simexplorer-is-swing/src/j
by glandais@users.labs.libre-entreprise.org 25 Feb '08
by glandais@users.labs.libre-entreprise.org 25 Feb '08
25 Feb '08
Author: glandais
Date: 2008-02-25 16:52:59 +0000 (Mon, 25 Feb 2008)
New Revision: 1234
Added:
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/EntityTypeEnum.java
Modified:
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/EntityHelper.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/StorageServiceHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/DataEntityModel.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/ListTableModel.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ui/DetailTabUpdater.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ui/EntityTreeNodeHelper.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/AppModule.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java
Log:
Entity type generalization
Retrieve elements of any type through service
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/EntityHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/EntityHelper.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/EntityHelper.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -17,8 +17,6 @@
* ##% */
package fr.cemagref.simexplorer.is.entities;
-import static org.codelutin.i18n.I18n._;
-import static org.codelutin.i18n.I18n.n_;
import java.util.ArrayList;
import java.util.Arrays;
@@ -40,84 +38,7 @@
*/
public class EntityHelper {
/**
- * Une enum pour definir les differents types d'entities rencontres dans le projet.
- * <p/>
- * On ajoute ici une clef i18n pour pouvoir traduire plus tard ces types.
- * <p/>
- * Note: on n'utilise pas directement les traductions pour permettre le mécanisme
- * de changement de langue (voir module swing et web).
- *
- * @author chemit
- */
- public static enum Type {
- Attachment(false,n_("simexplorer.common.attachment"), n_("simexplorer.common.attachments")),
- Code(false,n_("simexplorer.common.code"), n_("simexplorer.common.codes")),
- Component(true,n_("simexplorer.common.component"), n_("simexplorer.common.components")),
- Constant(false,n_("simexplorer.common.constant"), n_("simexplorer.common.constants")),
- ConstantValue(false,n_("simexplorer.common.constantvalue"), n_("simexplorer.common.constantvalues")),
- ExplorationApplication(true,n_("simexplorer.common.explorationapplication"), n_("simexplorer.common.explorationapplications")),
- ExplorationData(true,n_("simexplorer.common.explorationdata"), n_("simexplorer.common.explorationdatas")),
- Library(true,n_("simexplorer.common.library"), n_("simexplorer.common.libraries")),
- Repository(false,n_("simexplorer.common.repository"), n_("simexplorer.common.repositories")),
- Result(false,n_("simexplorer.common.result"), n_("simexplorer.common.results")),
- Structure(false,n_("simexplorer.common.structure"), n_("simexplorer.common.structures"));
-
- private String i18nKey;
- private String i18nKeys;
- private boolean le;
-
- public static String getLibelle(Object entity) {
- if (entity == null) {
- return "";
- }
- return getLibelle(entity instanceof Class?(Class)entity:entity.getClass());
- }
-
- public static String getLibelle(Class entity) {
- if (entity == null) {
- return "";
- }
- return getLibelle(entity.getSimpleName());
- }
-
- public String getLibelle() {
- return _(i18nKey);
- }
-
- public String getLibelles() {
- return _(i18nKeys);
- }
-
- public boolean isLe() {
- return le;
- }
-
- protected static String getLibelle(String type) {
- if (type != null) {
- try {
- Type type1 = Type.valueOf(type);
- return type1.getLibelle();
- } catch (IllegalArgumentException e) {
- //TODO log it
- System.err.println(e.getMessage());
- }
- }
- return "";
- }
-
- public static Type getType(Class<?> klass) {
- return Type.valueOf(klass.getSimpleName());
- }
-
- private Type(boolean isLE,String i18nKey, String i18nKeys) {
- this.le = isLE;
- this.i18nKey = i18nKey;
- this.i18nKeys = i18nKeys;
- }
- }
-
- /**
- * Une énumération pour définir les actions possibles sur les entités du
+ * Une énumération pour définir les types des entités du
* projet.
*
* @author chemit
Added: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/EntityTypeEnum.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/EntityTypeEnum.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/EntityTypeEnum.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -0,0 +1,170 @@
+package fr.cemagref.simexplorer.is.entities;
+
+import static org.codelutin.i18n.I18n._;
+import static org.codelutin.i18n.I18n.n_;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.data.Code;
+import fr.cemagref.simexplorer.is.entities.data.Component;
+import fr.cemagref.simexplorer.is.entities.data.Constant;
+import fr.cemagref.simexplorer.is.entities.data.ConstantValue;
+import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
+import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
+import fr.cemagref.simexplorer.is.entities.data.Library;
+import fr.cemagref.simexplorer.is.entities.data.Repository;
+import fr.cemagref.simexplorer.is.entities.data.Result;
+import fr.cemagref.simexplorer.is.entities.data.Structure;
+
+/**
+ * Une enum pour definir les differents types d'entities rencontres dans le projet. <p/> On ajoute ici une clef i18n
+ * pour pouvoir traduire plus tard ces types. <p/> Note: on n'utilise pas directement les traductions pour permettre le
+ * mécanisme de changement de langue (voir module swing et web).
+ *
+ * @author chemit
+ */
+public enum EntityTypeEnum {
+
+ /** The Attachment. */
+ Attachment(false, n_("simexplorer.common.attachment"), n_("simexplorer.common.attachments"), Attachment.class),
+
+ /** The Code. */
+ Code(false, n_("simexplorer.common.code"), n_("simexplorer.common.codes"), Code.class),
+
+ /** The Component. */
+ Component(true, n_("simexplorer.common.component"), n_("simexplorer.common.components"), Component.class),
+
+ /** The Constant. */
+ Constant(false, n_("simexplorer.common.constant"), n_("simexplorer.common.constants"), Constant.class),
+
+ /** The Constant value. */
+ ConstantValue(false, n_("simexplorer.common.constantvalue"), n_("simexplorer.common.constantvalues"), ConstantValue.class),
+
+ /** The Exploration application. */
+ ExplorationApplication(true, n_("simexplorer.common.explorationapplication"), n_("simexplorer.common.explorationapplications"), ExplorationApplication.class),
+
+ /** The Exploration data. */
+ ExplorationData(true, n_("simexplorer.common.explorationdata"), n_("simexplorer.common.explorationdatas"), ExplorationData.class),
+
+ /** The Library. */
+ Library(true, n_("simexplorer.common.library"), n_("simexplorer.common.libraries"), Library.class),
+
+ /** The Repository. */
+ Repository(false, n_("simexplorer.common.repository"), n_("simexplorer.common.repositories"), Repository.class),
+
+ /** The Result. */
+ Result(false, n_("simexplorer.common.result"), n_("simexplorer.common.results"), Result.class),
+
+ /** The Structure. */
+ Structure(false, n_("simexplorer.common.structure"), n_("simexplorer.common.structures"), Structure.class);
+
+ /** The le. */
+ private boolean le;
+
+ /** The i18n key. */
+ private String i18nKey;
+
+ /** The i18n keys. */
+ private String i18nKeys;
+
+ /** The implementation. */
+ private Class<?> implementation;
+
+ /**
+ * Gets the entity type.
+ *
+ * @param klass the klass
+ *
+ * @return the entity type
+ */
+ public static EntityTypeEnum getEntityType(Class<?> klass) {
+ EntityTypeEnum[] values = values();
+ for (int i = 0; i < values.length; i++) {
+ if (klass.equals(values[i].getImplementation())) {
+ return values[i];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets the libelle.
+ *
+ * @param entity the entity
+ *
+ * @return the libelle
+ */
+ public static String getLibelle(Object entity) {
+ if (entity == null) {
+ return "";
+ }
+ return getLibelle(entity instanceof Class ? (Class<?>) entity : entity.getClass());
+ }
+
+ /**
+ * Gets the libelle.
+ *
+ * @param entity the entity
+ *
+ * @return the libelle
+ */
+ private static String getLibelle(Class<?> entity) {
+ if (entity == null) {
+ return "";
+ }
+ EntityTypeEnum entityType = getEntityType(entity);
+ if (entityType == null) {
+ return "";
+ }
+ return entityType.getLibelle();
+ }
+
+ /**
+ * Gets the libelle.
+ *
+ * @return the libelle
+ */
+ public String getLibelle() {
+ return _(i18nKey);
+ }
+
+ /**
+ * Gets the libelles.
+ *
+ * @return the libelles
+ */
+ public String getLibelles() {
+ return _(i18nKeys);
+ }
+
+ /**
+ * Checks if is le.
+ *
+ * @return true, if is le
+ */
+ public boolean isLe() {
+ return le;
+ }
+
+ /**
+ * Gets the implementation.
+ *
+ * @return the implementation
+ */
+ public Class<?> getImplementation() {
+ return implementation;
+ }
+
+ /**
+ * Instantiates a new entity type enum.
+ *
+ * @param isLE the is le
+ * @param i18nKey the i18n key
+ * @param i18nKeys the i18n keys
+ * @param implementation the implementation
+ */
+ private EntityTypeEnum(boolean isLE, String i18nKey, String i18nKeys, Class<?> implementation) {
+ this.le = isLE;
+ this.i18nKey = i18nKey;
+ this.i18nKeys = i18nKeys;
+ this.implementation = implementation;
+ }
+}
\ No newline at end of file
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -20,7 +20,7 @@
import java.util.Date;
import fr.cemagref.simexplorer.is.entities.BaseEntity;
-import fr.cemagref.simexplorer.is.entities.EntityHelper;
+import fr.cemagref.simexplorer.is.entities.EntityTypeEnum;
import fr.cemagref.simexplorer.is.entities.EntityVisitor;
/**
@@ -294,8 +294,8 @@
*
* @return the element class label
*/
- public String getElementClassLabel() {
- return EntityHelper.Type.getType(getElementClass()).getLibelle();
+ public EntityTypeEnum getEntityType() {
+ return EntityTypeEnum.getEntityType(getElementClass());
}
}
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -111,24 +111,24 @@
public int findFullTextCount(String token, String query,String queryColumn, boolean onlyLatest) throws SimExplorerException {
// TODO Changer
- return findApplicationsCount(token, onlyLatest);
+ return findElementsCount(token, "", onlyLatest);
}
public MetaData[] findFullText(String token, String query, String queryColumn, boolean onlyLatest, int indexStart, int count,
String column,
boolean ascending) throws SimExplorerException {
// TODO Changer
- return findApplications(token, onlyLatest, indexStart, count, column, ascending);
+ return findElements(token, "", onlyLatest, indexStart, count, column, ascending);
}
- public int findApplicationsCount(String token, boolean onlyLatest) throws SimExplorerException {
+ public int findElementsCount(String token, String type, boolean onlyLatest) throws SimExplorerException {
return base.metadatas.size();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#findApplications(java.lang.String, boolean, int, int, int)
*/
- public MetaData[] findApplications(String token, boolean onlyLatest, int start, int count, String column,
+ public MetaData[] findElements(String token, String type, boolean onlyLatest, int start, int count, String column,
boolean ascending)
throws SimExplorerException {
int last = start + count;
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -24,6 +24,7 @@
import com.healthmarketscience.rmiio.SerializableInputStream;
+import fr.cemagref.simexplorer.is.entities.EntityTypeEnum;
import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
@@ -241,21 +242,23 @@
int count, String sortColumn, boolean ascending) throws SimExplorerException;
/**
- * Retrieve number of applications.
+ * Retrieve number of elements.
*
* @param token the token
+ * @param entityTypeEnum the entityTypeEnum as in {@link fr.cemagref.simexplorer.is.entities.EntityTypeEnum}, "" if all
* @param onlyLatest the only latest
*
* @return the int
*
- * @throws SimExplorerException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer exception
*/
- int findApplicationsCount(String token, boolean onlyLatest) throws SimExplorerException;
+ int findElementsCount(String token, String type, boolean onlyLatest) throws SimExplorerException;
/**
- * Get a list of applications.
+ * Get a list of elements.
*
* @param token the token
+ * @param entityTypeEnum the entityTypeEnum as in {@link fr.cemagref.simexplorer.is.entities.EntityTypeEnum}, "" if all
* @param onlyLatest the only latest
* @param start the start
* @param count the count
@@ -264,10 +267,10 @@
*
* @return the meta data[]
*
- * @throws SimExplorerException the sim explorer service exception
+ * @throws SimExplorerException the sim explorer exception
*/
- MetaData[] findApplications(String token, boolean onlyLatest, int start, int count, String column, boolean ascending)
- throws SimExplorerException;
+ MetaData[] findElements(String token, String type, boolean onlyLatest, int start, int count, String column,
+ boolean ascending) throws SimExplorerException;
/**
* Fully load an element.
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -209,18 +209,17 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#findApplicationsCount(java.lang.String, boolean)
*/
- public int findApplicationsCount(String token, boolean onlyLatest) throws SimExplorerException {
- return getStorageEngine().findElementsByTypeCount(token, ExplorationApplication.class.getCanonicalName(),
- onlyLatest);
+ public int findElementsCount(String token, String type, boolean onlyLatest) throws SimExplorerException {
+ return getStorageEngine().findElementsByTypeCount(token, type, onlyLatest);
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#findApplications(java.lang.String, boolean, int, int, int)
*/
- public MetaData[] findApplications(String token, boolean onlyLatest, int start, int count, String column,
+ public MetaData[] findElements(String token, String type, boolean onlyLatest, int start, int count, String column,
boolean ascending) throws SimExplorerException {
- return getStorageEngine().findElementsByType(token, ExplorationApplication.class.getCanonicalName(),
- onlyLatest, start, count, getSortColumn(column), getOrder(ascending));
+ return getStorageEngine().findElementsByType(token, type, onlyLatest, start, count, getSortColumn(column),
+ getOrder(ascending));
}
/* (non-Javadoc)
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -23,6 +23,7 @@
import java.util.List;
import java.util.Map;
+import fr.cemagref.simexplorer.is.entities.EntityTypeEnum;
import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.Descriptor;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
@@ -202,13 +203,16 @@
* Prepare properties for query.
*
* @param onlyLatest Only wanted elements
- * @param className the class name
+ * @param entityTypeName the entity type as in enum
*
* @return Properties for query
*/
- private Map<String, String> getPropertiesByType(String className, boolean onlyLatest) {
+ private Map<String, String> getPropertiesByType(String entityTypeName, boolean onlyLatest) {
Map<String, String> properties = new HashMap<String, String>();
- properties.put(KEY_CLASSNAME, className);
+
+ EntityTypeEnum entityType = EntityTypeEnum.valueOf(entityTypeName);
+ properties.put(KEY_CLASSNAME, entityType.getImplementation().getCanonicalName());
+
if (onlyLatest) {
properties.put(KEY_LATEST, "1");
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/StorageServiceHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/StorageServiceHelper.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/StorageServiceHelper.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -19,6 +19,8 @@
package fr.cemagref.simexplorer.is.ui.swing;
import com.healthmarketscience.rmiio.SerializableInputStream;
+
+import fr.cemagref.simexplorer.is.entities.EntityTypeEnum;
import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
@@ -82,7 +84,7 @@
int size;
try {
if (query == null || query.isEmpty()) {
- size = service.findApplicationsCount(token, onlyLatest);
+ size = service.findElementsCount(token, EntityTypeEnum.ExplorationApplication.toString(), onlyLatest);
} else {
size = service.findFullTextCount(token, query, "", onlyLatest);
}
@@ -109,7 +111,7 @@
try {
MetaData[] data;
if (query == null || query.isEmpty()) {
- data = service.findApplications(token, onlyLatest, (int) newFirstIndex, width, column.name(), ascending);
+ data = service.findElements(token, EntityTypeEnum.ExplorationApplication.toString(), onlyLatest, (int) newFirstIndex, width, column.name(), ascending);
} else {
data = service.findFullText(token, query, "", onlyLatest, (int) newFirstIndex, width, column.name(), ascending);
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/DataEntityModel.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/DataEntityModel.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/DataEntityModel.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -17,7 +17,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.model;
-import fr.cemagref.simexplorer.is.entities.EntityHelper;
+import fr.cemagref.simexplorer.is.entities.EntityTypeEnum;
import fr.cemagref.simexplorer.is.entities.data.DataEntity;
import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
@@ -44,7 +44,7 @@
protected Version version;
/** le type de l'entity encapsulée */
- protected transient EntityHelper.Type type;
+ protected transient EntityTypeEnum type;
/** l'objet selectionne */
protected transient DataEntity data;
@@ -62,7 +62,7 @@
}
public boolean isResult() {
- return type != null && type == EntityHelper.Type.Result;
+ return type != null && type == EntityTypeEnum.Result;
}
public String getUuid() {
@@ -122,8 +122,8 @@
return null;
}
- // compute type of data
- type = EntityHelper.Type.getType(le.getMetaData().getElementClass());
+ // compute entityTypeEnum of data
+ type = le.getMetaData().getEntityType();
// compute real data selected
if (type.isLe()) {
@@ -146,7 +146,7 @@
EntityTreeNode parent = (EntityTreeNode) node.getParent();
LoggableElement selectedElement = parent.getLoggableElement();
synch(node.isRemote(), selectedElement);
- setType(EntityHelper.Type.Result);
+ setType(EntityTypeEnum.Result);
setData((DataEntity) node.get());
} else {
synch(node.isRemote(), node.getLoggableElement());
@@ -167,8 +167,8 @@
synch(remote, null, null);
} else {
synch(remote, data.getUuid(), data.getVersion());
- EntityHelper.Type type = EntityHelper.Type.getType(data.getElementClass());
- setType(type);
+ EntityTypeEnum entityTypeEnum = data.getEntityType();
+ setType(entityTypeEnum);
}
setMeta(data);
}
@@ -192,7 +192,7 @@
this.meta = meta;
}
- public void setType(EntityHelper.Type type) {
+ public void setType(EntityTypeEnum type) {
this.type = type;
}
@@ -226,7 +226,7 @@
public String toString() {
String s = super.toString();
return s.substring(s.lastIndexOf('.') + 1) + "<remote:" + remote + ", uuid:" + uuid +
- ", version:" + version + ", result:" + isResult() + ", type:" +
+ ", version:" + version + ", result:" + isResult() + ", entityTypeEnum:" +
type + ">";
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/ListTableModel.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/ListTableModel.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/ListTableModel.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -18,7 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.model;
-import fr.cemagref.simexplorer.is.entities.EntityHelper;
+import fr.cemagref.simexplorer.is.entities.EntityTypeEnum;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.storage.SortColumn;
import static org.codelutin.i18n.I18n._;
@@ -94,7 +94,7 @@
result = readMethod.invoke(current);
if (columnIndex == 1) {
// use I18n
- result = EntityHelper.Type.getLibelle(result);
+ result = EntityTypeEnum.getLibelle(result);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ui/DetailTabUpdater.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ui/DetailTabUpdater.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ui/DetailTabUpdater.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -18,6 +18,7 @@
package fr.cemagref.simexplorer.is.ui.swing.ui;
import fr.cemagref.simexplorer.is.entities.EntityHelper;
+import fr.cemagref.simexplorer.is.entities.EntityTypeEnum;
import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
@@ -308,7 +309,7 @@
ui.getDetailHeader().setText(detail.getName());
ui.getDetailDescriptorsHeader().setText(_("simexplorer.node.descriptors", element.getDescriptors().size()));
- ui.getDetailType().setText(EntityHelper.Type.getLibelle(detail.getElementClass()));
+ ui.getDetailType().setText(EntityTypeEnum.getLibelle(detail.getElementClass()));
String s = detail.getDescription();
String tooltip = s;
@@ -335,7 +336,7 @@
ui.getScrollTable().setPreferredSize(new Dimension((int) dimOneRow.getWidth(), 2 + ((rows[0] + 1) * (4 + table.getFont().getSize()))));
//ui.getScrollTable().setPreferredSize(new Dimension((int) table.getSize().getWidth(), 2 + (nbDescriptorRows * (4 + table.getFont().getSize()))));
if (nbAttachmentRows > 0) {
- ui.getDetailAttachmentsHeader().setText(EntityHelper.Type.Attachment.getLibelles() + " (" + nbAttachmentRows + ")");
+ ui.getDetailAttachmentsHeader().setText(EntityTypeEnum.Attachment.getLibelles() + " (" + nbAttachmentRows + ")");
Rectangle rect = listAttachments.getUI().getCellBounds(listAttachments, 0, 0);
ui.getScrollAttachments().setPreferredSize(new Dimension((int) rect.getWidth() - 4, (int) (3 + rows[1] * rect.getHeight())));
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ui/EntityTreeNodeHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ui/EntityTreeNodeHelper.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ui/EntityTreeNodeHelper.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -18,13 +18,13 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.ui;
-import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.Code;
-import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.Component;
-import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.Constant;
-import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.ConstantValue;
-import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.ExplorationData;
-import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.Library;
-import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.Structure;
+import static fr.cemagref.simexplorer.is.entities.EntityTypeEnum.Code;
+import static fr.cemagref.simexplorer.is.entities.EntityTypeEnum.Component;
+import static fr.cemagref.simexplorer.is.entities.EntityTypeEnum.Constant;
+import static fr.cemagref.simexplorer.is.entities.EntityTypeEnum.ConstantValue;
+import static fr.cemagref.simexplorer.is.entities.EntityTypeEnum.ExplorationData;
+import static fr.cemagref.simexplorer.is.entities.EntityTypeEnum.Library;
+import static fr.cemagref.simexplorer.is.entities.EntityTypeEnum.Structure;
import fr.cemagref.simexplorer.is.entities.EntityVisitable;
import fr.cemagref.simexplorer.is.entities.SimpleEntityVisitor;
import fr.cemagref.simexplorer.is.entities.data.Code;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -20,6 +20,7 @@
import org.apache.tapestry.beaneditor.PropertyModel;
import org.apache.tapestry.grid.GridDataSource;
+import fr.cemagref.simexplorer.is.entities.EntityTypeEnum;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.User;
@@ -45,6 +46,9 @@
/** The Search query. */
SearchQuery,
+ /** The Search query. */
+ RightsListing,
+
/** The Elements owned by. */
ElementsOwnedBy;
}
@@ -93,7 +97,8 @@
try {
switch (elementListType) {
case ApplicationList:
- result = RemoteStorageService.getStorageService().findApplicationsCount(token, true);
+ result = RemoteStorageService.getStorageService().findElementsCount(token,
+ EntityTypeEnum.ExplorationApplication.toString(), true);
break;
case SearchQuery:
result = RemoteStorageService.getStorageService().findFullTextCount(token, searchQuery,
@@ -149,8 +154,9 @@
}
switch (elementListType) {
case ApplicationList:
- entities = RemoteStorageService.getStorageService().findApplications(token, true, startIndex,
- 1 + endIndex - startIndex, sortColumn, ascending);
+ entities = RemoteStorageService.getStorageService().findElements(token,
+ EntityTypeEnum.ExplorationApplication.toString(), true, startIndex, 1 + endIndex - startIndex,
+ sortColumn, ascending);
break;
case SearchQuery:
entities = RemoteStorageService.getStorageService().findFullText(token, searchQuery,
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -29,7 +29,7 @@
import org.apache.tapestry.ioc.annotations.Inject;
import org.codelutin.tapestry.beans.TreeNode;
-import fr.cemagref.simexplorer.is.entities.EntityHelper;
+import fr.cemagref.simexplorer.is.entities.EntityTypeEnum;
import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.Descriptor;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
@@ -283,8 +283,7 @@
nodes.add(simpleNode(getMessages().get("simexplorer.ui.web.metadata.uuid"), m.getUuid()));
nodes.add(simpleNode(getMessages().get("simexplorer.ui.web.metadata.version"), m.getVersion().toString()));
nodes.add(simpleNode(getMessages().get("simexplorer.ui.web.metadata.name"), m.getName()));
- nodes.add(simpleNode(getMessages().get("simexplorer.ui.web.metadata.type"), EntityHelper.Type.getType(
- m.getElementClass()).getLibelle()));
+ nodes.add(simpleNode(getMessages().get("simexplorer.ui.web.metadata.type"), m.getEntityType().getLibelle()));
nodes.add(simpleNode(getMessages().get("simexplorer.ui.web.metadata.description"), m.getDescription()));
nodes.add(simpleNode(getMessages().get("simexplorer.ui.web.metadata.creationDate"), DATE_FORMAT.format(m
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/AppModule.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/AppModule.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/AppModule.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -32,7 +32,7 @@
import org.apache.tapestry.services.Response;
import org.slf4j.Logger;
-import fr.cemagref.simexplorer.is.entities.EntityHelper;
+import fr.cemagref.simexplorer.is.entities.EntityTypeEnum;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
/**
@@ -74,7 +74,7 @@
*/
public static void contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class<?>, String> configuration) {
configuration.add(Version.class, "text");
- configuration.add(Class.class, "text");
+ configuration.add(EntityTypeEnum.class, "text");
}
/**
@@ -93,17 +93,17 @@
return Version.valueOf(input);
}
};
- Coercion<Class, String> coercionClassString = new Coercion<Class, String>() {
- public String coerce(Class input) {
+ Coercion<EntityTypeEnum, String> coercionEntityTypeEnumString = new Coercion<EntityTypeEnum, String>() {
+ public String coerce(EntityTypeEnum input) {
if (input == null) {
return "";
}
- return EntityHelper.Type.getType(input).getLibelle();
+ return input.getLibelle();
}
};
configuration.add(new CoercionTuple<Version, String>(Version.class, String.class, coercionVersionString));
configuration.add(new CoercionTuple<String, Version>(String.class, Version.class, coercionStringVersion));
- configuration.add(new CoercionTuple<Class, String>(Class.class, String.class, coercionClassString));
+ configuration.add(new CoercionTuple<EntityTypeEnum, String>(EntityTypeEnum.class, String.class, coercionEntityTypeEnumString));
}
/**
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java 2008-02-25 15:28:24 UTC (rev 1233)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java 2008-02-25 16:52:59 UTC (rev 1234)
@@ -58,7 +58,7 @@
wantedProperties.add("name");
wantedProperties.add("description");
wantedProperties.add("creationDate");
- wantedProperties.add("elementClassLabel");
+ wantedProperties.add("entityType");
List<String> properties = model.getPropertyNames();
for (String property : properties) {
if (!sortable) {
1
0
r1233 - in trunk/simexplorer-is: simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools src/site/fr/rst
by glandais@users.labs.libre-entreprise.org 25 Feb '08
by glandais@users.labs.libre-entreprise.org 25 Feb '08
25 Feb '08
Author: glandais
Date: 2008-02-25 15:28:24 +0000 (Mon, 25 Feb 2008)
New Revision: 1233
Modified:
trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManager.java
trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManagerImpl.java
trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermission.java
trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermissionImpl.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java
trunk/simexplorer-is/src/site/fr/rst/todo.rst
Log:
Paginer la recherche des ?\195?\169l?\195?\169ments dont l'utilisateur est propri?\195?\169taire
Modified: trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManager.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManager.java 2008-02-25 14:15:49 UTC (rev 1232)
+++ trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManager.java 2008-02-25 15:28:24 UTC (rev 1233)
@@ -70,12 +70,23 @@
* Gets the permissions owned by.
*
* @param user the user
+ * @param count the count
+ * @param indexStart the index start
*
* @return the permissions owned by
*/
- public List<Permission> getPermissionsOwnedBy(User user);
-
+ public List<Permission> getPermissionsOwnedBy(User user, int indexStart, int count);
+
/**
+ * Gets the permissions owned by count.
+ *
+ * @param user the user
+ *
+ * @return the permissions owned by count
+ */
+ public int getPermissionsOwnedByCount(User user);
+
+ /**
* Gets the businnes ids of elements visible by user. null means all elements.
*
* @param token the token
Modified: trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManagerImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManagerImpl.java 2008-02-25 14:15:49 UTC (rev 1232)
+++ trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManagerImpl.java 2008-02-25 15:28:24 UTC (rev 1233)
@@ -187,11 +187,16 @@
* @see fr.cemagref.simexplorer.is.security.credentials.CredentialManager#getPermissionsOwnedBy(fr.cemagref.simexplorer.is.security.entities.User)
*/
@Override
- public List<Permission> getPermissionsOwnedBy(User user) {
- List<Permission> permissionsOwnedBy = daoPermission.getPermissionsOwnedBy(user);
+ public List<Permission> getPermissionsOwnedBy(User user, int indexStart, int count) {
+ List<Permission> permissionsOwnedBy = daoPermission.getPermissionsOwnedBy(user, indexStart, count);
return permissionsOwnedBy;
}
+ public int getPermissionsOwnedByCount(User user) {
+ int permissionsOwnedByCount = daoPermission.getPermissionsOwnedByCount(user);
+ return permissionsOwnedByCount;
+ }
+
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.security.credentials.CredentialManager#getElementsVisibleBy(fr.cemagref.simexplorer.is.security.entities.User)
*/
Modified: trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermission.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermission.java 2008-02-25 14:15:49 UTC (rev 1232)
+++ trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermission.java 2008-02-25 15:28:24 UTC (rev 1233)
@@ -22,6 +22,7 @@
import fr.cemagref.simexplorer.is.security.entities.Actor;
import fr.cemagref.simexplorer.is.security.entities.Permission;
+import fr.cemagref.simexplorer.is.security.entities.User;
/**
* The Interface DaoPermission.
@@ -51,12 +52,23 @@
* Gets the permissions.
*
* @param actor the actor
+ * @param count the count
+ * @param indexStart the index start
*
* @return the permissions
*/
- public List<Permission> getPermissionsOwnedBy(Actor actor);
-
+ public List<Permission> getPermissionsOwnedBy(Actor actor, int indexStart, int count);
+
/**
+ * Gets the permissions owned by count.
+ *
+ * @param user the user
+ *
+ * @return the permissions owned by count
+ */
+ public int getPermissionsOwnedByCount(Actor user);
+
+ /**
* Save permission.
*
* @param p the p
@@ -86,5 +98,5 @@
* @return ids visible
*/
public List<String> getBusinessIdsVisibleBy(Collection<Actor> actors);
-
+
}
Modified: trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermissionImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermissionImpl.java 2008-02-25 14:15:49 UTC (rev 1232)
+++ trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermissionImpl.java 2008-02-25 15:28:24 UTC (rev 1233)
@@ -28,6 +28,7 @@
import fr.cemagref.simexplorer.is.security.entities.Actor;
import fr.cemagref.simexplorer.is.security.entities.Permission;
+import fr.cemagref.simexplorer.is.security.entities.User;
/**
* The Class DaoPermissionImpl.
@@ -65,13 +66,21 @@
* @see fr.cemagref.simexplorer.is.security.dao.DaoPermission#getPermissionsOwnedBy(fr.cemagref.simexplorer.is.security.entities.Actor)
*/
@Override
- public List<Permission> getPermissionsOwnedBy(Actor actor) {
+ public List<Permission> getPermissionsOwnedBy(Actor actor, int indexStart, int count) {
List<Permission> permissions = CollectionUtil.toGenericList(em.createQuery(
"select p from Permission p where p.actor=:actor and p.owner = true").setParameter("actor", actor)
- .getResultList(), Permission.class);
+ .setFirstResult(indexStart).setMaxResults(count).getResultList(), Permission.class);
return permissions;
}
+ public int getPermissionsOwnedByCount(Actor actor) {
+ Object singleResult = em.createQuery(
+ "select count(p) from Permission p where p.actor=:actor and p.owner = true").setParameter("actor",
+ actor).getSingleResult();
+ int result = ((Number) singleResult).intValue();
+ return result;
+ }
+
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.security.dao.DaoActor#savePermission(fr.cemagref.simexplorer.is.security.entities.Permission)
*/
@@ -104,8 +113,7 @@
public List<String> getBusinessIdsVisibleBy(Collection<Actor> actors) {
StringBuffer query = new StringBuffer();
query.append("select p.businessId from Permission p").append(
- " where (p.canRead = true or p.canAdmin = true or p.owner = true)").append(
- " and p.actor in (:actors)");
+ " where (p.canRead = true or p.canAdmin = true or p.owner = true)").append(" and p.actor in (:actors)");
List<String> businessIds = CollectionUtil.toGenericList(em.createQuery(query.toString()).setParameter("actors",
actors).getResultList(), String.class);
return businessIds;
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java 2008-02-25 14:15:49 UTC (rev 1232)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java 2008-02-25 15:28:24 UTC (rev 1233)
@@ -40,8 +40,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public String loginUser(String login, String password)
- throws SimExplorerException;
+ public String loginUser(String login, String password) throws SimExplorerException;
/**
* Request account.
@@ -51,8 +50,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public void requestAccount(String login, String mail)
- throws SimExplorerException;
+ public void requestAccount(String login, String mail) throws SimExplorerException;
/**
* Save user.
@@ -65,8 +63,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public User saveUser(String token, String login, String mail)
- throws SimExplorerException;
+ public User saveUser(String token, String login, String mail) throws SimExplorerException;
/**
* Reset password.
@@ -76,8 +73,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public void resetPassword(String token, String login)
- throws SimExplorerException;
+ public void resetPassword(String token, String login) throws SimExplorerException;
/**
* Change password.
@@ -89,19 +85,17 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
-// public void changePassword(String token, String password)
-// throws SimExplorerException;
-
+ // public void changePassword(String token, String password)
+ // throws SimExplorerException;
/**
* Gets the user.
- *
+ *
* @param token the token
- * @param id the id
+ * @param id the id
* @return the user
* @throws SimExplorerException the sim explorer service exception
*/
- public User getUser(String token, Integer id)
- throws SimExplorerException;
+ public User getUser(String token, Integer id) throws SimExplorerException;
/**
* Gets the user.
@@ -113,8 +107,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public User getUser(String token, String login)
- throws SimExplorerException;
+ public User getUser(String token, String login) throws SimExplorerException;
/**
* Update user.
@@ -126,8 +119,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public User updateUser(String token, User user)
- throws SimExplorerException;
+ public User updateUser(String token, User user) throws SimExplorerException;
/**
* Delete user.
@@ -137,8 +129,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public void deleteUser(String token, Integer id)
- throws SimExplorerException;
+ public void deleteUser(String token, Integer id) throws SimExplorerException;
/**
* Gets the users.
@@ -161,8 +152,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public User[] getUsersOfGroup(String token, Group group)
- throws SimExplorerException;
+ public User[] getUsersOfGroup(String token, Group group) throws SimExplorerException;
/**
* Sets the users of group.
@@ -173,8 +163,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public void setUsersOfGroup(String token, Group group,
- Integer[] usersInGroup) throws SimExplorerException;
+ public void setUsersOfGroup(String token, Group group, Integer[] usersInGroup) throws SimExplorerException;
/**
* Sets the groups of group.
@@ -185,8 +174,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public void setGroupsOfGroup(String token, Group group, Integer[] groupsIds)
- throws SimExplorerException;
+ public void setGroupsOfGroup(String token, Group group, Integer[] groupsIds) throws SimExplorerException;
/**
* Gets the groups of user.
@@ -198,8 +186,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public Group[] getGroupsOfUser(String token, User user)
- throws SimExplorerException;
+ public Group[] getGroupsOfUser(String token, User user) throws SimExplorerException;
/**
* Gets the groups of group.
@@ -211,8 +198,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public Group[] getGroupsOfGroup(String token, Group group)
- throws SimExplorerException;
+ public Group[] getGroupsOfGroup(String token, Group group) throws SimExplorerException;
/**
* Sets the groups of user.
@@ -223,8 +209,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public void setGroupsOfUser(String token, User user, Integer[] groupsIds)
- throws SimExplorerException;
+ public void setGroupsOfUser(String token, User user, Integer[] groupsIds) throws SimExplorerException;
/**
* Save group.
@@ -236,8 +221,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public Group saveGroup(String token, String name)
- throws SimExplorerException;
+ public Group saveGroup(String token, String name) throws SimExplorerException;
/**
* Gets the group.
@@ -249,8 +233,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public Group getGroup(String token, Integer id)
- throws SimExplorerException;
+ public Group getGroup(String token, Integer id) throws SimExplorerException;
/**
* Gets the group.
@@ -262,8 +245,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public Group getGroup(String token, String name)
- throws SimExplorerException;
+ public Group getGroup(String token, String name) throws SimExplorerException;
/**
* Update group.
@@ -275,8 +257,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public Group updateGroup(String token, Group group)
- throws SimExplorerException;
+ public Group updateGroup(String token, Group group) throws SimExplorerException;
/**
* Delete group.
@@ -286,8 +267,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public void deleteGroup(String token, Integer id)
- throws SimExplorerException;
+ public void deleteGroup(String token, Integer id) throws SimExplorerException;
/**
* Gets the groups.
@@ -310,8 +290,7 @@
*
* @throws SimExplorerException the sim explorer service exception
*/
- public Group[] getGroupsOwnedBy(String token, User user)
- throws SimExplorerException;
+ public Group[] getGroupsOwnedBy(String token, User user) throws SimExplorerException;
/**
* Gets the logged user.
@@ -332,16 +311,28 @@
*
* @return the elements owned by
*/
- public String[] getElementsOwnedBy(String token, User user);
-
+ public int getElementsOwnedByCount(String token, User user);
+
/**
+ * Gets the elements owned by.
+ *
+ * @param token the token
+ * @param user the user
+ * @param indexStart the index start
+ * @param count the count
+ *
+ * @return the elements owned by
+ */
+ public String[] getElementsOwnedBy(String token, User user, int indexStart, int count);
+
+ /**
* Gets the permissions.
*
* @param uuid the uuid
* @param token the token
*
* @return the permissions
- * @throws SimExplorerException
+ * @throws SimExplorerException
*/
public Permission[] getPermissions(String token, String uuid) throws SimExplorerException;
@@ -351,9 +342,8 @@
* @param uuid the uuid
* @param permissions the permissions
* @param token the token
- * @throws SimExplorerException
+ * @throws SimExplorerException
*/
public void setPermissions(String token, String uuid, Permission[] permissions) throws SimExplorerException;
-
}
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java 2008-02-25 14:15:49 UTC (rev 1232)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java 2008-02-25 15:28:24 UTC (rev 1233)
@@ -777,13 +777,17 @@
* @see fr.cemagref.simexplorer.is.service.AuthenticationService#getElementsOwnedBy(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User)
*/
@Override
- public String[] getElementsOwnedBy(String token, User user) {
+ public String[] getElementsOwnedBy(String token, User user, int indexStart, int count) {
List<String> uuids = new ArrayList<String>();
- List<Permission> permissions = credentialManager.getPermissionsOwnedBy(user);
+ List<Permission> permissions = credentialManager.getPermissionsOwnedBy(user, indexStart, count);
for (Permission permission : permissions) {
uuids.add(permission.getBusinessId());
}
return uuids.toArray(new String[uuids.size()]);
}
+ public int getElementsOwnedByCount(String token, User user) {
+ return credentialManager.getPermissionsOwnedByCount(user);
+ }
+
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 14:15:49 UTC (rev 1232)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 15:28:24 UTC (rev 1233)
@@ -22,7 +22,9 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.security.entities.User;
import fr.cemagref.simexplorer.is.storage.SearchColumn;
+import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
/**
@@ -32,18 +34,42 @@
*/
public class ElementDataSource implements GridDataSource {
+ /**
+ * The Enum ElementListType.
+ */
+ public enum ElementListType {
+
+ /** The Application list. */
+ ApplicationList,
+
+ /** The Search query. */
+ SearchQuery,
+
+ /** The Elements owned by. */
+ ElementsOwnedBy;
+ }
+
+ /** The element list type. */
+ private ElementListType elementListType;
+
/** Query being searched. */
- private String query = "";
+ private String searchQuery = "";
/** Query being searched. */
private SearchColumn searchColumn = SearchColumn.AllFields;
+ /** The user. */
+ private User user;
+
/** Bookmark on first item index. */
private int indexStart = 0;
/** Cached entities. */
private MetaData[] entities = null;
+ /** The elements owned by. */
+ private String[] elementsOwnedBy = null;
+
/** Authentification token. */
private String token;
@@ -51,14 +77,12 @@
* Build datasource with text query.
*
* @param token the token
- * @param query the query
- * @param searchColumn the search column
+ * @param elementListType the element list type
*/
- public ElementDataSource(String token, String query, SearchColumn searchColumn) {
+ public ElementDataSource(String token, ElementListType elementListType) {
super();
- this.query = query;
+ this.elementListType = elementListType;
this.token = token;
- this.searchColumn = searchColumn;
}
/* (non-Javadoc)
@@ -67,11 +91,20 @@
public int getAvailableRows() {
int result;
try {
- if (query == null) {
+ switch (elementListType) {
+ case ApplicationList:
result = RemoteStorageService.getStorageService().findApplicationsCount(token, true);
- } else {
- result = RemoteStorageService.getStorageService().findFullTextCount(token, query,
+ break;
+ case SearchQuery:
+ result = RemoteStorageService.getStorageService().findFullTextCount(token, searchQuery,
searchColumn.toString(), false);
+ break;
+ case ElementsOwnedBy:
+ result = RemoteSecurityService.getAuthentificationService().getElementsOwnedByCount(token, user);
+ break;
+ default:
+ result = 0;
+ break;
}
} catch (SimExplorerException e) {
throw new RuntimeException(e);
@@ -90,6 +123,16 @@
* @see org.apache.tapestry.grid.GridDataSource#getRowValue(int)token
*/
public Object getRowValue(int index) {
+ if (elementListType == ElementListType.ElementsOwnedBy) {
+ MetaData metadata = null;
+ try {
+ metadata = RemoteStorageService.getStorageService().getMetadata(token,
+ elementsOwnedBy[index - indexStart]);
+ } catch (Exception e) {
+ metadata = null;
+ }
+ return metadata;
+ }
return entities[index - indexStart];
}
@@ -104,17 +147,61 @@
if (sortModel != null) {
sortColumn = sortModel.getPropertyName();
}
-
- if (query == null) {
+ switch (elementListType) {
+ case ApplicationList:
entities = RemoteStorageService.getStorageService().findApplications(token, true, startIndex,
1 + endIndex - startIndex, sortColumn, ascending);
- } else {
- entities = RemoteStorageService.getStorageService().findFullText(token, query, searchColumn.toString(),
- false, startIndex, 1 + endIndex - startIndex, sortColumn, ascending);
+ break;
+ case SearchQuery:
+ entities = RemoteStorageService.getStorageService().findFullText(token, searchQuery,
+ searchColumn.toString(), false, startIndex, 1 + endIndex - startIndex, sortColumn, ascending);
+ break;
+ case ElementsOwnedBy:
+ elementsOwnedBy = RemoteSecurityService.getAuthentificationService().getElementsOwnedBy(token, user,
+ startIndex, 1 + endIndex - startIndex);
+ break;
+ default:
+ break;
}
} catch (SimExplorerException e) {
throw new RuntimeException(e);
}
}
+ /**
+ * Gets the element list type.
+ *
+ * @return the element list type
+ */
+ public ElementListType getElementListType() {
+ return elementListType;
+ }
+
+ /**
+ * Sets the search query.
+ *
+ * @param searchQuery the new search query
+ */
+ public void setSearchQuery(String searchQuery) {
+ this.searchQuery = searchQuery;
+ }
+
+ /**
+ * Sets the search column.
+ *
+ * @param searchColumn the new search column
+ */
+ public void setSearchColumn(SearchColumn searchColumn) {
+ this.searchColumn = searchColumn;
+ }
+
+ /**
+ * Sets the user.
+ *
+ * @param user the new user
+ */
+ public void setUser(User user) {
+ this.user = user;
+ }
+
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-25 14:15:49 UTC (rev 1232)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-25 15:28:24 UTC (rev 1233)
@@ -34,7 +34,7 @@
import fr.cemagref.simexplorer.is.storage.SearchColumn;
import fr.cemagref.simexplorer.is.ui.web.components.SimGrid;
import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource;
-import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource;
+import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource.ElementListType;
import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage;
import fr.cemagref.simexplorer.is.ui.web.tools.ModelFactory;
@@ -114,7 +114,18 @@
* @return the elements
*/
public ElementDataSource getElements() {
- return new ElementDataSource(getToken(), this.query, this.searchColumn);
+ ElementListType listType = ElementListType.SearchQuery;
+ if (this.query == null) {
+ listType = ElementListType.ApplicationList;
+ } else {
+ listType = ElementListType.SearchQuery;
+ }
+ ElementDataSource elementDataSource = new ElementDataSource(getToken(), listType);
+ if (this.query != null) {
+ elementDataSource.setSearchQuery(this.query);
+ elementDataSource.setSearchColumn(this.searchColumn);
+ }
+ return elementDataSource;
}
/**
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java 2008-02-25 14:15:49 UTC (rev 1232)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java 2008-02-25 15:28:24 UTC (rev 1233)
@@ -36,6 +36,8 @@
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.security.entities.Group;
import fr.cemagref.simexplorer.is.security.entities.User;
+import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource;
+import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource.ElementListType;
import fr.cemagref.simexplorer.is.ui.web.pages.security.AdminPage;
import fr.cemagref.simexplorer.is.ui.web.services.GroupValueEncoder;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService;
@@ -188,20 +190,10 @@
*
* @throws SimExplorerException the sim explorer exception
*/
- public List<MetaData> getElementsOwnedBy() throws SimExplorerException {
- List<MetaData> metadatas = new ArrayList<MetaData>();
-
- String[] elementsOwnedBy = RemoteSecurityService.getAuthentificationService().getElementsOwnedBy(getToken(),
- user);
-
- for (int i = 0; i < elementsOwnedBy.length; i++) {
- MetaData metadata = RemoteStorageService.getStorageService().getMetadata(getToken(), elementsOwnedBy[i]);
- if (metadata != null) {
- metadatas.add(metadata);
- }
- }
-
- return metadatas;
+ public ElementDataSource getElementsOwnedBy() throws SimExplorerException {
+ ElementDataSource elementDataSource = new ElementDataSource(getToken(), ElementListType.ElementsOwnedBy);
+ elementDataSource.setUser(user);
+ return elementDataSource;
}
/**
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java 2008-02-25 14:15:49 UTC (rev 1232)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java 2008-02-25 15:28:24 UTC (rev 1233)
@@ -45,12 +45,12 @@
*
* @param beanModelSource the bean model source
* @param resources the resources
- * @param dateSortable the date sortable
+ * @param sortable the sortable
*
* @return the meta data model
*/
public static BeanModel getMetaDataModel(BeanModelSource beanModelSource, ComponentResources resources,
- boolean dateSortable) {
+ boolean sortable) {
BeanModel model = beanModelSource.create(MetaData.class, false, resources);
List<String> wantedProperties = new ArrayList<String>();
wantedProperties.add("uuid");
@@ -61,6 +61,9 @@
wantedProperties.add("elementClassLabel");
List<String> properties = model.getPropertyNames();
for (String property : properties) {
+ if (!sortable) {
+ model.get(property).sortable(false);
+ }
if (!wantedProperties.contains(property)) {
model = model.remove(property);
}
Modified: trunk/simexplorer-is/src/site/fr/rst/todo.rst
===================================================================
--- trunk/simexplorer-is/src/site/fr/rst/todo.rst 2008-02-25 14:15:49 UTC (rev 1232)
+++ trunk/simexplorer-is/src/site/fr/rst/todo.rst 2008-02-25 15:28:24 UTC (rev 1233)
@@ -36,7 +36,6 @@
- Application web
- * (NOK) [2] Recherche sur différents critères
* (NOK) Création d'une page d'administration des droits :
+ Filtre sur le propriétaire via un utilisateur ou un groupe (pour les administrateurs)
@@ -54,7 +53,6 @@
-----
[1] Un élément peut avoir plusieurs propriétaires, une personne écrivant un nouvelle version est ajouté à cette liste -> OK
- [2] Recherche full text sur tous les champs -> envoyer mail
[3] L'élément conserve son id si l'utilisateur a les droits d'écriture, sinon un nouvel élément est créé.
[4] Un élément peut être supprimer si, et seulement si, l'élement n'est utilisé que par un autre élément au maximum, qui sera lui aussi supprimé selon les même rêgles.
Les éléments supprimés sont tous les enfants (quelque soit le niveau), qui n'ont qu'un seul parent.
@@ -82,7 +80,6 @@
égaux, vérifier que les données sont effectivement égales
- ( OK) Filtrage des listes en fonction des droits (implémentation d'un
Filter Lucene, conservation de l'indépendance du stockage et de la sécurité)
- - (NOK) Paginer la recherche des éléments dont l'utilisateur est propriétaire
- ( OK) Gestion du tri sur toutes les colonnes pour les recherches
- (NOK) Créer les interfaces accessibles via d'autres protocoles que RMI
(WebService, CORBA).
1
0
r1232 - in trunk/simexplorer-is/simexplorer-is-web/src: java/fr/cemagref/simexplorer/is/ui/web/components java/fr/cemagref/simexplorer/is/ui/web/grid java/fr/cemagref/simexplorer/is/ui/web/pages java/fr/cemagref/simexplorer/is/ui/web/tools main/webapp resources/fr/cemagref/simexplorer/is/ui/web/components
by glandais@users.labs.libre-entreprise.org 25 Feb '08
by glandais@users.labs.libre-entreprise.org 25 Feb '08
25 Feb '08
Author: glandais
Date: 2008-02-25 14:15:49 +0000 (Mon, 25 Feb 2008)
New Revision: 1232
Modified:
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java
trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementList.tml
trunk/simexplorer-is/simexplorer-is-web/src/resources/fr/cemagref/simexplorer/is/ui/web/components/Layout.tml
Log:
Fieldable research
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java 2008-02-25 14:14:33 UTC (rev 1231)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java 2008-02-25 14:15:49 UTC (rev 1232)
@@ -24,12 +24,13 @@
import org.apache.tapestry.annotations.IncludeStylesheet;
import org.apache.tapestry.annotations.InjectPage;
import org.apache.tapestry.annotations.Parameter;
+import org.apache.tapestry.annotations.Persist;
import org.apache.tapestry.annotations.Service;
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.services.PersistentLocale;
import org.apache.tapestry.services.RequestGlobals;
-import de.hsofttec.t5components.annotations.SetterGetter;
+import fr.cemagref.simexplorer.is.storage.SearchColumn;
import fr.cemagref.simexplorer.is.ui.web.pages.ElementList;
/**
@@ -49,9 +50,13 @@
private PersistentLocale persistentLocale;
/** The _search text. */
- @SetterGetter
- private String _searchText;
+ @Persist
+ private String searchText;
+ /** The search column. */
+ @Persist
+ private SearchColumn searchColumn;
+
/** The element list. */
@InjectPage
private ElementList elementList;
@@ -113,7 +118,7 @@
* @return the object
*/
Object onSuccess() {
- elementList.searchQuery(_searchText);
+ elementList.searchQuery(searchText, searchColumn);
// form.recordError(searchField, "Invalid request.");
// return null;
return elementList;
@@ -125,7 +130,8 @@
* @return the object
*/
public Object onActionFromApplicationList() {
- elementList.searchQuery(null);
+ elementList.searchQuery(null, searchColumn);
+ searchText = "";
return elementList;
}
@@ -135,8 +141,7 @@
* @return the object
*/
public Object onActionFromLogout() {
- HttpSession session = requestGlobals.getHTTPServletRequest()
- .getSession();
+ HttpSession session = requestGlobals.getHTTPServletRequest().getSession();
session.invalidate();
return elementList;
}
@@ -177,4 +182,40 @@
return elementList.isUserSuperAdmin();
}
+ /**
+ * Gets the search text.
+ *
+ * @return the search text
+ */
+ public String getSearchText() {
+ return searchText;
+ }
+
+ /**
+ * Sets the search text.
+ *
+ * @param searchText the new search text
+ */
+ public void setSearchText(String searchText) {
+ this.searchText = searchText;
+ }
+
+ /**
+ * Gets the search column.
+ *
+ * @return the search column
+ */
+ public SearchColumn getSearchColumn() {
+ return searchColumn;
+ }
+
+ /**
+ * Sets the search column.
+ *
+ * @param searchColumn the new search column
+ */
+ public void setSearchColumn(SearchColumn searchColumn) {
+ this.searchColumn = searchColumn;
+ }
+
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 14:14:33 UTC (rev 1231)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 14:15:49 UTC (rev 1232)
@@ -22,6 +22,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.storage.SearchColumn;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
/**
@@ -34,6 +35,9 @@
/** Query being searched. */
private String query = "";
+ /** Query being searched. */
+ private SearchColumn searchColumn = SearchColumn.AllFields;
+
/** Bookmark on first item index. */
private int indexStart = 0;
@@ -48,11 +52,13 @@
*
* @param token the token
* @param query the query
+ * @param searchColumn the search column
*/
- public ElementDataSource(String token, String query) {
+ public ElementDataSource(String token, String query, SearchColumn searchColumn) {
super();
this.query = query;
this.token = token;
+ this.searchColumn = searchColumn;
}
/* (non-Javadoc)
@@ -64,7 +70,8 @@
if (query == null) {
result = RemoteStorageService.getStorageService().findApplicationsCount(token, true);
} else {
- result = RemoteStorageService.getStorageService().findFullTextCount(token, query, "", false);
+ result = RemoteStorageService.getStorageService().findFullTextCount(token, query,
+ searchColumn.toString(), false);
}
} catch (SimExplorerException e) {
throw new RuntimeException(e);
@@ -102,8 +109,8 @@
entities = RemoteStorageService.getStorageService().findApplications(token, true, startIndex,
1 + endIndex - startIndex, sortColumn, ascending);
} else {
- entities = RemoteStorageService.getStorageService().findFullText(token, query, "", false, startIndex,
- 1 + endIndex - startIndex, sortColumn, ascending);
+ entities = RemoteStorageService.getStorageService().findFullText(token, query, searchColumn.toString(),
+ false, startIndex, 1 + endIndex - startIndex, sortColumn, ascending);
}
} catch (SimExplorerException e) {
throw new RuntimeException(e);
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-25 14:14:33 UTC (rev 1231)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-25 14:15:49 UTC (rev 1232)
@@ -20,6 +20,7 @@
import java.util.StringTokenizer;
import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.annotations.Component;
import org.apache.tapestry.annotations.InjectPage;
import org.apache.tapestry.annotations.Persist;
import org.apache.tapestry.annotations.Retain;
@@ -30,6 +31,8 @@
import de.hsofttec.t5components.annotations.SetterGetter;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.storage.SearchColumn;
+import fr.cemagref.simexplorer.is.ui.web.components.SimGrid;
import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource;
import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource;
import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage;
@@ -60,9 +63,18 @@
@InjectPage
private ElementDetail elementDetail;
+ /** The query. */
@Persist
private String query;
-
+
+ /** The search column. */
+ @Persist
+ private SearchColumn searchColumn;
+
+ /** The element list grid. */
+ @Component
+ private SimGrid elementListGrid;
+
/**
* Page loaded.
*/
@@ -83,13 +95,17 @@
* Search query.
*
* @param query the query
+ * @param searchColumn the search column
*/
- public void searchQuery(String query) {
+ public void searchQuery(String query, SearchColumn searchColumn) {
if (query == null || query.equals("")) {
this.query = null;
} else {
this.query = query;
+ this.searchColumn = searchColumn;
}
+ elementListGrid.setCurrentPage(1);
+ elementListGrid.updateSort("");
}
/**
@@ -97,8 +113,8 @@
*
* @return the elements
*/
- public ElementDataSource getElements() {
- return new ElementDataSource(getToken(), this.query);
+ public ElementDataSource getElements() {
+ return new ElementDataSource(getToken(), this.query, this.searchColumn);
}
/**
@@ -116,7 +132,8 @@
* @param context the context
*
* @return the object
- * @throws SimExplorerException
+ *
+ * @throws SimExplorerException the sim explorer exception
*/
public Object onActionFromDetailElement(String context) throws SimExplorerException {
StringTokenizer st = new StringTokenizer(context, ",");
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java 2008-02-25 14:14:33 UTC (rev 1231)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java 2008-02-25 14:15:49 UTC (rev 1232)
@@ -58,7 +58,7 @@
wantedProperties.add("name");
wantedProperties.add("description");
wantedProperties.add("creationDate");
- wantedProperties.add("elementClass");
+ wantedProperties.add("elementClassLabel");
List<String> properties = model.getPropertyNames();
for (String property : properties) {
if (!wantedProperties.contains(property)) {
Modified: trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementList.tml
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementList.tml 2008-02-25 14:14:33 UTC (rev 1231)
+++ trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementList.tml 2008-02-25 14:15:49 UTC (rev 1232)
@@ -3,7 +3,7 @@
<h1 class="Title">${windowtitle}</h1>
- <table t:type="SimGrid" source="elements" row="element" model="model">
+ <table t:id="elementListGrid" t:type="SimGrid" source="elements" row="element" model="model">
<t:parameter name="uuidCell">
<t:actionlink t:id="detailElement" context="${detailElementContext}">${message:simexplorer.ui.web.elementlist.details}</t:actionlink>
</t:parameter>
Modified: trunk/simexplorer-is/simexplorer-is-web/src/resources/fr/cemagref/simexplorer/is/ui/web/components/Layout.tml
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/resources/fr/cemagref/simexplorer/is/ui/web/components/Layout.tml 2008-02-25 14:14:33 UTC (rev 1231)
+++ trunk/simexplorer-is/simexplorer-is-web/src/resources/fr/cemagref/simexplorer/is/ui/web/components/Layout.tml 2008-02-25 14:15:49 UTC (rev 1232)
@@ -48,7 +48,11 @@
<h2 class="Title"><t:label for="searchField" />:</h2>
<input t:type="TextField" t:id="searchField" t:value="searchText"
t:validate="required,minlength=3" size="30" />
- <input type="submit" value="${message:simexplorer.ui.web.layout.search}" />
+ <br />
+ <input t:type="Select" t:value="searchColumn" />
+ <br />
+ <input type="submit"
+ value="${message:simexplorer.ui.web.layout.search}" />
</t:form></div>
</div>
1
0
r1231 - in trunk/simexplorer-is: simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine simexplorer-i
by glandais@users.labs.libre-entreprise.org 25 Feb '08
by glandais@users.labs.libre-entreprise.org 25 Feb '08
25 Feb '08
Author: glandais
Date: 2008-02-25 14:14:33 +0000 (Mon, 25 Feb 2008)
New Revision: 1231
Modified:
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SearchColumn.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/DatabaseConstants.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java
trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseLoadMassTestCase.java
trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseTestCase.java
trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseThread.java
Log:
Element indexation
Fieldable research
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-25 14:12:26 UTC (rev 1230)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-25 14:14:33 UTC (rev 1231)
@@ -466,7 +466,7 @@
} else {
getStorageEngine().duplicateElementHierarchy(token, currentMetaData, elementToUpdate);
}
- getStorageEngine().saveElement(token, elementToUpdate, attachments);
+ getStorageEngine().saveElement(token, loggableElement, attachments);
getStorageEngine().commit();
}
@@ -847,7 +847,7 @@
attachments.put(attachment, getStorageEngine().retrieveTempData(idAttachment));
}
- getStorageEngine().saveElement(token, metaData, attachments);
+ getStorageEngine().saveElement(token, element, attachments);
getStorageEngine().commit();
}
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-25 14:12:26 UTC (rev 1230)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-25 14:14:33 UTC (rev 1231)
@@ -27,6 +27,7 @@
import javax.ejb.Stateless;
import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
@@ -210,12 +211,12 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#saveElement(java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.util.Map)
*/
@Override
- public void saveElement(String token, MetaData element, Map<Attachment, InputStream> attachments)
+ public void saveElement(String token, LoggableElement element, Map<Attachment, InputStream> attachments)
throws SimExplorerException {
- Permission permission = credentialManager.getPermission(token, element.getUuid());
+ Permission permission = credentialManager.getPermission(token, element.getMetaData().getUuid());
if (permission.isCanWrite()) {
super.saveElement(token, element, attachments);
- credentialManager.saveElement(token, element.getUuid());
+ credentialManager.saveElement(token, element.getMetaData().getUuid());
} else {
throw new SimExplorerSecurityException();
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SearchColumn.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SearchColumn.java 2008-02-25 14:12:26 UTC (rev 1230)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SearchColumn.java 2008-02-25 14:14:33 UTC (rev 1231)
@@ -25,17 +25,23 @@
public enum SearchColumn {
/** The All fields. */
- AllFields(DatabaseConstants.KEY_SEARCHABLE_CONTENT),
+ AllFields(DatabaseConstants.KEY_SEARCHABLE_ALL),
/** The Name. */
- Name(DatabaseConstants.KEY_SEARCHABLE_CONTENT),
+ Name(DatabaseConstants.KEY_NAME),
/** The Description. */
- Description(DatabaseConstants.KEY_SEARCHABLE_CONTENT),
+ Description(DatabaseConstants.KEY_DESCRIPTION),
/** The Descriptors. */
- Descriptors(DatabaseConstants.KEY_SEARCHABLE_CONTENT);
+ Descriptors(DatabaseConstants.KEY_SEARCHABLE_DESCRIPTORS),
+ /** The Descriptors. */
+ AttachmentsName(DatabaseConstants.KEY_SEARCHABLE_ATTACHMENTS_NAME),
+
+ /** The Descriptors. */
+ AttachmentsContent(DatabaseConstants.KEY_SEARCHABLE_ATTACHMENTS_CONTENT);
+
/** The column. */
private String column;
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-25 14:12:26 UTC (rev 1230)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-25 14:14:33 UTC (rev 1231)
@@ -23,6 +23,8 @@
import java.util.List;
import java.util.Map;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.data.Descriptor;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
@@ -76,11 +78,13 @@
* Insert an element into database Delete existing element with same id/version if exists.
*
* @param element Element to insert
- * @param readers the readers
+ * @param descriptors the descriptors
+ * @param attachments the attachments
+ * @param attachmentsContent the attachments content
*
* @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void insertElement(MetaData element, List<Reader> readers) throws SimExplorerException;
+ public abstract void insertElement(MetaData element, List<Reader> attachmentsContent, List<Attachment> attachments, List<Descriptor> descriptors) throws SimExplorerException;
/**
* Save element hierarchy, saving the fact that parent uses child.
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/DatabaseConstants.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/DatabaseConstants.java 2008-02-25 14:12:26 UTC (rev 1230)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/DatabaseConstants.java 2008-02-25 14:14:33 UTC (rev 1231)
@@ -67,8 +67,17 @@
public static final String KEY_PARENT_VERSION = "simexplorer.parent.version";
/** Field name for searchable content. */
- public static final String KEY_SEARCHABLE_CONTENT = "simexplorer.searchablecontent";
+ public static final String KEY_SEARCHABLE_ALL = "simexplorer.searchable.all";
+ /** Field name for searchable content. */
+ public static final String KEY_SEARCHABLE_DESCRIPTORS = "simexplorer.searchable.descriptors";
+
+ /** Field name for searchable content. */
+ public static final String KEY_SEARCHABLE_ATTACHMENTS_NAME = "simexplorer.searchable.attachments.name";
+
+ /** Field name for searchable content. */
+ public static final String KEY_SEARCHABLE_ATTACHMENTS_CONTENT = "simexplorer.searchable.attachments.content";
+
/** No date sort. */
public static final int SORT_NONE = 0;
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-25 14:12:26 UTC (rev 1230)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-25 14:14:33 UTC (rev 1231)
@@ -20,6 +20,7 @@
import java.io.File;
import java.io.IOException;
import java.io.Reader;
+import java.io.StringReader;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collection;
@@ -33,7 +34,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.KeywordAnalyzer;
+import org.apache.lucene.analysis.PerFieldAnalyzerWrapper;
import org.apache.lucene.analysis.SimpleAnalyzer;
+import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexReader;
@@ -56,6 +60,8 @@
import org.apache.lucene.store.LockFactory;
import org.apache.lucene.store.NoLockFactory;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.data.Descriptor;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
@@ -100,6 +106,9 @@
/** Searcher that should be used for new queries. */
private static Searcher cachedSearcher = null;
+ /** The analyzer. */
+ private static Analyzer analyzer = null;
+
/** Date of latest optimization. */
private static Date lastOptimize = new Date();
@@ -322,8 +331,26 @@
public void open(boolean create) throws SimExplorerException {
if (writer == null) {
// Create an analyzer
- Analyzer analyzer = new SimpleAnalyzer();
+ SimpleAnalyzer simpleAnalyzer = new SimpleAnalyzer();
+ analyzer = new PerFieldAnalyzerWrapper(simpleAnalyzer);
+ PerFieldAnalyzerWrapper perFieldAnalyzerWrapper = (PerFieldAnalyzerWrapper) analyzer;
+ KeywordAnalyzer keywordAnalyzer = new KeywordAnalyzer();
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_UUID, keywordAnalyzer);
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_UUID_VERSION, keywordAnalyzer);
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_UUID_VERSION_PARENT, keywordAnalyzer);
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_UUID_VERSION_CHILD, keywordAnalyzer);
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_VERSION, keywordAnalyzer);
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_LATEST, keywordAnalyzer);
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_CLASSNAME, keywordAnalyzer);
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_CREATIONDATE, keywordAnalyzer);
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_HASH, keywordAnalyzer);
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_PARENT_UUID, keywordAnalyzer);
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_PARENT_VERSION, keywordAnalyzer);
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_NAME, simpleAnalyzer);
+ perFieldAnalyzerWrapper.addAnalyzer(KEY_DESCRIPTION, simpleAnalyzer);
+
+ // Retrieve all searchable columns
File indexDir = new File(dbFolder);
// Create directories
File resultFolder = new File(indexDir.getParent());
@@ -410,9 +437,10 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#insertElement(fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.util.List)
*/
@Override
- public void insertElement(MetaData element, List<Reader> readers) throws SimExplorerException {
+ public void insertElement(MetaData element, List<Reader> attachmentsContent, List<Attachment> attachments,
+ List<Descriptor> descriptors) throws SimExplorerException {
// Save element to a Lucene document
- Document document = saveLuceneElement(element, readers);
+ Document document = saveLuceneElement(element, attachmentsContent, attachments, descriptors);
try {
synchronized (writerSynchronizer) {
@@ -622,8 +650,8 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#findElementsByContentSearchCount(java.lang.String, boolean)
*/
@Override
- public int findElementsByContentSearchCount(String queryText, SearchColumn column, boolean onlyLatest, String userFilter)
- throws SimExplorerException {
+ public int findElementsByContentSearchCount(String queryText, SearchColumn column, boolean onlyLatest,
+ String userFilter) throws SimExplorerException {
Query query;
try {
query = getQueryByContentSearch(queryText, column, onlyLatest);
@@ -656,8 +684,9 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#findElementsByContentSearch(java.lang.String, boolean, int, int, int)
*/
@Override
- public List<MetaData> findElementsByContentSearch(String queryText, SearchColumn searchColumn, boolean onlyLatest, int start, int count,
- SortColumn sortColumn, SortOrder sortOrder, String userFilter) throws SimExplorerException {
+ public List<MetaData> findElementsByContentSearch(String queryText, SearchColumn searchColumn, boolean onlyLatest,
+ int start, int count, SortColumn sortColumn, SortOrder sortOrder, String userFilter)
+ throws SimExplorerException {
Query query;
try {
query = getQueryByContentSearch(queryText, searchColumn, onlyLatest);
@@ -720,20 +749,28 @@
*
* @param queryText String to match
* @param onlyLatest Latest flag
+ * @param column the column
*
* @return Query
*
* @throws ParseException the parse exception
*/
- private Query getQueryByContentSearch(String queryText, SearchColumn column, boolean onlyLatest) throws ParseException {
+ private Query getQueryByContentSearch(String queryText, SearchColumn column, boolean onlyLatest)
+ throws ParseException {
Query query;
- // Create an analyzer for query parsing
- Analyzer analyzer = new SimpleAnalyzer();
- // Create an parser to handle query
- QueryParser parser = new QueryParser(column.getColumn(), analyzer);
- // Parse query
- Query searchQuery = parser.parse(queryText);
+ Query searchQuery = null;
+
+ if (column == SearchColumn.AllFields) {
+ searchQuery = new BooleanQuery();
+ ((BooleanQuery) searchQuery).add(getQueryByContentSearchForColumn(queryText, column.getColumn()),
+ BooleanClause.Occur.SHOULD);
+ ((BooleanQuery) searchQuery).add(getQueryByContentSearchForColumn(queryText,
+ SearchColumn.AttachmentsContent.getColumn()), BooleanClause.Occur.SHOULD);
+ } else {
+ searchQuery = getQueryByContentSearchForColumn(queryText, column.getColumn());
+ }
+
if (onlyLatest) {
// If we want only latest items
// Boolean search with content and latest field
@@ -748,6 +785,25 @@
return query;
}
+ /**
+ * Gets the query by content search for column.
+ *
+ * @param queryText the query text
+ * @param column the column
+ *
+ * @return the query by content search for column
+ *
+ * @throws ParseException the parse exception
+ */
+ private Query getQueryByContentSearchForColumn(String queryText, String column) throws ParseException {
+ // Create an parser to handle query
+ QueryParser parser;
+ parser = new QueryParser(column, analyzer);
+ // Parse query
+ Query searchQuery = parser.parse(queryText);
+ return searchQuery;
+ }
+
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.database.Database#deleteElement(java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
*/
@@ -914,24 +970,29 @@
/**
* Transform an element to a Lucene document thanks to a factory.
*
- * @param readers the readers
* @param element the element
+ * @param descriptors the descriptors
+ * @param attachments the attachments
+ * @param attachmentsContent the attachments content
*
* @return the document
*/
- private Document saveLuceneElement(MetaData element, List<Reader> readers) {
+ private Document saveLuceneElement(MetaData element, List<Reader> attachmentsContent, List<Attachment> attachments,
+ List<Descriptor> descriptors) {
Document document = new Document();
// Store all element properties in Lucene document
-
addSimpleField(document, KEY_UUID, element.getUuid());
addSimpleField(document, KEY_VERSION, element.getVersion().toString());
addSimpleField(document, KEY_UUID_VERSION, getUuidVersion(element.getUuid(), element.getVersion()));
addSimpleField(document, KEY_NAME, element.getName());
+ document.add(new Field(KEY_SEARCHABLE_ALL, new StringReader(element.getName())));
+ addSimpleField(document, KEY_DESCRIPTION, element.getDescription());
+ document.add(new Field(KEY_SEARCHABLE_ALL, new StringReader(element.getDescription())));
+
addSimpleField(document, KEY_CLASSNAME, element.getElementClass().getCanonicalName());
- addSimpleField(document, KEY_DESCRIPTION, element.getDescription());
if (element.isLatest()) {
addSimpleField(document, KEY_LATEST, "1");
} else {
@@ -948,9 +1009,18 @@
addSimpleField(document, KEY_PARENT_VERSION, element.getParentVersion().toString());
}
- for (Reader reader : readers) {
- document.add(new Field(KEY_SEARCHABLE_CONTENT, reader));
+ // Index data
+ for (Descriptor descriptor : descriptors) {
+ document.add(new Field(KEY_SEARCHABLE_DESCRIPTORS, new StringReader(descriptor.getValue())));
+ document.add(new Field(KEY_SEARCHABLE_ALL, new StringReader(descriptor.getValue())));
}
+ for (Attachment attachment : attachments) {
+ document.add(new Field(KEY_SEARCHABLE_ATTACHMENTS_NAME, new StringReader(attachment.getFileName())));
+ document.add(new Field(KEY_SEARCHABLE_ALL, new StringReader(attachment.getFileName())));
+ }
+ for (Reader attachmentContent : attachmentsContent) {
+ document.add(new Field(KEY_SEARCHABLE_ATTACHMENTS_CONTENT, attachmentContent));
+ }
return document;
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-25 14:12:26 UTC (rev 1230)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-25 14:14:33 UTC (rev 1231)
@@ -24,6 +24,7 @@
import javax.ejb.Local;
import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
@@ -67,7 +68,7 @@
*
* @throws SimExplorerException the sim explorer storage exception
*/
- public abstract void saveElement(String token, MetaData element, Map<Attachment, InputStream> attachments)
+ public abstract void saveElement(String token, LoggableElement element, Map<Attachment, InputStream> attachments)
throws SimExplorerException;
/**
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-25 14:12:26 UTC (rev 1230)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-25 14:14:33 UTC (rev 1231)
@@ -29,6 +29,7 @@
import java.util.UUID;
import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
@@ -71,7 +72,7 @@
protected MetaData[] convertList(Collection<MetaData> metadatas) {
return metadatas.toArray(new MetaData[metadatas.size()]);
}
-
+
/** Default constructor with default implementations of storage and indexing. */
public StorageEngineImpl() {
this(null, null);
@@ -128,21 +129,21 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#saveElement(fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.util.Map)
*/
- public void saveElement(String token, MetaData element, Map<Attachment, InputStream> attachments)
+ public void saveElement(String token, LoggableElement loggableElement, Map<Attachment, InputStream> attachments)
throws SimExplorerException {
// Save all attachments in system
for (Map.Entry<Attachment, InputStream> entry : attachments.entrySet()) {
- attachmentHandler.storeData(element, entry.getKey(), entry.getValue());
+ attachmentHandler.storeData(loggableElement.getMetaData(), entry.getKey(), entry.getValue());
}
// Parse all attachments for indexing
- List<Reader> readers = new ArrayList<Reader>();
+ List<Reader> attachmentsContent = new ArrayList<Reader>();
for (Map.Entry<Attachment, InputStream> entry : attachments.entrySet()) {
Attachment attachment = entry.getKey();
if (attachment.getContentType() != null) {
- InputStream content = attachmentHandler.retrieveData(element, attachment);
+ InputStream content = attachmentHandler.retrieveData(loggableElement.getMetaData(), attachment);
// Transform stream into indexable text
Reader reader;
try {
@@ -150,23 +151,13 @@
} catch (Exception e) {
throw new SimExplorerTechnicalException(e);
}
- readers.add(reader);
+ attachmentsContent.add(reader);
}
}
- if (element.getName() != null) {
- Reader reader = new StringReader(element.getName());
- readers.add(reader);
- }
- if (element.getDescription() != null) {
- Reader reader = new StringReader(element.getDescription());
- readers.add(reader);
- }
- // FIXME descriptors
-
// Insert element in database
- // FIXME separate search
- database.insertElement(element, readers);
+ database.insertElement(loggableElement.getMetaData(), attachmentsContent, loggableElement.getAttachments(),
+ loggableElement.getDescriptors());
}
/* (non-Javadoc)
@@ -249,7 +240,7 @@
@Override
public MetaData[] getMetadatasUsing(String token, String uuid, Version version) throws SimExplorerException {
MetaData mde = database.getElement(uuid, version);
- return convertList( database.getElementsUsing(mde));
+ return convertList(database.getElementsUsing(mde));
}
@Override
@@ -279,17 +270,18 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findFullTextCount(java.lang.String, boolean)
*/
- public int findFullTextCount(String token, String query, SearchColumn searchColumn, boolean onlyLatest) throws SimExplorerException {
+ public int findFullTextCount(String token, String query, SearchColumn searchColumn, boolean onlyLatest)
+ throws SimExplorerException {
return database.findElementsByContentSearchCount(query, searchColumn, onlyLatest);
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findFullText(java.lang.String, boolean, int, int, int)
*/
- public MetaData[] findFullText(String token, String query, SearchColumn searchColumn, boolean onlyLatest, int indexStart, int count,
- SortColumn column, SortOrder sortOrder) throws SimExplorerException {
- List<MetaData> elements = database.findElementsByContentSearch(query, searchColumn, onlyLatest, indexStart, count, column,
- sortOrder);
+ public MetaData[] findFullText(String token, String query, SearchColumn searchColumn, boolean onlyLatest,
+ int indexStart, int count, SortColumn column, SortOrder sortOrder) throws SimExplorerException {
+ List<MetaData> elements = database.findElementsByContentSearch(query, searchColumn, onlyLatest, indexStart,
+ count, column, sortOrder);
return convertList(elements);
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseLoadMassTestCase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseLoadMassTestCase.java 2008-02-25 14:12:26 UTC (rev 1230)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseLoadMassTestCase.java 2008-02-25 14:14:33 UTC (rev 1231)
@@ -25,6 +25,8 @@
import java.util.Random;
import junit.framework.TestCase;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.data.Descriptor;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.storage.MetaDataGenerator;
import fr.cemagref.simexplorer.is.storage.SearchColumn;
@@ -161,7 +163,7 @@
readers.clear();
readers.add(reader);
- database.insertElement(me, readers);
+ database.insertElement(me, readers, new ArrayList<Attachment>(), new ArrayList<Descriptor>());
}
if (i > 0 && i % 100 == 0) {
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseTestCase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseTestCase.java 2008-02-25 14:12:26 UTC (rev 1230)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseTestCase.java 2008-02-25 14:14:33 UTC (rev 1231)
@@ -26,9 +26,12 @@
import junit.framework.TestCase;
+import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.data.Descriptor;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.storage.MetaDataGenerator;
@@ -81,11 +84,11 @@
*/
public void testInsertElementGetElement() throws Exception {
MetaData me = mdg.generateMetaDataEntity();
- database.insertElement(me, new ArrayList<Reader>());
+ database.insertElement(me, new ArrayList<Reader>(), new ArrayList<Attachment>(), new ArrayList<Descriptor>());
database.commit();
MetaData me2 = database.getElement(me.getUuid(), me.getVersion());
assertEquals(me.getDescription(), me2.getDescription());
- database.insertElement(me, new ArrayList<Reader>());
+ database.insertElement(me, new ArrayList<Reader>(), new ArrayList<Attachment>(), new ArrayList<Descriptor>());
database.commit();
}
@@ -97,14 +100,14 @@
public void testIndexAddFindElementsByContentSearch() throws Exception {
MetaData me = mdg.generateMetaDataEntity();
- String keyphrase = Long.toHexString(r.nextLong());
+ String keyphrase = RandomStringUtils.randomAlphabetic(r.nextInt(5) + 5);
StringReader reader = new StringReader("ogijeriog ergijergioj " + keyphrase + " egiojergij ergijerogij");
List<Reader> readers = new ArrayList<Reader>();
readers.add(reader);
- database.insertElement(me, readers);
+ database.insertElement(me, readers, new ArrayList<Attachment>(), new ArrayList<Descriptor>());
database.commit();
int mesCount = database.findElementsByContentSearchCount(keyphrase, SearchColumn.AllFields, true);
@@ -120,7 +123,8 @@
public void testGetVersions() throws Exception {
MetaData[] mes = mdg.generateVersionnedMetaDataEntity();
for (MetaData me : mes) {
- database.insertElement(me, new ArrayList<Reader>());
+ database.insertElement(me, new ArrayList<Reader>(), new ArrayList<Attachment>(),
+ new ArrayList<Descriptor>());
}
database.commit();
@@ -141,7 +145,8 @@
public void testFindElementsById() throws Exception {
MetaData[] mes = mdg.generateVersionnedMetaDataEntity();
for (MetaData me : mes) {
- database.insertElement(me, new ArrayList<Reader>());
+ database.insertElement(me, new ArrayList<Reader>(), new ArrayList<Attachment>(),
+ new ArrayList<Descriptor>());
}
database.commit();
@@ -157,7 +162,7 @@
public void testFindElementsByProperties() throws Exception {
MetaData me = mdg.generateMetaDataEntity();
- database.insertElement(me, new ArrayList<Reader>());
+ database.insertElement(me, new ArrayList<Reader>(), new ArrayList<Attachment>(), new ArrayList<Descriptor>());
database.commit();
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseThread.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseThread.java 2008-02-25 14:12:26 UTC (rev 1230)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseThread.java 2008-02-25 14:14:33 UTC (rev 1231)
@@ -22,6 +22,8 @@
import java.util.List;
import java.util.Random;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.data.Descriptor;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.storage.MetaDataGenerator;
import fr.cemagref.simexplorer.is.storage.database.Database;
@@ -52,8 +54,7 @@
/**
* Sets the database.
*
- * @param database
- * the database to set
+ * @param database the database to set
*/
public void setDatabase(Database database) {
this.database = database;
@@ -87,11 +88,9 @@
/**
* Search elements.
*
- * @param id
- * the id
+ * @param id the id
*
- * @throws Exception
- * the exception
+ * @throws Exception the exception
*/
private void searchElements(String id) throws Exception {
List<MetaData> mde = database.findElementsById(id, true);
@@ -103,13 +102,11 @@
/**
* Insert elements.
*
- * @param ipass
- * the ipass
+ * @param ipass the ipass
*
* @return the string
*
- * @throws Exception
- * the exception
+ * @throws Exception the exception
*/
private String insertElements(int ipass) throws Exception {
@@ -120,7 +117,8 @@
for (int j = 0; j < ncycles; j++) {
MetaData[] mes = mdg.generateVersionnedMetaDataEntity();
for (MetaData me : mes) {
- database.insertElement(me, new ArrayList<Reader>());
+ database.insertElement(me, new ArrayList<Reader>(), new ArrayList<Attachment>(),
+ new ArrayList<Descriptor>());
id = me.getUuid();
}
}
@@ -141,8 +139,7 @@
/**
* Sets the id thread lucene.
*
- * @param idThreadLucene
- * the idThreadLucene to set
+ * @param idThreadLucene the idThreadLucene to set
*/
public void setIdThreadLucene(int idThreadLucene) {
this.idThreadLucene = idThreadLucene;
1
0
r1230 - trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata
by glandais@users.labs.libre-entreprise.org 25 Feb '08
by glandais@users.labs.libre-entreprise.org 25 Feb '08
25 Feb '08
Author: glandais
Date: 2008-02-25 14:12:26 +0000 (Mon, 25 Feb 2008)
New Revision: 1230
Modified:
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java
Log:
Getter for common name
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-25 14:06:59 UTC (rev 1229)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-25 14:12:26 UTC (rev 1230)
@@ -20,6 +20,7 @@
import java.util.Date;
import fr.cemagref.simexplorer.is.entities.BaseEntity;
+import fr.cemagref.simexplorer.is.entities.EntityHelper;
import fr.cemagref.simexplorer.is.entities.EntityVisitor;
/**
@@ -288,4 +289,13 @@
this.elementClass = elementClass;
}
+ /**
+ * Gets the element class label.
+ *
+ * @return the element class label
+ */
+ public String getElementClassLabel() {
+ return EntityHelper.Type.getType(getElementClass()).getLibelle();
+ }
+
}
1
0
r1229 - in trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing: actions actions/util model
by tchemit@users.labs.libre-entreprise.org 25 Feb '08
by tchemit@users.labs.libre-entreprise.org 25 Feb '08
25 Feb '08
Author: tchemit
Date: 2008-02-25 14:06:59 +0000 (Mon, 25 Feb 2008)
New Revision: 1229
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowDetailTabAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/ListTabModel.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/PaginationModel.java
Log:
javadoc
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowDetailTabAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowDetailTabAction.java 2008-02-25 14:05:03 UTC (rev 1228)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowDetailTabAction.java 2008-02-25 14:06:59 UTC (rev 1229)
@@ -22,8 +22,8 @@
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.ui.swing.SimExplorerActionManager;
import fr.cemagref.simexplorer.is.ui.swing.StorageServiceHelper;
+import fr.cemagref.simexplorer.is.ui.swing.actions.util.SelectedAction;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.ShowTabAbstractAction;
-import fr.cemagref.simexplorer.is.ui.swing.actions.util.SelectedAction;
import fr.cemagref.simexplorer.is.ui.swing.model.DataEntityModel;
import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
@@ -45,11 +45,7 @@
/**
* Action pour afficher le tab de détail d'un LoggableElement.
- * <p/>
- * Les deux listeners (sur l'arbre de navigation et sur la liste des versions)
- * écoutent les changements provenant du model de détail afin
- * de pouvoir optimiser les rafraichissement d'ui.
- *
+ *
* @author chemit
*/
@jaxx.runtime.builder.ActionConfig(
@@ -62,9 +58,17 @@
hideActionText = true
)
public class ShowDetailTabAction extends ShowTabAbstractAction<JDetailTab, DetailTabModel> implements SelectedAction {
-
+
/** la donnée à afficher dans l'onglet de détail */
protected DataEntityModel selected;
+ /** le listener sur le changement de noeud dans l'arbre de navigation */
+ protected NavigationSelectionListener navigationSelectionListener;
+ /** le listener sur les actions propres à l'arbre de navigation */
+ protected TreeActionUpdater treeActionUpdater;
+ /** le listener sur le changement de version */
+ protected VersionSelectionListener versionSelectionListener;
+ /** le listener sur le changement de fichier attaché */
+ protected AttachmentSelectionListener attachmentSelectionListener;
private static final long serialVersionUID = 6643631041114311643L;
@@ -73,6 +77,11 @@
}
@Override
+ protected void setStatus(String status) {
+ // no log
+ }
+
+ @Override
public String getI18nToolTipText() {
return "simexplorer.action.showTab_detail.tooltip";
}
@@ -100,7 +109,7 @@
// on doit retrouver l'élément à traiter à partir de la source
selected = findSelectedItem(e);
}
- }
+ }
boolean selectedUuid = selected != null && selected.getUuid() != null;
if (!selectedUuid) {
return false;
@@ -113,15 +122,10 @@
detailModel.setSelectedItem(selected);
// chargement de l'élément à partir du service
- // délégué au model de selection
+ // délégué au model de selection
return detailModel.getSelectedItem().getLe(getContext()) != null;
}
- NavigationSelectionListener navigationSelectionListener;
- TreeActionUpdater treeActionUpdater;
- VersionSelectionListener versionSelectionListener;
- AttachmentSelectionListener attachmentSelectionListener;
-
protected void initFirstUsage(final JDetailTab ui, final DetailTabModel model) {
// add a listener on navigation tree
navigationSelectionListener = new NavigationSelectionListener();
@@ -151,28 +155,28 @@
protected void updateUI(JDetailTab ui, DetailTabModel model) {
// ajout de l'élément dans l'historique
- SimExplorerActionManager.fireSelectedAction("historyAdd", e.getSource(),selected);
+ SimExplorerActionManager.fireSelectedAction("historyAdd", e.getSource(), selected);
}
@Override
public void disposeUI() {
super.disposeUI();
- if (navigationSelectionListener!=null) {
+ if (navigationSelectionListener != null) {
getTabUI().getNavigationTree().removeTreeSelectionListener(navigationSelectionListener);
- navigationSelectionListener=null;
+ navigationSelectionListener = null;
}
- if (treeActionUpdater!=null) {
+ if (treeActionUpdater != null) {
getTabUI().getNavigationTree().removeTreeSelectionListener(treeActionUpdater);
- treeActionUpdater=null;
+ treeActionUpdater = null;
}
- if (versionSelectionListener!=null) {
+ if (versionSelectionListener != null) {
getTabUI().getDetailVersions().removeItemListener(versionSelectionListener);
- versionSelectionListener=null;
+ versionSelectionListener = null;
}
- if (attachmentSelectionListener!=null) {
+ if (attachmentSelectionListener != null) {
getTabUI().getDetailAttachments().removeListSelectionListener(attachmentSelectionListener);
- attachmentSelectionListener=null;
+ attachmentSelectionListener = null;
}
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java 2008-02-25 14:05:03 UTC (rev 1228)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java 2008-02-25 14:06:59 UTC (rev 1229)
@@ -50,11 +50,13 @@
/** flag pour indiquer si la liste est locale ou remote */
protected boolean remote;
+ /** le listener sur le changement de meta selectionnée */
+ protected ListMetaSelectionListener listMetaSelectionListener;
+ /** le listener sur le changement de tri */
+ protected TableRowSorterListener rowSorterListener;
+ /** le trieur de table */
+ protected MyTableRowSorter rowSorter;
- ListMetaSelectionListener listMetaSelectionListener;
- TableRowSorterListener rowSorterListener;
- MyTableRowSorter rowSorter;
-
public ShowListTabAbstractAction(String name, boolean remote) {
super(name);
this.remote = remote;
@@ -64,7 +66,7 @@
protected void setStatus(String status) {
// no log
}
-
+
@Override
protected boolean beforeAction(ActionEvent e) throws Exception {
super.beforeAction(e);
@@ -81,17 +83,17 @@
@Override
public void disposeUI() {
super.disposeUI();
- if (listMetaSelectionListener!=null) {
+ if (listMetaSelectionListener != null) {
getTabUI().getTable().getSelectionModel().removeListSelectionListener(listMetaSelectionListener);
- listMetaSelectionListener=null;
+ listMetaSelectionListener = null;
}
- if (rowSorterListener!=null) {
+ if (rowSorterListener != null) {
getTabUI().getTable().getRowSorter().removeRowSorterListener(rowSorterListener);
- rowSorterListener=null;
+ rowSorterListener = null;
}
- if (rowSorter!=null) {
+ if (rowSorter != null) {
getTabUI().getTable().setRowSorter(rowSorter);
- rowSorter=null;
+ rowSorter = null;
}
}
@@ -113,7 +115,7 @@
@Override
public void keyReleased(KeyEvent e) {
// rafraichissement des actions de recherche
- getListUpdater( getModel().isRemote()).refreshSearchActions();
+ getListUpdater(getModel().isRemote()).refreshSearchActions();
}
});
@@ -132,7 +134,7 @@
rowSorter.addRowSorterListener(rowSorterListener);
// init updater listens the model
- getListUpdater( model.isRemote()).initListeners();
+ getListUpdater(model.isRemote()).initListeners();
// init model
model.initTabModel(remote);
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/ListTabModel.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/ListTabModel.java 2008-02-25 14:05:03 UTC (rev 1228)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/ListTabModel.java 2008-02-25 14:06:59 UTC (rev 1229)
@@ -77,7 +77,6 @@
this.selectedIndex = selectedIndex;
if (selectedIndex!=-1) {
synch(isRemote(),get(selectedIndex));
-
}
firePropertyChange(SELECTED_ROW_PROPERTY_CHANGED, oldSelectedIndex, selectedIndex);
}
@@ -232,7 +231,7 @@
query.getQuery(),
(int) page.getFirstIndex(),
page.getWidthInt(),
- query.getSortColumn().getColumn(),
+ query.getSortColumn(),
query.isSortAscending()
);
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/PaginationModel.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/PaginationModel.java 2008-02-25 14:05:03 UTC (rev 1228)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/PaginationModel.java 2008-02-25 14:06:59 UTC (rev 1229)
@@ -129,6 +129,9 @@
}
void setWidth(SimplePaginationEnum width) {
+ if (width==null) {
+ throw new NullPointerException("can not set a null width");
+ }
this.width = width;
this.pageNumber = 0;
}
1
0
r1228 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing
by tchemit@users.labs.libre-entreprise.org 25 Feb '08
by tchemit@users.labs.libre-entreprise.org 25 Feb '08
25 Feb '08
Author: tchemit
Date: 2008-02-25 14:05:03 +0000 (Mon, 25 Feb 2008)
New Revision: 1228
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorer.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/StorageServiceHelper.java
Log:
mise en place des tris
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorer.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorer.java 2008-02-25 09:30:34 UTC (rev 1227)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorer.java 2008-02-25 14:05:03 UTC (rev 1228)
@@ -152,6 +152,7 @@
public void initI18n() {
I18n.initISO88591(getContext().getConfig().getUserLocale());
}
+
protected SimExplorer() {
// protected restricted access
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/StorageServiceHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/StorageServiceHelper.java 2008-02-25 09:30:34 UTC (rev 1227)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/StorageServiceHelper.java 2008-02-25 14:05:03 UTC (rev 1228)
@@ -30,6 +30,7 @@
import fr.cemagref.simexplorer.is.service.StorageService;
import fr.cemagref.simexplorer.is.service.StorageServiceClient;
import static fr.cemagref.simexplorer.is.service.StorageServiceHelper.STORAGE_SERVICE_LOOKUP_NAME;
+import fr.cemagref.simexplorer.is.storage.SortColumn;
import javax.naming.Context;
import javax.naming.InitialContext;
@@ -102,15 +103,15 @@
}
}
- public static MetaData[] getData(SimExplorerContext context, boolean remote, boolean onlyLatest, String query, long newFirstIndex, int width, String column, boolean ascending) {
+ public static MetaData[] getData(SimExplorerContext context, boolean remote, boolean onlyLatest, String query, long newFirstIndex, int width, SortColumn column, boolean ascending) {
StorageService service = getService(context, remote);
String token = context.getToken();
try {
MetaData[] data;
if (query == null || query.isEmpty()) {
- data = service.findApplications(token, onlyLatest, (int) newFirstIndex, width, column, ascending);
+ data = service.findApplications(token, onlyLatest, (int) newFirstIndex, width, column.name(), ascending);
} else {
- data = service.findFullText(token, query, "", onlyLatest, (int) newFirstIndex, width, column, ascending);
+ data = service.findFullText(token, query, "", onlyLatest, (int) newFirstIndex, width, column.name(), ascending);
}
return data;
} catch (SimExplorerException e) {
1
0
r1227 - in trunk/simexplorer-is: simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine simexplorer-i
by glandais@users.labs.libre-entreprise.org 25 Feb '08
by glandais@users.labs.libre-entreprise.org 25 Feb '08
25 Feb '08
Author: glandais
Date: 2008-02-25 09:30:34 +0000 (Mon, 25 Feb 2008)
New Revision: 1227
Added:
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SearchColumn.java
Modified:
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SortColumn.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java
trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseLoadMassTestCase.java
trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseTestCase.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/StorageServiceHelper.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
Log:
Search by column
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -109,12 +109,12 @@
return null;
}
- public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerException {
+ public int findFullTextCount(String token, String query,String queryColumn, boolean onlyLatest) throws SimExplorerException {
// TODO Changer
return findApplicationsCount(token, onlyLatest);
}
- public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count,
+ public MetaData[] findFullText(String token, String query, String queryColumn, boolean onlyLatest, int indexStart, int count,
String column,
boolean ascending) throws SimExplorerException {
// TODO Changer
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -212,12 +212,14 @@
* @param token the token
* @param query the query
* @param onlyLatest the only latest
+ * @param queryColumn the query column
*
* @return the int
*
* @throws SimExplorerException the sim explorer service exception
*/
- int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerException;
+ int findFullTextCount(String token, String query, String queryColumn, boolean onlyLatest)
+ throws SimExplorerException;
/**
* Find elements matching query.
@@ -227,15 +229,16 @@
* @param onlyLatest the only latest
* @param indexStart the index start
* @param count the count
- * @param column the column
* @param ascending the ascending
+ * @param queryColumn the query column
+ * @param sortColumn the sort column
*
* @return the meta data[]
*
* @throws SimExplorerException the sim explorer service exception
*/
- MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count, String column, boolean ascending)
- throws SimExplorerException;
+ MetaData[] findFullText(String token, String query, String queryColumn, boolean onlyLatest, int indexStart,
+ int count, String sortColumn, boolean ascending) throws SimExplorerException;
/**
* Retrieve number of applications.
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -52,6 +52,7 @@
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
import fr.cemagref.simexplorer.is.factories.LoggableElementFactory;
+import fr.cemagref.simexplorer.is.storage.SearchColumn;
import fr.cemagref.simexplorer.is.storage.SortColumn;
import fr.cemagref.simexplorer.is.storage.SortOrder;
import fr.cemagref.simexplorer.is.storage.engine.StorageEngine;
@@ -147,10 +148,10 @@
*
* @return the column
*/
- private SortColumn getColumn(String column) {
+ private SortColumn getSortColumn(String column) {
SortColumn sortColumn;
try {
- sortColumn = SortColumn.valueOf(column);
+ sortColumn = SortColumn.valueOf(column);
} catch (Exception e) {
sortColumn = SortColumn.None;
}
@@ -158,6 +159,23 @@
}
/**
+ * Gets the query column.
+ *
+ * @param column the column
+ *
+ * @return the query column
+ */
+ private SearchColumn getQueryColumn(String column) {
+ SearchColumn searchColumn;
+ try {
+ searchColumn = SearchColumn.valueOf(column);
+ } catch (Exception e) {
+ searchColumn = SearchColumn.AllFields;
+ }
+ return searchColumn;
+ }
+
+ /**
* Gets the order.
*
* @param ascending the ascending
@@ -174,17 +192,18 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#findFullText(java.lang.String, java.lang.String, boolean, int, int, int)
*/
- public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count,
- String column, boolean ascending) throws SimExplorerException {
- return getStorageEngine().findFullText(token, query, onlyLatest, indexStart, count, getColumn(column),
- getOrder(ascending));
+ public MetaData[] findFullText(String token, String query, String queryColumn, boolean onlyLatest, int indexStart,
+ int count, String column, boolean ascending) throws SimExplorerException {
+ return getStorageEngine().findFullText(token, query, getQueryColumn(queryColumn), onlyLatest, indexStart,
+ count, getSortColumn(column), getOrder(ascending));
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.service.StorageService#findFullTextCount(java.lang.String, java.lang.String, boolean)
*/
- public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerException {
- return getStorageEngine().findFullTextCount(token, query, onlyLatest);
+ public int findFullTextCount(String token, String query, String queryColumn, boolean onlyLatest)
+ throws SimExplorerException {
+ return getStorageEngine().findFullTextCount(token, query, getQueryColumn(queryColumn), onlyLatest);
}
/* (non-Javadoc)
@@ -201,7 +220,7 @@
public MetaData[] findApplications(String token, boolean onlyLatest, int start, int count, String column,
boolean ascending) throws SimExplorerException {
return getStorageEngine().findElementsByType(token, ExplorationApplication.class.getCanonicalName(),
- onlyLatest, start, count, getColumn(column), getOrder(ascending));
+ onlyLatest, start, count, getSortColumn(column), getOrder(ascending));
}
/* (non-Javadoc)
@@ -386,7 +405,8 @@
List<LoggableElement> children = loggableElement.getChildren();
// TODO a valider : (fixbug: ajouter les attachments du le aussi)
for (Attachment attachment : loggableElement.getAttachments()) {
- files.put(FILE_DATA_PREFIX + FOLDER_SEPARATOR + attachment.getUniqueId(), getStorageEngine().retrieveData(token, loggableElement.getMetaData(), attachment));
+ files.put(FILE_DATA_PREFIX + FOLDER_SEPARATOR + attachment.getUniqueId(), getStorageEngine().retrieveData(
+ token, loggableElement.getMetaData(), attachment));
}
for (LoggableElement child : children) {
List<Attachment> attachments = child.getAttachments();
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -34,6 +34,7 @@
import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
import fr.cemagref.simexplorer.is.security.credentials.CredentialManager;
import fr.cemagref.simexplorer.is.security.entities.Permission;
+import fr.cemagref.simexplorer.is.storage.SearchColumn;
import fr.cemagref.simexplorer.is.storage.SortColumn;
import fr.cemagref.simexplorer.is.storage.SortOrder;
@@ -101,11 +102,11 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#findFullText(java.lang.String, java.lang.String, boolean, int, int, int)
*/
@Override
- public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count,
- SortColumn column, SortOrder sortOrder) throws SimExplorerException {
+ public MetaData[] findFullText(String token, String query, SearchColumn searchColumn, boolean onlyLatest,
+ int indexStart, int count, SortColumn column, SortOrder sortOrder) throws SimExplorerException {
String userFilter = getUserFilter(token);
- List<MetaData> elements = database.findElementsByContentSearch(query, onlyLatest, indexStart, count, column,
- sortOrder, userFilter);
+ List<MetaData> elements = database.findElementsByContentSearch(query, searchColumn, onlyLatest, indexStart,
+ count, column, sortOrder, userFilter);
return convertList(elements);
}
@@ -113,9 +114,10 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#findFullTextCount(java.lang.String, java.lang.String, boolean)
*/
@Override
- public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerException {
+ public int findFullTextCount(String token, String query, SearchColumn searchColumn, boolean onlyLatest)
+ throws SimExplorerException {
String userFilter = getUserFilter(token);
- return database.findElementsByContentSearchCount(query, onlyLatest, userFilter);
+ return database.findElementsByContentSearchCount(query, searchColumn, onlyLatest, userFilter);
}
/**
Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SearchColumn.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SearchColumn.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SearchColumn.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -0,0 +1,59 @@
+/*
+* ##% Copyright (C) 2008 Code Lutin, Gabriel Landais
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+* ##% */
+package fr.cemagref.simexplorer.is.storage;
+
+import fr.cemagref.simexplorer.is.storage.database.DatabaseConstants;
+
+/**
+ * The Enum SearchColumn.
+ */
+public enum SearchColumn {
+
+ /** The All fields. */
+ AllFields(DatabaseConstants.KEY_SEARCHABLE_CONTENT),
+
+ /** The Name. */
+ Name(DatabaseConstants.KEY_SEARCHABLE_CONTENT),
+
+ /** The Description. */
+ Description(DatabaseConstants.KEY_SEARCHABLE_CONTENT),
+
+ /** The Descriptors. */
+ Descriptors(DatabaseConstants.KEY_SEARCHABLE_CONTENT);
+
+ /** The column. */
+ private String column;
+
+ /**
+ * Gets the column.
+ *
+ * @return the column
+ */
+ public String getColumn() {
+ return column;
+ }
+
+ /**
+ * Instantiates a new searchable column.
+ *
+ * @param column the column
+ */
+ private SearchColumn(String column) {
+ this.column = column;
+ }
+}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SortColumn.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SortColumn.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SortColumn.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -10,17 +10,17 @@
public enum SortColumn {
/** None. */
None("", 0),
- /** The Date. */
+ /** The Id. */
uuid(DatabaseConstants.KEY_UUID, SortField.STRING),
- /** The Date. */
+ /** The Version. */
version(DatabaseConstants.KEY_VERSION, SortField.STRING),
- /** The Date. */
+ /** The Name. */
name(DatabaseConstants.KEY_NAME, SortField.STRING),
- /** The Date. */
+ /** The Description. */
description(DatabaseConstants.KEY_DESCRIPTION, SortField.STRING),
/** The Date. */
creationDate(DatabaseConstants.KEY_CREATIONDATE, SortField.LONG),
- /** The Date. */
+ /** The Class name. */
elementClass(DatabaseConstants.KEY_CLASSNAME, SortField.STRING);
/** The column. */
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -27,6 +27,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
+import fr.cemagref.simexplorer.is.storage.SearchColumn;
import fr.cemagref.simexplorer.is.storage.SortColumn;
import fr.cemagref.simexplorer.is.storage.SortOrder;
@@ -170,19 +171,21 @@
* @param start Index of first element returned
* @param count Number of elements to return
* @param sortOrder the order
- * @param column the column
+ * @param sortColumn the sort column
+ * @param userFilter the user filter
*
* @return Element list
*
* @throws SimExplorerException the sim explorer storage exception
*/
public abstract List<MetaData> findElementsByProperties(Map<String, String> properties, int start, int count,
- SortColumn column, SortOrder sortOrder, String userFilter) throws SimExplorerException;
+ SortColumn sortColumn, SortOrder sortOrder, String userFilter) throws SimExplorerException;
/**
* Retrieve element count specific properties.
*
* @param properties Matching properties needed
+ * @param userFilter the user filter
*
* @return Number of elements fund
*
@@ -215,16 +218,16 @@
* @param onlyLatest Only latest elements
* @param start Start index
* @param count Number of documents
- * @param column the column
* @param sortOrder the sort order
+ * @param sortColumn the sort column
*
* @return Element list
*
* @throws SimExplorerException the sim explorer storage exception
*/
- public List<MetaData> findElementsByType(String type, boolean onlyLatest, int start, int count, SortColumn column,
+ public List<MetaData> findElementsByType(String type, boolean onlyLatest, int start, int count, SortColumn sortColumn,
SortOrder sortOrder) throws SimExplorerException {
- return findElementsByType(type, onlyLatest, start, count, column, sortOrder, null);
+ return findElementsByType(type, onlyLatest, start, count, sortColumn, sortOrder, null);
}
/**
@@ -234,17 +237,17 @@
* @param onlyLatest the only latest
* @param start the start
* @param count the count
- * @param column the column
* @param sortOrder the sort order
- * @param elementsVisible the elements visible
+ * @param sortColumn the sort column
+ * @param user the user
*
* @return the list< meta data>
*
* @throws SimExplorerException the sim explorer exception
*/
- public List<MetaData> findElementsByType(String type, boolean onlyLatest, int start, int count, SortColumn column,
+ public List<MetaData> findElementsByType(String type, boolean onlyLatest, int start, int count, SortColumn sortColumn,
SortOrder sortOrder, String user) throws SimExplorerException {
- return findElementsByProperties(getPropertiesByType(type, onlyLatest), start, count, column, sortOrder, user);
+ return findElementsByProperties(getPropertiesByType(type, onlyLatest), start, count, sortColumn, sortOrder, user);
}
/**
@@ -284,15 +287,17 @@
* @param onlyLatest the only latest
* @param start Index of first element returned
* @param count Number of elements to return
- * @param column the column
* @param sortOrder the sort order
+ * @param searchColumn the search column
+ * @param sortColumn the sort column
+ * @param userFilter the user filter
*
* @return Element list
*
* @throws SimExplorerException the sim explorer storage exception
*/
- public abstract List<MetaData> findElementsByContentSearch(String queryText, boolean onlyLatest, int start,
- int count, SortColumn column, SortOrder sortOrder, String userFilter) throws SimExplorerException;
+ public abstract List<MetaData> findElementsByContentSearch(String queryText, SearchColumn searchColumn, boolean onlyLatest, int start,
+ int count, SortColumn sortColumn, SortOrder sortOrder, String userFilter) throws SimExplorerException;
/**
* Find elements by content search.
@@ -301,16 +306,17 @@
* @param onlyLatest the only latest
* @param start the start
* @param count the count
- * @param column the column
* @param sortOrder the sort order
+ * @param searchColumn the search column
+ * @param sortColumn the sort column
*
* @return the list< meta data>
*
* @throws SimExplorerException the sim explorer exception
*/
- public List<MetaData> findElementsByContentSearch(String queryText, boolean onlyLatest, int start, int count,
- SortColumn column, SortOrder sortOrder) throws SimExplorerException {
- return findElementsByContentSearch(queryText, onlyLatest, start, count, column, sortOrder, null);
+ public List<MetaData> findElementsByContentSearch(String queryText, SearchColumn searchColumn, boolean onlyLatest, int start, int count,
+ SortColumn sortColumn, SortOrder sortOrder) throws SimExplorerException {
+ return findElementsByContentSearch(queryText, searchColumn, onlyLatest, start, count, sortColumn, sortOrder, null);
}
/**
@@ -318,12 +324,14 @@
*
* @param queryText Searched text
* @param onlyLatest the only latest
+ * @param userFilter the user filter
+ * @param searchColumn the search column
*
* @return Number of elements fund
*
* @throws SimExplorerException the sim explorer storage exception
*/
- public abstract int findElementsByContentSearchCount(String queryText, boolean onlyLatest, String userFilter)
+ public abstract int findElementsByContentSearchCount(String queryText, SearchColumn searchColumn, boolean onlyLatest, String userFilter)
throws SimExplorerException;
/**
@@ -331,13 +339,14 @@
*
* @param queryText the query text
* @param onlyLatest the only latest
+ * @param searchColumn the search column
*
* @return the int
*
* @throws SimExplorerException the sim explorer exception
*/
- public int findElementsByContentSearchCount(String queryText, boolean onlyLatest) throws SimExplorerException {
- return findElementsByContentSearchCount(queryText, onlyLatest, null);
+ public int findElementsByContentSearchCount(String queryText, SearchColumn searchColumn, boolean onlyLatest) throws SimExplorerException {
+ return findElementsByContentSearchCount(queryText, searchColumn, onlyLatest, null);
}
/**
@@ -345,7 +354,8 @@
*
* @param userFilter the user filter
* @param visibleItems the visible items
- * @throws SimExplorerTechnicalException
+ *
+ * @throws SimExplorerTechnicalException the sim explorer technical exception
*/
public abstract void updateFilter(String userFilter, Collection<String> visibleItems) throws SimExplorerTechnicalException;
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -44,7 +44,6 @@
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Filter;
-import org.apache.lucene.search.HitCollector;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
@@ -61,6 +60,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
+import fr.cemagref.simexplorer.is.storage.SearchColumn;
import fr.cemagref.simexplorer.is.storage.SortColumn;
import fr.cemagref.simexplorer.is.storage.SortOrder;
import fr.cemagref.simexplorer.is.storage.database.Database;
@@ -622,11 +622,11 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#findElementsByContentSearchCount(java.lang.String, boolean)
*/
@Override
- public int findElementsByContentSearchCount(String queryText, boolean onlyLatest, String userFilter)
+ public int findElementsByContentSearchCount(String queryText, SearchColumn column, boolean onlyLatest, String userFilter)
throws SimExplorerException {
Query query;
try {
- query = getQueryByContentSearch(queryText, onlyLatest);
+ query = getQueryByContentSearch(queryText, column, onlyLatest);
} catch (ParseException e) {
throw new SimExplorerTechnicalException(e);
}
@@ -656,11 +656,11 @@
* @see fr.cemagref.simexplorer.is.storage.database.Database#findElementsByContentSearch(java.lang.String, boolean, int, int, int)
*/
@Override
- public List<MetaData> findElementsByContentSearch(String queryText, boolean onlyLatest, int start, int count,
- SortColumn column, SortOrder sortOrder, String userFilter) throws SimExplorerException {
+ public List<MetaData> findElementsByContentSearch(String queryText, SearchColumn searchColumn, boolean onlyLatest, int start, int count,
+ SortColumn sortColumn, SortOrder sortOrder, String userFilter) throws SimExplorerException {
Query query;
try {
- query = getQueryByContentSearch(queryText, onlyLatest);
+ query = getQueryByContentSearch(queryText, searchColumn, onlyLatest);
} catch (ParseException e) {
throw new SimExplorerTechnicalException(e);
}
@@ -672,7 +672,7 @@
// Get current searcher instance
Searcher searcher = getSearcher();
try {
- hits = filterSearch(searcher, query, userFilter, getSortDate(column, sortOrder));
+ hits = filterSearch(searcher, query, userFilter, getSortDate(sortColumn, sortOrder));
// Convert hits to elements
result = convertHitsToElements(hits, start, count);
} finally {
@@ -725,12 +725,12 @@
*
* @throws ParseException the parse exception
*/
- private Query getQueryByContentSearch(String queryText, boolean onlyLatest) throws ParseException {
+ private Query getQueryByContentSearch(String queryText, SearchColumn column, boolean onlyLatest) throws ParseException {
Query query;
// Create an analyzer for query parsing
Analyzer analyzer = new SimpleAnalyzer();
// Create an parser to handle query
- QueryParser parser = new QueryParser(KEY_SEARCHABLE_CONTENT, analyzer);
+ QueryParser parser = new QueryParser(column.getColumn(), analyzer);
// Parse query
Query searchQuery = parser.parse(queryText);
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -27,6 +27,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+import fr.cemagref.simexplorer.is.storage.SearchColumn;
import fr.cemagref.simexplorer.is.storage.SortColumn;
import fr.cemagref.simexplorer.is.storage.SortOrder;
@@ -227,12 +228,13 @@
* @param query the query
* @param onlyLatest the only latest
* @param token the token
+ * @param searchColumn the search column
*
* @return the int
*
* @throws SimExplorerException the sim explorer storage exception
*/
- public abstract int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerException;
+ public abstract int findFullTextCount(String token, String query, SearchColumn searchColumn, boolean onlyLatest) throws SimExplorerException;
/**
* Retrieve list of items corresponding to query.
@@ -242,15 +244,16 @@
* @param indexStart the index start
* @param count the count
* @param token the token
- * @param column the column
* @param sortOrder the sort order
+ * @param searchColumn the search column
+ * @param sortColumn the sort column
*
* @return the meta data[]
*
* @throws SimExplorerException the sim explorer storage exception
*/
- public abstract MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count,
- SortColumn column, SortOrder sortOrder) throws SimExplorerException;
+ public abstract MetaData[] findFullText(String token, String query, SearchColumn searchColumn, boolean onlyLatest, int indexStart, int count,
+ SortColumn sortColumn, SortOrder sortOrder) throws SimExplorerException;
/**
* Retrieve list of items of type wanted.
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -33,6 +33,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
+import fr.cemagref.simexplorer.is.storage.SearchColumn;
import fr.cemagref.simexplorer.is.storage.SortColumn;
import fr.cemagref.simexplorer.is.storage.SortOrder;
import fr.cemagref.simexplorer.is.storage.attachment.AttachmentHandler;
@@ -278,16 +279,16 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findFullTextCount(java.lang.String, boolean)
*/
- public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerException {
- return database.findElementsByContentSearchCount(query, onlyLatest);
+ public int findFullTextCount(String token, String query, SearchColumn searchColumn, boolean onlyLatest) throws SimExplorerException {
+ return database.findElementsByContentSearchCount(query, searchColumn, onlyLatest);
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findFullText(java.lang.String, boolean, int, int, int)
*/
- public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count,
+ public MetaData[] findFullText(String token, String query, SearchColumn searchColumn, boolean onlyLatest, int indexStart, int count,
SortColumn column, SortOrder sortOrder) throws SimExplorerException {
- List<MetaData> elements = database.findElementsByContentSearch(query, onlyLatest, indexStart, count, column,
+ List<MetaData> elements = database.findElementsByContentSearch(query, searchColumn, onlyLatest, indexStart, count, column,
sortOrder);
return convertList(elements);
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseLoadMassTestCase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseLoadMassTestCase.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseLoadMassTestCase.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -27,6 +27,7 @@
import junit.framework.TestCase;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.storage.MetaDataGenerator;
+import fr.cemagref.simexplorer.is.storage.SearchColumn;
import fr.cemagref.simexplorer.is.storage.SortColumn;
import fr.cemagref.simexplorer.is.storage.SortOrder;
import fr.cemagref.simexplorer.is.storage.database.Database;
@@ -61,8 +62,7 @@
/**
* Generate string.
*
- * @param length
- * the length
+ * @param length the length
*
* @return the string
*/
@@ -101,8 +101,7 @@
/**
* Instantiates a new lucene database load mass test case.
*
- * @param name
- * the name
+ * @param name the name
*/
public LuceneDatabaseLoadMassTestCase(String name) {
super(name);
@@ -132,8 +131,7 @@
/**
* Test mass insert.
*
- * @throws Exception
- * the exception
+ * @throws Exception the exception
*/
public void testMassInsert() throws Exception {
database.open(true);
@@ -171,12 +169,9 @@
Date end = new Date();
long time = end.getTime() - begin.getTime();
- System.out.println("Insert " + i + " : Time taken : " + time
- + "ms");
+ System.out.println("Insert " + i + " : Time taken : " + time + "ms");
double timePerElement = time / (4 * i);
- System.out.println("Insert " + i
- + " : Time taken per element : " + timePerElement
- + "ms");
+ System.out.println("Insert " + i + " : Time taken per element : " + timePerElement + "ms");
System.out.println("Content size : " + contentSize);
}
@@ -188,16 +183,14 @@
long time = end.getTime() - begin.getTime();
System.out.println("Insert : Time taken : " + time + "ms");
double timePerElement = time / (4 * c);
- System.out.println("Insert : Time taken per element : "
- + timePerElement + "ms");
+ System.out.println("Insert : Time taken per element : " + timePerElement + "ms");
System.out.println("Content size : " + contentSize);
}
/**
* Test mass search paginated.
*
- * @throws Exception
- * the exception
+ * @throws Exception the exception
*/
public void testMassSearchPaginated() throws Exception {
database.open();
@@ -209,25 +202,23 @@
for (int i = 0; i < csearch; i++) {
String key = randomstrings[r.nextInt(randomstrings.length)] + "*";
- int count = database.findElementsByContentSearchCount(key, false);
+ int count = database.findElementsByContentSearchCount(key, SearchColumn.AllFields, false);
System.out.println(key + " : " + count);
int start = count / 2;
int length = Math.min(200, Math.min(count, Math.max(1, count / 4)));
- List<MetaData> metaDatas = database.findElementsByContentSearch(key,
- false, start, length, SortColumn.None, SortOrder.Ascending);
+ List<MetaData> metaDatas = database.findElementsByContentSearch(key, SearchColumn.AllFields, false, start,
+ length, SortColumn.None, SortOrder.Ascending);
- System.out.println(key + " (" + start + " " + length + ") : "
- + metaDatas.size());
+ System.out.println(key + " (" + start + " " + length + ") : " + metaDatas.size());
}
Date end = new Date();
long time = end.getTime() - begin.getTime();
System.out.println("Search : Time taken : " + time + "ms");
double timePerElement = time / csearch;
- System.out.println("Search : Time taken per element : "
- + timePerElement + "ms");
+ System.out.println("Search : Time taken per element : " + timePerElement + "ms");
}
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseTestCase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseTestCase.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/test/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabaseTestCase.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -32,6 +32,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.storage.MetaDataGenerator;
+import fr.cemagref.simexplorer.is.storage.SearchColumn;
import fr.cemagref.simexplorer.is.storage.database.Database;
import fr.cemagref.simexplorer.is.storage.util.Config;
@@ -41,8 +42,7 @@
public class LuceneDatabaseTestCase extends TestCase {
/** The Constant log. */
- private static final Log log = LogFactory
- .getLog(LuceneDatabaseTestCase.class);
+ private static final Log log = LogFactory.getLog(LuceneDatabaseTestCase.class);
/** The database. */
private Database database;
@@ -77,8 +77,7 @@
/**
* Test insert element get element.
*
- * @throws Exception
- * the exception
+ * @throws Exception the exception
*/
public void testInsertElementGetElement() throws Exception {
MetaData me = mdg.generateMetaDataEntity();
@@ -93,16 +92,14 @@
/**
* Test index add find elements by content search.
*
- * @throws Exception
- * the exception
+ * @throws Exception the exception
*/
public void testIndexAddFindElementsByContentSearch() throws Exception {
MetaData me = mdg.generateMetaDataEntity();
String keyphrase = Long.toHexString(r.nextLong());
- StringReader reader = new StringReader("ogijeriog ergijergioj "
- + keyphrase + " egiojergij ergijerogij");
+ StringReader reader = new StringReader("ogijeriog ergijergioj " + keyphrase + " egiojergij ergijerogij");
List<Reader> readers = new ArrayList<Reader>();
readers.add(reader);
@@ -110,8 +107,7 @@
database.insertElement(me, readers);
database.commit();
- int mesCount = database.findElementsByContentSearchCount(keyphrase,
- true);
+ int mesCount = database.findElementsByContentSearchCount(keyphrase, SearchColumn.AllFields, true);
assertEquals(1, mesCount);
}
@@ -119,8 +115,7 @@
/**
* Test get versions.
*
- * @throws Exception
- * the exception
+ * @throws Exception the exception
*/
public void testGetVersions() throws Exception {
MetaData[] mes = mdg.generateVersionnedMetaDataEntity();
@@ -141,8 +136,7 @@
/**
* Test find elements by id.
*
- * @throws Exception
- * the exception
+ * @throws Exception the exception
*/
public void testFindElementsById() throws Exception {
MetaData[] mes = mdg.generateVersionnedMetaDataEntity();
@@ -151,16 +145,14 @@
}
database.commit();
- List<MetaData> elements = database.findElementsById(mes[0].getUuid(),
- false);
+ List<MetaData> elements = database.findElementsById(mes[0].getUuid(), false);
assertEquals(elements.size(), mes.length);
}
/**
* Test find elements by properties.
*
- * @throws Exception
- * the exception
+ * @throws Exception the exception
*/
public void testFindElementsByProperties() throws Exception {
MetaData me = mdg.generateMetaDataEntity();
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/StorageServiceHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/StorageServiceHelper.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/StorageServiceHelper.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -83,7 +83,7 @@
if (query == null || query.isEmpty()) {
size = service.findApplicationsCount(token, onlyLatest);
} else {
- size = service.findFullTextCount(token, query, onlyLatest);
+ size = service.findFullTextCount(token, query, "", onlyLatest);
}
return size;
} catch (SimExplorerException e) {
@@ -110,7 +110,7 @@
if (query == null || query.isEmpty()) {
data = service.findApplications(token, onlyLatest, (int) newFirstIndex, width, column, ascending);
} else {
- data = service.findFullText(token, query, onlyLatest, (int) newFirstIndex, width, column, ascending);
+ data = service.findFullText(token, query, "", onlyLatest, (int) newFirstIndex, width, column, ascending);
}
return data;
} catch (SimExplorerException e) {
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 09:07:57 UTC (rev 1226)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 09:30:34 UTC (rev 1227)
@@ -64,7 +64,7 @@
if (query == null) {
result = RemoteStorageService.getStorageService().findApplicationsCount(token, true);
} else {
- result = RemoteStorageService.getStorageService().findFullTextCount(token, query, false);
+ result = RemoteStorageService.getStorageService().findFullTextCount(token, query, "", false);
}
} catch (SimExplorerException e) {
throw new RuntimeException(e);
@@ -102,7 +102,7 @@
entities = RemoteStorageService.getStorageService().findApplications(token, true, startIndex,
1 + endIndex - startIndex, sortColumn, ascending);
} else {
- entities = RemoteStorageService.getStorageService().findFullText(token, query, false, startIndex,
+ entities = RemoteStorageService.getStorageService().findFullText(token, query, "", false, startIndex,
1 + endIndex - startIndex, sortColumn, ascending);
}
} catch (SimExplorerException e) {
1
0
25 Feb '08
Author: glandais
Date: 2008-02-25 09:07:57 +0000 (Mon, 25 Feb 2008)
New Revision: 1226
Modified:
trunk/simexplorer-is/src/site/fr/rst/todo.rst
Log:
MAJ todo
Modified: trunk/simexplorer-is/src/site/fr/rst/todo.rst
===================================================================
--- trunk/simexplorer-is/src/site/fr/rst/todo.rst 2008-02-24 23:20:32 UTC (rev 1225)
+++ trunk/simexplorer-is/src/site/fr/rst/todo.rst 2008-02-25 09:07:57 UTC (rev 1226)
@@ -5,12 +5,8 @@
Serveur central
===============
- - Bug descripteurs
- - Règles de gestion pour la suppression d'élément (élément liés, etc)
- Règles de gestion pour la suppression d'un groupe/utilisateur (affichage selon flag)
- dump H2, backup, restore
- - hash égaux <> éléments égaux
- - filtrage des listes selon les droits
Client léger
============
@@ -24,47 +20,23 @@
============
- Synchronisation d'un élément avec le serveur
- - Communication avec le serveur via SSL
- export, import
- configuration
- commandline : SimExplorerConfig(Config).addProperty(ConfigPropertyKey<T>, T) line: 633 -> setCurrentValue -> equals : Inet6AddressImpl.lookupAllHostAddr(String) -> recherche le host, prends du temps en mode déconnecté
-
+Fonctionnalités première réunion
+================================
- Fonctionnalités première réunion
- ================================
-
- - ( OK) Les administrateurs ne sont pas chargés de valider les AE soumises, contrairement à ce qui avait été compris dans un premier temps.
- - ( OK) Choix de lucene comme système de stockage des méta données et d'indexation
- - ( OK) Le serveur n'est pas chargé de lancer de simulation. Simexplorer SI s'occuper uniquement de stocker les données d'AE
-
* (NOK) Une API permet à l'application SimExplorer de stocker ses données
- - ( OK) Les CE et les DE ne sont jamais soumis individuellement, mais via une AE
-
- Gestion des droits :
- * ( OK) Les groupes ont des sous-groupes
- * ( OK) Un utilisateur peut appartenir à plusieurs groupes
- * ( OK) Une permission autorise un utilisateur/groupe la lecture/écriture/suppression d'un élément ainsi que la gestion des permissions de l'élément
- * ( OK) Un élément peut avoir plusieurs permissions
* (NOK) [1] Un élément possède un unique propriétaire
* (NOK) [1] L'utilisateur mettant à jour un élément en devient le propriétaire
- * ( OK) Toutes les versions d'un élément possède les mêmes permissions
- * ( OK) Un utilisateur peut toujours modifier et créer des permissions sur ses éléments
- * ( OK) Un utilisateur peut toujours ajouter une nouvelle AE
- * ( OK) Un utilisateur peut créer un sous élément à un élément uniquement si il a les droits d'écriture sur cet élément (ex : création/ajout d'un CE dans une AE)
- Application web
- * ( OK) Pas de création d'élément
- * ( OK) Fonction d'export d'une AE
* (NOK) [2] Recherche sur différents critères
- * ( OK) Import de librairie et d'AE, par deux champs distincts
- * ( OK) Affichage des groupes de chaque utilisateur dans la liste des utilisateurs
- * ( OK) Affichage des éléments dont l'utilisateur est propriétaire lors de l'édition d'un utilisateur
- * ( OK) Gestion des groupes enfants dans la page d'un groupe
- * ( OK) Gestion des utilisateurs d'un groupe dans la page d'un groupe
* (NOK) Création d'une page d'administration des droits :
+ Filtre sur le propriétaire via un utilisateur ou un groupe (pour les administrateurs)
@@ -73,22 +45,13 @@
- Versionnement
- * ( OK) Chaque enregistrement incrémente la version mineure (1.4 -> 1.5)
* Exceptions :
- + ( OK) Export sur le serveur : incrémentation de la version majeure (1.5 -> 2.0), renumérotation sur le client [3]
+ (NOK) [3] Export sur le serveur, après l'export d'un autre utilisateur : création d'un nouvel élément, en conservant l'historique de l'élément
- * ( OK) Export d'une AE sans parent : création d'une nouvelle AE sans historique
- * ( OK) Un utilisateur peut créer une nouvelle version sur un élément si et seulement si il a les droits d'écriture sur cet élément
- * ( OK) Soumission d'un élément par un utilisateur ne possédant pas les droits d'écriture (pour création d'une nouvelle version) : création d'un nouvel élément, en conservant l'historique de l'élément
* (NOK) [4] Suppression d'un CE ou de DE : suppression des AE associées (avec message de confirmation...)
* (NOK) [4] Suppression d'une AE : les CE et les DE orphelins (ie utilisés uniquement par cette AE) sont supprimés
- * Un utilisateur soumet une AE :
- + L'AE contient un CE qui devrait être soumis dans une nouvelle version (composant partagé par plusieurs AE)
- + L'utilisateur n'a pas les droits d'écriture pour ce CE sur le serveur
- + ( OK) -> un nouveau CE est créé et associé à cette AE
-Evolutions
-----------
+Notes
+-----
[1] Un élément peut avoir plusieurs propriétaires, une personne écrivant un nouvelle version est ajouté à cette liste -> OK
[2] Recherche full text sur tous les champs -> envoyer mail
@@ -96,11 +59,61 @@
[4] Un élément peut être supprimer si, et seulement si, l'élement n'est utilisé que par un autre élément au maximum, qui sera lui aussi supprimé selon les même rêgles.
Les éléments supprimés sont tous les enfants (quelque soit le niveau), qui n'ont qu'un seul parent.
+Fonctionnalités seconde réunion
+===============================
+
+Général
+-------
+
+ - (NOK) Mettre à jour les entêtes de fichier avec la bonne licence GPL
+ - ( OK) Decouper les métadonnées en deux parties : celles propres à SimExplorer et celles propres au SI.
+ - (NOK) [1] Refondre les entités afin de les générer depuis un modèle et gérer la
+sérialisation par outils comme JAXB/XStream, ceci dans un module propre
+(et non inclu avec les autres classes storage)
+
+Serveur
+-------
+
+ - (NOK) Suppression : La règle de gestion "suppression d'un CE/DE entraîne la
+suppression de l'AE (si elle est la seule à l'utiliser)" n'est pas
+correctement implémentée (suppression récursive de tous les parents si
+ils sont les seul à utiliser l'élément)
+ - ( OK) Vérification d'existence de l'élément dans la base : si les hash sont
+égaux, vérifier que les données sont effectivement égales
+ - ( OK) Filtrage des listes en fonction des droits (implémentation d'un
+Filter Lucene, conservation de l'indépendance du stockage et de la sécurité)
+ - (NOK) Paginer la recherche des éléments dont l'utilisateur est propriétaire
+ - ( OK) Gestion du tri sur toutes les colonnes pour les recherches
+ - (NOK) Créer les interfaces accessibles via d'autres protocoles que RMI
+(WebService, CORBA).
+ - (NOK) Remplacer l'invoker jrmp par http afin de permettre l'utilisation de
+proxy (voir http://www.jtips.info/index.php?title=JBoss/HttpInvoker et
+http.proxyHost, http.proxyPort, proxySet, http.proxy.username et
+http.proxy.password)
+
+Interface web
+-------------
+
+ - (NOK) Ecran de gestion des droits sur tous les éléments
+
+Interface Swing
+---------------
+
+ - Créer des méthodes afin de permettre à SimExplorer d'utiliser le SI comme
+
+Documentation
+-------------
+
+ - Documentation utilisateur
+ - Enoncer les règles métiers qui ont été développées dans un document
+indépendant du code (pas du Javadoc)
+ - Documentation développeur
+ - Documentation intégration (backup, dumps, configuration)
+
Reste à faire
=============
- Interface avec SimExplorer (API + appli swing comme plugin)
- - Document référence XSD + format du fichier zip
+ - Document format du fichier zip
- Types de fichiers joints (uniquement texte pour le moment), visualisation?
-
\ No newline at end of file
1
0