Simexplorer-si-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
February 2008
- 2 participants
- 701 discussions
r1025 - in trunk/simexplorer-is/simexplorer-is-swing/src: java/fr/cemagref/simexplorer/is/ui/swing java/fr/cemagref/simexplorer/is/ui/swing/model uimodel/fr/cemagref/simexplorer/is/ui/swing
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
16 Feb '08
Author: tchemit
Date: 2008-02-16 15:18:36 +0000 (Sat, 16 Feb 2008)
New Revision: 1025
Added:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/DetailTableModel.java
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/JDetailTab.jaxx
Log:
renommage model
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java 2008-02-16 15:16:09 UTC (rev 1024)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java 2008-02-16 15:18:36 UTC (rev 1025)
@@ -26,7 +26,7 @@
import fr.cemagref.simexplorer.is.ui.SimExplorer;
import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.JDetailTableModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.DetailTableModel;
import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeNode;
import static org.codelutin.i18n.I18n._;
@@ -175,7 +175,7 @@
listModel.setSize(0);
listModel.trimToSize();
ui.getDetail().setVisible(false);
- ((JDetailTableModel) ui.getDetailTable().getModel()).setData(null);
+ ((DetailTableModel) ui.getDetailTable().getModel()).setData(null);
}
public static void updateDetailNavigationTree(JDetailTab ui, HistoryModel<LoggableElementTreeNode> model) {
@@ -210,7 +210,7 @@
ui.getDetailCreationDate().setText(DATE_FORMAT.format(detail.getCreationDate()));
ui.getDetail().setVisible(true);
JTable table = ui.getDetailTable();
- ((JDetailTableModel) table.getModel()).setData(detail);
+ ((DetailTableModel) table.getModel()).setData(detail);
int nbDescriptorRows = table.getRowCount();
List<Attachment> attachments = detail.getAttachments();
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/DetailTableModel.java (from rev 1023, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/JDetailTableModel.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/DetailTableModel.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/DetailTableModel.java 2008-02-16 15:18:36 UTC (rev 1025)
@@ -0,0 +1,94 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit
+*
+* 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.swing.model;
+
+import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import static org.codelutin.i18n.I18n._;
+import static org.codelutin.i18n.I18n.n_;
+
+import javax.swing.table.AbstractTableModel;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Table model to contains a MetaData details
+ *
+ * @author chemit
+ */
+public class DetailTableModel extends AbstractTableModel {
+
+ protected MetaData data;
+ protected List<String> descriptors;
+ private static final long serialVersionUID = -2377632046940030206L;
+
+ protected final String[] columnNames = {
+ n_("simexplorer.common.key"),
+ n_("simexplorer.common.value")
+ };
+
+ public DetailTableModel() {
+ }
+
+ public int getRowCount() {
+ return getDescriptors().size();
+ }
+
+ public int getColumnCount() {
+ return columnNames.length;
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ Object result = null;
+ if (data == null) {
+ return null;
+ }
+ if (columnIndex == 0) {
+ // key
+ result = getDescriptors().get(rowIndex);
+ } else if (columnIndex == 1) {
+ // value
+ String propertyDescriptor = getDescriptors().get(rowIndex);
+ result = data.getDescriptors().get(propertyDescriptor);
+ }
+ return result;
+ }
+
+ @Override
+ public String getColumnName(int column) {
+ return _(columnNames[column]);
+ }
+
+ public List<String> getDescriptors() {
+ if (descriptors == null) {
+ descriptors = new ArrayList<String>();
+ }
+ return descriptors;
+ }
+
+ public void setData(MetaData data) {
+ this.data = data;
+ getDescriptors().clear();
+ if (data != null) {
+ getDescriptors().addAll(data.getDescriptors().keySet());
+ Collections.sort(getDescriptors());
+ }
+ }
+
+}
\ No newline at end of file
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/JDetailTab.jaxx
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/JDetailTab.jaxx 2008-02-16 15:16:09 UTC (rev 1024)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/JDetailTab.jaxx 2008-02-16 15:18:36 UTC (rev 1025)
@@ -96,7 +96,7 @@
<row>
<cell fill='horizontal' columns="2" insets='0,0,0,0'>
<JScrollPane id='scrollTable' border='{null}' horizontalScrollBarPolicy='horizontal_scrollbar_as_needed' verticalScrollBarPolicy='vertical_scrollbar_as_needed'>
- <JTable id="detailTable" border='{null}' model='{new fr.cemagref.simexplorer.is.ui.swing.model.JDetailTableModel()}' focusable='false' enabled='false' />
+ <JTable id="detailTable" border='{null}' model='{new fr.cemagref.simexplorer.is.ui.swing.model.DetailTableModel()}' focusable='false' enabled='false' />
</JScrollPane>
</cell>
</row>
1
0
r1024 - trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
16 Feb '08
Author: tchemit
Date: 2008-02-16 15:16:09 +0000 (Sat, 16 Feb 2008)
New Revision: 1024
Removed:
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/attachment/
Log:
deplacement du paquetage attchment dans paquetage entities
1
0
r1023 - in trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing: . actions actions/util model
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
16 Feb '08
Author: tchemit
Date: 2008-02-16 15:14:13 +0000 (Sat, 16 Feb 2008)
New Revision: 1023
Added:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/TreeNodeBuilder.java
Removed:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableElementTreeHelper.java
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ListTabRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/MainUIRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SynchronizeTabRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ChangePageAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ChangeSizorAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/CollapseAllAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DetailToTreeAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DownloadAttachmentAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExpandAllAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToLocalAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToRemoteAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ResetSearchAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SearchAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowDetailTabAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/DetailTabModel.java
Log:
utilisation visiteur pour contruire les arbres de navigation : le code est lineaire :)
utilisation EntityHelper
renommage model
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -18,8 +18,8 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
-import fr.cemagref.simexplorer.is.entities.EntitiesAction;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.EntityHelper;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
@@ -85,16 +85,14 @@
public static void refreshDownloadElementAction(JDetailTab ui, DetailTabModel model, LoggableElementTreeNode node) {
MetaData detail = model.getDetail();
- //boolean enabled = detail != null || LoggableElementTreeHelper.canDownload(node);
- boolean enabled = EntitiesAction.DOWNLOAD.accept(node);
+ boolean enabled = EntityHelper.Action.DOWNLOAD.accept(node);
String tooltip = !enabled ? null : _("simexplorer.action.downloadLoggableElement.tooltip", detail == null ? node.getUserObject() : detail.getName() + " [" + model.getSelectedVersion() + "]");
MainUIRefreshHelper.updateButton(ui.getDownloadElement(), enabled, tooltip);
}
protected static void refreshDeleteAction(JDetailTab ui, DetailTabModel model) {
MetaData detail = model.getDetail();
- //boolean enabled = detail != null;
- boolean enabled = EntitiesAction.DELETE.accept(detail);
+ boolean enabled = EntityHelper.Action.DELETE.accept(detail);
String tooltip = !enabled ? null : _("simexplorer.action.deleteLoggableElement.tooltip", detail.getName() + " [" + model.getSelectedVersion() + "]");
MainUIRefreshHelper.updateButton(ui.getDeleteElement(), enabled, tooltip);
}
@@ -134,14 +132,14 @@
MetaData detail = model.getDetail();
LoggableElement sNode = model.getSelectedNode();
//boolean enabled = sNode != null && SimExplorer.getContext().isConnected() && sNode instanceof ExplorationApplication;
- boolean enabled = SimExplorer.getContext().isConnected() && EntitiesAction.EXPORT.accept(sNode);
+ boolean enabled = SimExplorer.getContext().isConnected() && EntityHelper.Action.EXPORT.accept(sNode);
- String text=null;
+ String text = null;
if (enabled) {
text = detail.getName() + " [" + model.getSelectedVersion() + "]";
}
- MainUIRefreshHelper.refreshExportAction(enabled,model.isRemote(),text,ui.getExportElement());
-
+ MainUIRefreshHelper.refreshExportAction(enabled, model.isRemote(), text, ui.getExportElement());
+
}
public static void resetHistory(JDetailTab ui, DetailTabModel model, DefaultComboBoxModel historyModel) {
@@ -187,9 +185,9 @@
ui.getNavigationTree().setSelectionRow(0);
boolean enabled;
enabled = model.size() > 1 && model.hasPrevious();
- MainUIRefreshHelper.updateButton(ui.getHistoryPrevious(), enabled, !enabled?null:_("simexplorer.action.historyPrevious.tooltip", model.getPrevious()));
- enabled= model.size() > 1 && model.hasNext();
- MainUIRefreshHelper.updateButton(ui.getHistoryNext(), enabled, !enabled?null:_("simexplorer.action.historyNext.tooltip", model.getNext()));
+ MainUIRefreshHelper.updateButton(ui.getHistoryPrevious(), enabled, !enabled ? null : _("simexplorer.action.historyPrevious.tooltip", model.getPrevious()));
+ enabled = model.size() > 1 && model.hasNext();
+ MainUIRefreshHelper.updateButton(ui.getHistoryNext(), enabled, !enabled ? null : _("simexplorer.action.historyNext.tooltip", model.getNext()));
}
public static void updateDetailPanel(Integer index, final JDetailTab ui, DetailTabModel model, LoggableElement selectedNode) {
@@ -198,7 +196,7 @@
ui.getDetailVersions().setSelectedIndex(index);
ui.getDetailHeader().setText(selectedNode.getMetaData().getName());
ui.getDetailDescriptorsHeader().setText(_("simexplorer.node.descriptors", detail.getDescriptors().size()));
- ui.getDetailType().setText(detail.getType());
+ ui.getDetailType().setText(EntityHelper.Type.getLibelle(detail));
String s = detail.getDescription();
String tooltip = s;
if (s.length() > 32) {
@@ -226,7 +224,8 @@
ui.getScrollAttachments().setVisible(false);
nbAttachmentRows = 0;
} else {
- ui.getDetailAttachmentsHeader().setText(_("simexplorer.node.attachments", attachments.size()));
+ ui.getDetailAttachmentsHeader().setText(EntityHelper.Type.Attachment.getLibelles() + " (" + attachments.size() + ")");
+ //ui.getDetailAttachmentsHeader().setText(_("simexplorer.node.attachments", attachments.size()));
for (Attachment attachment : attachments) {
listModel.addElement(attachment);
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ListTabRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ListTabRefreshHelper.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ListTabRefreshHelper.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -18,7 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing;
-import fr.cemagref.simexplorer.is.entities.EntitiesAction;
+import fr.cemagref.simexplorer.is.entities.EntityHelper;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.ui.SimExplorer;
import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
@@ -92,13 +92,13 @@
String text = data.getName() + " [" + data.getVersion() + "]";
String tooltip = _("simexplorer.action.downloadLoggableElement.tooltip", text);
- MainUIRefreshHelper.updateButton(ui.getDownloadElement(), EntitiesAction.DOWNLOAD.accept(data), tooltip);
+ MainUIRefreshHelper.updateButton(ui.getDownloadElement(), EntityHelper.Action.DOWNLOAD.accept(data), tooltip);
tooltip = _("simexplorer.action.deleteLoggableElement.tooltip", text);
- MainUIRefreshHelper.updateButton(ui.getDeleteElement(), EntitiesAction.DELETE.accept(data), tooltip);
+ MainUIRefreshHelper.updateButton(ui.getDeleteElement(), EntityHelper.Action.DELETE.accept(data), tooltip);
boolean isConnected = SimExplorer.getContext().isConnected();
- boolean enabled = isConnected && EntitiesAction.EXPORT.accept(data);
+ boolean enabled = isConnected && EntityHelper.Action.EXPORT.accept(data);
MainUIRefreshHelper.refreshExportAction(enabled,model.isRemote(),text,ui.getExportElement());
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/MainUIRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/MainUIRefreshHelper.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/MainUIRefreshHelper.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -30,6 +30,8 @@
import javax.swing.AbstractButton;
import javax.swing.JTabbedPane;
+import javax.swing.JTree;
+import javax.swing.tree.TreePath;
import java.util.regex.Matcher;
/**
@@ -159,4 +161,49 @@
}
updateButton(button, enabled, tooltip);
}
+
+ public static LoggableElementTreeNode getSelectedNodeOrRootNode(JTree tree) {
+ TreePath path = tree.getSelectionPath();
+ LoggableElementTreeNode node = null;
+ if (path != null) {
+ Object o = path.getLastPathComponent();
+ if (o != null && !(o instanceof LoggableElementTreeNode)) {
+ return null;
+ }
+ node = (LoggableElementTreeNode) o;
+ }
+ if (node == null) {
+ // take the root node
+ Object root = tree.getModel().getRoot();
+ if (root == null || !(root instanceof LoggableElementTreeNode)) {
+ return null;
+ }
+ node = (LoggableElementTreeNode) root;
+ }
+ return node;
+ }
+
+ public static LoggableElementTreeNode getSelectedNode(JTree tree) {
+ TreePath path = tree.getSelectionPath();
+ LoggableElementTreeNode node = null;
+ if (path != null) {
+ Object o = path.getLastPathComponent();
+ if (o != null && !(o instanceof LoggableElementTreeNode)) {
+ return null;
+ }
+ node = (LoggableElementTreeNode) o;
+ }
+ return node;
+ }
+
+ public static LoggableElementTreeNode getRootNode(JTree tree) {
+ LoggableElementTreeNode node;
+ // take the root node
+ Object root = tree.getModel().getRoot();
+ if (root == null || !(root instanceof LoggableElementTreeNode)) {
+ return null;
+ }
+ node = (LoggableElementTreeNode) root;
+ return node;
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SynchronizeTabRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SynchronizeTabRefreshHelper.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SynchronizeTabRefreshHelper.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -18,11 +18,11 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing;
-import fr.cemagref.simexplorer.is.entities.EntitiesAction;
+import fr.cemagref.simexplorer.is.entities.EntityHelper;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
-import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeHelper;
import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeNode;
import fr.cemagref.simexplorer.is.ui.swing.model.SynchronizeTabModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.TreeNodeBuilder;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeModel;
@@ -46,7 +46,7 @@
public static void refreshExportElementToRemoteAction(JSynchronizeTab ui, SynchronizeTabModel model) {
LoggableElement sNode = model.getLocalSelectedNode();
- boolean enabled = EntitiesAction.EXPORT.accept(sNode);
+ boolean enabled = EntityHelper.Action.EXPORT.accept(sNode);
String text = null;
if (enabled) {
text = sNode.getMetaData().getName() + " [" + sNode.getMetaData().getVersion() + "]";
@@ -56,7 +56,7 @@
public static void refreshExportElementToLocalAction(JSynchronizeTab ui, SynchronizeTabModel model) {
LoggableElement sNode = model.getRemoteSelectedNode();
- boolean enabled = EntitiesAction.EXPORT.accept(sNode);
+ boolean enabled = EntityHelper.Action.EXPORT.accept(sNode);
String text = null;
if (enabled) {
text = sNode.getMetaData().getName() + " [" + sNode.getMetaData().getVersion() + "]";
@@ -74,11 +74,12 @@
public static void updateSynchronizeNavigationTrees(JSynchronizeTab ui, SynchronizeTabModel model) {
- TreeNode sourceRoot = LoggableElementTreeHelper.buildLoggableElementNode(model.getSource(), model.isRemote());
- TreeNode destinationRoot = model.getDestination() == null ? null : LoggableElementTreeHelper.buildLoggableElementNode(model.getDestination(), !model.isRemote());
-
+ boolean remote = model.isRemote();
+ TreeNode sourceRoot = TreeNodeBuilder.build(model.getSource(), remote);
+ TreeNode destinationRoot = model.getDestination() == null ? null : TreeNodeBuilder.build(model.getDestination(), !remote);
+
JTree sourceTree, destinationTree;
- if (model.isRemote()) {
+ if (remote) {
// source is remote
sourceTree = ui.getContentTreeRemote();
destinationTree = ui.getContentTreeLocal();
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ChangePageAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ChangePageAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ChangePageAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -22,7 +22,7 @@
import fr.cemagref.simexplorer.is.ui.swing.JListTab;
import fr.cemagref.simexplorer.is.ui.swing.ListTabRefreshHelper;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
-import fr.cemagref.simexplorer.is.ui.swing.model.JApplicationTableModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.ListTableModel;
import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
import fr.cemagref.simexplorer.is.ui.swing.model.PaginationModel;
@@ -88,7 +88,7 @@
// update table model
JListTab container = (JListTab) getUI();
JTable table = container.getTable();
- JApplicationTableModel modelTab = (JApplicationTableModel) table.getModel();
+ ListTableModel modelTab = (ListTableModel) table.getModel();
modelTab.setData(model.getList());
// refresh ui
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ChangeSizorAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ChangeSizorAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ChangeSizorAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -19,7 +19,7 @@
package fr.cemagref.simexplorer.is.ui.swing.actions;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
-import fr.cemagref.simexplorer.is.ui.swing.model.JApplicationTableModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.ListTableModel;
import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
import fr.cemagref.simexplorer.is.ui.swing.model.PaginationModel;
import fr.cemagref.simexplorer.is.ui.swing.JListTab;
@@ -85,7 +85,7 @@
// save in TableModel
JListTab container = (JListTab) getUI();
JTable jApplicationTable = container.getTable();
- JApplicationTableModel modelTab = (JApplicationTableModel) jApplicationTable.getModel();
+ ListTableModel modelTab = (ListTableModel) jApplicationTable.getModel();
modelTab.setData(model.getList());
// refresh ui
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/CollapseAllAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/CollapseAllAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/CollapseAllAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -20,12 +20,11 @@
import fr.cemagref.simexplorer.is.ui.swing.JDetailTab;
import fr.cemagref.simexplorer.is.ui.swing.JSynchronizeTab;
+import fr.cemagref.simexplorer.is.ui.swing.MainUIRefreshHelper;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
-import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeHelper;
import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeNode;
import javax.swing.JTree;
-import javax.swing.SwingUtilities;
import java.awt.event.ActionEvent;
/**
@@ -73,7 +72,7 @@
// arbre non trouvé (cela devrait souleve une exception !)
return false;
}
- node = LoggableElementTreeHelper.getSelectedNodeOrRootNode(tree);
+ node = MainUIRefreshHelper.getSelectedNodeOrRootNode(tree);
boolean result;
result = !(node == null || node.isLeaf());
return result;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DetailToTreeAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DetailToTreeAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DetailToTreeAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -25,8 +25,8 @@
import fr.cemagref.simexplorer.is.ui.swing.JDetailTab;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeHelper;
import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeNode;
+import fr.cemagref.simexplorer.is.ui.swing.model.TreeNodeBuilder;
import java.awt.event.ActionEvent;
@@ -74,8 +74,8 @@
@Override
protected void doAction(ActionEvent e) throws Exception {
model.setRootNode(element);
- // create navigation tree
- LoggableElementTreeNode root = LoggableElementTreeHelper.buildLoggableElementNode(model.getRootNode(), model.isRemote());
+ // create navigation tree
+ LoggableElementTreeNode root = TreeNodeBuilder.build(model.getRootNode(), model.isRemote());
model.getHistory().add(root);
// push it in tree
DetailTabRefreshHelper.updateDetailNavigationTree((JDetailTab) getUI(), model.getHistory());
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DownloadAttachmentAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DownloadAttachmentAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DownloadAttachmentAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -18,7 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.actions;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.ui.StorageServiceHelper;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.DownloadAbstractAction;
import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExpandAllAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExpandAllAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExpandAllAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -20,8 +20,8 @@
import fr.cemagref.simexplorer.is.ui.swing.JDetailTab;
import fr.cemagref.simexplorer.is.ui.swing.JSynchronizeTab;
+import fr.cemagref.simexplorer.is.ui.swing.MainUIRefreshHelper;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
-import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeHelper;
import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeNode;
import javax.swing.JTree;
@@ -74,7 +74,7 @@
return false;
}
- node = LoggableElementTreeHelper.getSelectedNodeOrRootNode(tree);
+ node = MainUIRefreshHelper.getSelectedNodeOrRootNode(tree);
boolean result;
result = !(node == null || node.isLeaf());
return result;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -18,7 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.actions;
-import fr.cemagref.simexplorer.is.entities.EntitiesAction;
+import fr.cemagref.simexplorer.is.entities.EntityHelper;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.service.StorageService;
@@ -85,7 +85,7 @@
return true;
}
boolean result;
- result = remote != null && version != null && uuid != null && EntitiesAction.EXPORT.accept(element);
+ result = remote != null && version != null && uuid != null && EntityHelper.Action.EXPORT.accept(element);
return result;
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToLocalAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToLocalAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToLocalAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -18,7 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.actions;
-import fr.cemagref.simexplorer.is.entities.EntitiesAction;
+import fr.cemagref.simexplorer.is.entities.EntityHelper;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.ui.swing.model.SynchronizeTabModel;
@@ -54,7 +54,7 @@
SynchronizeTabModel model = (SynchronizeTabModel) getModel();
LoggableElement element = model.getRemoteSelectedNode();
boolean result;
- if (result = EntitiesAction.EXPORT.accept(element)) {
+ if (result = EntityHelper.Action.EXPORT.accept(element)) {
uuid = element.getMetaData().getUuid();
version = element.getMetaData().getVersion();
remote = true;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToRemoteAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToRemoteAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToRemoteAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -18,7 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.actions;
-import fr.cemagref.simexplorer.is.entities.EntitiesAction;
+import fr.cemagref.simexplorer.is.entities.EntityHelper;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.ui.swing.model.SynchronizeTabModel;
@@ -54,7 +54,7 @@
SynchronizeTabModel model = (SynchronizeTabModel) getModel();
LoggableElement element = model.getLocalSelectedNode();
boolean result;
- if (result = EntitiesAction.EXPORT.accept(element)) {
+ if (result = EntityHelper.Action.EXPORT.accept(element)) {
uuid = element.getMetaData().getUuid();
version = element.getMetaData().getVersion();
remote = false;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ResetSearchAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ResetSearchAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ResetSearchAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -19,7 +19,7 @@
package fr.cemagref.simexplorer.is.ui.swing.actions;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
-import fr.cemagref.simexplorer.is.ui.swing.model.JApplicationTableModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.ListTableModel;
import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
import fr.cemagref.simexplorer.is.ui.swing.JListTab;
import fr.cemagref.simexplorer.is.ui.swing.ListTabRefreshHelper;
@@ -83,7 +83,7 @@
// update table model in ui
JListTab container = (JListTab) getUI();
JTable table = container.getTable();
- JApplicationTableModel modelTab = (JApplicationTableModel) table.getModel();
+ ListTableModel modelTab = (ListTableModel) table.getModel();
modelTab.setData(model.getList());
// refresh ui
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SearchAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SearchAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SearchAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -20,7 +20,7 @@
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.JApplicationTableModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.ListTableModel;
import fr.cemagref.simexplorer.is.ui.swing.JListTab;
import fr.cemagref.simexplorer.is.ui.swing.ListTabRefreshHelper;
@@ -75,7 +75,7 @@
// update table model in ui
JListTab container = (JListTab) getUI();
JTable table = container.getTable();
- JApplicationTableModel modelTab = (JApplicationTableModel) table.getModel();
+ ListTableModel modelTab = (ListTableModel) table.getModel();
modelTab.setData(model.getList());
// refresh ui
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowDetailTabAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowDetailTabAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowDetailTabAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -17,17 +17,18 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.actions;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.ui.StorageServiceHelper;
import fr.cemagref.simexplorer.is.ui.swing.DetailTabRefreshHelper;
import fr.cemagref.simexplorer.is.ui.swing.JDetailTab;
+import fr.cemagref.simexplorer.is.ui.swing.MainUIRefreshHelper;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.ShowTabAbstractAction;
import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeHelper;
import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeNode;
+import fr.cemagref.simexplorer.is.ui.swing.model.TreeNodeBuilder;
import javax.swing.DefaultComboBoxModel;
import javax.swing.event.ListSelectionEvent;
@@ -86,8 +87,8 @@
protected void initUI(JDetailTab ui, DetailTabModel model) {
DetailTabRefreshHelper.refreshTreeDetailActions(ui, null);
- // create navigation tree
- LoggableElementTreeNode root = LoggableElementTreeHelper.buildLoggableElementNode(model.getRootNode(), model.isRemote());
+ // create navigation tree
+ LoggableElementTreeNode root = TreeNodeBuilder.build(model.getRootNode(), model.isRemote());
model.getHistory().add(root);
DetailTabRefreshHelper.updateDetailNavigationTree(ui, model.getHistory());
}
@@ -177,10 +178,10 @@
versionListener.setEnabled(wasEnable);
attachmentListener.setEnabled(wasEnable2);
// update actions on toolbar
- LoggableElementTreeNode node = LoggableElementTreeHelper.getSelectedNode(ui.getNavigationTree());
+ LoggableElementTreeNode node = MainUIRefreshHelper.getSelectedNode(ui.getNavigationTree());
DetailTabRefreshHelper.refreshDetailActions(ui, model, node);
- LoggableElementTreeNode rootNode = LoggableElementTreeHelper.getRootNode(ui.getNavigationTree());
+ LoggableElementTreeNode rootNode = MainUIRefreshHelper.getRootNode(ui.getNavigationTree());
if (model.getDetail() != null && !node.equals(rootNode)) {
// refresh detail to tree button only if required
DetailTabRefreshHelper.refreshDetailToTreeAction(ui, model);
@@ -264,7 +265,7 @@
attachmentListener.setEnabled(wasEnable2);
ui.getDetailAttachments().setSelectedIndex(0);
// update actions on toolbar
- LoggableElementTreeNode node = LoggableElementTreeHelper.getSelectedNodeOrRootNode(ui.getNavigationTree());
+ LoggableElementTreeNode node = MainUIRefreshHelper.getSelectedNodeOrRootNode(ui.getNavigationTree());
DetailTabRefreshHelper.refreshDetailActions(ui, model, node);
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -29,7 +29,7 @@
import fr.cemagref.simexplorer.is.ui.swing.ListTabRefreshHelper;
import fr.cemagref.simexplorer.is.ui.swing.actions.ShowSynchronizeTabAction;
import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.JApplicationTableModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.ListTableModel;
import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
import jaxx.runtime.swing.JAXXTab;
@@ -168,7 +168,7 @@
});
//TODO Est-ce vraiment le bon endroit pour faire ça ?
// push model into tableModel
- JApplicationTableModel modelTab = (JApplicationTableModel) ui.getTable().getModel();
+ ListTableModel modelTab = (ListTableModel) ui.getTable().getModel();
modelTab.setData(model.getList());
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/DetailTabModel.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/DetailTabModel.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/DetailTabModel.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -18,7 +18,7 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.model;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableElementTreeHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableElementTreeHelper.java 2008-02-16 15:12:14 UTC (rev 1022)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableElementTreeHelper.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -1,245 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, 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.swing.model;
-
-import fr.cemagref.simexplorer.is.entities.data.Code;
-import fr.cemagref.simexplorer.is.entities.data.Component;
-import fr.cemagref.simexplorer.is.entities.data.Constant;
-import fr.cemagref.simexplorer.is.entities.data.ConstantValue;
-import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
-import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
-import fr.cemagref.simexplorer.is.entities.data.Library;
-import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
-import fr.cemagref.simexplorer.is.entities.data.Result;
-import fr.cemagref.simexplorer.is.entities.data.Structure;
-import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
-import static org.codelutin.i18n.I18n._;
-
-import javax.swing.JTree;
-import javax.swing.tree.TreePath;
-
-/**
- * Une classe d'utilitaire pour construire les arbres de LoggableElement
- *
- * @author chemit
- * @see LoggableElementTreeNode
- */
-public class LoggableElementTreeHelper {
-
- public enum TypeNode {
- explorationApplication(ExplorationApplication.class),
- explorationData(ExplorationData.class),
- component(Component.class),
- result(Result.class),
- library(Library.class);
-
- private Class<?> klass;
-
- TypeNode(Class<?> aClass) {
- this.klass = aClass;
- }
-
- public Class<?> getKlass() {
- return klass;
- }
- }
-
- public static LoggableElementTreeNode getSelectedNodeOrRootNode(JTree tree) {
- TreePath path = tree.getSelectionPath();
- LoggableElementTreeNode node = null;
- if (path != null) {
- Object o = path.getLastPathComponent();
- if (o != null && !(o instanceof LoggableElementTreeNode)) {
- return null;
- }
- node = (LoggableElementTreeNode) o;
- }
- if (node == null) {
- // take the root node
- Object root = tree.getModel().getRoot();
- if (root == null || !(root instanceof LoggableElementTreeNode)) {
- return null;
- }
- node = (LoggableElementTreeNode) root;
- }
- return node;
- }
-
- public static LoggableElementTreeNode getSelectedNode(JTree tree) {
- TreePath path = tree.getSelectionPath();
- LoggableElementTreeNode node = null;
- if (path != null) {
- Object o = path.getLastPathComponent();
- if (o != null && !(o instanceof LoggableElementTreeNode)) {
- return null;
- }
- node = (LoggableElementTreeNode) o;
- }
- return node;
- }
-
- public static LoggableElementTreeNode getRootNode(JTree tree) {
- LoggableElementTreeNode node;
- // take the root node
- Object root = tree.getModel().getRoot();
- if (root == null || !(root instanceof LoggableElementTreeNode)) {
- return null;
- }
- node = (LoggableElementTreeNode) root;
- return node;
- }
-
- public static LoggableElementTreeNode buildLoggableElementNode(LoggableElement element, boolean remote) {
- if (element instanceof ExplorationApplication) {
- return buildExplorationApplicationNode(null, (ExplorationApplication) element, remote);
- }
- if (element instanceof Component) {
- return buildComponentNode(null, (Component) element, remote);
- }
- if (element instanceof ExplorationData) {
- return buildExplorationDataNode(null, (ExplorationData) element, remote);
- }
-
- if (element instanceof Library) {
- return buildLibraryNode(null, (Library) element, remote);
- }
- throw new SimExplorerRuntimeException("could not foud a builder for " + element);
-
- }
-
- public static LoggableElementTreeNode buildExplorationApplicationNode(LoggableElementTreeNode parent, ExplorationApplication element, boolean remote) {
- LoggableElementTreeNode result = new LoggableElementTreeNode(parent, element, remote, true);
- LoggableElementTreeNode tmpNode;
- // build components node and his childs
- tmpNode = new LoggableElementTreeNode(result, _("simexplorer.node.components"), remote, true);
- if (element.getComponents() != null) {
- for (Component component : element.getComponents()) {
- buildComponentNode(tmpNode, component, remote);
- }
- }
-
- // build explorations node and his childs
- tmpNode = new LoggableElementTreeNode(result, _("simexplorer.node.explorations"), remote, true);
- if (element.getExplorations() != null) {
- for (ExplorationData explorationData : element.getExplorations()) {
- buildExplorationDataNode(tmpNode, explorationData, remote);
- }
- }
- return result;
- }
-
- public static LoggableElementTreeNode buildComponentNode(LoggableElementTreeNode parent, Component element, boolean remote) {
-
- LoggableElementTreeNode result = new LoggableElementTreeNode(parent, element, remote, true);
- LoggableElementTreeNode tmpNode;
-
- // build constantes nodes
- tmpNode = new LoggableElementTreeNode(result, _("simexplorer.node.constants"), remote, true);
- if (element.getConstants() != null) {
- for (Constant constante : element.getConstants()) {
- buildConstantNode(tmpNode, constante, remote);
- }
- }
-
- // build structures nodes
- tmpNode = new LoggableElementTreeNode(result, _("simexplorer.node.structures"), remote, true);
- if (element.getStructures() != null) {
- for (Structure structure : element.getStructures()) {
- buildStructureNode(tmpNode, structure, remote);
- }
- }
-
- // build Codes nodes
- tmpNode = new LoggableElementTreeNode(result, _("simexplorer.node.codes"), remote, true);
- if (element.getCodes() != null) {
- for (Code code : element.getCodes()) {
- buildCodeNode(tmpNode, code, remote);
- }
- }
-
- // build libraries nodes
- tmpNode = new LoggableElementTreeNode(result, _("simexplorer.node.libraries"), remote, true);
- if (element.getLibraries() != null) {
- for (Library library : element.getLibraries()) {
- buildLibraryNode(tmpNode, library, remote);
- }
- }
-
- return result;
- }
-
- public static LoggableElementTreeNode buildExplorationDataNode(LoggableElementTreeNode parent, ExplorationData element, boolean remote) {
- LoggableElementTreeNode result = new LoggableElementTreeNode(parent, element, remote, true);
- LoggableElementTreeNode tmpNode;
- // build constant values nodes
- tmpNode = new LoggableElementTreeNode(result, _("simexplorer.node.constantvalues"), remote, true);
- if (element.getValuesMap() != null) {
- for (ConstantValue library : element.getValuesMap()) {
- buildConstantValueNode(tmpNode, library, remote);
- }
- }
- // build result node
- if (element.getResult() != null) {
- buildResultNode(result, element.getResult(), remote);
- }
- return result;
- }
-
- public static LoggableElementTreeNode buildLibraryNode(LoggableElementTreeNode parent, Library element, boolean remote) {
- LoggableElementTreeNode result;
- result = new LoggableElementTreeNode(parent, element, remote, false);
- return result;
- }
-
- public static LoggableElementTreeNode buildCodeNode(LoggableElementTreeNode parent, Code element, boolean remote) {
- LoggableElementTreeNode result;
- result = new LoggableElementTreeNode(parent, element, remote, false);
- return result;
- }
-
- public static LoggableElementTreeNode buildStructureNode(LoggableElementTreeNode parent, Structure element, boolean remote) {
- LoggableElementTreeNode result;
- result = new LoggableElementTreeNode(parent, element, remote, false);
- return result;
- }
-
- public static LoggableElementTreeNode buildConstantNode(LoggableElementTreeNode parent, Constant element, boolean remote) {
- LoggableElementTreeNode result;
- result = new LoggableElementTreeNode(parent, element, remote, false);
- return result;
- }
-
-
- public static LoggableElementTreeNode buildConstantValueNode(LoggableElementTreeNode parent, ConstantValue element, boolean remote) {
- LoggableElementTreeNode result;
- result = new LoggableElementTreeNode(parent, element.getConstant().getName(), remote, true);
- result.add(new LoggableElementTreeNode(result, element.getValue(), remote, false));
- return result;
- }
-
- public static LoggableElementTreeNode buildResultNode(LoggableElementTreeNode parent, Result element, boolean remote) {
- LoggableElementTreeNode result;
- result = new LoggableElementTreeNode(parent, element, remote, false);
- return result;
- }
-
- protected LoggableElementTreeHelper() {
- // no instance please
- }
-}
Added: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/TreeNodeBuilder.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/TreeNodeBuilder.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/TreeNodeBuilder.java 2008-02-16 15:14:13 UTC (rev 1023)
@@ -0,0 +1,278 @@
+/*
+* ##% Copyright (C) 2007, 2008 Code Lutin,
+* Tony Chemit, 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.swing.model;
+
+import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.Code;
+import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.Component;
+import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.Constant;
+import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.ConstantValue;
+import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.ExplorationData;
+import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.Library;
+import static fr.cemagref.simexplorer.is.entities.EntityHelper.Type.Structure;
+import fr.cemagref.simexplorer.is.entities.EntityVisitable;
+import fr.cemagref.simexplorer.is.entities.SimpleEntityVisitor;
+import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import fr.cemagref.simexplorer.is.entities.data.Code;
+import fr.cemagref.simexplorer.is.entities.data.Component;
+import fr.cemagref.simexplorer.is.entities.data.Constant;
+import fr.cemagref.simexplorer.is.entities.data.ConstantValue;
+import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
+import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
+import fr.cemagref.simexplorer.is.entities.data.Library;
+import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
+import fr.cemagref.simexplorer.is.entities.data.Result;
+import fr.cemagref.simexplorer.is.entities.data.Structure;
+
+import java.util.Collection;
+
+/**
+ * La classe responsable de la création des arbres de {@link LoggableElementTreeNode}
+ * à partir de {@link LoggableElement} .
+ * <p/>
+ * La classe possède une instance cachée par thread qui délègue la construction
+ * del'arbre de navigation à un visiteur de {@link LoggableElement}.
+ * <p/>
+ *
+ * @author chemit
+ */
+public class TreeNodeBuilder extends SimpleEntityVisitor {
+
+ /** L'instance cachée par Thread. */
+ protected static final ThreadLocal<TreeNodeBuilder> instance =
+ new ThreadLocal<TreeNodeBuilder>() {
+ @Override
+ protected TreeNodeBuilder initialValue() {
+ return new TreeNodeBuilder();
+ }
+ };
+
+ /** le visiteur */
+ protected LoggableElementVisitorBuilder visitor;
+
+ /**
+ * Construit un arbre de navigation à partir d'un {@link LoggableElement}.
+ *
+ * @param v la donnée à visiter
+ * @param remote flag pour indiquer si on travaille sur des données locales
+ * ou en remote.
+ * @return le noeud parent de l'arbre de nivation construit.
+ */
+ public static LoggableElementTreeNode build(LoggableElement v, boolean remote) {
+ TreeNodeBuilder instance;
+ synchronized (instance = TreeNodeBuilder.instance.get()) {
+ LoggableElementTreeNode result;
+ // walk
+ result = instance.visitor.visit(v, remote);
+ return result;
+ }
+ }
+
+ /** Protected scope to disable instanciation, use cached instance instead. */
+ protected TreeNodeBuilder() {
+ visitor = new LoggableElementVisitorBuilder();
+ }
+
+ /**
+ * Lazy visitor getter.
+ *
+ * @return the cached visitor instance
+ */
+ public LoggableElementVisitorBuilder getVisitor() {
+ if (visitor == null) {
+ visitor = new LoggableElementVisitorBuilder();
+ }
+ return visitor;
+ }
+
+
+ /**
+ * Implantation de {@link SimpleEntityVisitor} pour construire l'arbre
+ * de navigation d'un {@link LoggableElement}.
+ * <p/>
+ * Cette classe est stateless, tous ces états internes doivent être nettoyé
+ * après une visite, en utilisant la méthode {@link #reset()}.
+ * <p/>
+ */
+ public static class LoggableElementVisitorBuilder extends SimpleEntityVisitor {
+
+ /**
+ * le noeud parent de tous les autres.
+ * <p/>
+ * Ce noeud est positionné par la méthode
+ * {@link #markRootNode(LoggableElementTreeNode)}.
+ */
+ protected LoggableElementTreeNode rootNode;
+
+ /**
+ * flag qui indique si on travaille sur des objet locaux ou distants.
+ * <p/>
+ * Cette information est conservé dans les nodes pour permettre de gérer
+ * de manière transparent des objet locaux ou distants.
+ */
+ protected Boolean remote;
+
+ /** les nodes internes utilisés pendant la visite. */
+ protected LoggableElementTreeNode explorationApplication,
+ component,
+ explorationData,
+ components,
+ explorationDatas,
+ libraries,
+ constants,
+ strutures,
+ codes,
+ constantValues;
+
+ public LoggableElementTreeNode visit(EntityVisitable v, boolean remote) {
+ reset();
+ try {
+ this.remote = remote;
+ super.visit(v);
+ return this.rootNode;
+ } finally {
+ reset();
+ }
+ }
+
+ @Override
+ public void visitMetaData(MetaData v) {
+ // do not visit meta data (for the moment we dont need thoses
+ // informations in navigation tree), but it could be interresting
+ // for example to display attchments here ?
+ }
+
+ @Override
+ public void visitExplorationApplication(ExplorationApplication v) {
+ markRootNode(explorationApplication = new LoggableElementTreeNode(explorationDatas, v, remote, true));
+ super.visitExplorationApplication(v);
+ }
+
+ @Override
+ public void visitComponent(Component v) {
+ markRootNode(component = new LoggableElementTreeNode(components, v, remote, true));
+ super.visitComponent(v);
+ }
+
+ @Override
+ public void visitExplorationData(ExplorationData v) {
+ markRootNode(explorationData = new LoggableElementTreeNode(explorationDatas, v, remote, true));
+ super.visitExplorationData(v);
+ }
+
+ @Override
+ public void visitCodes(Collection<Code> vs) {
+ codes = new LoggableElementTreeNode(component, Code.getLibelles(), remote, true);
+ super.visitCodes(vs);
+ }
+
+ @Override
+ public void visitComponents(Collection<Component> vs) {
+ components = new LoggableElementTreeNode(explorationApplication, Component.getLibelles(), remote, true);
+ super.visitComponents(vs);
+ }
+
+ @Override
+ public void visitConstants(Collection<Constant> vs) {
+ constants = new LoggableElementTreeNode(component, Constant.getLibelles(), remote, true);
+ super.visitConstants(vs);
+ }
+
+ @Override
+ public void visitConstantValues(Collection<ConstantValue> vs) {
+ constantValues = new LoggableElementTreeNode(explorationData, ConstantValue.getLibelles(), remote, true);
+ super.visitConstantValues(vs);
+ }
+
+ @Override
+ public void visitExplorationDatas(Collection<ExplorationData> vs) {
+ explorationDatas = new LoggableElementTreeNode(explorationApplication, ExplorationData.getLibelles(), remote, true);
+ super.visitExplorationDatas(vs);
+ }
+
+ @Override
+ public void visitLibraries(Collection<Library> vs) {
+ libraries = new LoggableElementTreeNode(component, Library.getLibelles(), remote, true);
+ super.visitLibraries(vs);
+ }
+
+ @Override
+ public void visitStructures(Collection<Structure> vs) {
+ strutures = new LoggableElementTreeNode(component, Structure.getLibelles(), remote, true);
+ super.visitStructures(vs);
+ }
+
+ @Override
+ public void visitConstant(Constant v) {
+ markRootNode(new LoggableElementTreeNode(constants, v, remote, false));
+ }
+
+ @Override
+ public void visitLibrary(Library v) {
+ markRootNode(new LoggableElementTreeNode(libraries, v, remote, false));
+ }
+
+ @Override
+ public void visitResult(Result v) {
+ markRootNode(new LoggableElementTreeNode(explorationData, v, remote, false));
+ }
+
+ @Override
+ public void visitCode(Code v) {
+ new LoggableElementTreeNode(codes, v, remote, false);
+ }
+
+ @Override
+ public void visitConstantValue(ConstantValue v) {
+ new LoggableElementTreeNode(
+ new LoggableElementTreeNode(constantValues, v.getConstant().getName(), remote, true),
+ v.getValue(), remote, false);
+ }
+
+ @Override
+ public void visitStructure(Structure v) {
+ new LoggableElementTreeNode(strutures, v, remote, false);
+ }
+
+ /**
+ * Tente de marquerle node donné comme noeud ancêtre de tous les autres.
+ * <p/>
+ * Le positionnement n'a lieu que si on a pas encore de rootNode.
+ *
+ * @param node le node a positionner comme rootNode (si nessecaire)
+ */
+ protected void markRootNode(LoggableElementTreeNode node) {
+ if (rootNode == null) {
+ rootNode = node;
+ }
+ }
+
+ /**
+ * La méthode pour réinitialiser les états interne de la classe.
+ * <p/>
+ * Cette méthode doit être appeler après chaque visite, afin d'assurer
+ * la propriété stateless de la classe.
+ */
+ protected void reset() {
+ remote = null;
+ rootNode = explorationApplication = explorationDatas = explorationData
+ = components = component = constants = codes = libraries
+ = constantValues = null;
+ }
+ }
+}
1
0
r1022 - in trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is: service storage/engine
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
16 Feb '08
Author: tchemit
Date: 2008-02-16 15:12:14 +0000 (Sat, 16 Feb 2008)
New Revision: 1022
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/storage/engine/StorageEngineSecuImpl.java
Log:
deplacement du generateur d'element dans le module storage avec les autres generateurs et dans le meme module
deplacement de la factorie de ContentType dans le paquetage des factories
deplacement du paquetage attchment dans paquetage entities
ajout TODO sur javadoc
i18n pour EntityHelper.Type
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-16 15:10:16 UTC (rev 1021)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-16 15:12:14 UTC (rev 1022)
@@ -24,7 +24,7 @@
import com.healthmarketscience.rmiio.SerializableInputStream;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
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-16 15:10:16 UTC (rev 1021)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-16 15:12:14 UTC (rev 1022)
@@ -41,7 +41,7 @@
import com.healthmarketscience.rmiio.SerializableInputStream;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.DataEntity;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
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-16 15:10:16 UTC (rev 1021)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-16 15:12:14 UTC (rev 1022)
@@ -25,7 +25,7 @@
import javax.ejb.Local;
import javax.ejb.Stateless;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
@@ -180,10 +180,7 @@
@Override
public boolean canCreateSubVersion(String token, String uuid) throws SimExplorerException {
Permission permission = credentialManager.getPermission(token, uuid);
- if (permission.isCanWrite()) {
- return true;
- }
- return false;
+ return permission.isCanWrite();
}
/* (non-Javadoc)
1
0
r1021 - in trunk/simexplorer-is: simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/metadata simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
16 Feb '08
Author: tchemit
Date: 2008-02-16 15:10:16 +0000 (Sat, 16 Feb 2008)
New Revision: 1021
Added:
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitable.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitor.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/SimpleEntityVisitor.java
Modified:
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java
Log:
passage de classe abstraite en interface (BaseEntity, ContentType.
suppression des implements Serializable inutile sur des classes qui ?\195?\169tant d?\195?\169j?\195?\160 ce contrat.
renommage de la propri?\195?\169t?\195?\169 valueMap en constantValues (dans ExplorationData)
Introduction d'un visiteur de BaseEntity, marquage du contrat de BaseEntity par cette interface.
implantation d'un premier visiteur qui definit la navigation dans les LoggableElement.
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -20,13 +20,16 @@
import java.io.Serializable;
/**
- * The Class BaseEntity.
- * TODO Be an interface
+ * The minimal Entity contract.
+ * <p/>
+ * This is a <code>marker</code> interface, nothing special to describe for this
+ * contract.
+ * <p/>
+ * An Entity is serializable and visitable.
+ *
+ * @author glandais
+ * @see Serializable
+ * @see EntityVisitable
*/
-public abstract class BaseEntity implements Serializable {
-
- // empty class
-
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = -1180452401816397351L;
+public interface BaseEntity extends Serializable, EntityVisitable {
}
Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitable.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitable.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitable.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -0,0 +1,36 @@
+/*
+* ##% Copyright (C) 2007, 2008 Code Lutin, Tony Chemit, 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.entities;
+
+/**
+ * Le contrat a respecter par un entity pour être visiter par un
+ * {@link EntityVisitor} visiteur.
+ *
+ * @author chemit
+ * @see EntityVisitor
+ */
+public interface EntityVisitable {
+ /**
+ * Méthode à implanter dans chaque visitable pour indiquer ce que
+ * le visiteur doit visiter.
+ *
+ * @param visitor le visiteur
+ */
+ void accept(EntityVisitor visitor);
+
+}
Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitor.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitor.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitor.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -0,0 +1,210 @@
+/*
+* ##% Copyright (C) 2007, 2008 Code Lutin, Tony Chemit, 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.entities;
+
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.data.Code;
+import fr.cemagref.simexplorer.is.entities.data.Component;
+import fr.cemagref.simexplorer.is.entities.data.Constant;
+import fr.cemagref.simexplorer.is.entities.data.ConstantValue;
+import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
+import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
+import fr.cemagref.simexplorer.is.entities.data.Library;
+import fr.cemagref.simexplorer.is.entities.data.Repository;
+import fr.cemagref.simexplorer.is.entities.data.Result;
+import fr.cemagref.simexplorer.is.entities.data.Structure;
+import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+
+import java.util.Collection;
+
+/**
+ * Le contrat à respecter pour un visiteur à visiter des {@link EntityVisitable}..
+ *
+ * @author chemit
+ * @see EntityVisitable
+ * @see SimpleEntityVisitor
+ */
+public interface EntityVisitor {
+
+ /**
+ * La méthode de base pour visiter n'importe quel {@link EntityVisitable}.
+ *
+ * @param v le visité
+ */
+ void visit(EntityVisitable v);
+
+ /**
+ * Pour visiter une exploration d'application
+ *
+ * @param v le visité
+ * @see ExplorationApplication
+ */
+ void visitExplorationApplication(ExplorationApplication v);
+
+ /**
+ * Pour visiter un Component
+ *
+ * @param v le visité
+ * @see Component
+ */
+ void visitComponent(Component v);
+
+ /**
+ * Pour visiter une ExplorationApplication
+ *
+ * @param v le visité
+ * @see ExplorationApplication
+ */
+ void visitExplorationData(ExplorationData v);
+
+ /**
+ * Pour visiter un Library
+ *
+ * @param v le visité
+ * @see Library
+ */
+ void visitLibrary(Library v);
+
+ /**
+ * Pour visiter un Metadata
+ *
+ * @param v le visité
+ * @see MetaData
+ */
+ void visitMetaData(MetaData v);
+
+ /**
+ * Pour visiter un Result
+ *
+ * @param v le visité
+ * @see Result
+ */
+ void visitResult(Result v);
+
+ /**
+ * Pour visiter un Constant
+ *
+ * @param vs le visité
+ * @see Constant
+ */
+ void visitConstant(Constant vs);
+
+ /**
+ * Pour visiter un Code
+ *
+ * @param v le visité
+ * @see Code
+ */
+ void visitCode(Code v);
+
+ /**
+ * Pour visiter un Structure
+ *
+ * @param v le visité
+ * @see Structure
+ */
+ void visitStructure(Structure v);
+
+ /**
+ * Pour visiter un ConstantValue
+ *
+ * @param v le visité
+ * @see ConstantValue
+ */
+ void visitConstantValue(ConstantValue v);
+
+ /**
+ * Pour visiter un Attachment
+ *
+ * @param v le visité
+ * @see Attachment
+ */
+ void visitAttachment(Attachment v);
+
+ /**
+ * Pour visiter un Repository
+ *
+ * @param v le visité
+ * @see Repository
+ */
+ void visitRepository(Repository v);
+
+ /**
+ * Pour visiter une collection de Component
+ *
+ * @param vs les visités
+ * @see Component
+ */
+ void visitComponents(Collection<Component> vs);
+
+ /**
+ * Pour visiter une collection de ExplorationData
+ *
+ * @param vs les visités
+ * @see ExplorationData
+ */
+ void visitExplorationDatas(Collection<ExplorationData> vs);
+
+ /**
+ * Pour visiter une collection de Library
+ *
+ * @param vs les visités
+ * @see Library
+ */
+ void visitLibraries(Collection<Library> vs);
+
+ /**
+ * Pour visiter une collection de Constant
+ *
+ * @param vs les visités
+ * @see Constant
+ */
+ void visitConstants(Collection<Constant> vs);
+
+ /**
+ * Pour visiter une collection de Code
+ *
+ * @param vs les visités
+ * @see Code
+ */
+ void visitCodes(Collection<Code> vs);
+
+ /**
+ * Pour visiter une collection de Structure
+ *
+ * @param vs les visités
+ * @see Structure
+ */
+ void visitStructures(Collection<Structure> vs);
+
+ /**
+ * Pour visiter une collection de ConstantValue
+ *
+ * @param vs les visités
+ * @see ConstantValue
+ */
+ void visitConstantValues(Collection<ConstantValue> vs);
+
+ /**
+ * Pour visiter une collection de Attachment
+ *
+ * @param vs les visités
+ * @see Attachment
+ */
+ void visitAttachments(Collection<Attachment> vs);
+}
Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/SimpleEntityVisitor.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/SimpleEntityVisitor.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/SimpleEntityVisitor.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -0,0 +1,167 @@
+/*
+* ##% Copyright (C) 2007, 2008 Code Lutin,
+* Tony Chemit, 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.entities;
+
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.data.Code;
+import fr.cemagref.simexplorer.is.entities.data.Component;
+import fr.cemagref.simexplorer.is.entities.data.Constant;
+import fr.cemagref.simexplorer.is.entities.data.ConstantValue;
+import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
+import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
+import fr.cemagref.simexplorer.is.entities.data.Library;
+import fr.cemagref.simexplorer.is.entities.data.Repository;
+import fr.cemagref.simexplorer.is.entities.data.Result;
+import fr.cemagref.simexplorer.is.entities.data.Structure;
+import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+
+import java.util.Collection;
+
+/**
+ * Un simple visiteur de BaseEntity.
+ *
+ * @author chemit
+ * @see EntityVisitor
+ * @see EntityVisitable
+ * @see BaseEntity
+ */
+public class SimpleEntityVisitor implements EntityVisitor {
+
+ /**
+ * La méthode générique pour visiter un {@link EntityVisitable}.
+ *
+ * @param v le visité
+ */
+ public void visit(EntityVisitable v) {
+ if (v != null) {
+ // on lance la visite
+ v.accept(this);
+ }
+ }
+
+ public void visitExplorationApplication(ExplorationApplication v) {
+ if (v != null) {
+ visitComponents(v.getComponents());
+ visitExplorationDatas(v.getExplorations());
+ visitMetaData(v.getMetaData());
+ }
+ }
+
+ public void visitComponent(Component v) {
+ if (v != null) {
+ visitConstants(v.getConstants());
+ visitCodes(v.getCodes());
+ visitLibraries(v.getLibraries());
+ visitMetaData(v.getMetaData());
+ }
+ }
+
+ public void visitExplorationData(ExplorationData v) {
+ if (v != null) {
+ visitConstantValues(v.getConstantValues());
+ visitResult(v.getResult());
+ visitMetaData(v.getMetaData());
+ }
+ }
+
+ public void visitLibrary(Library v) {
+ if (v != null) {
+ visitMetaData(v.getMetaData());
+ }
+ }
+
+ public void visitMetaData(MetaData v) {
+ if (v != null) {
+ visitAttachments(v.getAttachments());
+ }
+ }
+
+ public void visitExplorationDatas(Collection<ExplorationData> vs) {
+ visitSet(vs);
+ }
+
+ public void visitComponents(Collection<Component> v) {
+ visitSet(v);
+ }
+
+ public void visitCodes(Collection<Code> v) {
+ visitSet(v);
+ }
+
+ public void visitConstants(Collection<Constant> vs) {
+ visitSet(vs);
+ }
+
+ public void visitConstantValues(Collection<ConstantValue> vs) {
+ visitSet(vs);
+ }
+
+ public void visitLibraries(Collection<Library> vs) {
+ visitSet(vs);
+ }
+
+ public void visitStructures(Collection<Structure> vs) {
+ visitSet(vs);
+ }
+
+ public void visitAttachments(Collection<Attachment> vs) {
+ visitSet(vs);
+ }
+
+ public void visitCode(Code v) {
+ // by default, do nothing
+ }
+
+ public void visitConstant(Constant v) {
+ // by default, do nothing
+ }
+
+ public void visitConstantValue(ConstantValue v) {
+ // by default, do nothing
+ }
+
+ public void visitResult(Result v) {
+ // by default, do nothing
+ }
+
+ public void visitRepository(Repository v) {
+ // by default, do nothing
+ }
+
+ public void visitStructure(Structure v) {
+ // by default, do nothing
+ }
+
+ public void visitAttachment(Attachment v) {
+ // by default, do nothing
+ }
+
+ /**
+ * Visite une collection de visitables du même type.
+ *
+ * @param vs l'ensemble de visitables visités
+ */
+ protected void visitSet(Collection<? extends EntityVisitable> vs) {
+ if (vs != null) {
+ for (EntityVisitable visitable : vs) {
+ visitable.accept(this);
+ }
+ }
+ }
+}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -17,6 +17,8 @@
* ##% */
package fr.cemagref.simexplorer.is.entities.data;
+import fr.cemagref.simexplorer.is.entities.EntityVisitor;
+
import java.io.Serializable;
/**
@@ -78,4 +80,8 @@
public String toString() {
return getCode() + " : " + getLanguage();
}
+
+ public void accept(EntityVisitor visitor) {
+ visitor.visitCode(this);
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -17,6 +17,8 @@
* ##% */
package fr.cemagref.simexplorer.is.entities.data;
+import fr.cemagref.simexplorer.is.entities.EntityVisitor;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -128,4 +130,7 @@
return directChildren;
}
+ public void accept(EntityVisitor visitor) {
+ visitor.visitComponent(this);
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -17,11 +17,11 @@
* ##% */
package fr.cemagref.simexplorer.is.entities.data;
+import fr.cemagref.simexplorer.is.entities.EntityVisitor;
+
import java.io.Serializable;
-/**
- * The Class Constant.
- */
+/** The Class Constant. */
public class Constant extends DataEntity implements Serializable {
/** The Constant serialVersionUID. */
@@ -35,7 +35,7 @@
/**
* Gets the name.
- *
+ *
* @return the name
*/
public String getName() {
@@ -44,9 +44,8 @@
/**
* Sets the name.
- *
- * @param name
- * the new name
+ *
+ * @param name the new name
*/
public void setName(String name) {
this.name = name;
@@ -54,7 +53,7 @@
/**
* Gets the type.
- *
+ *
* @return the type
*/
public Class<?> getType() {
@@ -63,9 +62,8 @@
/**
* Sets the type.
- *
- * @param type
- * the new type
+ *
+ * @param type the new type
*/
public void setType(Class<?> type) {
this.type = type;
@@ -78,4 +76,8 @@
public String toString() {
return getName() + " : " + getType().getSimpleName();
}
+
+ public void accept(EntityVisitor visitor) {
+ visitor.visitConstant(this);
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -17,6 +17,8 @@
* ##% */
package fr.cemagref.simexplorer.is.entities.data;
+import fr.cemagref.simexplorer.is.entities.EntityVisitor;
+
import java.io.Serializable;
/**
@@ -71,4 +73,8 @@
this.constant = constant;
}
+ public void accept(EntityVisitor visitor) {
+ visitor.visitConstantValue(this);
+ }
+
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -22,7 +22,7 @@
/**
* The Class DataEntity.
*/
-public abstract class DataEntity extends BaseEntity {
+public abstract class DataEntity implements BaseEntity {
/** The parent data. */
private DataEntity parentData;
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -17,6 +17,8 @@
* ##% */
package fr.cemagref.simexplorer.is.entities.data;
+import fr.cemagref.simexplorer.is.entities.EntityVisitor;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -86,4 +88,7 @@
return directChildren;
}
+ public void accept(EntityVisitor visitor) {
+ visitor.visitExplorationApplication(this);
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -17,6 +17,8 @@
* ##% */
package fr.cemagref.simexplorer.is.entities.data;
+import fr.cemagref.simexplorer.is.entities.EntityVisitor;
+
import java.io.Serializable;
import java.util.List;
import java.util.Set;
@@ -29,8 +31,8 @@
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -6439801837608358754L;
- /** The values map. */
- private Set<ConstantValue> valuesMap;
+ /** The values map. TODO le champs doit s'appeller constantValues */
+ private Set<ConstantValue> constantValues;
/** The result. */
private Result result;
@@ -44,7 +46,7 @@
* @return the constant value
*/
private ConstantValue findConstantValue(Constant c) {
- for (ConstantValue constantValue : valuesMap) {
+ for (ConstantValue constantValue : constantValues) {
if (c.equals(constantValue.getConstant())) {
return constantValue;
}
@@ -65,7 +67,7 @@
if (constantValue == null) {
constantValue = new ConstantValue();
constantValue.setConstant(c);
- valuesMap.add(constantValue);
+ constantValues.add(constantValue);
}
constantValue.setValue(value);
}
@@ -110,18 +112,18 @@
*
* @return the values map
*/
- public Set<ConstantValue> getValuesMap() {
- return valuesMap;
+ public Set<ConstantValue> getConstantValues() {
+ return constantValues;
}
/**
* Sets the values map.
*
- * @param valuesMap
+ * @param constantValues
* the new values map
*/
- public void setValuesMap(Set<ConstantValue> valuesMap) {
- this.valuesMap = valuesMap;
+ public void setConstantValues(Set<ConstantValue> constantValues) {
+ this.constantValues = constantValues;
}
/* (non-Javadoc)
@@ -132,4 +134,7 @@
return null;
}
+ public void accept(EntityVisitor visitor) {
+ visitor.visitExplorationData(this);
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -17,13 +17,12 @@
* ##% */
package fr.cemagref.simexplorer.is.entities.data;
-import java.io.Serializable;
+import fr.cemagref.simexplorer.is.entities.EntityVisitor;
+
import java.util.List;
-/**
- * The Class Library.
- */
-public class Library extends LoggableElement implements Serializable {
+/** The Class Library. */
+public class Library extends LoggableElement {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -5635619075345573945L;
@@ -36,4 +35,7 @@
return null;
}
+ public void accept(EntityVisitor visitor) {
+ visitor.visitLibrary(this);
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -17,14 +17,19 @@
* ##% */
package fr.cemagref.simexplorer.is.entities.data;
+import fr.cemagref.simexplorer.is.entities.EntityVisitor;
+
import java.io.Serializable;
/**
* The Class Repository.
*/
-public class Repository extends DataEntity implements Serializable {
+public class Repository extends DataEntity {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1232065724338066924L;
+ public void accept(EntityVisitor visitor) {
+ visitor.visitRepository(this);
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -17,10 +17,12 @@
* ##% */
package fr.cemagref.simexplorer.is.entities.data;
+import fr.cemagref.simexplorer.is.entities.EntityVisitor;
+
import java.io.Serializable;
/** The Class Result. */
-public class Result extends DataEntity implements Serializable {
+public class Result extends DataEntity {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 2111484866027162494L;
@@ -29,4 +31,8 @@
public String toString() {
return "Result " + Math.abs(hashCode());
}
+
+ public void accept(EntityVisitor visitor) {
+ visitor.visitResult(this);
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -17,11 +17,17 @@
* ##% */
package fr.cemagref.simexplorer.is.entities.data;
+import fr.cemagref.simexplorer.is.entities.EntityVisitor;
+
/**
* The Class Structure.
*/
-public abstract class Structure extends DataEntity {
+public class Structure extends DataEntity {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 2594331198459134006L;
+
+ public void accept(EntityVisitor visitor) {
+ visitor.visitStructure(this);
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -17,20 +17,18 @@
* ##% */
package fr.cemagref.simexplorer.is.entities.metadata;
-import java.io.Serializable;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.BaseEntity;
+import fr.cemagref.simexplorer.is.entities.EntityVisitor;
+
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
-import fr.cemagref.simexplorer.is.entities.BaseEntity;
+/** The Class MetaData. */
+public class MetaData implements BaseEntity {
-/**
- * The Class MetaData.
- */
-public class MetaData extends BaseEntity implements Serializable {
-
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -7916932464982315229L;
@@ -72,7 +70,7 @@
/**
* Gets the uuid.
- *
+ *
* @return the uuid
*/
public String getUuid() {
@@ -81,9 +79,8 @@
/**
* Sets the uuid.
- *
- * @param uuid
- * the uuid to set
+ *
+ * @param uuid the uuid to set
*/
public void setUuid(String uuid) {
this.uuid = uuid;
@@ -91,7 +88,7 @@
/**
* Gets the name.
- *
+ *
* @return the name
*/
public String getName() {
@@ -100,9 +97,8 @@
/**
* Sets the name.
- *
- * @param name
- * the name to set
+ *
+ * @param name the name to set
*/
public void setName(String name) {
this.name = name;
@@ -110,7 +106,7 @@
/**
* Gets the type.
- *
+ *
* @return the type
*/
public String getType() {
@@ -119,9 +115,8 @@
/**
* Sets the type.
- *
- * @param type
- * the type to set
+ *
+ * @param type the type to set
*/
public void setType(String type) {
this.type = type;
@@ -129,7 +124,7 @@
/**
* Gets the description.
- *
+ *
* @return the description
*/
public String getDescription() {
@@ -138,9 +133,8 @@
/**
* Sets the description.
- *
- * @param description
- * the description to set
+ *
+ * @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
@@ -148,7 +142,7 @@
/**
* Gets the version.
- *
+ *
* @return the version
*/
public Version getVersion() {
@@ -157,9 +151,8 @@
/**
* Sets the version.
- *
- * @param version
- * the version to set
+ *
+ * @param version the version to set
*/
public void setVersion(String version) {
this.version = Version.valueOf(version);
@@ -167,7 +160,7 @@
/**
* Gets the creation date.
- *
+ *
* @return the creationDate
*/
public Date getCreationDate() {
@@ -176,9 +169,8 @@
/**
* Sets the creation date.
- *
- * @param creationDate
- * the creationDate to set
+ *
+ * @param creationDate the creationDate to set
*/
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
@@ -186,7 +178,7 @@
/**
* Gets the hash.
- *
+ *
* @return the hash
*/
public String getHash() {
@@ -195,9 +187,8 @@
/**
* Sets the hash.
- *
- * @param hash
- * the hash to set
+ *
+ * @param hash the hash to set
*/
public void setHash(String hash) {
this.hash = hash;
@@ -205,7 +196,7 @@
/**
* Gets the descriptors.
- *
+ *
* @return the descriptors
*/
public Map<String, String> getDescriptors() {
@@ -214,9 +205,8 @@
/**
* Sets the descriptors.
- *
- * @param descriptors
- * the descriptors to set
+ *
+ * @param descriptors the descriptors to set
*/
public void setDescriptors(Map<String, String> descriptors) {
this.descriptors = descriptors;
@@ -224,7 +214,7 @@
/**
* Gets the attachments.
- *
+ *
* @return the attachments
*/
public List<Attachment> getAttachments() {
@@ -236,11 +226,12 @@
/**
* Get attachment by his index
+ *
* @param attachmentIndex index of attachment to find
* @return the correct attachment
*/
public Attachment getAttachment(Integer attachmentIndex) {
- if (attachmentIndex!=null && attachmentIndex>-1 && attachments != null && !attachments.isEmpty() && attachments.size()>attachmentIndex) {
+ if (attachmentIndex != null && attachmentIndex > -1 && attachments != null && !attachments.isEmpty() && attachments.size() > attachmentIndex) {
return attachments.get(attachmentIndex);
}
return null;
@@ -248,6 +239,7 @@
/**
* Get attachment by his uniqueId
+ *
* @param attachmentUniqueId unqiue id of attachment to find
* @return the correct attachment
*/
@@ -264,9 +256,8 @@
/**
* Sets the attachments.
- *
- * @param attachments
- * the attachments to set
+ *
+ * @param attachments the attachments to set
*/
public void setAttachments(List<Attachment> attachments) {
this.attachments = attachments;
@@ -274,7 +265,7 @@
/**
* Gets the parent version uuid.
- *
+ *
* @return the parentVersionUuid
*/
public String getParentVersionUuid() {
@@ -283,9 +274,8 @@
/**
* Sets the parent version uuid.
- *
- * @param parentVersionUuid
- * the parentVersionUuid to set
+ *
+ * @param parentVersionUuid the parentVersionUuid to set
*/
public void setParentVersionUuid(String parentVersionUuid) {
this.parentVersionUuid = parentVersionUuid;
@@ -293,7 +283,7 @@
/**
* Gets the parent version version.
- *
+ *
* @return the parentVersionVersion
*/
public String getParentVersionVersion() {
@@ -302,9 +292,8 @@
/**
* Sets the parent version version.
- *
- * @param parentVersionVersion
- * the parentVersionVersion to set
+ *
+ * @param parentVersionVersion the parentVersionVersion to set
*/
public void setParentVersionVersion(String parentVersionVersion) {
this.parentVersionVersion = parentVersionVersion;
@@ -312,7 +301,7 @@
/**
* Checks if is latest.
- *
+ *
* @return true, if is latest
*/
public boolean isLatest() {
@@ -321,12 +310,14 @@
/**
* Sets the latest.
- *
- * @param latest
- * the new latest
+ *
+ * @param latest the new latest
*/
public void setLatest(boolean latest) {
this.latest = latest;
}
+ public void accept(EntityVisitor visitor) {
+ visitor.visitMetaData(this);
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -49,7 +49,7 @@
.loadElement(
getXMLElementByTagName(xmlElement,
KEY_EXPLORATIONDATA_RESULT)));
- explorationData.setValuesMap(loadCollection(KEY_EXPLORATIONDATA_VALUES,
+ explorationData.setConstantValues(loadCollection(KEY_EXPLORATIONDATA_VALUES,
KEY_EXPLORATIONDATA_VALUE, ConstantValue.class, xmlElement,
explorationData));
return explorationData;
@@ -68,7 +68,7 @@
element.getResult());
xmlElement.appendChild(xmlResult);
- saveCollection(element.getValuesMap(), KEY_EXPLORATIONDATA_VALUES,
+ saveCollection(element.getConstantValues(), KEY_EXPLORATIONDATA_VALUES,
KEY_EXPLORATIONDATA_VALUE, ConstantValue.class, document,
xmlElement);
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java 2008-02-16 15:05:24 UTC (rev 1020)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java 2008-02-16 15:10:16 UTC (rev 1021)
@@ -210,7 +210,7 @@
* @return the list< tree node>
*/
private List<TreeNode> generateValues(ExplorationData explorationData) {
- Set<ConstantValue> values = explorationData.getValuesMap();
+ Set<ConstantValue> values = explorationData.getConstantValues();
List<TreeNode> res = new ArrayList<TreeNode>();
for (ConstantValue value : values) {
TreeNode node = new TreeNode();
1
0
r1020 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
16 Feb '08
Author: tchemit
Date: 2008-02-16 15:05:24 +0000 (Sat, 16 Feb 2008)
New Revision: 1020
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java
Log:
deplacement du generateur d'element dans le module storage avec les autres generateurs et dans le meme module
deplacement de la factorie de ContentType dans le paquetage des factories
deplacement du paquetage attchment dans paquetage entities
ajout TODO sur javadoc
i18n pour EntityHelper.Type
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-16 15:05:10 UTC (rev 1019)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java 2008-02-16 15:05:24 UTC (rev 1020)
@@ -33,7 +33,7 @@
import com.healthmarketscience.rmiio.SerializableInputStream;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
1
0
r1019 - in trunk/simexplorer-is: simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
16 Feb '08
Author: tchemit
Date: 2008-02-16 15:05:10 +0000 (Sat, 16 Feb 2008)
New Revision: 1019
Modified:
trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceLocalVersions.java
trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceMassInsert.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDownload.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java
Log:
deplacement du generateur d'element dans le module storage avec les autres generateurs et dans le meme module
deplacement de la factorie de ContentType dans le paquetage des factories
deplacement du paquetage attchment dans paquetage entities
ajout TODO sur javadoc
i18n pour EntityHelper.Type
Modified: trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceLocalVersions.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceLocalVersions.java 2008-02-16 15:03:25 UTC (rev 1018)
+++ trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceLocalVersions.java 2008-02-16 15:05:10 UTC (rev 1019)
@@ -21,18 +21,14 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
import java.util.Random;
import java.util.Set;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
import junit.framework.TestCase;
import com.healthmarketscience.rmiio.SerializableInputStream;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.Code;
import fr.cemagref.simexplorer.is.entities.data.Component;
import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
@@ -44,7 +40,8 @@
import fr.cemagref.simexplorer.is.factories.BaseEntityFactory;
import fr.cemagref.simexplorer.is.factories.MetaDataFactory;
import fr.cemagref.simexplorer.is.factories.XmlConstants;
-import fr.cemagref.simexplorer.is.service.ElementGenerator.RandomStream;
+import fr.cemagref.simexplorer.is.storage.ElementGenerator.RandomStream;
+import fr.cemagref.simexplorer.is.storage.ElementGenerator;
public class StorageServiceLocalVersions extends TestCase {
@@ -182,9 +179,9 @@
MetaData mde2 = saveEa(ea, false);
listExisting(ea.getMetaData().getUuid());
- System.out.println("A : " + mde1.getHash().toString());
+ System.out.println("A : " + mde1.getHash());
if (different) {
- System.out.println("B : " + mde2.getHash().toString());
+ System.out.println("B : " + mde2.getHash());
}
return ea.getMetaData().getUuid();
Modified: trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceMassInsert.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceMassInsert.java 2008-02-16 15:03:25 UTC (rev 1018)
+++ trunk/simexplorer-is/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceMassInsert.java 2008-02-16 15:05:10 UTC (rev 1019)
@@ -33,14 +33,15 @@
import com.healthmarketscience.rmiio.SerializableInputStream;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.Component;
import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
import fr.cemagref.simexplorer.is.entities.data.Library;
import fr.cemagref.simexplorer.is.factories.BaseEntityFactory;
import fr.cemagref.simexplorer.is.factories.XmlConstants;
-import fr.cemagref.simexplorer.is.service.ElementGenerator.RandomStream;
+import fr.cemagref.simexplorer.is.storage.ElementGenerator.RandomStream;
+import fr.cemagref.simexplorer.is.storage.ElementGenerator;
/**
* The Class StorageServiceMassInsert.
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-16 15:03:25 UTC (rev 1018)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-16 15:05:10 UTC (rev 1019)
@@ -19,7 +19,7 @@
package fr.cemagref.simexplorer.is.service;
import com.healthmarketscience.rmiio.SerializableInputStream;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDownload.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDownload.java 2008-02-16 15:03:25 UTC (rev 1018)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDownload.java 2008-02-16 15:05:10 UTC (rev 1019)
@@ -26,7 +26,7 @@
import org.apache.tapestry.StreamResponse;
import org.codelutin.tapestry.beans.TreeNode;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.Component;
import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
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-16 15:03:25 UTC (rev 1018)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java 2008-02-16 15:05:10 UTC (rev 1019)
@@ -29,7 +29,7 @@
import org.apache.tapestry.ioc.annotations.Inject;
import org.codelutin.tapestry.beans.TreeNode;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
1
0
16 Feb '08
Author: tchemit
Date: 2008-02-16 15:03:25 +0000 (Sat, 16 Feb 2008)
New Revision: 1018
Added:
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ContentTypeFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/ElementGenerator.java
Removed:
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/ElementGenerator.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/ContentTypeFactory.java
Modified:
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/Attachment.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/ContentType.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/RawType.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/MetaDataGenerator.java
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.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
trunk/simexplorer-is/simexplorer-is-storage/src/resources/i18n/simexplorer-is-storage-en_GB.properties
trunk/simexplorer-is/simexplorer-is-storage/src/resources/i18n/simexplorer-is-storage-fr_FR.properties
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockDatabase.java
trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Install.java
Log:
deplacement du generateur d'element dans le module storage avec les autres generateurs et dans le meme module
deplacement de la factorie de ContentType dans le paquetage des factories
deplacement du paquetage attchment dans paquetage entities
ajout TODO sur javadoc
i18n pour EntityHelper.Type
Deleted: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/ElementGenerator.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/ElementGenerator.java 2008-02-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/ElementGenerator.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -1,387 +0,0 @@
-/*
-* ##% 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.service;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.commons.lang.RandomStringUtils;
-import org.codelutin.util.MD5;
-
-import fr.cemagref.simexplorer.is.attachment.Attachment;
-import fr.cemagref.simexplorer.is.attachment.ContentTypeFactory;
-import fr.cemagref.simexplorer.is.entities.data.Code;
-import fr.cemagref.simexplorer.is.entities.data.Component;
-import fr.cemagref.simexplorer.is.entities.data.Constant;
-import fr.cemagref.simexplorer.is.entities.data.ConstantValue;
-import fr.cemagref.simexplorer.is.entities.data.DataEntity;
-import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
-import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
-import fr.cemagref.simexplorer.is.entities.data.Library;
-import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
-import fr.cemagref.simexplorer.is.entities.data.Result;
-import fr.cemagref.simexplorer.is.entities.data.Structure;
-import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.entities.metadata.Version;
-import fr.cemagref.simexplorer.is.factories.BaseEntityFactory;
-
-/**
- * The Class ElementGenerator.
- */
-public class ElementGenerator {
-
- /**
- * The Class RandomStream.
- */
- public class RandomStream {
-
- /** The md5. */
- private String md5;
-
- private byte[] data;
-
- /**
- * Gets the stream.
- *
- * @return the stream
- */
- public InputStream getStream() {
- InputStream is;
- is = new ByteArrayInputStream(data);
- return is;
- }
-
- /**
- * Gets the md5.
- *
- * @return the md5
- */
- public String getMd5() {
- return md5;
- }
-
- /**
- * Sets the md5.
- *
- * @param md5 the new md5
- */
- public void setMd5(String md5) {
- this.md5 = md5;
- }
-
- public void setData(byte[] bytes) {
- data = bytes;
- }
-
- }
-
- /** The r. */
- private Random r = new Random();
-
- /** The cs. */
- private static int cs;
-
- /** The randomstrings. */
- private static String[] randomstrings;
-
- /**
- * Instantiates a new element generator.
- */
- public ElementGenerator() {
- super();
- initializeStrings();
- }
-
- /**
- * Short string.
- *
- * @return the string
- */
- private String shortString() {
- return RandomStringUtils.randomAlphabetic(r.nextInt(5) + 5);
- }
-
- /**
- * Long string.
- *
- * @return the string
- */
- private String longString() {
- /*
- StringBuilder sb = new StringBuilder();
- int c = 3 + r.nextInt(5);
- for (int i = 0; i < c; i++) {
- sb.append(shortString());
- sb.append(" ");
- }
- return sb.toString();
- */
- return RandomStringUtils.randomAlphabetic(r.nextInt(10) + 10);
- }
-
- private String hash() {
- return RandomStringUtils.randomAlphanumeric(32);
- }
-
- /**
- * Initialize strings.
- */
- private void initializeStrings() {
- cs = 150000;
- randomstrings = new String[cs];
- for (int i = 0; i < randomstrings.length; i++) {
- randomstrings[i] = shortString();
- }
- }
-
- /**
- * Update.
- *
- * @param element the element
- *
- * @throws Exception the exception
- */
- private void update(LoggableElement element) throws Exception {
- MetaData metaData = new MetaData();
- metaData.setUuid(UUID.randomUUID().toString());
- metaData.setName(longString());
- metaData.setType(element.getClass().getSimpleName());
-
- StringBuffer sb = new StringBuffer("");
-
- for (int i = 0, max = 3 + r.nextInt(5); i < max; i++) {
- sb.append(randomstrings[r.nextInt(cs)]).append(" ");
- }
- metaData.setDescription(sb.toString());
-
- Version v = new Version("0");
-
- for (int i = 0, max = 2 + r.nextInt(2); i < max; i++) {
- v.setVersion(i, r.nextInt(5));
- }
- metaData.setVersion(v.toString());
- metaData.setCreationDate(new Date());
- metaData.setHash(shortString());
- metaData.setLatest(true);
-
- Map<String, String> descriptors = new HashMap<String, String>();
- for (int i = 0, max = 1 + r.nextInt(12); i < max; i++) {
- descriptors.put(Integer.toString(i), shortString());
- }
- metaData.setDescriptors(descriptors);
-
- if (element instanceof Library || element instanceof ExplorationData) {
- // generate attachments
- for (int i = 0, max = r.nextInt(15); i < max; i++) {
- metaData.getAttachments().add(generateAttachment());
- }
- }
-
- element.setMetaData(metaData);
- }
-
- /**
- * Generate array.
- *
- * @param <T> Class in array
- *
- * @param clazz the clazz
- *
- * @return the set< t>
- *
- * @throws Exception the exception
- */
- public <T extends DataEntity> Set<T> generateArray(Class<T> clazz) throws Exception {
- Set<T> elements = new HashSet<T>();
- int i = 3 + r.nextInt(2);
- for (int j = 0; j < i; j++) {
- T element = BaseEntityFactory.<T> getFactory(clazz).createInstance();
- if (element instanceof LoggableElement) {
- update((LoggableElement) element);
- }
- elements.add(element);
- }
- return elements;
- }
-
- /**
- * Generate random ea.
- *
- * @return the exploration application
- *
- * @throws Exception the exception
- */
- public ExplorationApplication generateRandomEA() throws Exception {
- ExplorationApplication ea = new ExplorationApplication();
- update(ea);
- Set<ExplorationData> datas = generateArray(ExplorationData.class);
- for (ExplorationData object : datas) {
- processExplorationData(object);
- }
- ea.setExplorations(datas);
- Set<Component> components = generateArray(Component.class);
- for (Component object : components) {
- processComponent(object);
- }
- ea.setComponents(components);
- return ea;
- }
-
- /**
- * Process component.
- *
- * @param component the component
- *
- * @throws Exception the exception
- */
- private void processComponent(Component component) throws Exception {
- Set<Constant> constants = generateArray(Constant.class);
- for (Constant constant : constants) {
- processConstant(constant);
- }
- component.setConstants(constants);
-
- component.setStructures(new HashSet<Structure>());
-
- Set<Code> codes = generateArray(Code.class);
- for (Code code : codes) {
- processCode(code);
- }
- component.setCodes(codes);
-
- Set<Library> libraries = generateArray(Library.class);
- for (Library library : libraries) {
- processLibrary(library);
- }
- component.setLibraries(libraries);
-
- }
-
- /**
- * Generate attachment.
- *
- * @return the attachment
- *
- * @throws Exception the exception
- */
- private Attachment generateAttachment() throws Exception {
- Attachment attachment = new Attachment();
- attachment.setContentType(ContentTypeFactory.getContentTypeInstance("RawType"));
- attachment.setDataHash(hash());
- // attachment.setDataHash("d41d8cd98f00b204e9800998ecf8427e");
- attachment.setFileName(shortString() + ".txt");
- return attachment;
- }
-
- /**
- * Process library.
- *
- * @param library the library
- *
- * @throws Exception the exception
- */
- private void processLibrary(Library library) throws Exception {
- // library.getMetaData().getAttachments().add(generateAttachment());
- }
-
- /**
- * Process code.
- *
- * @param code the code
- */
- private void processCode(Code code) {
- code.setCode(shortString());
- code.setLanguage(shortString());
- }
-
- /**
- * Process constant.
- *
- * @param constant the constant
- */
- private void processConstant(Constant constant) {
- constant.setName(shortString());
- constant.setType(String.class);
- }
-
- /**
- * Process exploration data.
- *
- * @param explorationData the exploration data
- *
- * @throws Exception the exception
- */
- private void processExplorationData(ExplorationData explorationData) throws Exception {
- Result result = new Result();
- explorationData.setResult(result);
- // explorationData.getMetaData().getAttachments().add(generateAttachment());
-
- Set<ConstantValue> constantValues = generateArray(ConstantValue.class);
- for (ConstantValue constantValue : constantValues) {
- processConstantValue(constantValue);
- }
- explorationData.setValuesMap(constantValues);
-
- }
-
- /**
- * Process constant value.
- *
- * @param constantValue the constant value
- */
- private void processConstantValue(ConstantValue constantValue) {
- Constant constant = new Constant();
- constant.setName(shortString());
- constant.setType(Integer.class);
-
- constantValue.setConstant(constant);
- constantValue.setValue(Integer.toString(r.nextInt()));
- }
-
- /**
- * Generate text stream.
- *
- * @return the input stream
- *
- * @throws Exception the exception
- */
- public RandomStream generateTextStream() throws Exception {
- RandomStream rs = new RandomStream();
-
- int wordcount = 300 + r.nextInt(300);
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < wordcount; i++) {
- sb.append(randomstrings[r.nextInt(cs)]).append(" ");
- }
-
- MD5 md5 = new MD5();
- md5.Update(sb.toString().getBytes());
- rs.setMd5(md5.asHex());
-
- rs.setData(sb.toString().getBytes());
-
- return rs;
- }
-}
Copied: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment (from rev 1014, trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/attachment)
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/Attachment.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/attachment/Attachment.java 2008-02-16 09:39:37 UTC (rev 1014)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/Attachment.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -15,18 +15,18 @@
* 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.attachment;
+package fr.cemagref.simexplorer.is.entities.attachment;
-import java.io.Serializable;
-
import org.apache.commons.lang.StringUtils;
+import fr.cemagref.simexplorer.is.entities.BaseEntity;
+import fr.cemagref.simexplorer.is.entities.EntityVisitor;
/**
* Represents data attached to metadata.
*
* @author glandais
*/
-public class Attachment implements Serializable {
+public class Attachment implements BaseEntity {
/** Serial version ID. */
private static final long serialVersionUID = 5467615366054227592L;
@@ -176,13 +176,14 @@
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
- sb.append(getFileName());
- //sb.append(getFileName()).append(" - ");
- //sb.append(getDataHash());
+ sb.append(getFileName());
if (getContentType() != null) {
sb.append(" - ").append(getContentType().getDescription());
}
return sb.toString();
}
+ public void accept(EntityVisitor visitor) {
+ visitor.visitAttachment(this);
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/ContentType.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/attachment/ContentType.java 2008-02-16 09:39:37 UTC (rev 1014)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/ContentType.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -15,45 +15,42 @@
* 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.attachment;
+package fr.cemagref.simexplorer.is.entities.attachment;
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
+
import java.io.InputStream;
import java.io.Reader;
+import java.io.Serializable;
-import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
-
/**
- * Content handler.
- *
+ * Content handler contract.
+ *
* @author landais
*/
-public abstract class ContentType {
+public interface ContentType extends Serializable {
/**
* Index content.
- *
- * @param is
- * Input stream
- *
+ *
+ * @param is Input stream
* @return Indexable text
- *
- * @throws SimExplorerException
- * the exception
+ * @throws SimExplorerException the exception
*/
- public abstract Reader renderToText(InputStream is) throws SimExplorerException;
+ Reader renderToText(InputStream is) throws SimExplorerException;
/**
* Gets the mime type.
- *
+ *
* @return the mimeType
*/
- public abstract String getMimeType();
+ String getMimeType();
/**
* Gets the description.
- *
+ *
* @return the description
*/
- public abstract String getDescription();
+ String getDescription();
}
Deleted: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/ContentTypeFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/attachment/ContentTypeFactory.java 2008-02-16 09:39:37 UTC (rev 1014)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/ContentTypeFactory.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -1,78 +0,0 @@
-/*
-* ##% 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.attachment;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Cache content types.
- *
- * @author landais
- */
-public class ContentTypeFactory {
-
- /** Content type cache. */
- private static Map<String, ContentType> contentTypes = null;
-
- /** Constant defining where are implementations */
- private static final String PACKAGE_IMPLS = ContentTypeFactory.class.getPackage().getName();
-
- /**
- * Retrieve a content type instance from the cache.
- * <p/>
- * If no such instance is found, then create it and store it in cache.
- *
- * @param contentTypeClassSimpleName Class required
- * @return the Instance
- * @throws IllegalArgumentException if could not found the class or has
- * problem while instanciation
- */
- public static ContentType getContentTypeInstance(String contentTypeClassSimpleName) throws IllegalArgumentException {
- Map<String, ContentType> contentTypes = getContentTypes();
- // Check cache
- ContentType result = getContentTypes().get(contentTypeClassSimpleName);
- // Create instance if doesn't exist, and put it in cache
- if (result == null) {
- try {
- Class<?> impl;
- impl = Class.forName(PACKAGE_IMPLS + "." + contentTypeClassSimpleName);
- result = (ContentType) impl.newInstance();
- contentTypes.put(contentTypeClassSimpleName, result);
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException(e);
- } catch (IllegalAccessException e) {
- throw new IllegalArgumentException(e);
- } catch (InstantiationException e) {
- throw new IllegalArgumentException(e);
- }
- }
- return result;
- }
-
- protected static Map<String, ContentType> getContentTypes() {
- if (contentTypes == null) {
- contentTypes = new HashMap<String, ContentType>();
- }
- return contentTypes;
- }
-
- protected ContentTypeFactory() {
- // no instance
- }
-}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/RawType.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/attachment/RawType.java 2008-02-16 09:39:37 UTC (rev 1014)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/attachment/RawType.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -15,27 +15,26 @@
* 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.attachment;
+package fr.cemagref.simexplorer.is.entities.attachment;
import static org.codelutin.i18n.I18n._;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
-import java.io.Serializable;
/**
* Raw content type.
*
* @author landais
*/
-public class RawType extends ContentType implements Serializable {
+public class RawType implements ContentType {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -8010160085848440286L;
/* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.attachment.ContentType#renderToText(java.io.InputStream)
+ * @see fr.cemagref.simexplorer.is.entities.attachment.ContentType#renderToText(java.io.InputStream)
*/
@Override
public Reader renderToText(InputStream is) {
@@ -44,15 +43,17 @@
}
/* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.attachment.ContentType#getDescription()
+ * @see fr.cemagref.simexplorer.is.entities.attachment.ContentType#getDescription()
*/
@Override
public String getDescription() {
+ //TODO, il vaudrait mieux utiliser la clef de marquage i18n
+ //TODO, sinon on ne peut pas changer de langue...
return _("simexplorer.contenttype.rawtype");
}
/* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.attachment.ContentType#getMimeType()
+ * @see fr.cemagref.simexplorer.is.entities.attachment.ContentType#getMimeType()
*/
@Override
public String getMimeType() {
Copied: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ContentTypeFactory.java (from rev 1014, trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/attachment/ContentTypeFactory.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ContentTypeFactory.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ContentTypeFactory.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -0,0 +1,80 @@
+/*
+* ##% 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.factories;
+
+import fr.cemagref.simexplorer.is.entities.attachment.ContentType;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Cache content types.
+ *
+ * @author landais
+ */
+public class ContentTypeFactory {
+
+ /** Content type cache. */
+ private static Map<String, ContentType> contentTypes = null;
+
+ /** Constant defining where are implementations */
+ private static final String PACKAGE_IMPLS = ContentTypeFactory.class.getPackage().getName();
+
+ /**
+ * Retrieve a content type instance from the cache.
+ * <p/>
+ * If no such instance is found, then create it and store it in cache.
+ *
+ * @param contentTypeClassSimpleName Class required
+ * @return the Instance
+ * @throws IllegalArgumentException if could not found the class or has
+ * problem while instanciation
+ */
+ public static ContentType getContentTypeInstance(String contentTypeClassSimpleName) throws IllegalArgumentException {
+ Map<String, ContentType> contentTypes = getContentTypes();
+ // Check cache
+ ContentType result = getContentTypes().get(contentTypeClassSimpleName);
+ // Create instance if doesn't exist, and put it in cache
+ if (result == null) {
+ try {
+ Class<?> impl;
+ impl = Class.forName(PACKAGE_IMPLS + "." + contentTypeClassSimpleName);
+ result = (ContentType) impl.newInstance();
+ contentTypes.put(contentTypeClassSimpleName, result);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalArgumentException(e);
+ } catch (InstantiationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ return result;
+ }
+
+ protected static Map<String, ContentType> getContentTypes() {
+ if (contentTypes == null) {
+ contentTypes = new HashMap<String, ContentType>();
+ }
+ return contentTypes;
+ }
+
+ protected ContentTypeFactory() {
+ // no instance
+ }
+}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java 2008-02-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -38,9 +38,8 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
-import fr.cemagref.simexplorer.is.attachment.ContentType;
-import fr.cemagref.simexplorer.is.attachment.ContentTypeFactory;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.ContentType;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
@@ -300,7 +299,7 @@
/**
* Compute hash.
*
- * @param xmlStream the xml stream
+ * @param node the xml stream
*
* @return the string
*
@@ -311,7 +310,7 @@
Document document = getXMLBuilder().newDocument();
document.appendChild(document.importNode(node, true));
- int removeNodes = removeMetadatas(document);
+ removeMetadatas(document);
DigestGenerator digestGenerator = new DigestGenerator();
byte[] digest = digestGenerator.getDigest(document, DigestGenerator.sha1DigestAlgorithm);
@@ -324,8 +323,7 @@
/**
* Removes the metadatas.
- *
- * @param document the document
+ *
* @param node the node
*
* @return the int
Copied: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/ElementGenerator.java (from rev 1014, trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/ElementGenerator.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/ElementGenerator.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/ElementGenerator.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -0,0 +1,387 @@
+/*
+* ##% Copyright (C) 2008 Code Lutin, Gabriel Landais
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+* ##% */
+package fr.cemagref.simexplorer.is.storage;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.commons.lang.RandomStringUtils;
+import org.codelutin.util.MD5;
+
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.factories.ContentTypeFactory;
+import fr.cemagref.simexplorer.is.entities.data.Code;
+import fr.cemagref.simexplorer.is.entities.data.Component;
+import fr.cemagref.simexplorer.is.entities.data.Constant;
+import fr.cemagref.simexplorer.is.entities.data.ConstantValue;
+import fr.cemagref.simexplorer.is.entities.data.DataEntity;
+import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
+import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
+import fr.cemagref.simexplorer.is.entities.data.Library;
+import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
+import fr.cemagref.simexplorer.is.entities.data.Result;
+import fr.cemagref.simexplorer.is.entities.data.Structure;
+import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.factories.BaseEntityFactory;
+
+/**
+ * The Class ElementGenerator.
+ */
+public class ElementGenerator {
+
+ /**
+ * The Class RandomStream.
+ */
+ public class RandomStream {
+
+ /** The md5. */
+ private String md5;
+
+ private byte[] data;
+
+ /**
+ * Gets the stream.
+ *
+ * @return the stream
+ */
+ public InputStream getStream() {
+ InputStream is;
+ is = new ByteArrayInputStream(data);
+ return is;
+ }
+
+ /**
+ * Gets the md5.
+ *
+ * @return the md5
+ */
+ public String getMd5() {
+ return md5;
+ }
+
+ /**
+ * Sets the md5.
+ *
+ * @param md5 the new md5
+ */
+ public void setMd5(String md5) {
+ this.md5 = md5;
+ }
+
+ public void setData(byte[] bytes) {
+ data = bytes;
+ }
+
+ }
+
+ /** The r. */
+ private Random r = new Random();
+
+ /** The cs. */
+ private static int cs;
+
+ /** The randomstrings. */
+ private static String[] randomstrings;
+
+ /**
+ * Instantiates a new element generator.
+ */
+ public ElementGenerator() {
+ super();
+ initializeStrings();
+ }
+
+ /**
+ * Short string.
+ *
+ * @return the string
+ */
+ private String shortString() {
+ return RandomStringUtils.randomAlphabetic(r.nextInt(5) + 5);
+ }
+
+ /**
+ * Long string.
+ *
+ * @return the string
+ */
+ private String longString() {
+ /*
+ StringBuilder sb = new StringBuilder();
+ int c = 3 + r.nextInt(5);
+ for (int i = 0; i < c; i++) {
+ sb.append(shortString());
+ sb.append(" ");
+ }
+ return sb.toString();
+ */
+ return RandomStringUtils.randomAlphabetic(r.nextInt(10) + 10);
+ }
+
+ private String hash() {
+ return RandomStringUtils.randomAlphanumeric(32);
+ }
+
+ /**
+ * Initialize strings.
+ */
+ private void initializeStrings() {
+ cs = 150000;
+ randomstrings = new String[cs];
+ for (int i = 0; i < randomstrings.length; i++) {
+ randomstrings[i] = shortString();
+ }
+ }
+
+ /**
+ * Update.
+ *
+ * @param element the element
+ *
+ * @throws Exception the exception
+ */
+ private void update(LoggableElement element) throws Exception {
+ MetaData metaData = new MetaData();
+ metaData.setUuid(UUID.randomUUID().toString());
+ metaData.setName(longString());
+ metaData.setType(element.getClass().getSimpleName());
+
+ StringBuffer sb = new StringBuffer("");
+
+ for (int i = 0, max = 3 + r.nextInt(5); i < max; i++) {
+ sb.append(randomstrings[r.nextInt(cs)]).append(" ");
+ }
+ metaData.setDescription(sb.toString());
+
+ Version v = new Version("0");
+
+ for (int i = 0, max = 2 + r.nextInt(2); i < max; i++) {
+ v.setVersion(i, r.nextInt(5));
+ }
+ metaData.setVersion(v.toString());
+ metaData.setCreationDate(new Date());
+ metaData.setHash(shortString());
+ metaData.setLatest(true);
+
+ Map<String, String> descriptors = new HashMap<String, String>();
+ for (int i = 0, max = 1 + r.nextInt(12); i < max; i++) {
+ descriptors.put(Integer.toString(i), shortString());
+ }
+ metaData.setDescriptors(descriptors);
+
+ if (element instanceof Library || element instanceof ExplorationData) {
+ // generate attachments
+ for (int i = 0, max = r.nextInt(15); i < max; i++) {
+ metaData.getAttachments().add(generateAttachment());
+ }
+ }
+
+ element.setMetaData(metaData);
+ }
+
+ /**
+ * Generate array.
+ *
+ * @param <T> Class in array
+ *
+ * @param clazz the clazz
+ *
+ * @return the set< t>
+ *
+ * @throws Exception the exception
+ */
+ public <T extends DataEntity> Set<T> generateArray(Class<T> clazz) throws Exception {
+ Set<T> elements = new HashSet<T>();
+ int i = 3 + r.nextInt(2);
+ for (int j = 0; j < i; j++) {
+ T element = BaseEntityFactory.<T> getFactory(clazz).createInstance();
+ if (element instanceof LoggableElement) {
+ update((LoggableElement) element);
+ }
+ elements.add(element);
+ }
+ return elements;
+ }
+
+ /**
+ * Generate random ea.
+ *
+ * @return the exploration application
+ *
+ * @throws Exception the exception
+ */
+ public ExplorationApplication generateRandomEA() throws Exception {
+ ExplorationApplication ea = new ExplorationApplication();
+ update(ea);
+ Set<ExplorationData> datas = generateArray(ExplorationData.class);
+ for (ExplorationData object : datas) {
+ processExplorationData(object);
+ }
+ ea.setExplorations(datas);
+ Set<Component> components = generateArray(Component.class);
+ for (Component object : components) {
+ processComponent(object);
+ }
+ ea.setComponents(components);
+ return ea;
+ }
+
+ /**
+ * Process component.
+ *
+ * @param component the component
+ *
+ * @throws Exception the exception
+ */
+ private void processComponent(Component component) throws Exception {
+ Set<Constant> constants = generateArray(Constant.class);
+ for (Constant constant : constants) {
+ processConstant(constant);
+ }
+ component.setConstants(constants);
+
+ component.setStructures(new HashSet<Structure>());
+
+ Set<Code> codes = generateArray(Code.class);
+ for (Code code : codes) {
+ processCode(code);
+ }
+ component.setCodes(codes);
+
+ Set<Library> libraries = generateArray(Library.class);
+ for (Library library : libraries) {
+ processLibrary(library);
+ }
+ component.setLibraries(libraries);
+
+ }
+
+ /**
+ * Generate attachment.
+ *
+ * @return the attachment
+ *
+ * @throws Exception the exception
+ */
+ private Attachment generateAttachment() throws Exception {
+ Attachment attachment = new Attachment();
+ attachment.setContentType(ContentTypeFactory.getContentTypeInstance("RawType"));
+ attachment.setDataHash(hash());
+ // attachment.setDataHash("d41d8cd98f00b204e9800998ecf8427e");
+ attachment.setFileName(shortString() + ".txt");
+ return attachment;
+ }
+
+ /**
+ * Process library.
+ *
+ * @param library the library
+ *
+ * @throws Exception the exception
+ */
+ private void processLibrary(Library library) throws Exception {
+ // library.getMetaData().getAttachments().add(generateAttachment());
+ }
+
+ /**
+ * Process code.
+ *
+ * @param code the code
+ */
+ private void processCode(Code code) {
+ code.setCode(shortString());
+ code.setLanguage(shortString());
+ }
+
+ /**
+ * Process constant.
+ *
+ * @param constant the constant
+ */
+ private void processConstant(Constant constant) {
+ constant.setName(shortString());
+ constant.setType(String.class);
+ }
+
+ /**
+ * Process exploration data.
+ *
+ * @param explorationData the exploration data
+ *
+ * @throws Exception the exception
+ */
+ private void processExplorationData(ExplorationData explorationData) throws Exception {
+ Result result = new Result();
+ explorationData.setResult(result);
+ // explorationData.getMetaData().getAttachments().add(generateAttachment());
+
+ Set<ConstantValue> constantValues = generateArray(ConstantValue.class);
+ for (ConstantValue constantValue : constantValues) {
+ processConstantValue(constantValue);
+ }
+ explorationData.setConstantValues(constantValues);
+
+ }
+
+ /**
+ * Process constant value.
+ *
+ * @param constantValue the constant value
+ */
+ private void processConstantValue(ConstantValue constantValue) {
+ Constant constant = new Constant();
+ constant.setName(shortString());
+ constant.setType(Integer.class);
+
+ constantValue.setConstant(constant);
+ constantValue.setValue(Integer.toString(r.nextInt()));
+ }
+
+ /**
+ * Generate text stream.
+ *
+ * @return the input stream
+ *
+ * @throws Exception the exception
+ */
+ public RandomStream generateTextStream() throws Exception {
+ RandomStream rs = new RandomStream();
+
+ int wordcount = 300 + r.nextInt(300);
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < wordcount; i++) {
+ sb.append(randomstrings[r.nextInt(cs)]).append(" ");
+ }
+
+ MD5 md5 = new MD5();
+ md5.Update(sb.toString().getBytes());
+ rs.setMd5(md5.asHex());
+
+ rs.setData(sb.toString().getBytes());
+
+ return rs;
+ }
+}
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/MetaDataGenerator.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/MetaDataGenerator.java 2008-02-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/MetaDataGenerator.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -17,7 +17,7 @@
* ##% */
package fr.cemagref.simexplorer.is.storage;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java 2008-02-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -19,7 +19,7 @@
import java.io.InputStream;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
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-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -29,7 +29,7 @@
import org.codelutin.util.MD5;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
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-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -93,7 +93,7 @@
*
* @param fromElement the from element
* @param toElement the to element
- * @throws SimExplorerException
+ * @throws SimExplorerException TODO
*/
public abstract void duplicateElementHierarchy(MetaData fromElement, MetaData toElement) throws SimExplorerException;
@@ -129,7 +129,7 @@
* @param mde the mde
*
* @return the elements used by
- * @throws SimExplorerException
+ * @throws SimExplorerException TODO
*/
public abstract Set<MetaData> getElementsUsedBy(MetaData mde) throws SimExplorerException;
@@ -139,7 +139,7 @@
* @param mde the mde
*
* @return the elements using
- * @throws SimExplorerException
+ * @throws SimExplorerException TODO
*/
public abstract Set<MetaData> getElementsUsing(MetaData mde) throws SimExplorerException;
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-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -55,8 +55,8 @@
import org.apache.lucene.store.LockFactory;
import org.apache.lucene.store.NoLockFactory;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
-import fr.cemagref.simexplorer.is.attachment.ContentTypeFactory;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
+import fr.cemagref.simexplorer.is.factories.ContentTypeFactory;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
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-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -24,7 +24,7 @@
import javax.ejb.Local;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
@@ -86,7 +86,7 @@
* @param token the token
* @param fromElement the from element
* @param toElement the to element
- * @throws SimExplorerException
+ * @throws SimExplorerException if any problem while operation
*/
public abstract void duplicateElementHierarchy(String token, MetaData fromElement, MetaData toElement) throws SimExplorerException;
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -26,13 +26,11 @@
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.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
-import fr.cemagref.simexplorer.is.exceptions.SimExplorerTechnicalException;
import fr.cemagref.simexplorer.is.storage.attachment.AttachmentHandler;
import fr.cemagref.simexplorer.is.storage.attachment.FileSystemAttachmentHandler;
import fr.cemagref.simexplorer.is.storage.database.Database;
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/resources/i18n/simexplorer-is-storage-en_GB.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/resources/i18n/simexplorer-is-storage-en_GB.properties 2008-02-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/resources/i18n/simexplorer-is-storage-en_GB.properties 2008-02-16 15:03:25 UTC (rev 1018)
@@ -1 +1,23 @@
+simexplorer.common.attachment=Attachment
+simexplorer.common.attachments=Attachments
+simexplorer.common.code=Code
+simexplorer.common.codes=Codes
+simexplorer.common.component=Component
+simexplorer.common.components=Components
+simexplorer.common.constant=Constant
+simexplorer.common.constants=Constants
+simexplorer.common.constantvalue=Constant value
+simexplorer.common.constantvalues=Constant values
+simexplorer.common.explorationapplication=Exploration application
+simexplorer.common.explorationapplications=Exploration applications
+simexplorer.common.explorationdata=Exploration data
+simexplorer.common.explorationdatas=Exploration datas
+simexplorer.common.libraries=Libraries
+simexplorer.common.library=Library
+simexplorer.common.repositories=Repositories
+simexplorer.common.repository=Repository
+simexplorer.common.result=Result
+simexplorer.common.results=Results
+simexplorer.common.structure=Structure
+simexplorer.common.structures=Structures
simexplorer.contenttype.rawtype=Raw file (text)
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/resources/i18n/simexplorer-is-storage-fr_FR.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/resources/i18n/simexplorer-is-storage-fr_FR.properties 2008-02-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/resources/i18n/simexplorer-is-storage-fr_FR.properties 2008-02-16 15:03:25 UTC (rev 1018)
@@ -1 +1,23 @@
+simexplorer.common.attachment=Fichier attach\u00E9
+simexplorer.common.attachments=Fichiers attach\u00E9s
+simexplorer.common.code=Code
+simexplorer.common.codes=Codes
+simexplorer.common.component=Componsant
+simexplorer.common.components=Composants
+simexplorer.common.constant=Constante
+simexplorer.common.constants=Constantes
+simexplorer.common.constantvalue=Valeur de constante
+simexplorer.common.constantvalues=Valeurs de constante
+simexplorer.common.explorationapplication=Exploration d'application
+simexplorer.common.explorationapplications=Explorations d'application
+simexplorer.common.explorationdata=Donn\u00E9e d'exploration
+simexplorer.common.explorationdatas=Donn\u00E9es d'Explorations
+simexplorer.common.libraries=Librairies
+simexplorer.common.library=Librarie
+simexplorer.common.repositories=Repositories
+simexplorer.common.repository=Repository
+simexplorer.common.result=R\u00E9sultat
+simexplorer.common.results=Resultats
+simexplorer.common.structure=Structure
+simexplorer.common.structures=Structures
simexplorer.contenttype.rawtype=Fichier brut (texte)
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockDatabase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockDatabase.java 2008-02-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/service/MockDatabase.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -26,6 +26,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.storage.VersionGenerator;
+import fr.cemagref.simexplorer.is.storage.ElementGenerator;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import java.util.ArrayList;
Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Install.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Install.java 2008-02-16 14:56:40 UTC (rev 1017)
+++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Install.java 2008-02-16 15:03:25 UTC (rev 1018)
@@ -29,7 +29,7 @@
import com.healthmarketscience.rmiio.SerializableInputStream;
-import fr.cemagref.simexplorer.is.attachment.Attachment;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.Component;
import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
@@ -37,8 +37,8 @@
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.factories.BaseEntityFactory;
import fr.cemagref.simexplorer.is.factories.XmlConstants;
-import fr.cemagref.simexplorer.is.service.ElementGenerator;
-import fr.cemagref.simexplorer.is.service.ElementGenerator.RandomStream;
+import fr.cemagref.simexplorer.is.storage.ElementGenerator;
+import fr.cemagref.simexplorer.is.storage.ElementGenerator.RandomStream;
import fr.cemagref.simexplorer.is.ui.web.pages.security.SuperAdminPage;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
1
0
r1017 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/entities
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
16 Feb '08
Author: tchemit
Date: 2008-02-16 14:56:40 +0000 (Sat, 16 Feb 2008)
New Revision: 1017
Removed:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/entities/EntitiesAction.java
Log:
utilisation EntityHelper dans module storage
Deleted: 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-16 14:56:00 UTC (rev 1016)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/entities/EntitiesAction.java 2008-02-16 14:56:40 UTC (rev 1017)
@@ -1,76 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, 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.entities;
-
-import fr.cemagref.simexplorer.is.entities.data.Component;
-import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
-import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
-import fr.cemagref.simexplorer.is.entities.data.Library;
-import fr.cemagref.simexplorer.is.entities.data.Result;
-import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
-import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeNode;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Une énumération pour définir les actions possibles sur les entités du projet.
- *
- * @author chemit
- */
-public enum EntitiesAction {
-
- DOWNLOAD(ExplorationApplication.class, Result.class, Library.class),
- EXPORT(ExplorationApplication.class, Result.class, Library.class),
- IMPORT(ExplorationApplication.class, Library.class),
- DELETE(ExplorationApplication.class, ExplorationData.class, Component.class);
-
- private List<Class<?>> classes;
- private List<String> types;
-
- private EntitiesAction(Class<?>... classes) {
- this.classes = Arrays.asList(classes);
- this.types = new ArrayList<String>(classes.length);
- for (Class<?> aClass : classes) {
- this.types.add(aClass.getSimpleName());
- }
- }
-
- public boolean accept(LoggableElementTreeNode node) {
- return node != null && node.getUserObject() != null && accept(node.getUserObject().getClass());
- }
-
- public boolean accept(LoggableElement sNode) {
- return sNode!=null && accept(sNode.getClass());
- }
-
- public boolean accept(MetaData metaData) {
- return metaData!=null && accept(metaData.getType());
- }
-
- private boolean accept(Class<?> klass) {
- return classes.contains(klass);
- }
-
- private boolean accept(String type) {
- return types.contains(type);
- }
-}
1
0
r1016 - in trunk/simexplorer-is/simexplorer-is-swing/src: java/fr/cemagref/simexplorer/is/ui/swing/model uimodel/fr/cemagref/simexplorer/is/ui/swing
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
by tchemit@users.labs.libre-entreprise.org 16 Feb '08
16 Feb '08
Author: tchemit
Date: 2008-02-16 14:56:00 +0000 (Sat, 16 Feb 2008)
New Revision: 1016
Added:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/ListTableModel.java
Removed:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/JApplicationTableModel.java
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/JListTab.jaxx
Log:
renommage model
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/JApplicationTableModel.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/JApplicationTableModel.java 2008-02-16 14:54:21 UTC (rev 1015)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/JApplicationTableModel.java 2008-02-16 14:56:00 UTC (rev 1016)
@@ -1,127 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit
-*
-* 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.swing.model;
-
-import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import static org.codelutin.i18n.I18n._;
-import static org.codelutin.i18n.I18n.n_;
-
-import javax.swing.table.AbstractTableModel;
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-/** @author tony */
-public class JApplicationTableModel extends AbstractTableModel {
-
- MetaData[] data;
-
- PropertyDescriptor[] descriptors;
- private static final long serialVersionUID = -105647814466295077L;
- private SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss.SSS");
-
- public JApplicationTableModel() {
- }
-
- public JApplicationTableModel(MetaData[] data) {
- this.data = data;
- }
-
- public MetaData[] getData() {
- return data;
- }
-
- public void setData(MetaData[] data) {
- this.data = data;
- }
-
- private final String[] columnNames = {
- n_("simexplorer.common.name"),
- n_("simexplorer.common.type"),
- n_("simexplorer.common.description"),
- n_("simexplorer.common.version"),
- n_("simexplorer.common.creationDate")
- };
-
- public int getRowCount() {
- return data == null ? 0 : data.length;
- }
-
- public int getColumnCount() {
- return columnNames.length;
- }
-
- public Object getValueAt(int rowIndex, int columnIndex) {
- Object result = null;
- MetaData current = data[rowIndex];
- if (current != null) {
- try {
- PropertyDescriptor propertyDescriptor = getDescriptors()[columnIndex];
- Method readMethod = propertyDescriptor.getReadMethod();
- result = readMethod.invoke(current);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
- if (columnIndex == columnNames.length - 1) {
- result = DATE_FORMAT.format(result);
- }
- return result;
- }
-
- @Override
- public String getColumnName(int column) {
- return _(columnNames[column]);
- }
-
- protected PropertyDescriptor[] getDescriptors() {
- if (descriptors == null) {
- descriptors = new PropertyDescriptor[columnNames.length];
- BeanInfo beanInfo;
- try {
- beanInfo = Introspector.getBeanInfo(MetaData.class);
- List<String> props = new ArrayList<String>(columnNames.length);
- int index = "simexplorer.common.".length();
- for (String columnName : columnNames) {
- props.add(columnName.substring(index));
- }
-
- descriptors = new PropertyDescriptor[props.size()];
- for (PropertyDescriptor descriptor : beanInfo.getPropertyDescriptors()) {
- index = props.indexOf(descriptor.getName());
- if (index == -1) {
- continue;
- }
- descriptors[index] = descriptor;
- }
- } catch (IntrospectionException e) {
- throw new RuntimeException(e);
- }
- }
- return descriptors;
- }
-}
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/ListTableModel.java (from rev 1014, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/JApplicationTableModel.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/ListTableModel.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/ListTableModel.java 2008-02-16 14:56:00 UTC (rev 1016)
@@ -0,0 +1,133 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit
+*
+* 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.swing.model;
+
+import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import fr.cemagref.simexplorer.is.entities.EntityHelper;
+import static org.codelutin.i18n.I18n._;
+import static org.codelutin.i18n.I18n.n_;
+
+import javax.swing.table.AbstractTableModel;
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/** @author tony */
+public class ListTableModel extends AbstractTableModel {
+
+ MetaData[] data;
+
+ PropertyDescriptor[] descriptors;
+ private static final long serialVersionUID = -105647814466295077L;
+ private SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss.SSS");
+
+ public ListTableModel() {
+ }
+
+ public ListTableModel(MetaData[] data) {
+ this.data = data;
+ }
+
+ public MetaData[] getData() {
+ return data;
+ }
+
+ public void setData(MetaData[] data) {
+ this.data = data;
+ }
+
+ private final String[] columnNames = {
+ n_("simexplorer.common.name"),
+ n_("simexplorer.common.type"),
+ n_("simexplorer.common.description"),
+ n_("simexplorer.common.version"),
+ n_("simexplorer.common.creationDate")
+ };
+
+ public int getRowCount() {
+ return data == null ? 0 : data.length;
+ }
+
+ public int getColumnCount() {
+ return columnNames.length;
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ Object result = null;
+ MetaData current = data[rowIndex];
+ if (current != null) {
+ try {
+ if (columnIndex==1) {
+ // use I18n
+ result = EntityHelper.Type.getLibelle(current);
+ } else {
+ PropertyDescriptor propertyDescriptor = getDescriptors()[columnIndex];
+ Method readMethod = propertyDescriptor.getReadMethod();
+ result = readMethod.invoke(current);
+ }
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ if (columnIndex == columnNames.length - 1) {
+ result = DATE_FORMAT.format(result);
+ }
+ return result;
+ }
+
+ @Override
+ public String getColumnName(int column) {
+ return _(columnNames[column]);
+ }
+
+ protected PropertyDescriptor[] getDescriptors() {
+ if (descriptors == null) {
+ descriptors = new PropertyDescriptor[columnNames.length];
+ BeanInfo beanInfo;
+ try {
+ beanInfo = Introspector.getBeanInfo(MetaData.class);
+ List<String> props = new ArrayList<String>(columnNames.length);
+ int index = "simexplorer.common.".length();
+ for (String columnName : columnNames) {
+ props.add(columnName.substring(index));
+ }
+
+ descriptors = new PropertyDescriptor[props.size()];
+ for (PropertyDescriptor descriptor : beanInfo.getPropertyDescriptors()) {
+ index = props.indexOf(descriptor.getName());
+ if (index == -1) {
+ continue;
+ }
+ descriptors[index] = descriptor;
+ }
+ } catch (IntrospectionException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return descriptors;
+ }
+}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/JListTab.jaxx
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/JListTab.jaxx 2008-02-16 14:54:21 UTC (rev 1015)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/JListTab.jaxx 2008-02-16 14:56:00 UTC (rev 1016)
@@ -30,7 +30,7 @@
<row fill='both' weightx='1' weighty='1'>
<cell insets='0,0,0,0'>
<JScrollPane>
- <JTable id='table' model='{new fr.cemagref.simexplorer.is.ui.swing.model.JApplicationTableModel()}'/>
+ <JTable id='table' model='{new fr.cemagref.simexplorer.is.ui.swing.model.ListTableModel()}'/>
</JScrollPane>
</cell>
</row>
1
0