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
- 1607 discussions
r995 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util
by tchemit@users.labs.libre-entreprise.org 15 Feb '08
by tchemit@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: tchemit
Date: 2008-02-15 15:42:01 +0000 (Fri, 15 Feb 2008)
New Revision: 995
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ChangeI18nAbstractAction.java
Log:
fix bug : i18n was load after ui reload!
add comments
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ChangeI18nAbstractAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ChangeI18nAbstractAction.java 2008-02-15 15:41:33 UTC (rev 994)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ChangeI18nAbstractAction.java 2008-02-15 15:42:01 UTC (rev 995)
@@ -67,13 +67,17 @@
//TODO Should ask confirm from user since it will close ui, and re instanciate ui
getMainUI().getQuit().getAction().actionPerformed(new ActionEvent(this, ActionEvent.ACTION_FIRST, "cancel"));
- SimExplorer.reloadUI();
getContext().getConfig().setI18n(language, country);
+ // on doit initialiser la nouvelle locale avant de decharger les ui
+ // au cas ou un appel à une ui surviendrait et dans quel cas la locale
+ // serait toujours sur l'ancienne valeur ...
getContext().getConfig().initI18n();
-
+ // save config
+ SimExplorer.getContext().saveSafely();
+ // dispose all ui
+ SimExplorer.disposeUI();
+ // reload main ui
SimExplorer.launch();
-
- SimExplorer.getContext().saveSafely();
}
public boolean equalsLocale(LanguageEnum lang, CountryEnum countr) {
1
0
r994 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/entities
by tchemit@users.labs.libre-entreprise.org 15 Feb '08
by tchemit@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: tchemit
Date: 2008-02-15 15:41:33 +0000 (Fri, 15 Feb 2008)
New Revision: 994
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/entities/EntitiesAction.java
Log:
pass as private method, real private methods :)
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/entities/EntitiesAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/entities/EntitiesAction.java 2008-02-15 15:41:17 UTC (rev 993)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/entities/EntitiesAction.java 2008-02-15 15:41:33 UTC (rev 994)
@@ -66,11 +66,11 @@
return metaData!=null && accept(metaData.getType());
}
- public boolean accept(Class<?> klass) {
- return klass != null && classes.contains(klass);
+ private boolean accept(Class<?> klass) {
+ return classes.contains(klass);
}
- public boolean accept(String type) {
- return type != null && types.contains(type);
+ private boolean accept(String type) {
+ return types.contains(type);
}
}
1
0
r993 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui
by tchemit@users.labs.libre-entreprise.org 15 Feb '08
by tchemit@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: tchemit
Date: 2008-02-15 15:41:17 +0000 (Fri, 15 Feb 2008)
New Revision: 993
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java
Log:
suppress downloadXXX mehtods (use retrieve ones)
and importElement method
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java 2008-02-15 15:40:32 UTC (rev 992)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java 2008-02-15 15:41:17 UTC (rev 993)
@@ -18,6 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui;
+import com.healthmarketscience.rmiio.SerializableInputStream;
import fr.cemagref.simexplorer.is.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
@@ -32,6 +33,8 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URI;
import java.util.Properties;
@@ -119,30 +122,7 @@
}
}
- public static BufferedInputStream downloadElementFull(SimExplorerContext context, boolean remote, String uuid, String version) {
- try {
- InputStream stream = ((MockStorageServiceImpl) getService(context, remote)).downloadElementFull(context.getToken(), uuid, version);
- BufferedInputStream bis;
- bis = new BufferedInputStream(stream);
- return bis;
- } catch (SimExplorerServiceException e1) {
- throw new SimExplorerRuntimeException(e1);
- }
- }
-
- public static BufferedInputStream downloadElementData(SimExplorerContext context, boolean remote, String uuid, String version, Attachment attachment) {
- try {
- InputStream stream = ((MockStorageServiceImpl) getService(context, remote)).downloadElementData(context.getToken(), uuid, version, attachment);
- BufferedInputStream bis;
- bis = new BufferedInputStream(stream);
- return bis;
- } catch (SimExplorerServiceException e1) {
- throw new SimExplorerRuntimeException(e1);
- }
- }
-
-
public static BufferedInputStream retrieveElementFull(SimExplorerContext context, boolean remote, String uuid, String version) {
try {
InputStream stream = getService(context, remote).retrieveElementFull(context.getToken(), uuid, version);
@@ -165,6 +145,16 @@
}
}
+ public static void importElement(SimExplorerContext context, boolean remote, File file) {
+ try {
+ SerializableInputStream zipStream;
+ zipStream = new SerializableInputStream(new FileInputStream(file));
+ getService(context, remote).saveElement(context.getToken(), zipStream);
+ } catch (Exception e) {
+ throw new SimExplorerRuntimeException(e);
+ }
+ }
+
public static Version[] getVersions(SimExplorerContext context, boolean remote, String uuid) {
try {
Version[] result;
1
0
r992 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui
by tchemit@users.labs.libre-entreprise.org 15 Feb '08
by tchemit@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: tchemit
Date: 2008-02-15 15:40:32 +0000 (Fri, 15 Feb 2008)
New Revision: 992
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java
Log:
dispose importElement action ui
rename resetUI and reloadUI in disposeUI
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java 2008-02-15 15:04:15 UTC (rev 991)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java 2008-02-15 15:40:32 UTC (rev 992)
@@ -23,6 +23,7 @@
import fr.cemagref.simexplorer.is.ui.swing.SimExplorerTab;
import fr.cemagref.simexplorer.is.ui.swing.MainUIRefreshHelper;
import fr.cemagref.simexplorer.is.ui.swing.actions.ConnectAction;
+import fr.cemagref.simexplorer.is.ui.swing.actions.ImportAction;
import fr.cemagref.simexplorer.is.ui.swing.util.ErrorDialog;
import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
import fr.cemagref.simexplorer.is.ui.swing.model.SynchronizeTabModel;
@@ -78,7 +79,7 @@
errorDialog.setVisible(true);
}
- public static void reloadUI() {
+ public static void disposeUI() {
ui = null;
SimExplorerActionManager.resetCache();
ConfigUI.reloadUI();
@@ -89,7 +90,9 @@
// remove listeners on synchronize tab model
((SynchronizeTabModel) SimExplorerTab.synchronize.getModel()).removePropertyChangeListeners();
ConnectAction connectAction = (ConnectAction) SimExplorerActionManager.newAction("connect", (AbstractButton) null);
- connectAction.resetUI();
+ connectAction.disposeUI();
+ ImportAction importAction = (ImportAction) SimExplorerActionManager.newAction("importElement", (AbstractButton) null);
+ importAction.disposeUI();
}
/**
1
0
r991 - trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage
by glandais@users.labs.libre-entreprise.org 15 Feb '08
by glandais@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: glandais
Date: 2008-02-15 15:04:15 +0000 (Fri, 15 Feb 2008)
New Revision: 991
Modified:
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageSecurityException.java
Log:
serialVersionUID
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageSecurityException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageSecurityException.java 2008-02-15 15:02:34 UTC (rev 990)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageSecurityException.java 2008-02-15 15:04:15 UTC (rev 991)
@@ -23,6 +23,11 @@
public class SimExplorerStorageSecurityException extends SimExplorerStorageException {
/**
+ *
+ */
+ private static final long serialVersionUID = 862842493087651110L;
+
+ /**
* Instantiates a new sim explorer storage security exception.
*/
public SimExplorerStorageSecurityException() {
1
0
r990 - in trunk/simexplorer-is: simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage 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/attachment simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database simexplorer-is-storage/src
by glandais@users.labs.libre-entreprise.org 15 Feb '08
by glandais@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: glandais
Date: 2008-02-15 15:02:34 +0000 (Fri, 15 Feb 2008)
New Revision: 990
Added:
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageSecurityException.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageTechnicalException.java
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/StorageServiceCommon.java
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceHelper.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/SimExplorerStorageException.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.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
Log:
SimExplorerStorageTechnicalException creation
Hierarchy duplication on element copy
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-15 14:08:21 UTC (rev 989)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-15 15:02:34 UTC (rev 990)
@@ -79,14 +79,14 @@
* Update.
*
* @param token the token
- * @param oldVersion the old version
- * @param newVersion the new version
- * @param oldUuid the old uuid
- * @param deleteOldElement
+ * @param uuid the uuid
+ * @param version the version
+ * @param updatedElement the updated element
+ * @param justRemoveLatest just remove latest, if true, updatedElement has to be null
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- void update(String token, String oldUuid, Version oldVersion, MetaData newVersion, boolean deleteOldElement)
+ void update(String token, String uuid, Version version, MetaData updatedElement, boolean justRemoveLatest)
throws SimExplorerServiceException;
/**
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-15 14:08:21 UTC (rev 989)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-15 15:02:34 UTC (rev 990)
@@ -374,30 +374,41 @@
}
/* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.StorageService#update(java.lang.String, java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version, fr.cemagref.simexplorer.is.entities.metadata.MetaData)
+ * @see fr.cemagref.simexplorer.is.service.StorageService#update(java.lang.String, java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version, fr.cemagref.simexplorer.is.entities.metadata.MetaData, boolean)
*/
- public void update(String token, String oldUuid, Version oldVersion, MetaData newElement, boolean deleteOldElement)
+ public void update(String token, String uuid, Version version, MetaData updatedElement, boolean justRemoveLatest)
throws SimExplorerServiceException {
Map<Attachment, InputStream> attachments = new HashMap<Attachment, InputStream>();
try {
- MetaData oldMetaData = getStorageEngine().getMetadata(token, oldUuid, oldVersion);
+ MetaData elementToUpdate;
- InputStream oldXml = getStorageEngine().retrieveData(token, oldMetaData, getXMLAttachment());
+ MetaData currentMetaData = getStorageEngine().getMetadata(token, uuid, version);
+
+ if (justRemoveLatest) {
+ currentMetaData.setLatest(false);
+ elementToUpdate = currentMetaData;
+ } else {
+ elementToUpdate = updatedElement;
+ }
+ InputStream currentXml = getStorageEngine().retrieveData(token, currentMetaData, getXMLAttachment());
+
MetaDataFactory<MetaData> mdeFactory = MetaDataFactory.getFactory(MetaData.class);
- InputStream newXml = mdeFactory.modifyMedataElementStream(oldXml, newElement);
+ InputStream newXml = mdeFactory.modifyMedataElementStream(currentXml, elementToUpdate);
attachments.put(getXMLAttachment(), newXml);
- List<Attachment> realAttachments = oldMetaData.getAttachments();
+ List<Attachment> realAttachments = currentMetaData.getAttachments();
for (Attachment attachment : realAttachments) {
- attachments.put(attachment, getStorageEngine().retrieveData(token, oldMetaData, attachment));
+ attachments.put(attachment, getStorageEngine().retrieveData(token, currentMetaData, attachment));
}
- if (deleteOldElement) {
- getStorageEngine().deleteElement(token, oldUuid, oldVersion);
+ if (justRemoveLatest) {
+ getStorageEngine().deleteElement(token, uuid, version);
+ } else {
+ getStorageEngine().duplicateElementHierarchy(token, currentMetaData, elementToUpdate);
}
- getStorageEngine().saveElement(token, newElement, attachments);
+ getStorageEngine().saveElement(token, elementToUpdate, attachments);
getStorageEngine().commit();
} catch (Exception e) {
throw new SimExplorerServiceException(e);
@@ -474,9 +485,7 @@
// check if we have rights to create a subversion
if (getStorageEngine().canCreateSubVersion(token, metaData.getUuid())) {
// set previous as not being the latest one
- previousVersion.setLatest(false);
- // update item in database, replace previous version
- update(token, previousVersion.getUuid(), previousVersion.getVersion(), previousVersion, true);
+ update(token, previousVersion.getUuid(), previousVersion.getVersion(), null, true);
// Increment version only if needed
if (metaData.getVersion().compareTo(incrementVersion(previousVersion.getVersion())) <= 0) {
@@ -559,12 +568,11 @@
} else {
if (getStorageEngine().canCreateSubVersion(token, metaData.getUuid())) {
// trying to save a version with same hash but in superior version
+ // so we will copy versionToUpgrade to metaData.getVersion()
Version versionToUpgrade = previousVersion.getVersion().clone();
// set previous as not being the latest one
- previousVersion.setLatest(false);
- // update item in database, replace previous version
- update(token, previousVersion.getUuid(), previousVersion.getVersion(), previousVersion, true);
+ update(token, previousVersion.getUuid(), previousVersion.getVersion(), null, true);
// update already stored element with element being saved version
previousVersion.setLatest(true);
Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceHelper.java 2008-02-15 14:08:21 UTC (rev 989)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceHelper.java 2008-02-15 15:02:34 UTC (rev 990)
@@ -57,8 +57,7 @@
// fromElement has to be updated
if (!toElement.getUuid().equals(uuid) || !toElement.getVersion().equals(Version.valueOf(version))) {
MetaData previousVersion = fromService.getMetadata(token, uuid, version);
- previousVersion.setLatest(false);
- fromService.update(token, previousVersion.getUuid(), previousVersion.getVersion(), previousVersion, true);
+ fromService.update(token, previousVersion.getUuid(), previousVersion.getVersion(), null, true);
// Update element in source service, from what remote service returns on export
toElement.setLatest(true);
Added: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageSecurityException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageSecurityException.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageSecurityException.java 2008-02-15 15:02:34 UTC (rev 990)
@@ -0,0 +1,60 @@
+/*
+* ##% 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;
+
+/**
+ * The Class SimExplorerStorageSecurityException.
+ */
+public class SimExplorerStorageSecurityException extends SimExplorerStorageException {
+
+ /**
+ * Instantiates a new sim explorer storage security exception.
+ */
+ public SimExplorerStorageSecurityException() {
+ super();
+ }
+
+ /**
+ * Instantiates a new sim explorer storage security exception.
+ *
+ * @param message the message
+ */
+ public SimExplorerStorageSecurityException(String message) {
+ super(message);
+ }
+
+ /**
+ * Instantiates a new sim explorer storage security exception.
+ *
+ * @param cause the cause
+ */
+ public SimExplorerStorageSecurityException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Instantiates a new sim explorer storage security exception.
+ *
+ * @param message the message
+ * @param cause the cause
+ */
+ public SimExplorerStorageSecurityException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
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-15 14:08:21 UTC (rev 989)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-15 15:02:34 UTC (rev 990)
@@ -33,6 +33,7 @@
import fr.cemagref.simexplorer.is.security.credentials.CredentialManager;
import fr.cemagref.simexplorer.is.security.entities.Permission;
import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageSecurityException;
/**
* The Class StorageEngineSecuImpl.
@@ -55,7 +56,7 @@
if (permission.isCanAdmin()) {
super.deleteElement(token, uuid, version);
} else {
- throw new SimExplorerStorageException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerStorageSecurityException();
}
}
@@ -69,7 +70,7 @@
if (permission.isCanAdmin()) {
super.deleteElements(token, uuid);
} else {
- throw new SimExplorerStorageException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerStorageSecurityException();
}
}
@@ -124,7 +125,7 @@
if (permission.isCanRead()) {
mde = super.getMetadata(token, uuid, version);
} else {
- throw new SimExplorerStorageException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerStorageSecurityException();
}
return mde;
}
@@ -139,7 +140,7 @@
if (permission.isCanRead()) {
mde = super.getMetadata(token, uuid);
} else {
- throw new SimExplorerStorageException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerStorageSecurityException();
}
return mde;
}
@@ -154,7 +155,7 @@
if (permission.isCanRead()) {
versions = super.getVersions(token, uuid);
} else {
- throw new SimExplorerStorageException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerStorageSecurityException();
}
return versions;
}
@@ -170,7 +171,7 @@
if (permission.isCanRead()) {
stream = super.retrieveData(token, entity, attachment);
} else {
- throw new SimExplorerStorageException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerStorageSecurityException();
}
return stream;
}
@@ -198,7 +199,7 @@
super.saveElement(token, element, attachments);
credentialManager.saveElement(token, element.getUuid());
} else {
- throw new SimExplorerStorageException(_("simexplorer.service.security.norights"));
+ throw new SimExplorerStorageSecurityException();
}
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java 2008-02-15 14:08:21 UTC (rev 989)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java 2008-02-15 15:02:34 UTC (rev 990)
@@ -20,7 +20,7 @@
/**
* The Class SimExplorerStorageException.
*/
-public class SimExplorerStorageException extends Exception {
+public abstract class SimExplorerStorageException extends Exception {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 4405447107690074844L;
@@ -35,8 +35,7 @@
/**
* Instantiates a new sim explorer storage exception.
*
- * @param message
- * the message
+ * @param message the message
*/
public SimExplorerStorageException(String message) {
super(message);
@@ -45,8 +44,7 @@
/**
* Instantiates a new sim explorer storage exception.
*
- * @param cause
- * the cause
+ * @param cause the cause
*/
public SimExplorerStorageException(Throwable cause) {
super(cause);
@@ -55,10 +53,8 @@
/**
* Instantiates a new sim explorer storage exception.
*
- * @param message
- * the message
- * @param cause
- * the cause
+ * @param message the message
+ * @param cause the cause
*/
public SimExplorerStorageException(String message, Throwable cause) {
super(message, cause);
Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageTechnicalException.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageTechnicalException.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageTechnicalException.java 2008-02-15 15:02:34 UTC (rev 990)
@@ -0,0 +1,62 @@
+/*
+* ##% 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;
+
+/**
+ * The Class SimExplorerStorageTechnicalException.
+ */
+public class SimExplorerStorageTechnicalException extends SimExplorerStorageException {
+
+ private static final long serialVersionUID = 7182289381405452276L;
+
+ /**
+ * Instantiates a new sim explorer storage technical exception.
+ */
+ public SimExplorerStorageTechnicalException() {
+ super();
+ }
+
+ /**
+ * Instantiates a new sim explorer storage technical exception.
+ *
+ * @param message the message
+ */
+ public SimExplorerStorageTechnicalException(String message) {
+ super(message);
+ }
+
+ /**
+ * Instantiates a new sim explorer storage technical exception.
+ *
+ * @param cause the cause
+ */
+ public SimExplorerStorageTechnicalException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Instantiates a new sim explorer storage technical exception.
+ *
+ * @param message the message
+ * @param cause the cause
+ */
+ public SimExplorerStorageTechnicalException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java 2008-02-15 14:08:21 UTC (rev 989)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java 2008-02-15 15:02:34 UTC (rev 990)
@@ -32,6 +32,7 @@
import fr.cemagref.simexplorer.is.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageTechnicalException;
import fr.cemagref.simexplorer.is.storage.util.Config;
/**
@@ -107,7 +108,7 @@
try {
fis = new FileInputStream(getFile(entity, attachment, false));
} catch (FileNotFoundException e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
return fis;
}
@@ -121,7 +122,7 @@
try {
md5 = MD5.asHex(MD5.getHash(getFile(entity, attachment, false)));
} catch (Exception e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
return md5;
}
@@ -153,9 +154,9 @@
bout.flush();
} catch (FileNotFoundException e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
} catch (IOException e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
} finally {
closeStream(bout);
}
@@ -167,7 +168,7 @@
try {
fos.close();
} catch (IOException e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
}
}
@@ -181,7 +182,7 @@
// Simple delete on file
getFile(entity, attachment, false).delete();
} catch (Exception e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
}
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-15 14:08:21 UTC (rev 989)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-15 15:02:34 UTC (rev 990)
@@ -88,6 +88,15 @@
*/
public abstract void saveElementHierarchy(MetaData parent, MetaData child) throws SimExplorerStorageException;
+ /**
+ * Duplicate element hierarchy.
+ *
+ * @param fromElement the from element
+ * @param toElement the to element
+ * @throws SimExplorerStorageException
+ */
+ public abstract void duplicateElementHierarchy(MetaData fromElement, MetaData toElement) throws SimExplorerStorageException;
+
// Read
/**
@@ -290,4 +299,5 @@
*/
public abstract void deleteElement(String uuid, Version version) throws SimExplorerStorageException;
+
}
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-15 14:08:21 UTC (rev 989)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-15 15:02:34 UTC (rev 990)
@@ -60,6 +60,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageTechnicalException;
import fr.cemagref.simexplorer.is.storage.database.Database;
import fr.cemagref.simexplorer.is.storage.util.Config;
import fr.cemagref.simexplorer.is.storage.util.KeyValue;
@@ -199,7 +200,7 @@
commit();
}
} catch (IOException e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
}
}
@@ -217,7 +218,7 @@
}
resetReader();
} catch (IOException e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
searcherPool = null;
}
@@ -253,7 +254,7 @@
// Allows concurent access
synchedCommit();
} catch (IOException e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
}
@@ -271,7 +272,7 @@
writer.addDocument(document);
}
} catch (IOException e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
}
@@ -289,7 +290,7 @@
writer.addDocument(document);
}
} catch (IOException e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
}
@@ -314,7 +315,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
return result;
@@ -372,7 +373,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
return versions;
@@ -403,7 +404,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
// Return all elements parsed from documents fund
@@ -428,7 +429,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
// Return all elements parsed from documents fund
@@ -454,7 +455,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
// Return all elements parsed from documents fund
@@ -471,7 +472,7 @@
try {
query = getQueryByContentSearch(queryText, onlyLatest);
} catch (ParseException e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
int result = 0;
@@ -489,7 +490,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
return result;
@@ -523,7 +524,7 @@
try {
query = getQueryByContentSearch(queryText, onlyLatest);
} catch (ParseException e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
Set<MetaData> result = null;
@@ -541,7 +542,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
return result;
@@ -594,7 +595,7 @@
writer.deleteDocuments(term);
}
} catch (Exception e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
}
@@ -908,7 +909,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
return result;
}
@@ -929,4 +930,26 @@
return getAssociatedElements(mde, KEY_UUID_VERSION_PARENT, KEY_UUID_VERSION_CHILD);
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.storage.database.Database#duplicateElementHierarchy(fr.cemagref.simexplorer.is.entities.metadata.MetaData, fr.cemagref.simexplorer.is.entities.metadata.MetaData)
+ */
+ @Override
+ public void duplicateElementHierarchy(MetaData fromElement, MetaData toElement) throws SimExplorerStorageException {
+ // Delete element in db with term search
+ Term term = new Term(KEY_UUID_VERSION_PARENT, getUuidVersion(toElement.getUuid(), toElement.getVersion()));
+ try {
+ synchronized (writerSynchronizer) {
+ writer.deleteDocuments(term);
+ }
+ } catch (Exception e) {
+ throw new SimExplorerStorageTechnicalException(e);
+ }
+
+ Set<MetaData> elementsUsedByFrom = getElementsUsedBy(fromElement);
+
+ for (MetaData elementUsed : elementsUsedByFrom) {
+ saveElementHierarchy(toElement, elementUsed);
+ }
+ }
+
}
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-15 14:08:21 UTC (rev 989)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-15 15:02:34 UTC (rev 990)
@@ -81,6 +81,16 @@
throws SimExplorerStorageException;
/**
+ * Duplicate element hierarchy.
+ *
+ * @param token the token
+ * @param fromElement the from element
+ * @param toElement the to element
+ * @throws SimExplorerStorageException
+ */
+ public abstract void duplicateElementHierarchy(String token, MetaData fromElement, MetaData toElement) throws SimExplorerStorageException;
+
+ /**
* Can create sub version for element.
*
* @param token the token
@@ -319,4 +329,5 @@
*/
public abstract void deleteTempData(String id) throws SimExplorerStorageException;
+
}
\ No newline at end of file
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-15 14:08:21 UTC (rev 989)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-15 15:02:34 UTC (rev 990)
@@ -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.SimExplorerStorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageTechnicalException;
import fr.cemagref.simexplorer.is.storage.attachment.AttachmentHandler;
import fr.cemagref.simexplorer.is.storage.attachment.FileSystemAttachmentHandler;
import fr.cemagref.simexplorer.is.storage.database.Database;
@@ -120,7 +121,7 @@
Reader reader = attachment.getContentType().renderToText(content);
readers.add(reader);
} catch (Exception e) {
- throw new SimExplorerStorageException(e);
+ throw new SimExplorerStorageTechnicalException(e);
}
}
}
@@ -149,6 +150,11 @@
database.saveElementHierarchy(parent, child);
}
+ @Override
+ public void duplicateElementHierarchy(String token, MetaData fromElement, MetaData toElement) throws SimExplorerStorageException {
+ database.duplicateElementHierarchy(fromElement, toElement);
+ }
+
// Read
/* (non-Javadoc)
@@ -339,4 +345,5 @@
return true;
}
+
}
1
0
r989 - in trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web: grid pages services tools
by glandais@users.labs.libre-entreprise.org 15 Feb '08
by glandais@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: glandais
Date: 2008-02-15 14:08:21 +0000 (Fri, 15 Feb 2008)
New Revision: 989
Added:
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/MetaDataModelFactory.java
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/pages/ElementImport.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/ElementMetadata.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/AppModule.java
Log:
Display version in tables
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-15 13:15:27 UTC (rev 988)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-15 14:08:21 UTC (rev 989)
@@ -78,7 +78,7 @@
try {
if (query.equals("")) {
result = RemoteStorageService.getStorageService()
- .findApplicationsCount(token, false);
+ .findApplicationsCount(token, true);
} else {
result = RemoteStorageService.getStorageService()
.findFullTextCount(token, query, false);
@@ -123,7 +123,7 @@
try {
if (query.equals("")) {
entities = RemoteStorageService.getStorageService()
- .findApplications(token, false, startIndex,
+ .findApplications(token, true, startIndex,
1 + endIndex - startIndex, dateOrder);
} else {
entities = RemoteStorageService.getStorageService()
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java 2008-02-15 13:15:27 UTC (rev 988)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java 2008-02-15 14:08:21 UTC (rev 989)
@@ -49,6 +49,8 @@
* On success.
*
* @return the object
+ *
+ * @throws Exception the exception
*/
public Object onSuccess() throws Exception {
MetaData mde = null;
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-15 13:15:27 UTC (rev 988)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-15 14:08:21 UTC (rev 989)
@@ -17,8 +17,6 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.web.pages;
-import java.util.ArrayList;
-import java.util.List;
import java.util.StringTokenizer;
import org.apache.tapestry.ComponentResources;
@@ -33,6 +31,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource;
import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage;
+import fr.cemagref.simexplorer.is.ui.web.tools.MetaDataModelFactory;
/**
* The Class ElementList.
@@ -67,23 +66,7 @@
* Page loaded.
*/
void pageLoaded() {
- model = beanModelSource.create(MetaData.class, true, resources);
- List<String> wantedProperties = new ArrayList<String>();
- wantedProperties.add("type");
- wantedProperties.add("uuid");
- wantedProperties.add("name");
- wantedProperties.add("description");
- wantedProperties.add("version");
- wantedProperties.add("creationDate");
- List<String> properties = model.getPropertyNames();
- for (String property : properties) {
- if (!"creationDate".equals(property)) {
- model.get(property).sortable(false);
- }
- if (!wantedProperties.contains(property)) {
- model = model.remove(property);
- }
- }
+ model = MetaDataModelFactory.getMetaDataModel(beanModelSource, resources, true);
elementDataSource = new ElementDataSource(getToken());
}
@@ -99,8 +82,7 @@
/**
* Search query.
*
- * @param query
- * the query
+ * @param query the query
*/
public void searchQuery(String query) {
if (query == null || query.equals("")) {
@@ -134,8 +116,7 @@
/**
* On action from detail element.
*
- * @param context
- * the context
+ * @param context the context
*
* @return the object
*/
@@ -153,14 +134,10 @@
@Override
public String getWindowTitle() {
String title;
- if (elementDataSource.getQuery() != null
- && !elementDataSource.getQuery().equals("")) {
- title = getMessages().format(
- "simexplorer.ui.web.title.searchresults",
- elementDataSource.getQuery());
+ if (elementDataSource.getQuery() != null && !elementDataSource.getQuery().equals("")) {
+ title = getMessages().format("simexplorer.ui.web.title.searchresults", elementDataSource.getQuery());
} else {
- title = getMessages().get(
- "simexplorer.ui.web.title.applicationlist");
+ title = getMessages().get("simexplorer.ui.web.title.applicationlist");
}
return title;
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java 2008-02-15 13:15:27 UTC (rev 988)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java 2008-02-15 14:08:21 UTC (rev 989)
@@ -17,9 +17,6 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.web.pages;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.tapestry.ComponentResources;
import org.apache.tapestry.annotations.Retain;
import org.apache.tapestry.beaneditor.BeanModel;
@@ -30,6 +27,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
+import fr.cemagref.simexplorer.is.ui.web.tools.MetaDataModelFactory;
/**
* The Class ElementMetadata.
@@ -64,22 +62,7 @@
* Page loaded.
*/
void pageLoaded() {
- model = beanModelSource.create(MetaData.class, false, resources);
- List<String> wantedProperties = new ArrayList<String>();
- wantedProperties.add("type");
- wantedProperties.add("uuid");
- wantedProperties.add("name");
- wantedProperties.add("description");
- wantedProperties.add("version");
- wantedProperties.add("creationDate");
- List<String> properties = model.getPropertyNames();
- for (String property : properties) {
- System.out.println(property);
- model.get(property).sortable(false);
- if (!wantedProperties.contains(property)) {
- model = model.remove(property);
- }
- }
+ model = MetaDataModelFactory.getMetaDataModel(beanModelSource, resources, false);
}
/**
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-15 13:15:27 UTC (rev 988)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/AppModule.java 2008-02-15 14:08:21 UTC (rev 989)
@@ -18,7 +18,6 @@
package fr.cemagref.simexplorer.is.ui.web.services;
import java.io.IOException;
-import java.math.BigDecimal;
import org.apache.tapestry.ioc.Configuration;
import org.apache.tapestry.ioc.MappedConfiguration;
@@ -31,7 +30,6 @@
import org.apache.tapestry.services.RequestFilter;
import org.apache.tapestry.services.RequestHandler;
import org.apache.tapestry.services.Response;
-import org.apache.tapestry.services.ValueEncoderFactory;
import org.slf4j.Logger;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
@@ -69,18 +67,12 @@
}
/**
- * Contribute value encoder source.
+ * Contribute default data type analyzer.
*
* @param configuration the configuration
*/
- @SuppressWarnings("unchecked")
- public static void contributeValueEncoderSource(MappedConfiguration<Class, ValueEncoderFactory> configuration) {
- /*
- configuration.add(User.class, new GenericValueEncoderFactory<User>(
- new UserValueEncoder()));
- configuration.add(Group.class, new GenericValueEncoderFactory<Group>(
- new GroupValueEncoder()));
- */
+ public static void contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String> configuration) {
+ configuration.add(Version.class, "text");
}
/**
Added: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/MetaDataModelFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/MetaDataModelFactory.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/MetaDataModelFactory.java 2008-02-15 14:08:21 UTC (rev 989)
@@ -0,0 +1,74 @@
+/*
+* ##% 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.ui.web.tools;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.beaneditor.BeanModel;
+import org.apache.tapestry.services.BeanModelSource;
+
+import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+
+/**
+ * A factory for creating MetaDataModel objects.
+ */
+public class MetaDataModelFactory {
+
+ /**
+ * Instantiates a new meta data model factory.
+ */
+ protected MetaDataModelFactory() {
+ // ssssh
+ }
+
+ /**
+ * Gets the meta data model.
+ *
+ * @param beanModelSource the bean model source
+ * @param resources the resources
+ * @param dateSortable the date sortable
+ *
+ * @return the meta data model
+ */
+ public static BeanModel getMetaDataModel(BeanModelSource beanModelSource, ComponentResources resources,
+ boolean dateSortable) {
+ BeanModel model = beanModelSource.create(MetaData.class, false, resources);
+ List<String> wantedProperties = new ArrayList<String>();
+ wantedProperties.add("type");
+ wantedProperties.add("uuid");
+ wantedProperties.add("name");
+ wantedProperties.add("description");
+ wantedProperties.add("version");
+ wantedProperties.add("creationDate");
+ List<String> properties = model.getPropertyNames();
+ for (String property : properties) {
+ if (!dateSortable || !property.equals("creationDate")) {
+ model.get(property).sortable(false);
+ } else {
+ model.get(property).sortable(true);
+ }
+ if (!wantedProperties.contains(property)) {
+ model = model.remove(property);
+ }
+ }
+ return model;
+ }
+
+}
1
0
r988 - in trunk/simexplorer-is/simexplorer-is-web/src: java/fr/cemagref/simexplorer/is/ui/web/pages java/fr/cemagref/simexplorer/is/ui/web/services main/webapp main/webapp/WEB-INF
by glandais@users.labs.libre-entreprise.org 15 Feb '08
by glandais@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: glandais
Date: 2008-02-15 13:15:27 +0000 (Fri, 15 Feb 2008)
New Revision: 988
Modified:
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.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/main/webapp/ElementMetadata.tml
trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/WEB-INF/app.properties
trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/WEB-INF/app_fr.properties
Log:
Display hierarchy on metadata page
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java 2008-02-15 13:15:05 UTC (rev 987)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java 2008-02-15 13:15:27 UTC (rev 988)
@@ -19,7 +19,6 @@
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Comparator;
import java.util.List;
import org.apache.tapestry.annotations.Persist;
@@ -47,8 +46,7 @@
public void setup(String uuid, String version) {
super.setup(uuid, version);
try {
- versions = RemoteStorageService.getStorageService().getVersions(
- getToken(), uuid);
+ versions = RemoteStorageService.getStorageService().getVersions(getToken(), uuid);
} catch (Exception e) {
throw new SimExplorerWebException(e);
}
@@ -99,8 +97,7 @@
Arrays.sort(versions);
TreeNode rootNode = new TreeNode();
rootNode.setType(TreeNode.TYPE_FOLDER);
- rootNode.setColumns(generateStringArray(getMessages().get(
- "simexplorer.ui.web.history")));
+ rootNode.setColumns(generateStringArray(getMessages().get("simexplorer.ui.web.history")));
rootNode.setObject(new Version(""));
rootNode.setChildren(new ArrayList<TreeNode>());
for (Version version : versions) {
@@ -126,8 +123,7 @@
TreeNode parentNode = null;
for (TreeNode treeNode : nodes) {
if (getVersion(treeNode).getVersion(pos) != null
- && getVersion(treeNode).getVersion(pos).equals(
- version.getVersion(pos))) {
+ && getVersion(treeNode).getVersion(pos).equals(version.getVersion(pos))) {
parentNode = treeNode;
}
}
@@ -185,12 +181,10 @@
*/
private TreeNode generateLeaf(Version version) throws SimExplorerServiceException {
TreeNode node = new TreeNode();
- MetaData mde = RemoteStorageService.getStorageService().getMetadata(
- getToken(), getMetadata().getUuid(), version.toString());
- // FIXME date tostring
- node.setColumns(generateStringArray(mde.getVersion().toString(), mde
- .getDescription(), mde.getCreationDate().toString(), mde,
- false, "metadata", "export", "delete", "details"));
+ MetaData mde = RemoteStorageService.getStorageService().getMetadata(getToken(), getMetadata().getUuid(),
+ version.toString());
+ node.setColumns(generateStringArray(mde.getVersion().toString(), mde.getDescription(), DATE_FORMAT.format(mde
+ .getCreationDate()), mde, false, "metadata", "export", "delete", "details"));
node.setObject(mde.getVersion());
node.setType(TreeNode.TYPE_DOCUMENT);
return node;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java 2008-02-15 13:15:05 UTC (rev 987)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementMetadata.java 2008-02-15 13:15:27 UTC (rev 988)
@@ -17,11 +17,41 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.web.pages;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.annotations.Retain;
+import org.apache.tapestry.beaneditor.BeanModel;
+import org.apache.tapestry.ioc.annotations.Inject;
+import org.apache.tapestry.services.BeanModelSource;
+
+import de.hsofttec.t5components.annotations.SetterGetter;
+import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
+import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
+
/**
* The Class ElementMetadata.
*/
public class ElementMetadata extends ElementPageDetail {
+ /** The model. */
+ @Retain
+ private BeanModel model;
+
+ /** The bean model source. */
+ @Inject
+ private BeanModelSource beanModelSource;
+
+ /** The resources. */
+ @Inject
+ private ComponentResources resources;
+
+ /** The _element. */
+ @SetterGetter
+ private MetaData _element;
+
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle()
*/
@@ -30,4 +60,90 @@
return getMessages().get("simexplorer.ui.web.title.elementmetadata");
}
+ /**
+ * Page loaded.
+ */
+ void pageLoaded() {
+ model = beanModelSource.create(MetaData.class, false, resources);
+ List<String> wantedProperties = new ArrayList<String>();
+ wantedProperties.add("type");
+ wantedProperties.add("uuid");
+ wantedProperties.add("name");
+ wantedProperties.add("description");
+ wantedProperties.add("version");
+ wantedProperties.add("creationDate");
+ List<String> properties = model.getPropertyNames();
+ for (String property : properties) {
+ System.out.println(property);
+ model.get(property).sortable(false);
+ if (!wantedProperties.contains(property)) {
+ model = model.remove(property);
+ }
+ }
+ }
+
+ /**
+ * Gets the model.
+ *
+ * @return the model
+ */
+ public BeanModel getModel() {
+ return model;
+ }
+
+ /**
+ * Gets the elements used.
+ *
+ * @return the elements used
+ *
+ * @throws SimExplorerServiceException the sim explorer service exception
+ */
+ public MetaData[] getElementsUsed() throws SimExplorerServiceException {
+ return RemoteStorageService.getStorageService().getMetadatasUsed(getToken(), getMetadata().getUuid(),
+ getMetadata().getVersion().toString());
+ }
+
+ /**
+ * Gets the elements using.
+ *
+ * @return the elements using
+ *
+ * @throws SimExplorerServiceException the sim explorer service exception
+ */
+ public MetaData[] getElementsUsing() throws SimExplorerServiceException {
+ return RemoteStorageService.getStorageService().getMetadatasUsing(getToken(), getMetadata().getUuid(),
+ getMetadata().getVersion().toString());
+ }
+
+ /**
+ * Gets the detail element context.
+ *
+ * @return the detail element context
+ */
+ public String getDetailElementContext() {
+ return _element.getUuid() + "," + _element.getVersion();
+ }
+
+ /**
+ * On action from detail element used.
+ *
+ * @param context the context
+ *
+ * @return the object
+ */
+ public Object onActionFromDetailElementUsed(String context) {
+ return onDetails(context);
+ }
+
+ /**
+ * On action from detail element using.
+ *
+ * @param context the context
+ *
+ * @return the object
+ */
+ public Object onActionFromDetailElementUsing(String context) {
+ return onDetails(context);
+ }
+
}
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-15 13:15:05 UTC (rev 987)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java 2008-02-15 13:15:27 UTC (rev 988)
@@ -17,6 +17,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.web.pages;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -36,6 +37,9 @@
*/
public abstract class ElementPageDetail extends ElementPage {
+ /** The Constant DATE_FORMAT for formatting dates. */
+ public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss.SSS");
+
/** The resources. */
@Inject
private ComponentResources resources;
@@ -67,10 +71,8 @@
/**
* Prepare page.
*
- * @param page
- * the page
- * @param context
- * the context
+ * @param page the page
+ * @param context the context
*
* @return the object
*/
@@ -85,8 +87,7 @@
/**
* On export.
*
- * @param context
- * the context
+ * @param context the context
*
* @return the object
*/
@@ -97,8 +98,7 @@
/**
* On history.
*
- * @param context
- * the context
+ * @param context the context
*
* @return the object
*/
@@ -109,8 +109,7 @@
/**
* On delete.
*
- * @param context
- * the context
+ * @param context the context
*
* @return the object
*/
@@ -121,8 +120,7 @@
/**
* On rights.
*
- * @param context
- * the context
+ * @param context the context
*
* @return the object
*/
@@ -133,8 +131,7 @@
/**
* On details.
*
- * @param context
- * the context
+ * @param context the context
*
* @return the object
*/
@@ -145,8 +142,7 @@
/**
* On metadata.
*
- * @param context
- * the context
+ * @param context the context
*
* @return the object
*/
@@ -157,17 +153,13 @@
/**
* Generate string.
*
- * @param actionCaption
- * the action caption
- * @param action
- * the action
- * @param context
- * the context
+ * @param actionCaption the action caption
+ * @param action the action
+ * @param context the context
*
* @return the string
*/
- protected String generateString(String actionCaption, String action,
- String context) {
+ protected String generateString(String actionCaption, String action, String context) {
Link link = resources.createActionLink(action, false, context);
StringBuffer sb = new StringBuffer("");
sb.append("<a href=\"");
@@ -181,17 +173,13 @@
/**
* Generate string.
*
- * @param actionCaption
- * the action caption
- * @param action
- * the action
- * @param element
- * the element
+ * @param actionCaption the action caption
+ * @param action the action
+ * @param element the element
*
* @return the string
*/
- protected String generateString(String actionCaption, String action,
- MetaData element) {
+ protected String generateString(String actionCaption, String action, MetaData element) {
String context = element.getUuid() + "," + element.getVersion();
return generateString(actionCaption, action, context);
}
@@ -199,30 +187,25 @@
/**
* Generate actions.
*
- * @param element
- * the element
- * @param security
- * the security
- * @param actions
- * the actions
+ * @param element the element
+ * @param security the security
+ * @param actions the actions
*
* @return the string
*/
- private String generateActions(MetaData element, boolean security,
- String... actions) {
+ private String generateActions(MetaData element, boolean security, String... actions) {
StringBuilder sb = new StringBuilder("");
String res;
for (String anAction : actions) {
sb.append("<br>");
- sb.append(generateString(getMessages().get(
- "simexplorer.ui.web." + anAction + ".action"), anAction,
- element));
+ sb
+ .append(generateString(getMessages().get("simexplorer.ui.web." + anAction + ".action"), anAction,
+ element));
}
if (security) {
sb.append("<br>");
- sb.append(generateString(getMessages().get(
- "simexplorer.ui.web.rights.action"), "rights", element));
+ sb.append(generateString(getMessages().get("simexplorer.ui.web.rights.action"), "rights", element));
}
res = sb.substring(4);
@@ -232,23 +215,17 @@
/**
* Generate string array.
*
- * @param s1
- * the s1
- * @param s2
- * the s2
- * @param s3
- * the s3
- * @param element
- * the element
- * @param security
- * the security
- * @param actions
- * the actions
+ * @param s1 the s1
+ * @param s2 the s2
+ * @param s3 the s3
+ * @param element the element
+ * @param security the security
+ * @param actions the actions
*
* @return the string[]
*/
- protected String[] generateStringArray(String s1, String s2, String s3,
- MetaData element, boolean security, String... actions) {
+ protected String[] generateStringArray(String s1, String s2, String s3, MetaData element, boolean security,
+ String... actions) {
List<String> result = new ArrayList<String>();
result.add(s1);
result.add(s2);
@@ -265,8 +242,7 @@
/**
* Generate string array.
*
- * @param s
- * the s
+ * @param s the s
*
* @return the string[]
*/
@@ -294,31 +270,25 @@
public List<TreeNode> getMetadataNodes() {
List<TreeNode> nodes = new ArrayList<TreeNode>();
MetaData m = getMetadata();
- 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"), m.getType()));
- nodes
- .add(simpleNode(getMessages().get(
- "simexplorer.ui.web.metadata.description"), m
- .getDescription()));
- // FIXME date tostring
- nodes.add(simpleNode(getMessages().get(
- "simexplorer.ui.web.metadata.creationDate"), m
- .getCreationDate().toString()));
- nodes.add(simpleNode(getMessages().get(
- "simexplorer.ui.web.metadata.hash"), m.getHash()));
- nodes.add(simpleNode(getMessages().get(
- "simexplorer.ui.web.metadata.parentversion.uuid"), m
- .getParentVersionUuid()));
- nodes.add(simpleNode(getMessages().get(
- "simexplorer.ui.web.metadata.parentversion.version"), m
- .getParentVersionVersion()));
+ 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"), m.getType()));
+ 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
+ .getCreationDate())));
+
+ nodes.add(simpleNode(getMessages().get("simexplorer.ui.web.metadata.hash"), m.getHash()));
+
+ if (m.getParentVersionUuid() != null && m.getParentVersionVersion() != null) {
+ String parentContext = m.getParentVersionUuid() + "," + m.getParentVersionVersion();
+
+ nodes.add(simpleNode(getMessages().get("simexplorer.ui.web.metadata.parentversion"), generateString(m
+ .getParentVersionUuid()
+ + " - " + m.getParentVersionVersion(), "details", parentContext)));
+ }
+
nodes.add(descriptorsNode(m.getDescriptors()));
nodes.add(attachmentsNode(m.getAttachments()));
return nodes;
@@ -327,29 +297,24 @@
/**
* Attachments node.
*
- * @param attachments
- * the attachments
+ * @param attachments the attachments
*
* @return the tree node
*/
private TreeNode attachmentsNode(List<Attachment> attachments) {
TreeNode aNode = new TreeNode();
aNode.setType(TreeNode.TYPE_FOLDER);
- aNode.setColumns(generateStringArray(getMessages().get(
- "simexplorer.ui.web.metadata.attachments")));
+ aNode.setColumns(generateStringArray(getMessages().get("simexplorer.ui.web.metadata.attachments")));
List<TreeNode> attachmentNodes = new ArrayList<TreeNode>();
for (Attachment attachment : attachments) {
StringBuffer description = new StringBuffer();
if (attachment.getContentType() != null) {
- description
- .append(attachment.getContentType().getDescription())
- .append(" - ");
+ description.append(attachment.getContentType().getDescription()).append(" - ");
}
if (attachment.getContentType() != null) {
description.append("MD5 : ").append(attachment.getDataHash());
}
- attachmentNodes.add(simpleNode(attachment.getFileName(),
- description.toString()));
+ attachmentNodes.add(simpleNode(attachment.getFileName(), description.toString()));
}
aNode.setChildren(attachmentNodes);
return aNode;
@@ -358,20 +323,17 @@
/**
* Descriptors node.
*
- * @param descriptors
- * the descriptors
+ * @param descriptors the descriptors
*
* @return the tree node
*/
private TreeNode descriptorsNode(Map<String, String> descriptors) {
TreeNode aNode = new TreeNode();
aNode.setType(TreeNode.TYPE_FOLDER);
- aNode.setColumns(generateStringArray(getMessages().get(
- "simexplorer.ui.web.metadata.descriptors")));
+ aNode.setColumns(generateStringArray(getMessages().get("simexplorer.ui.web.metadata.descriptors")));
List<TreeNode> descriptorNodes = new ArrayList<TreeNode>();
for (Map.Entry<String, String> descriptor : descriptors.entrySet()) {
- descriptorNodes.add(simpleNode(descriptor.getKey(), descriptor
- .getValue()));
+ descriptorNodes.add(simpleNode(descriptor.getKey(), descriptor.getValue()));
}
aNode.setChildren(descriptorNodes);
return aNode;
@@ -380,10 +342,8 @@
/**
* Simple node.
*
- * @param s1
- * the s1
- * @param s2
- * the s2
+ * @param s1 the s1
+ * @param s2 the s2
*
* @return the tree node
*/
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-15 13:15:05 UTC (rev 987)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/AppModule.java 2008-02-15 13:15:27 UTC (rev 988)
@@ -18,11 +18,15 @@
package fr.cemagref.simexplorer.is.ui.web.services;
import java.io.IOException;
+import java.math.BigDecimal;
+import org.apache.tapestry.ioc.Configuration;
import org.apache.tapestry.ioc.MappedConfiguration;
import org.apache.tapestry.ioc.OrderedConfiguration;
import org.apache.tapestry.ioc.ServiceBinder;
import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.services.Coercion;
+import org.apache.tapestry.ioc.services.CoercionTuple;
import org.apache.tapestry.services.Request;
import org.apache.tapestry.services.RequestFilter;
import org.apache.tapestry.services.RequestHandler;
@@ -30,6 +34,8 @@
import org.apache.tapestry.services.ValueEncoderFactory;
import org.slf4j.Logger;
+import fr.cemagref.simexplorer.is.entities.metadata.Version;
+
/**
* The Class AppModule.
*/
@@ -38,8 +44,7 @@
/**
* Bind.
*
- * @param binder
- * the binder
+ * @param binder the binder
*/
public static void bind(ServiceBinder binder) {
/*
@@ -56,11 +61,9 @@
/**
* Contribute application defaults.
*
- * @param configuration
- * the configuration
+ * @param configuration the configuration
*/
- public static void contributeApplicationDefaults(
- MappedConfiguration<String, String> configuration) {
+ public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration) {
configuration.add("tapestry.supported-locales", "en,fr");
configuration.add("tapestry.scriptaculous.path", "fr/cemagref/simexplorer/is/ui/web/scriptaculous");
}
@@ -68,12 +71,10 @@
/**
* Contribute value encoder source.
*
- * @param configuration
- * the configuration
+ * @param configuration the configuration
*/
@SuppressWarnings("unchecked")
- public static void contributeValueEncoderSource(
- MappedConfiguration<Class, ValueEncoderFactory> configuration) {
+ public static void contributeValueEncoderSource(MappedConfiguration<Class, ValueEncoderFactory> configuration) {
/*
configuration.add(User.class, new GenericValueEncoderFactory<User>(
new UserValueEncoder()));
@@ -83,33 +84,47 @@
}
/**
- * This is a service definition, the service will be named "TimingFilter".
- * The interface, RequestFilter, is used within the RequestHandler service
- * pipeline, which is built from the RequestHandler service configuration.
- * Tapestry IoC is responsible for passing in an appropriate Log instance.
- * Requests for static resources are handled at a higher level, so this
- * filter will only be invoked for Tapestry related requests.
+ * Contribute type coercer.
*
+ * @param configuration the configuration
+ */
+ public static void contributeTypeCoercer(Configuration<CoercionTuple> configuration) {
+ Coercion<Version, String> coercionVersionString = new Coercion<Version, String>() {
+ public String coerce(Version input) {
+ return input.toString();
+ }
+ };
+ Coercion<String, Version> coercionStringVersion = new Coercion<String, Version>() {
+ public Version coerce(String input) {
+ return Version.valueOf(input);
+ }
+ };
+ configuration.add(new CoercionTuple<Version, String>(Version.class, String.class, coercionVersionString));
+ configuration.add(new CoercionTuple<String, Version>(String.class, Version.class, coercionStringVersion));
+ }
+
+ /**
+ * This is a service definition, the service will be named "TimingFilter". The interface, RequestFilter, is used
+ * within the RequestHandler service pipeline, which is built from the RequestHandler service configuration.
+ * Tapestry IoC is responsible for passing in an appropriate Log instance. Requests for static resources are handled
+ * at a higher level, so this filter will only be invoked for Tapestry related requests.
+ *
* <p>
- * Service builder methods are useful when the implementation is inline as
- * an inner class (as here) or require some other kind of special
- * initialization. In most cases, use the static bind() method instead.
+ * Service builder methods are useful when the implementation is inline as an inner class (as here) or require some
+ * other kind of special initialization. In most cases, use the static bind() method instead.
*
* <p>
- * If this method was named "build", then the service id would be taken from
- * the service interface and would be "RequestFilter". Since Tapestry
- * already defines a service named "RequestFilter" we use an explicit
- * service id that we can reference inside the contribution method.
+ * If this method was named "build", then the service id would be taken from the service interface and would be
+ * "RequestFilter". Since Tapestry already defines a service named "RequestFilter" we use an explicit service id
+ * that we can reference inside the contribution method.
*
- * @param log
- * the log
+ * @param log the log
*
* @return the request filter
*/
public RequestFilter buildTimingFilter(final Logger log) {
return new RequestFilter() {
- public boolean service(Request request, Response response,
- RequestHandler handler) throws IOException {
+ public boolean service(Request request, Response response, RequestHandler handler) throws IOException {
long startTime = System.currentTimeMillis();
try {
@@ -130,17 +145,13 @@
}
/**
- * This is a contribution to the RequestHandler service configuration. This
- * is how we extend Tapestry using the timing filter. A common use for this
- * kind of filter is transaction management or security.
+ * This is a contribution to the RequestHandler service configuration. This is how we extend Tapestry using the
+ * timing filter. A common use for this kind of filter is transaction management or security.
*
- * @param configuration
- * the configuration
- * @param filter
- * the filter
+ * @param configuration the configuration
+ * @param filter the filter
*/
- public void contributeRequestHandler(
- OrderedConfiguration<RequestFilter> configuration,
+ public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration,
@InjectService("TimingFilter")
RequestFilter filter) {
// Each contribution to an ordered configuration has a name, When
@@ -149,6 +160,6 @@
// contributed filter
// within the pipeline.
- //configuration.add("Timing", filter);
+ // configuration.add("Timing", filter);
}
}
Modified: trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementMetadata.tml
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementMetadata.tml 2008-02-15 13:15:05 UTC (rev 987)
+++ trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementMetadata.tml 2008-02-15 13:15:27 UTC (rev 988)
@@ -1,10 +1,38 @@
<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"
title="${windowtitle}">
+ <p>
+ <h2>${message:simexplorer.ui.web.metadata.properties}</h2>
+ </p>
+
<table t:type="cl/TreeGrid" source="metadataNodes"
columnHeaders="metadataHeaders">
</table>
+ <p>
+ <h2>${message:simexplorer.ui.web.metadata.usedby}</h2>
+ </p>
+
+
+ <table t:type="Grid" source="elementsUsed" row="element" model="model">
+ <t:parameter name="uuidCell">
+ <t:actionlink t:id="detailElementUsed"
+ context="${detailElementContext}">${message:simexplorer.ui.web.elementlist.details}</t:actionlink>
+ </t:parameter>
+ </table>
+
+ <p>
+ <h2>${message:simexplorer.ui.web.metadata.using}</h2>
+ </p>
+
+
+ <table t:type="Grid" source="elementsUsing" row="element" model="model">
+ <t:parameter name="uuidCell">
+ <t:actionlink t:id="detailElementUsing"
+ context="${detailElementContext}">${message:simexplorer.ui.web.elementlist.details}</t:actionlink>
+ </t:parameter>
+ </table>
+
<p><t:back label="${message:simexplorer.ui.web.back}" /></p>
</t:layout>
Modified: trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/WEB-INF/app.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/WEB-INF/app.properties 2008-02-15 13:15:05 UTC (rev 987)
+++ trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/WEB-INF/app.properties 2008-02-15 13:15:27 UTC (rev 988)
@@ -109,6 +109,9 @@
simexplorer.ui.web.elementlist.details=Details
+simexplorer.ui.web.metadata.properties=Properties
+simexplorer.ui.web.metadata.usedby=This element is used by
+simexplorer.ui.web.metadata.using=This element is using
simexplorer.ui.web.metadata.action=Metadata
simexplorer.ui.web.metadata.uuid=UUID
simexplorer.ui.web.metadata.version=Version
@@ -117,10 +120,7 @@
simexplorer.ui.web.metadata.description=Description
simexplorer.ui.web.metadata.creationDate=Creation date
simexplorer.ui.web.metadata.hash=Hash
-simexplorer.ui.web.metadata.parentdata.uuid=Data parent : UUID
-simexplorer.ui.web.metadata.parentdata.version=Data parent : Version
-simexplorer.ui.web.metadata.parentversion.uuid=Version parent : UUID
-simexplorer.ui.web.metadata.parentversion.version=Version parent : Version
+simexplorer.ui.web.metadata.parentversion=Parent version
simexplorer.ui.web.metadata.attachments=Attachments
simexplorer.ui.web.metadata.descriptors=Descriptors
Modified: trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/WEB-INF/app_fr.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/WEB-INF/app_fr.properties 2008-02-15 13:15:05 UTC (rev 987)
+++ trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/WEB-INF/app_fr.properties 2008-02-15 13:15:27 UTC (rev 988)
@@ -109,6 +109,9 @@
simexplorer.ui.web.elementlist.details=Details
+simexplorer.ui.web.metadata.properties=Properties
+simexplorer.ui.web.metadata.usedby=This element is used by
+simexplorer.ui.web.metadata.using=This element is using
simexplorer.ui.web.metadata.action=Metadonnées
simexplorer.ui.web.metadata.uuid=UUID
simexplorer.ui.web.metadata.version=Version
@@ -117,10 +120,7 @@
simexplorer.ui.web.metadata.description=Description
simexplorer.ui.web.metadata.creationDate=Date de création
simexplorer.ui.web.metadata.hash=Hash
-simexplorer.ui.web.metadata.parentdata.uuid=Parent de données : UUID
-simexplorer.ui.web.metadata.parentdata.version=Parent de données : Version
-simexplorer.ui.web.metadata.parentversion.uuid=Parent de version : UUID
-simexplorer.ui.web.metadata.parentversion.version=Parent de version : Version
+simexplorer.ui.web.metadata.parentversion=Parent de version
simexplorer.ui.web.metadata.attachments=Fichiers
simexplorer.ui.web.metadata.descriptors=Descripteurs
1
0
r987 - trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages
by glandais@users.labs.libre-entreprise.org 15 Feb '08
by glandais@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: glandais
Date: 2008-02-15 13:15:05 +0000 (Fri, 15 Feb 2008)
New Revision: 987
Modified:
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java
Log:
It works
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java 2008-02-15 13:14:05 UTC (rev 986)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java 2008-02-15 13:15:05 UTC (rev 987)
@@ -75,7 +75,6 @@
String pass = AuthenticationServiceHelper.computeHash(chars);
// reset du tableau
Arrays.fill(chars, (char) 0);
- //TODO verifier que cela est ok
password = null;
token = RemoteSecurityService.getAuthentificationService().loginUser(user, pass);
if (token != null && !token.equals("")) {
1
0
r986 - in trunk/simexplorer-is: simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service 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-is-swing/src/java/fr/cemagref/simexplorer/is/service
by glandais@users.labs.libre-entreprise.org 15 Feb '08
by glandais@users.labs.libre-entreprise.org 15 Feb '08
15 Feb '08
Author: glandais
Date: 2008-02-15 13:14:05 +0000 (Fri, 15 Feb 2008)
New Revision: 986
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/StorageServiceCommon.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-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
Log:
Retrieving element hierarchy
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-15 10:18:01 UTC (rev 985)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-15 13:14:05 UTC (rev 986)
@@ -47,8 +47,7 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- String loginUser(String login, String password)
- throws SimExplorerServiceException;
+ String loginUser(String login, String password) throws SimExplorerServiceException;
/**
* Save an element.
@@ -60,8 +59,7 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- MetaData saveElement(String token, SerializableInputStream zipStream)
- throws SimExplorerServiceException;
+ MetaData saveElement(String token, SerializableInputStream zipStream) throws SimExplorerServiceException;
/**
* Save an element.
@@ -75,8 +73,7 @@
* @throws SimExplorerServiceException the sim explorer service exception
*/
MetaData saveElement(String token, SerializableInputStream xmlStream,
- Map<Attachment, SerializableInputStream> attachmentsStream)
- throws SimExplorerServiceException;
+ Map<Attachment, SerializableInputStream> attachmentsStream) throws SimExplorerServiceException;
/**
* Update.
@@ -91,7 +88,7 @@
*/
void update(String token, String oldUuid, Version oldVersion, MetaData newVersion, boolean deleteOldElement)
throws SimExplorerServiceException;
-
+
/**
* Retrieve metadata (latest version).
*
@@ -102,8 +99,7 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- MetaData getMetadata(String token, String uuid)
- throws SimExplorerServiceException;
+ MetaData getMetadata(String token, String uuid) throws SimExplorerServiceException;
/**
* Retrieve metadata.
@@ -116,10 +112,35 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- MetaData getMetadata(String token, String uuid, String version)
- throws SimExplorerServiceException;
+ MetaData getMetadata(String token, String uuid, String version) throws SimExplorerServiceException;
/**
+ * Gets the metadatas used by the element.
+ *
+ * @param token the token
+ * @param uuid the uuid
+ * @param version the version
+ *
+ * @return the metadatas used
+ *
+ * @throws SimExplorerServiceException the sim explorer service exception
+ */
+ MetaData[] getMetadatasUsed(String token, String uuid, String version) throws SimExplorerServiceException;
+
+ /**
+ * Gets the metadatas using the element.
+ *
+ * @param token the token
+ * @param uuid the uuid
+ * @param version the version
+ *
+ * @return the metadatas using
+ *
+ * @throws SimExplorerServiceException the sim explorer service exception
+ */
+ MetaData[] getMetadatasUsing(String token, String uuid, String version) throws SimExplorerServiceException;
+
+ /**
* Export XML of element to a stream.
*
* @param token the token
@@ -130,8 +151,7 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- InputStream retrieveElementXML(String token, String uuid, String version)
- throws SimExplorerServiceException;
+ InputStream retrieveElementXML(String token, String uuid, String version) throws SimExplorerServiceException;
/**
* Export full element to a stream as a zip.
@@ -144,8 +164,7 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- InputStream retrieveElementFull(String token, String uuid, String version)
- throws SimExplorerServiceException;
+ InputStream retrieveElementFull(String token, String uuid, String version) throws SimExplorerServiceException;
/**
* Retrieve data related to an entity.
@@ -159,8 +178,8 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- InputStream retrieveElementData(String token, String uuid, String version,
- Attachment attachment) throws SimExplorerServiceException;
+ InputStream retrieveElementData(String token, String uuid, String version, Attachment attachment)
+ throws SimExplorerServiceException;
/**
* Retrieve number of elements matching query.
@@ -173,8 +192,7 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- int findFullTextCount(String token, String query, boolean onlyLatest)
- throws SimExplorerServiceException;
+ int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerServiceException;
/**
* Find elements matching query.
@@ -190,8 +208,7 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- MetaData[] findFullText(String token, String query, boolean onlyLatest,
- int indexStart, int count, int dateOrder)
+ MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count, int dateOrder)
throws SimExplorerServiceException;
/**
@@ -204,8 +221,7 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- int findApplicationsCount(String token, boolean onlyLatest)
- throws SimExplorerServiceException;
+ int findApplicationsCount(String token, boolean onlyLatest) throws SimExplorerServiceException;
/**
* Get a list of applications.
@@ -220,8 +236,8 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- MetaData[] findApplications(String token, boolean onlyLatest, int start,
- int count, int dateOrder) throws SimExplorerServiceException;
+ MetaData[] findApplications(String token, boolean onlyLatest, int start, int count, int dateOrder)
+ throws SimExplorerServiceException;
/**
* Fully load an element.
@@ -234,8 +250,7 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- LoggableElement getLoggableElement(String token, String uuid, String version)
- throws SimExplorerServiceException;
+ LoggableElement getLoggableElement(String token, String uuid, String version) throws SimExplorerServiceException;
/**
* Get all version of an element.
@@ -247,8 +262,7 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- Version[] getVersions(String token, String uuid)
- throws SimExplorerServiceException;
+ Version[] getVersions(String token, String uuid) throws SimExplorerServiceException;
/**
* Delete element.
@@ -259,8 +273,7 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- void deleteElement(String token, String uuid, String version)
- throws SimExplorerServiceException;
+ void deleteElement(String token, String uuid, String version) throws SimExplorerServiceException;
/**
* Delete element.
@@ -270,7 +283,6 @@
*
* @throws SimExplorerServiceException the sim explorer service exception
*/
- void deleteElement(String token, String uuid)
- throws SimExplorerServiceException;
+ void deleteElement(String token, String uuid) throws SimExplorerServiceException;
}
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-15 10:18:01 UTC (rev 985)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-15 13:14:05 UTC (rev 986)
@@ -100,6 +100,30 @@
}
/* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.service.StorageService#getMetadatasUsed(java.lang.String, java.lang.String, java.lang.String)
+ */
+ @Override
+ public MetaData[] getMetadatasUsed(String token, String uuid, String version) throws SimExplorerServiceException {
+ try {
+ return getStorageEngine().getMetadatasUsed(token, uuid, new Version(version));
+ } catch (SimExplorerStorageException e) {
+ throw new SimExplorerServiceException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.service.StorageService#getMetadatasUsing(java.lang.String, java.lang.String, java.lang.String)
+ */
+ @Override
+ public MetaData[] getMetadatasUsing(String token, String uuid, String version) throws SimExplorerServiceException {
+ try {
+ return getStorageEngine().getMetadatasUsing(token, uuid, new Version(version));
+ } catch (SimExplorerStorageException e) {
+ throw new SimExplorerServiceException(e);
+ }
+ }
+
+ /* (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,
@@ -475,6 +499,13 @@
}
}
+ /**
+ * Gets the first element.
+ *
+ * @param document the document
+ *
+ * @return the first element
+ */
private Element getFirstElement(Document document) {
Element element = null;
NodeList childNodes = document.getChildNodes();
@@ -627,6 +658,7 @@
* @param idsattachment the idsattachment
* @param document the document
* @param node the node
+ * @param parent the parent
*
* @throws Exception the exception
*/
@@ -641,7 +673,6 @@
for (Element element : entityElements) {
MetaData elementMetaData = saveElement(token, document, element, idsattachment);
getStorageEngine().saveElementHierarchy(token, parent, elementMetaData);
- // FIXME store that this element is used
}
}
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-15 10:18:01 UTC (rev 985)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-15 13:14:05 UTC (rev 986)
@@ -79,11 +79,12 @@
public abstract void insertElement(MetaData element, List<Reader> readers) throws SimExplorerStorageException;
/**
- * Save element hierarchy, saving the fact that parent uses child
+ * Save element hierarchy, saving the fact that parent uses child.
*
* @param parent the parent
* @param child the child
- * @throws SimExplorerStorageException
+ *
+ * @throws SimExplorerStorageException the sim explorer storage exception
*/
public abstract void saveElementHierarchy(MetaData parent, MetaData child) throws SimExplorerStorageException;
@@ -114,6 +115,26 @@
public abstract List<Version> getVersions(String uuid) throws SimExplorerStorageException;
/**
+ * Gets the elements used by mde.
+ *
+ * @param mde the mde
+ *
+ * @return the elements used by
+ * @throws SimExplorerStorageException
+ */
+ public abstract Set<MetaData> getElementsUsedBy(MetaData mde) throws SimExplorerStorageException;
+
+ /**
+ * Gets the elements using mde.
+ *
+ * @param mde the mde
+ *
+ * @return the elements using
+ * @throws SimExplorerStorageException
+ */
+ public abstract Set<MetaData> getElementsUsing(MetaData mde) throws SimExplorerStorageException;
+
+ /**
* Retrieve all elements by id Empty list if no element with this id.
*
* @param uuid Id
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-15 10:18:01 UTC (rev 985)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-15 13:14:05 UTC (rev 986)
@@ -764,6 +764,14 @@
}
}
+ /**
+ * Gets the uuid version.
+ *
+ * @param uuid the uuid
+ * @param version the version
+ *
+ * @return the uuid version
+ */
private String getUuidVersion(String uuid, Version version) {
StringBuffer sb = new StringBuffer();
sb.append(uuid).append(".").append(version.toString());
@@ -771,7 +779,7 @@
}
/**
- * Transform an element hierarchy to a Lucene document
+ * Transform an element hierarchy to a Lucene document.
*
* @param parent the parent
* @param child the child
@@ -849,4 +857,76 @@
return document;
}
+ /**
+ * Gets the associated elements.
+ *
+ * @param mde the mde
+ * @param fromField the from field
+ * @param toField the to field
+ *
+ * @return the associated elements
+ * @throws SimExplorerStorageException
+ */
+ protected Set<MetaData> getAssociatedElements(MetaData mde, String fromField, String toField)
+ throws SimExplorerStorageException {
+ Set<MetaData> result = new HashSet<MetaData>();
+ try {
+ Query query;
+ Hits hits;
+
+ // Get current searcher instance
+ Searcher searcher = getSearcher();
+ try {
+ List<String> uuidVersionList = new ArrayList<String>();
+
+ // First search corresponding elements in base
+ query = new TermQuery(new Term(fromField, getUuidVersion(mde.getUuid(), mde.getVersion())));
+ hits = searcher.search(query);
+
+ // For each one, retrieve idversion associated
+ for (int j = 0; j < hits.length(); j++) {
+ Document document = hits.doc(j);
+ uuidVersionList.add(document.get(toField));
+ }
+
+ // for each idversion associated, look up corresponding element
+ for (String uuidVersion : uuidVersionList) {
+
+ // Create a query with all parameters
+ query = new TermQuery(new Term(KEY_UUID_VERSION, uuidVersion));
+ hits = searcher.search(query);
+
+ for (int j = 0; j < hits.length(); j++) {
+ Document document = hits.doc(j);
+
+ result.add(loadLuceneElement(document));
+ }
+
+ }
+ } finally {
+ // Release searcher instance
+ releaseSearcher(searcher);
+ }
+ } catch (Exception e) {
+ throw new SimExplorerStorageException(e);
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.storage.database.Database#getElementsUsedBy(fr.cemagref.simexplorer.is.entities.metadata.MetaData)
+ */
+ @Override
+ public Set<MetaData> getElementsUsedBy(MetaData mde) throws SimExplorerStorageException {
+ return getAssociatedElements(mde, KEY_UUID_VERSION_CHILD, KEY_UUID_VERSION_PARENT);
+ }
+
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.storage.database.Database#getElementsUsing(fr.cemagref.simexplorer.is.entities.metadata.MetaData)
+ */
+ @Override
+ public Set<MetaData> getElementsUsing(MetaData mde) throws SimExplorerStorageException {
+ return getAssociatedElements(mde, KEY_UUID_VERSION_PARENT, KEY_UUID_VERSION_CHILD);
+ }
+
}
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-15 10:18:01 UTC (rev 985)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-15 13:14:05 UTC (rev 986)
@@ -74,7 +74,8 @@
* @param token the token
* @param parent the parent
* @param child the child
- * @throws SimExplorerStorageException
+ *
+ * @throws SimExplorerStorageException the sim explorer storage exception
*/
public abstract void saveElementHierarchy(String token, MetaData parent, MetaData child)
throws SimExplorerStorageException;
@@ -142,6 +143,34 @@
public abstract MetaData getMetadata(String token, String uuid, Version version) throws SimExplorerStorageException;
/**
+ * Gets the metadatas used.
+ *
+ * @param token the token
+ * @param uuid the uuid
+ * @param version the version
+ *
+ * @return the metadatas used
+ *
+ * @throws SimExplorerStorageException the sim explorer storage exception
+ */
+ public abstract MetaData[] getMetadatasUsed(String token, String uuid, Version version)
+ throws SimExplorerStorageException;
+
+ /**
+ * Gets the metadatas using.
+ *
+ * @param token the token
+ * @param uuid the uuid
+ * @param version the version
+ *
+ * @return the metadatas using
+ *
+ * @throws SimExplorerStorageException the sim explorer storage exception
+ */
+ public abstract MetaData[] getMetadatasUsing(String token, String uuid, Version version)
+ throws SimExplorerStorageException;
+
+ /**
* Get data associated to an element.
*
* @param entity Element related
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-15 10:18:01 UTC (rev 985)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-15 13:14:05 UTC (rev 986)
@@ -26,6 +26,8 @@
import java.util.Set;
import java.util.UUID;
+import org.codelutin.util.CollectionUtil;
+
import fr.cemagref.simexplorer.is.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
@@ -177,6 +179,26 @@
}
/* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getMetadatasUsed(java.lang.String, java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
+ */
+ @Override
+ public MetaData[] getMetadatasUsed(String token, String uuid, Version version) throws SimExplorerStorageException {
+ MetaData mde = database.getElement(uuid, version);
+ Set<MetaData> elements = database.getElementsUsedBy(mde);
+ return elements.toArray(new MetaData[elements.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getMetadatasUsing(java.lang.String, java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
+ */
+ @Override
+ public MetaData[] getMetadatasUsing(String token, String uuid, Version version) throws SimExplorerStorageException {
+ MetaData mde = database.getElement(uuid, version);
+ Set<MetaData> elements = database.getElementsUsing(mde);
+ return elements.toArray(new MetaData[elements.size()]);
+ }
+
+ /* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#retrieveData(fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.lang.String)
*/
public InputStream retrieveData(String token, MetaData entity, Attachment attachment)
@@ -197,8 +219,8 @@
*/
public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count,
int dateOrder) throws SimExplorerStorageException {
- MetaData[] result = database.findElementsByContentSearch(query, onlyLatest, indexStart, count, dateOrder)
- .toArray(new MetaData[0]);
+ Set<MetaData> elements = database.findElementsByContentSearch(query, onlyLatest, indexStart, count, dateOrder);
+ MetaData[] result = elements.toArray(new MetaData[elements.size()]);
return result;
}
@@ -207,8 +229,8 @@
*/
public MetaData[] findElementsByType(String token, String type, boolean onlyLatest, int start, int count,
int dateOrder) throws SimExplorerStorageException {
- MetaData[] result = database.findElementsByType(type, onlyLatest, start, count, dateOrder).toArray(
- new MetaData[0]);
+ Set<MetaData> elements = database.findElementsByType(type, onlyLatest, start, count, dateOrder);
+ MetaData[] result = elements.toArray(new MetaData[elements.size()]);
return result;
}
@@ -269,6 +291,9 @@
return id;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#storeTempData(java.lang.String, java.io.InputStream)
+ */
@Override
public void storeTempData(String id, InputStream stream) throws SimExplorerStorageException {
attachmentHandler.storeData(mdTmp, getTmpAttachment(id), stream);
@@ -282,6 +307,9 @@
return is;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#retrieveMD5TempData(java.lang.String)
+ */
@Override
public String retrieveMD5TempData(String id) throws SimExplorerStorageException {
String md5 = attachmentHandler.retrieveMD5Data(mdTmp, getTmpAttachment(id));
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-15 10:18:01 UTC (rev 985)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-15 13:14:05 UTC (rev 986)
@@ -291,4 +291,16 @@
public String toString() {
return super.toString() + " remote:" + remote;
}
+
+ @Override
+ public MetaData[] getMetadatasUsed(String token, String uuid, String version) throws SimExplorerServiceException {
+ checkImplemented();
+ return null;
+ }
+
+ @Override
+ public MetaData[] getMetadatasUsing(String token, String uuid, String version) throws SimExplorerServiceException {
+ checkImplemented();
+ return null;
+ }
}
1
0