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
r625 - in trunk: simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene simexplorer-is-storage/sr
by glandais@users.labs.libre-entreprise.org 04 Feb '08
by glandais@users.labs.libre-entreprise.org 04 Feb '08
04 Feb '08
Author: glandais
Date: 2008-02-04 14:34:43 +0000 (Mon, 04 Feb 2008)
New Revision: 625
Added:
trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java
Removed:
trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/StorageException.java
Modified:
trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java
trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java
trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java
trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java
trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java
trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java
trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java
trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java
trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java
trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java
Log:
StorageException renamed SimExplorerStorageException
Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java
===================================================================
--- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java 2008-02-04 14:32:52 UTC (rev 624)
+++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java 2008-02-04 14:34:43 UTC (rev 625)
@@ -17,7 +17,7 @@
* ##% */
package fr.cemagref.simexplorer.is.service;
-import fr.cemagref.simexplorer.is.storage.StorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
import fr.cemagref.simexplorer.is.storage.engine.StorageEngine;
import fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl;
@@ -31,7 +31,7 @@
}
@Override
- protected StorageEngine getStorageEngine() throws StorageException {
+ protected StorageEngine getStorageEngine() throws SimExplorerStorageException {
if (storageEngine == null) {
storageEngine = new StorageEngineImpl();
storageEngine.open();
Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java
===================================================================
--- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-04 14:32:52 UTC (rev 624)
+++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-04 14:34:43 UTC (rev 625)
@@ -44,7 +44,7 @@
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.storage.StorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
import fr.cemagref.simexplorer.is.storage.engine.StorageEngine;
import fr.cemagref.simexplorer.is.storage.util.ZipStreamEncoder;
@@ -53,7 +53,7 @@
private static final String KEY_XML = "_xml";
- protected abstract StorageEngine getStorageEngine() throws StorageException;
+ protected abstract StorageEngine getStorageEngine() throws SimExplorerStorageException;
public void close() throws Exception {
getStorageEngine().close();
@@ -62,7 +62,7 @@
public void commit() throws SimExplorerServiceException {
try {
getStorageEngine().commit();
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
}
}
@@ -102,7 +102,7 @@
throws SimExplorerServiceException {
try {
return getStorageEngine().getMetadata(token, uuid);
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
}
}
@@ -112,7 +112,7 @@
try {
return getStorageEngine().getMetadata(token, uuid,
new Version(version));
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
}
}
@@ -123,7 +123,7 @@
try {
return getStorageEngine().findFullText(token, query, onlyLatest,
indexStart, count, dateOrder);
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
}
}
@@ -133,7 +133,7 @@
try {
return getStorageEngine().findFullTextCount(token, query,
onlyLatest);
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
}
}
@@ -143,7 +143,7 @@
try {
return getStorageEngine().findElementsByTypeCount(token,
VALUE_METADATA_TYPE_EA, onlyLatest);
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
}
}
@@ -155,7 +155,7 @@
return getStorageEngine()
.findElementsByType(token, VALUE_METADATA_TYPE_EA,
onlyLatest, start, count, dateOrder);
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
}
}
@@ -240,7 +240,7 @@
RemoteInputStreamServer remoteStream = new SimpleRemoteInputStream(
stream);
return remoteStream.export();
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
} catch (RemoteException e) {
throw new SimExplorerServiceException(e);
@@ -256,7 +256,7 @@
RemoteInputStreamServer remoteStream = new SimpleRemoteInputStream(
xmlStream);
return remoteStream.export();
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
} catch (IOException e) {
throw new SimExplorerServiceException(e);
@@ -295,7 +295,7 @@
RemoteInputStreamServer remoteStream = new SimpleRemoteInputStream(
pipedIn);
return remoteStream.export();
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
} catch (IOException e) {
throw new SimExplorerServiceException(e);
@@ -414,7 +414,7 @@
Set<MetaData> versions = getStorageEngine().getElementVersions(
token, uuid);
return versions.toArray(new MetaData[versions.size()]);
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
}
}
@@ -423,7 +423,7 @@
throws SimExplorerServiceException {
try {
getStorageEngine().deleteElement(token, uuid, new Version(version));
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
}
}
@@ -432,7 +432,7 @@
throws SimExplorerServiceException {
try {
getStorageEngine().deleteElements(token, uuid);
- } catch (StorageException e) {
+ } catch (SimExplorerStorageException e) {
throw new SimExplorerServiceException(e);
}
}
Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java
===================================================================
--- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java 2008-02-04 14:32:52 UTC (rev 624)
+++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java 2008-02-04 14:34:43 UTC (rev 625)
@@ -23,7 +23,7 @@
import org.jboss.annotation.ejb.RemoteBinding;
-import fr.cemagref.simexplorer.is.storage.StorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
import fr.cemagref.simexplorer.is.storage.engine.StorageEngine;
import fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl;
@@ -45,7 +45,7 @@
}
@Override
- protected StorageEngine getStorageEngine() throws StorageException {
+ protected StorageEngine getStorageEngine() throws SimExplorerStorageException {
storageEngine.open();
return storageEngine;
}
Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java
===================================================================
--- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-04 14:32:52 UTC (rev 624)
+++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-04 14:34:43 UTC (rev 625)
@@ -29,7 +29,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.security.credentials.CredentialManager;
import fr.cemagref.simexplorer.is.security.entities.Permission;
-import fr.cemagref.simexplorer.is.storage.StorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
@Stateless(name = "StorageEngine")
@Local(StorageEngine.class)
@@ -40,32 +40,32 @@
@Override
public void deleteElement(String token, String uuid, Version version)
- throws StorageException {
+ throws SimExplorerStorageException {
Permission permission = credentialManager.getPermission(token, uuid);
// TODO check candelete = canadmin
if (permission != null && permission.isCanAdmin()) {
super.deleteElement(token, uuid, version);
} else {
- throw new StorageException("Permission denied");
+ throw new SimExplorerStorageException("Permission denied");
}
}
@Override
public void deleteElements(String token, String uuid)
- throws StorageException {
+ throws SimExplorerStorageException {
Permission permission = credentialManager.getPermission(token, uuid);
// TODO check candelete = canadmin
if (permission != null && permission.isCanAdmin()) {
super.deleteElements(token, uuid);
} else {
- throw new StorageException("Permission denied");
+ throw new SimExplorerStorageException("Permission denied");
}
}
@Override
public MetaData[] findElementsByType(String token, String type,
boolean onlyLatest, int start, int count, int dateOrder)
- throws StorageException {
+ throws SimExplorerStorageException {
MetaData[] list;
list = super.findElementsByType(token, type, onlyLatest, start, count,
dateOrder);
@@ -75,7 +75,7 @@
@Override
public int findElementsByTypeCount(String token, String type,
- boolean onlyLatest) throws StorageException {
+ boolean onlyLatest) throws SimExplorerStorageException {
// TODO how to filter without losing pagination?
return super.findElementsByTypeCount(token, type, onlyLatest);
}
@@ -83,7 +83,7 @@
@Override
public MetaData[] findFullText(String token, String query,
boolean onlyLatest, int indexStart, int count, int dateOrder)
- throws StorageException {
+ throws SimExplorerStorageException {
// TODO how to filter without losing pagination?
return super.findFullText(token, query, onlyLatest, indexStart, count,
dateOrder);
@@ -91,74 +91,74 @@
@Override
public int findFullTextCount(String token, String query, boolean onlyLatest)
- throws StorageException {
+ throws SimExplorerStorageException {
// TODO how to filter without losing pagination?
return super.findFullTextCount(token, query, onlyLatest);
}
@Override
public MetaData getMetadata(String token, String uuid, Version version)
- throws StorageException {
+ throws SimExplorerStorageException {
MetaData mde;
Permission permission = credentialManager.getPermission(token, uuid);
if (permission != null && permission.isCanRead()) {
mde = super.getMetadata(token, uuid, version);
} else {
- throw new StorageException("Permission denied");
+ throw new SimExplorerStorageException("Permission denied");
}
return mde;
}
@Override
public MetaData getMetadata(String token, String uuid)
- throws StorageException {
+ throws SimExplorerStorageException {
MetaData mde;
Permission permission = credentialManager.getPermission(token, uuid);
if (permission != null && permission.isCanRead()) {
mde = super.getMetadata(token, uuid);
} else {
- throw new StorageException("Permission denied");
+ throw new SimExplorerStorageException("Permission denied");
}
return mde;
}
@Override
public List<Version> getVersions(String token, String uuid)
- throws StorageException {
+ throws SimExplorerStorageException {
List<Version> versions;
Permission permission = credentialManager.getPermission(token, uuid);
if (permission != null && permission.isCanRead()) {
versions = super.getVersions(token, uuid);
} else {
- throw new StorageException("Permission denied");
+ throw new SimExplorerStorageException("Permission denied");
}
return versions;
}
@Override
public InputStream retrieveData(String token, MetaData entity,
- String field) throws StorageException {
+ String field) throws SimExplorerStorageException {
InputStream stream;
Permission permission = credentialManager.getPermission(token, entity
.getUuid());
if (permission != null && permission.isCanRead()) {
stream = super.retrieveData(token, entity, field);
} else {
- throw new StorageException("Permission denied");
+ throw new SimExplorerStorageException("Permission denied");
}
return stream;
}
@Override
public void saveElement(String token, MetaData element,
- Map<String, InputStream> attachments) throws StorageException {
+ Map<String, InputStream> attachments) throws SimExplorerStorageException {
Permission permission = credentialManager.getPermission(token, element
.getUuid());
if (permission != null && permission.isCanWrite()) {
super.saveElement(token, element, attachments);
credentialManager.saveElement(token, element.getUuid());
} else {
- throw new StorageException("Permission denied");
+ throw new SimExplorerStorageException("Permission denied");
}
}
Copied: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java (from rev 611, trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/StorageException.java)
===================================================================
--- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java (rev 0)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/SimExplorerStorageException.java 2008-02-04 14:34:43 UTC (rev 625)
@@ -0,0 +1,40 @@
+/*
+* ##% 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;
+
+public class SimExplorerStorageException extends Exception {
+
+ private static final long serialVersionUID = 4405447107690074844L;
+
+ public SimExplorerStorageException() {
+ super();
+ }
+
+ public SimExplorerStorageException(String message) {
+ super(message);
+ }
+
+ public SimExplorerStorageException(Throwable cause) {
+ super(cause);
+ }
+
+ public SimExplorerStorageException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Deleted: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/StorageException.java
===================================================================
--- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/StorageException.java 2008-02-04 14:32:52 UTC (rev 624)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/StorageException.java 2008-02-04 14:34:43 UTC (rev 625)
@@ -1,40 +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.storage;
-
-public class StorageException extends Exception {
-
- private static final long serialVersionUID = 4405447107690074844L;
-
- public StorageException() {
- super();
- }
-
- public StorageException(String message) {
- super(message);
- }
-
- public StorageException(Throwable cause) {
- super(cause);
- }
-
- public StorageException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java
===================================================================
--- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java 2008-02-04 14:32:52 UTC (rev 624)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/AttachmentHandler.java 2008-02-04 14:34:43 UTC (rev 625)
@@ -20,7 +20,7 @@
import java.io.InputStream;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.storage.StorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
/**
* Store, retrieve and delete content
@@ -39,10 +39,10 @@
* Unique field for content
* @param is
* Content
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public abstract void storeData(MetaData entity, String field,
- InputStream is) throws StorageException;
+ InputStream is) throws SimExplorerStorageException;
/**
* Retrieve content
@@ -52,10 +52,10 @@
* @param field
* Unique field for content
* @return Content
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public abstract InputStream retrieveData(MetaData entity, String field)
- throws StorageException;
+ throws SimExplorerStorageException;
/**
* Delete content
@@ -64,9 +64,9 @@
* DataEntity related to content
* @param field
* Unique field for content
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public abstract void deleteData(MetaData entity, String field)
- throws StorageException;
+ throws SimExplorerStorageException;
}
\ No newline at end of file
Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java
===================================================================
--- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java 2008-02-04 14:32:52 UTC (rev 624)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/attachment/FileSystemAttachmentHandler.java 2008-02-04 14:34:43 UTC (rev 625)
@@ -27,7 +27,7 @@
import java.io.InputStream;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.storage.StorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
import fr.cemagref.simexplorer.is.storage.util.Config;
/**
@@ -79,20 +79,20 @@
@Override
public InputStream retrieveData(MetaData entity, String field)
- throws StorageException {
+ throws SimExplorerStorageException {
// Simple stream on file
FileInputStream fis = null;
try {
fis = new FileInputStream(getFile(entity, field));
} catch (FileNotFoundException e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
return fis;
}
@Override
public void storeData(MetaData entity, String field, InputStream is)
- throws StorageException {
+ throws SimExplorerStorageException {
// Simple stream on file
@@ -115,15 +115,15 @@
// Close file
fos.close();
} catch (FileNotFoundException e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
} catch (IOException e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
}
@Override
public void deleteData(MetaData entity, String field)
- throws StorageException {
+ throws SimExplorerStorageException {
// Simple delete on file
getFile(entity, field).delete();
}
Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java
===================================================================
--- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-04 14:32:52 UTC (rev 624)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/Database.java 2008-02-04 14:34:43 UTC (rev 625)
@@ -25,7 +25,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
-import fr.cemagref.simexplorer.is.storage.StorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
/**
* Interface of a database able to manage metadata elements
@@ -38,9 +38,9 @@
/**
* Open database connection
*
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
- public void open() throws StorageException {
+ public void open() throws SimExplorerStorageException {
open(false);
}
@@ -49,23 +49,23 @@
*
* @param create
* Create database
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
- public abstract void open(boolean create) throws StorageException;
+ public abstract void open(boolean create) throws SimExplorerStorageException;
/**
* Close database connection
*
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
- public abstract void close() throws StorageException;
+ public abstract void close() throws SimExplorerStorageException;
/**
* Commit pending modifications
*
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
- public abstract void commit() throws StorageException;
+ public abstract void commit() throws SimExplorerStorageException;
// Create / Update
@@ -76,10 +76,10 @@
* @param element
* Element to insert
* @param readers
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public abstract void insertElement(MetaData element,
- List<Reader> readers) throws StorageException;
+ List<Reader> readers) throws SimExplorerStorageException;
// Read
@@ -91,10 +91,10 @@
* @param version
* version
* @return Fund element, null if not fund
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public abstract MetaData getElement(String uuid, Version version)
- throws StorageException;
+ throws SimExplorerStorageException;
/**
* Get all version of an element thanks to its id <br>
@@ -103,9 +103,9 @@
* @param uuid
* Id
* @return Versions
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
- public abstract List<Version> getVersions(String uuid) throws StorageException;
+ public abstract List<Version> getVersions(String uuid) throws SimExplorerStorageException;
/**
* Retrieve all elements by id Empty list if no element with this id
@@ -114,10 +114,10 @@
* Id
* @param onlyLatest
* @return Element list
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public abstract Set<MetaData> findElementsById(String uuid,
- boolean onlyLatest) throws StorageException;
+ boolean onlyLatest) throws SimExplorerStorageException;
/**
* Retrieve elements with specific properties<br>
@@ -126,10 +126,10 @@
* @param properties
* Matching properties needed
* @return Element list
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public Set<MetaData> findElementsByProperties(
- Map<String, String> properties) throws StorageException {
+ Map<String, String> properties) throws SimExplorerStorageException {
return findElementsByProperties(properties, 0, -1, 0);
}
@@ -145,11 +145,11 @@
* Number of elements to return
* @param dateOrder
* @return Element list
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public abstract Set<MetaData> findElementsByProperties(
Map<String, String> properties, int start, int count, int dateOrder)
- throws StorageException;
+ throws SimExplorerStorageException;
/**
* Retrieve element count specific properties
@@ -157,10 +157,10 @@
* @param properties
* Matching properties needed
* @return Number of elements fund
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public abstract int findElementsByPropertiesCount(
- Map<String, String> properties) throws StorageException;
+ Map<String, String> properties) throws SimExplorerStorageException;
/**
* Prepare properties for query
@@ -195,11 +195,11 @@
* @param dateOrder
* Sorting
* @return Element list
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public Set<MetaData> findElementsByType(String type,
boolean onlyLatest, int start, int count, int dateOrder)
- throws StorageException {
+ throws SimExplorerStorageException {
return findElementsByProperties(getPropertiesByType(type, onlyLatest),
start, count, dateOrder);
}
@@ -212,10 +212,10 @@
* @param onlyLatest
* Only latest elements
* @return Number of elements
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public int findElementsByTypeCount(String type, boolean onlyLatest)
- throws StorageException {
+ throws SimExplorerStorageException {
return findElementsByPropertiesCount(getPropertiesByType(type,
onlyLatest));
}
@@ -233,11 +233,11 @@
* Number of elements to return
* @param dateOrder
* @return Element list
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public abstract Set<MetaData> findElementsByContentSearch(
String queryText, boolean onlyLatest, int start, int count,
- int dateOrder) throws StorageException;
+ int dateOrder) throws SimExplorerStorageException;
/**
* Retrieve element count with specific content
@@ -246,10 +246,10 @@
* Searched text
* @param onlyLatest
* @return Number of elements fund
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public abstract int findElementsByContentSearchCount(String queryText,
- boolean onlyLatest) throws StorageException;
+ boolean onlyLatest) throws SimExplorerStorageException;
// Delete
@@ -258,9 +258,9 @@
*
* @param element
* Element to delete
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
- public void deleteElement(MetaData element) throws StorageException {
+ public void deleteElement(MetaData element) throws SimExplorerStorageException {
deleteElement(element.getUuid(), element.getVersion());
}
@@ -271,9 +271,9 @@
* Id
* @param version
* Version
- * @throws StorageException
+ * @throws SimExplorerStorageException
*/
public abstract void deleteElement(String uuid, Version version)
- throws StorageException;
+ throws SimExplorerStorageException;
}
Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java
===================================================================
--- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-04 14:32:52 UTC (rev 624)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-04 14:34:43 UTC (rev 625)
@@ -58,7 +58,7 @@
import fr.cemagref.simexplorer.is.attachment.ContentTypeFactory;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
-import fr.cemagref.simexplorer.is.storage.StorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
import fr.cemagref.simexplorer.is.storage.database.Database;
import fr.cemagref.simexplorer.is.storage.util.Config;
import fr.cemagref.simexplorer.is.storage.util.KeyValue;
@@ -167,7 +167,7 @@
}
@Override
- public void open(boolean create) throws StorageException {
+ public void open(boolean create) throws SimExplorerStorageException {
if (writer == null) {
// Create an analyzer
Analyzer analyzer = new SimpleAnalyzer();
@@ -196,13 +196,13 @@
commit();
}
} catch (IOException e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
}
}
@Override
- public void close() throws StorageException {
+ public void close() throws SimExplorerStorageException {
try {
synchronized (writerSynchronizer) {
// Close writer and invalidate reader
@@ -211,7 +211,7 @@
}
resetReader();
} catch (IOException e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
searcherPool = null;
}
@@ -240,18 +240,18 @@
}
@Override
- public void commit() throws StorageException {
+ public void commit() throws SimExplorerStorageException {
try {
// Allows concurent access
synchedCommit();
} catch (IOException e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
}
@Override
public void insertElement(MetaData element, List<Reader> readers)
- throws StorageException {
+ throws SimExplorerStorageException {
// Save element to a Lucene document
Document document = saveLuceneElement(element, readers);
@@ -270,13 +270,13 @@
writer.addDocument(document);
}
} catch (IOException e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
}
@Override
public MetaData getElement(String uuid, Version version)
- throws StorageException {
+ throws SimExplorerStorageException {
MetaData result = null;
try {
@@ -293,7 +293,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
return result;
@@ -320,7 +320,7 @@
}
@Override
- public List<Version> getVersions(String uuid) throws StorageException {
+ public List<Version> getVersions(String uuid) throws SimExplorerStorageException {
// Retrieve all document corresponding to id
Map<String, String> properties = new HashMap<String, String>();
properties.put(KEY_UUID, uuid);
@@ -346,7 +346,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
return versions;
@@ -354,7 +354,7 @@
@Override
public Set<MetaData> findElementsById(String uuid, boolean onlyLatest)
- throws StorageException {
+ throws SimExplorerStorageException {
// Create hash map with id
Map<String, String> properties = new HashMap<String, String>();
properties.put(KEY_UUID, uuid);
@@ -375,7 +375,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
// Return all elements parsed from documents fund
@@ -384,7 +384,7 @@
@Override
public int findElementsByPropertiesCount(Map<String, String> properties)
- throws StorageException {
+ throws SimExplorerStorageException {
int result = 0;
try {
@@ -398,7 +398,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
// Return all elements parsed from documents fund
@@ -408,7 +408,7 @@
@Override
public Set<MetaData> findElementsByProperties(
Map<String, String> properties, int start, int count, int dateOrder)
- throws StorageException {
+ throws SimExplorerStorageException {
Set<MetaData> result = null;
try {
@@ -422,7 +422,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
// Return all elements parsed from documents fund
@@ -431,12 +431,12 @@
@Override
public int findElementsByContentSearchCount(String queryText,
- boolean onlyLatest) throws StorageException {
+ boolean onlyLatest) throws SimExplorerStorageException {
Query query = null;
try {
query = getQueryByContentSearch(queryText, onlyLatest);
} catch (ParseException e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
int result = 0;
@@ -454,7 +454,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
return result;
@@ -482,12 +482,12 @@
@Override
public Set<MetaData> findElementsByContentSearch(String queryText,
boolean onlyLatest, int start, int count, int dateOrder)
- throws StorageException {
+ throws SimExplorerStorageException {
Query query = null;
try {
query = getQueryByContentSearch(queryText, onlyLatest);
} catch (ParseException e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
Set<MetaData> result = null;
@@ -505,7 +505,7 @@
releaseSearcher(searcher);
}
} catch (Exception e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
return result;
@@ -549,7 +549,7 @@
@Override
public void deleteElement(String uuid, Version version)
- throws StorageException {
+ throws SimExplorerStorageException {
// Delete element in db with term search
Term[] terms = new Term[2];
terms[0] = new Term(KEY_UUID, uuid);
@@ -560,7 +560,7 @@
writer.deleteDocuments(terms);
}
} catch (Exception e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
}
Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java
===================================================================
--- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-04 14:32:52 UTC (rev 624)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngine.java 2008-02-04 14:34:43 UTC (rev 625)
@@ -26,7 +26,7 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
-import fr.cemagref.simexplorer.is.storage.StorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
@Local
public interface StorageEngine {
@@ -36,21 +36,21 @@
*
* @throws Exception
*/
- public abstract void open() throws StorageException;
+ public abstract void open() throws SimExplorerStorageException;
/**
* Close storage
*
* @throws Exception
*/
- public abstract void close() throws StorageException;
+ public abstract void close() throws SimExplorerStorageException;
/**
* Commit changes to storage
*
* @throws Exception
*/
- public abstract void commit() throws StorageException;
+ public abstract void commit() throws SimExplorerStorageException;
/**
* Save an element to storage
@@ -62,7 +62,7 @@
* @throws Exception
*/
public abstract void saveElement(String token, MetaData element,
- Map<String, InputStream> attachments) throws StorageException;
+ Map<String, InputStream> attachments) throws SimExplorerStorageException;
/**
* Retrieve an element
@@ -73,7 +73,7 @@
* @throws Exception
*/
public abstract MetaData getMetadata(String token, String uuid)
- throws StorageException;
+ throws SimExplorerStorageException;
/**
* Retrieve versions of an element<br>
@@ -86,7 +86,7 @@
* @throws Exception
*/
public abstract List<Version> getVersions(String token, String uuid)
- throws StorageException;
+ throws SimExplorerStorageException;
/**
* Retrieve all version of a metadata
@@ -96,7 +96,7 @@
* @return
*/
public abstract Set<MetaData> getElementVersions(String token,
- String uuid) throws StorageException;
+ String uuid) throws SimExplorerStorageException;
/**
* Retrieve an element in a specific version
@@ -107,7 +107,7 @@
* @throws Exception
*/
public abstract MetaData getMetadata(String token, String uuid,
- Version version) throws StorageException;
+ Version version) throws SimExplorerStorageException;
/**
* Get data associated to an element
@@ -120,7 +120,7 @@
* @throws Exception
*/
public abstract InputStream retrieveData(String token,
- MetaData entity, String field) throws StorageException;
+ MetaData entity, String field) throws SimExplorerStorageException;
/**
* Get number of items corresponding to query
@@ -131,7 +131,7 @@
* @throws Exception
*/
public abstract int findFullTextCount(String token, String query,
- boolean onlyLatest) throws StorageException;
+ boolean onlyLatest) throws SimExplorerStorageException;
/**
* Retrieve list of items corresponding to query
@@ -146,7 +146,7 @@
*/
public abstract MetaData[] findFullText(String token, String query,
boolean onlyLatest, int indexStart, int count, int dateOrder)
- throws StorageException;
+ throws SimExplorerStorageException;
/**
* Retrieve list of items of type wanted
@@ -161,7 +161,7 @@
*/
public abstract MetaData[] findElementsByType(String token,
String type, boolean onlyLatest, int start, int count, int dateOrder)
- throws StorageException;
+ throws SimExplorerStorageException;
/**
* Retrieve number of items of type wanted
@@ -172,7 +172,7 @@
* @throws Exception
*/
public abstract int findElementsByTypeCount(String token, String type,
- boolean onlyLatest) throws StorageException;
+ boolean onlyLatest) throws SimExplorerStorageException;
/**
* Delete elements
@@ -181,7 +181,7 @@
* @throws Exception
*/
public abstract void deleteElements(String token, String uuid)
- throws StorageException;
+ throws SimExplorerStorageException;
/**
* Delete one element
@@ -191,7 +191,7 @@
* @throws Exception
*/
public abstract void deleteElement(String token, String uuid,
- Version version) throws StorageException;
+ Version version) throws SimExplorerStorageException;
/**
* Store temporary data, for stream duplication
@@ -202,7 +202,7 @@
* @throws Exception
*/
public abstract String storeTempData(InputStream stream)
- throws StorageException;
+ throws SimExplorerStorageException;
/**
* Retrieve temporary data
@@ -213,7 +213,7 @@
* @throws Exception
*/
public abstract InputStream retrieveTempData(String id)
- throws StorageException;
+ throws SimExplorerStorageException;
/**
* Delete temporary data
@@ -221,6 +221,6 @@
* @param id
* @throws Exception
*/
- public abstract void deleteTempData(String id) throws StorageException;
+ public abstract void deleteTempData(String id) throws SimExplorerStorageException;
}
\ No newline at end of file
Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java
===================================================================
--- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-04 14:32:52 UTC (rev 624)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineImpl.java 2008-02-04 14:34:43 UTC (rev 625)
@@ -30,7 +30,7 @@
import fr.cemagref.simexplorer.is.attachment.ContentType;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
-import fr.cemagref.simexplorer.is.storage.StorageException;
+import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException;
import fr.cemagref.simexplorer.is.storage.attachment.AttachmentHandler;
import fr.cemagref.simexplorer.is.storage.attachment.FileSystemAttachmentHandler;
import fr.cemagref.simexplorer.is.storage.database.Database;
@@ -79,7 +79,7 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#open()
*/
- public void open() throws StorageException {
+ public void open() throws SimExplorerStorageException {
if (!opened) {
database.open();
opened = true;
@@ -89,14 +89,14 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#close()
*/
- public void close() throws StorageException {
+ public void close() throws SimExplorerStorageException {
database.close();
}
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#commit()
*/
- public void commit() throws StorageException {
+ public void commit() throws SimExplorerStorageException {
database.commit();
}
@@ -106,7 +106,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#saveElement(fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.util.Map)
*/
public void saveElement(String token, MetaData element,
- Map<String, InputStream> attachments) throws StorageException {
+ Map<String, InputStream> attachments) throws SimExplorerStorageException {
// Save all attachments in system
for (Map.Entry<String, InputStream> entry : attachments.entrySet()) {
@@ -130,7 +130,7 @@
.renderToText(content);
readers.add(reader);
} catch (Exception e) {
- throw new StorageException(e);
+ throw new SimExplorerStorageException(e);
}
}
}
@@ -165,7 +165,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getMetadata(java.lang.String)
*/
public MetaData getMetadata(String token, String uuid)
- throws StorageException {
+ throws SimExplorerStorageException {
MetaData mde = null;
Set<MetaData> set = database.findElementsById(uuid, true);
if (!set.isEmpty()) {
@@ -178,7 +178,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getVersions(java.lang.String)
*/
public List<Version> getVersions(String token, String uuid)
- throws StorageException {
+ throws SimExplorerStorageException {
return database.getVersions(uuid);
}
@@ -186,7 +186,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#getMetadata(java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
*/
public MetaData getMetadata(String token, String uuid, Version version)
- throws StorageException {
+ throws SimExplorerStorageException {
MetaData mde = database.getElement(uuid, version);
return mde;
}
@@ -195,7 +195,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#retrieveData(fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.lang.String)
*/
public InputStream retrieveData(String token, MetaData entity, String field)
- throws StorageException {
+ throws SimExplorerStorageException {
InputStream result = attachmentHandler.retrieveData(entity, field);
return result;
}
@@ -204,7 +204,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findFullTextCount(java.lang.String, boolean)
*/
public int findFullTextCount(String token, String query, boolean onlyLatest)
- throws StorageException {
+ throws SimExplorerStorageException {
return database.findElementsByContentSearchCount(query, onlyLatest);
}
@@ -213,7 +213,7 @@
*/
public MetaData[] findFullText(String token, String query,
boolean onlyLatest, int indexStart, int count, int dateOrder)
- throws StorageException {
+ throws SimExplorerStorageException {
MetaData[] result = database.findElementsByContentSearch(query,
onlyLatest, indexStart, count, dateOrder).toArray(
new MetaData[0]);
@@ -225,7 +225,7 @@
*/
public MetaData[] findElementsByType(String token, String type,
boolean onlyLatest, int start, int count, int dateOrder)
- throws StorageException {
+ throws SimExplorerStorageException {
MetaData[] result = database.findElementsByType(type, onlyLatest,
start, count, dateOrder).toArray(new MetaData[0]);
return result;
@@ -235,7 +235,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#findElementsByTypeCount(java.lang.String, boolean)
*/
public int findElementsByTypeCount(String token, String type,
- boolean onlyLatest) throws StorageException {
+ boolean onlyLatest) throws SimExplorerStorageException {
return database.findElementsByTypeCount(type, onlyLatest);
}
@@ -245,7 +245,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#deleteElements(java.lang.String)
*/
public void deleteElements(String token, String uuid)
- throws StorageException {
+ throws SimExplorerStorageException {
List<Version> versions = getVersions(token, uuid);
for (Version version : versions) {
deleteElement(token, uuid, version);
@@ -256,7 +256,7 @@
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#deleteElement(java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version)
*/
public void deleteElement(String token, String uuid, Version version)
- throws StorageException {
+ throws SimExplorerStorageException {
MetaData element = getMetadata(token, uuid, version);
List<Attachment> attachments = element.getAttachments();
for (Attachment attachment : attachments) {
@@ -270,7 +270,7 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#storeTempData(java.io.InputStream)
*/
- public String storeTempData(InputStream stream) throws StorageException {
+ public String storeTempData(InputStream stream) throws SimExplorerStorageException {
String id = UUID.randomUUID().toString();
attachmentHandler.storeData(mdTmp, id, stream);
return id;
@@ -279,7 +279,7 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#retrieveTempData(java.lang.String)
*/
- public InputStream retrieveTempData(String id) throws StorageException {
+ public InputStream retrieveTempData(String id) throws SimExplorerStorageException {
InputStream is = attachmentHandler.retrieveData(mdTmp, id);
return is;
}
@@ -287,12 +287,12 @@
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.storage.engine.StorageEngine#deleteTempData(java.lang.String)
*/
- public void deleteTempData(String id) throws StorageException {
+ public void deleteTempData(String id) throws SimExplorerStorageException {
attachmentHandler.deleteData(mdTmp, id);
}
public Set<MetaData> getElementVersions(String token, String uuid)
- throws StorageException {
+ throws SimExplorerStorageException {
return database.findElementsById(uuid, false);
}
1
0
r624 - in trunk/simexplorer-is-security/src: java/fr/cemagref/simexplorer/is/security/credentials java/fr/cemagref/simexplorer/is/security/dao java/fr/cemagref/simexplorer/is/security/entities test
by glandais@users.labs.libre-entreprise.org 04 Feb '08
by glandais@users.labs.libre-entreprise.org 04 Feb '08
04 Feb '08
Author: glandais
Date: 2008-02-04 14:32:52 +0000 (Mon, 04 Feb 2008)
New Revision: 624
Removed:
trunk/simexplorer-is-security/src/test/fr/
Modified:
trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManager.java
trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManagerImpl.java
trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoSecurity.java
trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoSecurityImpl.java
trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/Actor.java
trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/Group.java
trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/LoginAction.java
trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/Permission.java
trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/User.java
Log:
Javadoc
Modified: trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManager.java
===================================================================
--- trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManager.java 2008-02-04 14:32:23 UTC (rev 623)
+++ trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManager.java 2008-02-04 14:32:52 UTC (rev 624)
@@ -21,11 +21,34 @@
import fr.cemagref.simexplorer.is.security.entities.Permission;
+/**
+ * The Interface CredentialManager.
+ */
@Local
public interface CredentialManager {
+ /**
+ * Gets the permission.
+ *
+ * @param token
+ * the token
+ * @param businessId
+ * the business id
+ *
+ * @return the permission
+ */
public Permission getPermission(String token, String businessId);
+ /**
+ * Save element.
+ *
+ * @param token
+ * the token
+ * @param businessId
+ * the business id
+ *
+ * @return the permission
+ */
public Permission saveElement(String token, String businessId);
}
Modified: trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManagerImpl.java
===================================================================
--- trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManagerImpl.java 2008-02-04 14:32:23 UTC (rev 623)
+++ trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManagerImpl.java 2008-02-04 14:32:52 UTC (rev 624)
@@ -31,14 +31,28 @@
import fr.cemagref.simexplorer.is.security.entities.Permission;
import fr.cemagref.simexplorer.is.security.entities.User;
+/**
+ * The Class CredentialManagerImpl.
+ */
@Stateless(name = "CredentialManager")
@Local(CredentialManager.class)
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class CredentialManagerImpl implements CredentialManager {
+ /** The dao. */
@EJB
private DaoSecurity dao;
+ /**
+ * Gets the relative level.
+ *
+ * @param actor
+ * the actor
+ * @param permission
+ * the permission
+ *
+ * @return the relative level
+ */
private int getRelativeLevel(Actor actor, Permission permission) {
int level = -1;
if (actor.equals(permission.getActor())) {
@@ -55,6 +69,9 @@
return level;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.credentials.CredentialManager#getPermission(java.lang.String, java.lang.String)
+ */
public Permission getPermission(String token, String businessId) {
Permission p = null;
@@ -89,6 +106,9 @@
return p;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.credentials.CredentialManager#saveElement(java.lang.String, java.lang.String)
+ */
public Permission saveElement(String token, String businessId) {
Permission p = new Permission();
p.setActor(dao.getLoggedUser(token));
Modified: trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoSecurity.java
===================================================================
--- trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoSecurity.java 2008-02-04 14:32:23 UTC (rev 623)
+++ trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoSecurity.java 2008-02-04 14:32:52 UTC (rev 624)
@@ -24,36 +24,135 @@
import fr.cemagref.simexplorer.is.security.entities.Permission;
import fr.cemagref.simexplorer.is.security.entities.User;
+/**
+ * The Interface DaoSecurity.
+ */
public interface DaoSecurity {
+ /**
+ * Save user.
+ *
+ * @param user
+ * the user
+ */
public void saveUser(User user);
+ /**
+ * Gets the user.
+ *
+ * @param id
+ * the id
+ *
+ * @return the user
+ */
public User getUser(Integer id);
+ /**
+ * Gets the user.
+ *
+ * @param login
+ * the login
+ *
+ * @return the user
+ */
public User getUser(String login);
+ /**
+ * Update user.
+ *
+ * @param user
+ * the user
+ *
+ * @return the user
+ */
public User updateUser(User user);
+ /**
+ * Delete user.
+ *
+ * @param id
+ * the id
+ */
public void deleteUser(Integer id);
+ /**
+ * Save group.
+ *
+ * @param group
+ * the group
+ */
public void saveGroup(Group group);
+ /**
+ * Gets the group.
+ *
+ * @param id
+ * the id
+ *
+ * @return the group
+ */
public Group getGroup(Integer id);
+ /**
+ * Gets the group.
+ *
+ * @param name
+ * the name
+ *
+ * @return the group
+ */
public Group getGroup(String name);
+ /**
+ * Update group.
+ *
+ * @param group
+ * the group
+ *
+ * @return the group
+ */
public Group updateGroup(Group group);
+ /**
+ * Delete group.
+ *
+ * @param id
+ * the id
+ */
public void deleteGroup(Integer id);
+ /**
+ * Gets the logged user.
+ *
+ * @param token
+ * the token
+ *
+ * @return the logged user
+ */
public User getLoggedUser(String token);
+ /**
+ * Login user.
+ *
+ * @param login
+ * the login
+ * @param passwordHash
+ * the password hash
+ *
+ * @return the user
+ */
public User loginUser(String login, String passwordHash);
+ /**
+ * Save token.
+ *
+ * @param loginAction
+ * the login action
+ */
public void saveToken(LoginAction loginAction);
/**
- * Delete old tokens associated to user
+ * Delete old tokens associated to user.
*
* @param login
* Login of user
@@ -62,22 +161,86 @@
*/
public void deleteTokens(String login, long before);
+ /**
+ * Gets the groups.
+ *
+ * @return the groups
+ */
public List<Group> getGroups();
+ /**
+ * Gets the groups owned by.
+ *
+ * @param user
+ * the user
+ *
+ * @return the groups owned by
+ */
public List<Group> getGroupsOwnedBy(User user);
+ /**
+ * Gets the users.
+ *
+ * @return the users
+ */
public List<User> getUsers();
+ /**
+ * Gets the users of group.
+ *
+ * @param group
+ * the group
+ *
+ * @return the users of group
+ */
public List<User> getUsersOfGroup(Group group);
+ /**
+ * Gets the groups of user.
+ *
+ * @param user
+ * the user
+ *
+ * @return the groups of user
+ */
public List<Group> getGroupsOfUser(User user);
+ /**
+ * Gets the groups of group.
+ *
+ * @param group
+ * the group
+ *
+ * @return the groups of group
+ */
public List<Group> getGroupsOfGroup(Group group);
+ /**
+ * Gets the permissions.
+ *
+ * @param businessId
+ * the business id
+ *
+ * @return the permissions
+ */
public List<Permission> getPermissions(String businessId);
+ /**
+ * Save permission.
+ *
+ * @param p
+ * the p
+ */
public void savePermission(Permission p);
+ /**
+ * Sets the permissions.
+ *
+ * @param uuid
+ * the uuid
+ * @param permissions
+ * the permissions
+ */
public void setPermissions(String uuid, Permission[] permissions);
}
Modified: trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoSecurityImpl.java
===================================================================
--- trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoSecurityImpl.java 2008-02-04 14:32:23 UTC (rev 623)
+++ trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoSecurityImpl.java 2008-02-04 14:32:52 UTC (rev 624)
@@ -31,12 +31,24 @@
import fr.cemagref.simexplorer.is.security.entities.Permission;
import fr.cemagref.simexplorer.is.security.entities.User;
+/**
+ * The Class DaoSecurityImpl.
+ */
@Stateless(name = "DaoSecurity")
public class DaoSecurityImpl implements DaoSecurity {
+ /** The em. */
@PersistenceContext(unitName = "simexploreris-security")
private EntityManager em;
+ /**
+ * Gets the single result.
+ *
+ * @param query
+ * the query
+ *
+ * @return the single result
+ */
private Object getSingleResult(Query query) {
Object o;
try {
@@ -47,6 +59,16 @@
return o;
}
+ /**
+ * Find.
+ *
+ * @param clazz
+ * the clazz
+ * @param arg
+ * the arg
+ *
+ * @return the object
+ */
private Object find(Class<?> clazz, Object arg) {
Object o;
try {
@@ -57,6 +79,9 @@
return o;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#deleteGroup(java.lang.Integer)
+ */
public void deleteGroup(Integer id) {
Group g = getGroup(id);
if (g != null) {
@@ -64,6 +89,9 @@
}
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#deleteUser(java.lang.Integer)
+ */
public void deleteUser(Integer id) {
User u = getUser(id);
if (u != null) {
@@ -71,11 +99,17 @@
}
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#getGroup(java.lang.Integer)
+ */
public Group getGroup(Integer id) {
Group g = (Group) find(Group.class, id);
return g;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#getGroup(java.lang.String)
+ */
public Group getGroup(String name) {
Group g = (Group) getSingleResult(em.createQuery(
"select g from Group g where g.name=:name").setParameter(
@@ -83,27 +117,45 @@
return g;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#getUser(java.lang.Integer)
+ */
public User getUser(Integer id) {
User u = (User) find(User.class, id);
return u;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#saveGroup(fr.cemagref.simexplorer.is.security.entities.Group)
+ */
public void saveGroup(Group group) {
em.persist(group);
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#saveUser(fr.cemagref.simexplorer.is.security.entities.User)
+ */
public void saveUser(User user) {
em.persist(user);
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#updateGroup(fr.cemagref.simexplorer.is.security.entities.Group)
+ */
public Group updateGroup(Group group) {
return em.merge(group);
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#updateUser(fr.cemagref.simexplorer.is.security.entities.User)
+ */
public User updateUser(User user) {
return em.merge(user);
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#getLoggedUser(java.lang.String)
+ */
public User getLoggedUser(String token) {
User loggedUser = null;
LoginAction loginAction = (LoginAction) getSingleResult(em.createQuery(
@@ -117,6 +169,9 @@
return loggedUser;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#loginUser(java.lang.String, java.lang.String)
+ */
public User loginUser(String login, String passwordHash) {
User user = (User) getSingleResult(em
.createQuery(
@@ -126,20 +181,29 @@
return user;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#saveToken(fr.cemagref.simexplorer.is.security.entities.LoginAction)
+ */
public void saveToken(LoginAction loginAction) {
em.persist(loginAction);
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#deleteTokens(java.lang.String, long)
+ */
public void deleteTokens(String login, long before) {
Date now = new Date();
Date date = new Date(now.getTime() - before);
em
.createQuery(
"delete from LoginAction la where la.loggedUser.login = :login and la.time < :time")
- .setParameter("time", date)
- .setParameter("login", login).executeUpdate();
+ .setParameter("time", date).setParameter("login", login)
+ .executeUpdate();
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#getUser(java.lang.String)
+ */
public User getUser(String login) {
User user = (User) getSingleResult(em.createQuery(
"select u from User u where u.login=:login").setParameter(
@@ -147,12 +211,20 @@
return user;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#getGroups()
+ */
+ @SuppressWarnings("unchecked")
public List<Group> getGroups() {
List<Group> groups = em.createQuery("select g from Group g")
.getResultList();
return groups;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#getGroupsOwnedBy(fr.cemagref.simexplorer.is.security.entities.User)
+ */
+ @SuppressWarnings("unchecked")
public List<Group> getGroupsOwnedBy(User user) {
List<Group> groups = em.createQuery(
"select g from Group g where g.owner=:owner").setParameter(
@@ -160,12 +232,20 @@
return groups;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#getUsers()
+ */
+ @SuppressWarnings("unchecked")
public List<User> getUsers() {
List<User> users = em.createQuery("select u from User u")
.getResultList();
return users;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#getUsersOfGroup(fr.cemagref.simexplorer.is.security.entities.Group)
+ */
+ @SuppressWarnings("unchecked")
public List<User> getUsersOfGroup(Group group) {
List<User> users = em
.createQuery(
@@ -174,6 +254,10 @@
return users;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#getGroupsOfUser(fr.cemagref.simexplorer.is.security.entities.User)
+ */
+ @SuppressWarnings("unchecked")
public List<Group> getGroupsOfUser(User user) {
List<Group> groups = em.createQuery(
"select distinct u.groups from User u where u = :user")
@@ -181,6 +265,10 @@
return groups;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#getGroupsOfGroup(fr.cemagref.simexplorer.is.security.entities.Group)
+ */
+ @SuppressWarnings("unchecked")
public List<Group> getGroupsOfGroup(Group group) {
List<Group> groups = em.createQuery(
"select distinct g.groups from Group g where g = :group")
@@ -188,6 +276,10 @@
return groups;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#getPermissions(java.lang.String)
+ */
+ @SuppressWarnings("unchecked")
public List<Permission> getPermissions(String businessId) {
List<Permission> permissions = em.createQuery(
"select p from Permission p where p.businessId=:businessId")
@@ -195,10 +287,16 @@
return permissions;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#savePermission(fr.cemagref.simexplorer.is.security.entities.Permission)
+ */
public void savePermission(Permission p) {
em.persist(p);
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.dao.DaoSecurity#setPermissions(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Permission[])
+ */
public void setPermissions(String uuid, Permission[] permissions) {
em.createQuery(
"delete from Permission p where p.businessId=:businessId")
Modified: trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/Actor.java
===================================================================
--- trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/Actor.java 2008-02-04 14:32:23 UTC (rev 623)
+++ trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/Actor.java 2008-02-04 14:32:52 UTC (rev 624)
@@ -22,22 +22,44 @@
import java.util.Iterator;
import java.util.List;
+/**
+ * The Class Actor.
+ */
public class Actor implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 813823268950750281L;
+ /** The id. */
protected Integer id;
+ /** The groups. */
private List<Group> groups;
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
public Integer getId() {
return id;
}
+ /**
+ * Sets the id.
+ *
+ * @param id
+ * the new id
+ */
public void setId(Integer id) {
this.id = id;
}
+ /**
+ * Gets the groups.
+ *
+ * @return the groups
+ */
public List<Group> getGroups() {
if (groups == null) {
groups = new ArrayList<Group>();
@@ -45,20 +67,37 @@
return groups;
}
+ /**
+ * Sets the groups.
+ *
+ * @param groups
+ * the new groups
+ */
public void setGroups(List<Group> groups) {
this.groups = groups;
}
- private int hashCodeGroups(List<Group> groups) {
+ /**
+ * Hash code groups.
+ *
+ * @param hashedGroups
+ * the hashed groups
+ *
+ * @return the int
+ */
+ private int hashCodeGroups(List<Group> hashedGroups) {
final int prime = 31;
int result = 1;
- result = prime * result + groups.size();
- for (Group group : groups) {
+ result = prime * result + hashedGroups.size();
+ for (Group group : hashedGroups) {
result = prime * result + ((group == null) ? 0 : group.getId());
}
return result;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
@Override
public int hashCode() {
final int prime = 31;
@@ -68,6 +107,16 @@
return result;
}
+ /**
+ * Equals groups.
+ *
+ * @param groups1
+ * the groups1
+ * @param groups2
+ * the groups2
+ *
+ * @return true, if successful
+ */
private boolean equalsGroups(List<Group> groups1, List<Group> groups2) {
if (groups1 == groups2)
return true;
@@ -90,6 +139,9 @@
return true;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
@Override
public boolean equals(Object obj) {
if (this == obj)
Modified: trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/Group.java
===================================================================
--- trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/Group.java 2008-02-04 14:32:23 UTC (rev 623)
+++ trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/Group.java 2008-02-04 14:32:52 UTC (rev 624)
@@ -17,33 +17,67 @@
* ##% */
package fr.cemagref.simexplorer.is.security.entities;
+/**
+ * The Class Group.
+ */
public class Group extends Actor {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 7378041114780247677L;
+
+ /** The name. */
private String name;
+
+ /** The owner. */
private User owner;
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
public String getName() {
return name;
}
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
public void setName(String name) {
this.name = name;
}
+ /**
+ * Gets the owner.
+ *
+ * @return the owner
+ */
public User getOwner() {
return owner;
}
+ /**
+ * Sets the owner.
+ *
+ * @param owner the new owner
+ */
public void setOwner(User owner) {
this.owner = owner;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
return name;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.entities.Actor#hashCode()
+ */
@Override
public int hashCode() {
final int prime = 31;
@@ -53,6 +87,9 @@
return result;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.entities.Actor#equals(java.lang.Object)
+ */
@Override
public boolean equals(Object obj) {
if (this == obj)
Modified: trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/LoginAction.java
===================================================================
--- trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/LoginAction.java 2008-02-04 14:32:23 UTC (rev 623)
+++ trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/LoginAction.java 2008-02-04 14:32:52 UTC (rev 624)
@@ -19,41 +19,91 @@
import java.util.Date;
+/**
+ * The Class LoginAction.
+ */
public class LoginAction {
+ /** The id. */
private Integer id;
+
+ /** The time. */
private Date time;
+
+ /** The logged user. */
private User loggedUser;
+
+ /** The token. */
private String token;
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
public Integer getId() {
return id;
}
+ /**
+ * Sets the id.
+ *
+ * @param id the new id
+ */
public void setId(Integer id) {
this.id = id;
}
+ /**
+ * Gets the time.
+ *
+ * @return the time
+ */
public Date getTime() {
return time;
}
+ /**
+ * Sets the time.
+ *
+ * @param time the new time
+ */
public void setTime(Date time) {
this.time = time;
}
+ /**
+ * Gets the logged user.
+ *
+ * @return the logged user
+ */
public User getLoggedUser() {
return loggedUser;
}
+ /**
+ * Sets the logged user.
+ *
+ * @param loggedUser the new logged user
+ */
public void setLoggedUser(User loggedUser) {
this.loggedUser = loggedUser;
}
+ /**
+ * Gets the token.
+ *
+ * @return the token
+ */
public String getToken() {
return token;
}
+ /**
+ * Sets the token.
+ *
+ * @param token the new token
+ */
public void setToken(String token) {
this.token = token;
}
Modified: trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/Permission.java
===================================================================
--- trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/Permission.java 2008-02-04 14:32:23 UTC (rev 623)
+++ trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/Permission.java 2008-02-04 14:32:52 UTC (rev 624)
@@ -19,70 +19,157 @@
import java.io.Serializable;
+/**
+ * The Class Permission.
+ */
public class Permission implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 2753683847549451125L;
+ /** The id. */
private Integer id;
+
+ /** The business id. */
private String businessId;
+
+ /** The actor. */
private Actor actor;
+
+ /** The can read. */
private boolean canRead;
+
+ /** The can write. */
private boolean canWrite;
+
+ /** The can admin. */
private boolean canAdmin;
+
+ /** The is owner. */
private boolean isOwner;
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
public Integer getId() {
return id;
}
+ /**
+ * Sets the id.
+ *
+ * @param id the new id
+ */
public void setId(Integer id) {
this.id = id;
}
+ /**
+ * Gets the business id.
+ *
+ * @return the business id
+ */
public String getBusinessId() {
return businessId;
}
+ /**
+ * Sets the business id.
+ *
+ * @param businessId the new business id
+ */
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
+ /**
+ * Gets the actor.
+ *
+ * @return the actor
+ */
public Actor getActor() {
return actor;
}
+ /**
+ * Sets the actor.
+ *
+ * @param actor the new actor
+ */
public void setActor(Actor actor) {
this.actor = actor;
}
+ /**
+ * Checks if is can read.
+ *
+ * @return true, if is can read
+ */
public boolean isCanRead() {
return canRead;
}
+ /**
+ * Sets the can read.
+ *
+ * @param canRead the new can read
+ */
public void setCanRead(boolean canRead) {
this.canRead = canRead;
}
+ /**
+ * Checks if is can write.
+ *
+ * @return true, if is can write
+ */
public boolean isCanWrite() {
return canWrite;
}
+ /**
+ * Sets the can write.
+ *
+ * @param canWrite the new can write
+ */
public void setCanWrite(boolean canWrite) {
this.canWrite = canWrite;
}
+ /**
+ * Checks if is can admin.
+ *
+ * @return true, if is can admin
+ */
public boolean isCanAdmin() {
return canAdmin;
}
+ /**
+ * Sets the can admin.
+ *
+ * @param canAdmin the new can admin
+ */
public void setCanAdmin(boolean canAdmin) {
this.canAdmin = canAdmin;
}
+ /**
+ * Checks if is owner.
+ *
+ * @return true, if is owner
+ */
public boolean isOwner() {
return isOwner;
}
+ /**
+ * Sets the owner.
+ *
+ * @param isOwner the new owner
+ */
public void setOwner(boolean isOwner) {
this.isOwner = isOwner;
}
Modified: trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/User.java
===================================================================
--- trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/User.java 2008-02-04 14:32:23 UTC (rev 623)
+++ trunk/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/entities/User.java 2008-02-04 14:32:52 UTC (rev 624)
@@ -17,60 +17,130 @@
* ##% */
package fr.cemagref.simexplorer.is.security.entities;
+/**
+ * The Class User.
+ */
public class User extends Actor {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -3031385996413945685L;
+
+ /** The login. */
private String login;
+
+ /** The mail. */
private String mail;
+
+ /** The password hash. */
private String passwordHash;
+
+ /** The admin. */
private boolean admin;
+
+ /** The super admin. */
private boolean superAdmin;
+ /**
+ * Gets the login.
+ *
+ * @return the login
+ */
public String getLogin() {
return login;
}
+ /**
+ * Sets the login.
+ *
+ * @param login the new login
+ */
public void setLogin(String login) {
this.login = login;
}
+ /**
+ * Gets the mail.
+ *
+ * @return the mail
+ */
public String getMail() {
return mail;
}
+ /**
+ * Sets the mail.
+ *
+ * @param mail the new mail
+ */
public void setMail(String mail) {
this.mail = mail;
}
+ /**
+ * Gets the password hash.
+ *
+ * @return the password hash
+ */
public String getPasswordHash() {
return passwordHash;
}
+ /**
+ * Sets the password hash.
+ *
+ * @param passwordHash the new password hash
+ */
public void setPasswordHash(String passwordHash) {
this.passwordHash = passwordHash;
}
+ /**
+ * Checks if is admin.
+ *
+ * @return true, if is admin
+ */
public boolean isAdmin() {
return admin;
}
+ /**
+ * Sets the admin.
+ *
+ * @param admin the new admin
+ */
public void setAdmin(boolean admin) {
this.admin = admin;
}
+ /**
+ * Checks if is super admin.
+ *
+ * @return true, if is super admin
+ */
public boolean isSuperAdmin() {
return superAdmin;
}
+ /**
+ * Sets the super admin.
+ *
+ * @param superAdmin the new super admin
+ */
public void setSuperAdmin(boolean superAdmin) {
this.superAdmin = superAdmin;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
return login;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.entities.Actor#hashCode()
+ */
@Override
public int hashCode() {
final int prime = 31;
@@ -84,6 +154,9 @@
return result;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.security.entities.Actor#equals(java.lang.Object)
+ */
@Override
public boolean equals(Object obj) {
if (this == obj)
1
0
r623 - trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories
by glandais@users.labs.libre-entreprise.org 04 Feb '08
by glandais@users.labs.libre-entreprise.org 04 Feb '08
04 Feb '08
Author: glandais
Date: 2008-02-04 14:32:23 +0000 (Mon, 04 Feb 2008)
New Revision: 623
Modified:
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java
Log:
Cast warning removed
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java 2008-02-04 14:31:55 UTC (rev 622)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java 2008-02-04 14:32:23 UTC (rev 623)
@@ -38,7 +38,7 @@
public E loadElement(Element xmlElement) throws Exception {
E element = super.loadElement(xmlElement);
- MetaDataFactory elementFactory = MetaDataFactory
+ MetaDataFactory<MetaData> elementFactory = MetaDataFactory
.getFactory(MetaData.class);
// Load metadata informations
@@ -55,7 +55,7 @@
@Override
public void saveElement(org.w3c.dom.Document document, Element xmlElement,
E element) throws Exception {
- MetaDataFactory elementFactory = MetaDataFactory
+ MetaDataFactory<MetaData> elementFactory = MetaDataFactory
.getFactory(MetaData.class);
// Save metadata informations
1
0
Author: glandais
Date: 2008-02-04 14:31:55 +0000 (Mon, 04 Feb 2008)
New Revision: 622
Modified:
trunk/simexplorer-is-ear/pom.xml
Log:
Tapestry5 components
Modified: trunk/simexplorer-is-ear/pom.xml
===================================================================
--- trunk/simexplorer-is-ear/pom.xml 2008-02-04 14:31:26 UTC (rev 621)
+++ trunk/simexplorer-is-ear/pom.xml 2008-02-04 14:31:55 UTC (rev 622)
@@ -5,7 +5,7 @@
<groupId>simexplorer-is</groupId>
<artifactId>simexplorer-is-ear</artifactId>
<name>EAR service</name>
-
+
<packaging>ear</packaging>
<version>0.0.1-SNAPSHOT</version>
<description></description>
@@ -57,8 +57,13 @@
<artifactId>tapestry-ioc</artifactId>
<version>5.0.9</version>
</dependency>
-
<dependency>
+ <groupId>de.hsofttec.t5components</groupId>
+ <artifactId>t5components</artifactId>
+ <version>0.5.6</version>
+ </dependency>
+
+ <dependency>
<groupId>simexplorer-is</groupId>
<artifactId>simexplorer-is-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
1
0
r621 - trunk/simexplorer-is/src/site/fr/rst/devel
by glandais@users.labs.libre-entreprise.org 04 Feb '08
by glandais@users.labs.libre-entreprise.org 04 Feb '08
04 Feb '08
Author: glandais
Date: 2008-02-04 14:31:26 +0000 (Mon, 04 Feb 2008)
New Revision: 621
Added:
trunk/simexplorer-is/src/site/fr/rst/devel/maven.rst
Log:
Maven repositories doc
Added: trunk/simexplorer-is/src/site/fr/rst/devel/maven.rst
===================================================================
--- trunk/simexplorer-is/src/site/fr/rst/devel/maven.rst (rev 0)
+++ trunk/simexplorer-is/src/site/fr/rst/devel/maven.rst 2008-02-04 14:31:26 UTC (rev 621)
@@ -0,0 +1,21 @@
+Les dépôts suivants doivent être disponibles dans le fichier ~/.m2/settings.xml :
+
+::
+ <repository>
+ <id>codelutin-lib</id>
+ <url>http://lutinbuilder.labs.libre-entreprise.org/maven2</url>
+ </repository>
+ <repository>
+ <id>openhms</id>
+ <url>http://open.hmsonline.com/repo/maven2</url>
+ </repository>
+ <repository>
+ <id>repository.jboss.com</id>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ <repository>
+ <id>t5components</id>
+ <name>T5Components Maven Repository</name>
+ <url>http://213.160.23.119:8080/t5components/maven-repository</url>
+ </repository>
+
\ No newline at end of file
1
0
Author: glandais
Date: 2008-02-04 14:30:59 +0000 (Mon, 04 Feb 2008)
New Revision: 620
Modified:
trunk/simexplorer-is/pom.xml
Log:
Lutinlib for all modules
Modified: trunk/simexplorer-is/pom.xml
===================================================================
--- trunk/simexplorer-is/pom.xml 2008-02-04 13:56:01 UTC (rev 619)
+++ trunk/simexplorer-is/pom.xml 2008-02-04 14:30:59 UTC (rev 620)
@@ -99,10 +99,10 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>${maven.test.skip}</skip>
- <excludes>
- <exclude>**/*MassTestCase.java</exclude>
- </excludes>
- </configuration>
+ <excludes>
+ <exclude>**/*MassTestCase.java</exclude>
+ </excludes>
+ </configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
@@ -129,6 +129,12 @@
<classifier>jdk15</classifier>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>lutinlib</groupId>
+ <artifactId>lutinutil</artifactId>
+ <version>0.29-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<modules>
@@ -140,4 +146,4 @@
<module>../simexplorer-is-swing</module>
<module>../simexplorer-is-ear</module>
</modules>
-</project>
\ No newline at end of file
+</project>
1
0
r619 - in trunk/simexplorer-is-web: . src/java/fr/cemagref/simexplorer/is/ui/web/components src/java/fr/cemagref/simexplorer/is/ui/web/pages src/main/webapp
by glandais@users.labs.libre-entreprise.org 04 Feb '08
by glandais@users.labs.libre-entreprise.org 04 Feb '08
04 Feb '08
Author: glandais
Date: 2008-02-04 13:56:01 +0000 (Mon, 04 Feb 2008)
New Revision: 619
Modified:
trunk/simexplorer-is-web/pom.xml
trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java
trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java
trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java
trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java
trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java
trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java
trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java
trunk/simexplorer-is-web/src/main/webapp/ExceptionReport.tml
Log:
SetterGetter annotation when possible
Modified: trunk/simexplorer-is-web/pom.xml
===================================================================
--- trunk/simexplorer-is-web/pom.xml 2008-02-04 13:55:08 UTC (rev 618)
+++ trunk/simexplorer-is-web/pom.xml 2008-02-04 13:56:01 UTC (rev 619)
@@ -91,6 +91,11 @@
<version>5.0.9</version>
</dependency>
<dependency>
+ <groupId>de.hsofttec.t5components</groupId>
+ <artifactId>t5components</artifactId>
+ <version>0.5.6</version>
+ </dependency>
+ <dependency>
<groupId>jboss</groupId>
<artifactId>jbossall-client</artifactId>
<version>4.2.2.GA</version>
Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java
===================================================================
--- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java 2008-02-04 13:55:08 UTC (rev 618)
+++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java 2008-02-04 13:56:01 UTC (rev 619)
@@ -33,6 +33,8 @@
import org.apache.tapestry.services.PersistentLocale;
import org.apache.tapestry.services.RequestGlobals;
+import de.hsofttec.t5components.annotations.SetterGetter;
+
import fr.cemagref.simexplorer.is.ui.web.pages.ElementList;
/**
@@ -56,7 +58,8 @@
@Component
private TextField searchField;
- private String searchText;
+ @SetterGetter
+ private String _searchText;
@Component
private Form form;
@@ -102,7 +105,7 @@
}
Object onSuccess() {
- elementList.searchQuery(searchText);
+ elementList.searchQuery(_searchText);
// form.recordError(searchField, "Invalid request.");
// return null;
return elementList;
@@ -119,14 +122,6 @@
return elementList;
}
- public String getSearchText() {
- return searchText;
- }
-
- public void setSearchText(String searchText) {
- this.searchText = searchText;
- }
-
public String getLoginName() {
return elementList.getUserLogged().getLogin();
}
Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java
===================================================================
--- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java 2008-02-04 13:55:08 UTC (rev 618)
+++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java 2008-02-04 13:56:01 UTC (rev 619)
@@ -22,45 +22,33 @@
import com.healthmarketscience.rmiio.RemoteInputStreamServer;
import com.healthmarketscience.rmiio.SimpleRemoteInputStream;
+import de.hsofttec.t5components.annotations.SetterGetter;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage;
import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService;
public class ElementImport extends UserPage {
- private UploadedFile fileEA;
- private UploadedFile fileLib;
+ @SetterGetter
+ private UploadedFile _fileEA;
- public UploadedFile getFileEA() {
- return fileEA;
- }
+ @SetterGetter
+ private UploadedFile _fileLib;
- public void setFileEA(UploadedFile fileEA) {
- this.fileEA = fileEA;
- }
-
- public UploadedFile getFileLib() {
- return fileLib;
- }
-
- public void setFileLib(UploadedFile fileLib) {
- this.fileLib = fileLib;
- }
-
public void onSuccess() {
- if (fileEA != null) {
+ if (_fileEA != null) {
RemoteInputStreamServer zipRemoteStream = new SimpleRemoteInputStream(
- fileEA.getStream());
+ _fileEA.getStream());
try {
RemoteStorageService.getStorageService().saveElement(
getToken(), zipRemoteStream.export());
} catch (Exception e) {
- throw new SimExplorerWebException();
+ throw new SimExplorerWebException(e);
}
}
- if (fileLib != null) {
+ if (_fileLib != null) {
RemoteInputStreamServer zipRemoteStream = new SimpleRemoteInputStream(
- fileLib.getStream());
+ _fileLib.getStream());
try {
RemoteStorageService.getStorageService().saveElement(
getToken(), zipRemoteStream.export());
Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java
===================================================================
--- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-04 13:55:08 UTC (rev 618)
+++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-04 13:56:01 UTC (rev 619)
@@ -29,6 +29,7 @@
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.services.BeanModelSource;
+import de.hsofttec.t5components.annotations.SetterGetter;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource;
import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage;
@@ -47,7 +48,8 @@
@Persist
private ElementDataSource elementDataSource;
- private MetaData element;
+ @SetterGetter
+ private MetaData _element;
@InjectPage
private ElementDetail elementDetail;
@@ -92,16 +94,8 @@
return elementDataSource;
}
- public MetaData getElement() {
- return element;
- }
-
- public void setElement(MetaData element) {
- this.element = element;
- }
-
public String getDetailElementContext() {
- String result = element.getUuid() + "," + element.getVersion();
+ String result = _element.getUuid() + "," + _element.getVersion();
return result;
}
Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java
===================================================================
--- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java 2008-02-04 13:55:08 UTC (rev 618)
+++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java 2008-02-04 13:56:01 UTC (rev 619)
@@ -26,21 +26,29 @@
import org.apache.tapestry.ioc.services.ExceptionInfo;
import org.apache.tapestry.services.ExceptionReporter;
+import de.hsofttec.t5components.annotations.SetterGetter;
+
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
public class ExceptionReport implements ExceptionReporter {
- private boolean unknown;
+ @SetterGetter(onlyGetter = true)
+ private boolean _unknown;
private SimExplorerWebException exception;
- private List<ExceptionInfo> stack;
- private ExceptionInfo info;
+ @SetterGetter(onlyGetter = true)
+ private List<ExceptionInfo> _stack;
- private String propertyName;
+ @SetterGetter
+ private ExceptionInfo _info;
- private String frame;
+ @SetterGetter
+ private String _propertyName;
+ @SetterGetter
+ private String _frame;
+
@Inject
private ExceptionAnalyzer analyzer;
@@ -51,16 +59,16 @@
public void reportException(Throwable exception) {
SimExplorerWebException simException = getException(exception);
if (simException != null) {
- unknown = false;
+ _unknown = false;
this.exception = simException;
- unknown = true;
+ _unknown = true;
ExceptionAnalysis analysis = analyzer.analyze(exception);
- stack = analysis.getExceptionInfos();
+ _stack = analysis.getExceptionInfos();
} else {
- unknown = true;
+ _unknown = true;
ExceptionAnalysis analysis = analyzer.analyze(exception);
- stack = analysis.getExceptionInfos();
+ _stack = analysis.getExceptionInfos();
}
}
@@ -76,7 +84,7 @@
}
public String getErrorMessage() {
- if (!unknown) {
+ if (!_unknown) {
return exception.getMessage();
} else {
return "";
@@ -85,44 +93,12 @@
public boolean getShowPropertyList() {
// True if either is non-empty
- return !(info.getPropertyNames().isEmpty() && info.getStackTrace()
+ return !(_info.getPropertyNames().isEmpty() && _info.getStackTrace()
.isEmpty());
}
public Object getPropertyValue() {
- return info.getProperty(propertyName);
+ return _info.getProperty(_propertyName);
}
- public List<ExceptionInfo> getStack() {
- return stack;
- }
-
- public ExceptionInfo getInfo() {
- return info;
- }
-
- public void setInfo(ExceptionInfo info) {
- this.info = info;
- }
-
- public String getPropertyName() {
- return propertyName;
- }
-
- public void setPropertyName(String propertyName) {
- this.propertyName = propertyName;
- }
-
- public boolean isUnknown() {
- return unknown;
- }
-
- public String getFrame() {
- return frame;
- }
-
- public void setFrame(String frame) {
- this.frame = frame;
- }
-
}
Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java
===================================================================
--- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java 2008-02-04 13:55:08 UTC (rev 618)
+++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java 2008-02-04 13:56:01 UTC (rev 619)
@@ -27,6 +27,8 @@
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.services.BeanModelSource;
+import de.hsofttec.t5components.annotations.SetterGetter;
+
import fr.cemagref.simexplorer.is.security.entities.Group;
import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
@@ -38,7 +40,8 @@
@Retain
private BeanModel model;
- private Group group;
+ @SetterGetter
+ private Group _group;
@Inject
private BeanModelSource beanModelSource;
@@ -107,14 +110,6 @@
return groupEdit;
}
- public Group getGroup() {
- return group;
- }
-
- public void setGroup(Group group) {
- this.group = group;
- }
-
public BeanModel getModel() {
return model;
}
Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java
===================================================================
--- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java 2008-02-04 13:55:08 UTC (rev 618)
+++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java 2008-02-04 13:56:01 UTC (rev 619)
@@ -30,6 +30,8 @@
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.services.BeanModelSource;
+import de.hsofttec.t5components.annotations.SetterGetter;
+
import fr.cemagref.simexplorer.is.security.entities.Group;
import fr.cemagref.simexplorer.is.security.entities.User;
import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
@@ -61,7 +63,8 @@
@Inject
private ComponentResources resources;
- private Group group;
+ @SetterGetter
+ private Group _group;
public String getWindowTitle() {
return "";
@@ -186,12 +189,4 @@
return groupModel;
}
- public Group getGroup() {
- return group;
- }
-
- public void setGroup(Group group) {
- this.group = group;
- }
-
}
Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java
===================================================================
--- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java 2008-02-04 13:55:08 UTC (rev 618)
+++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java 2008-02-04 13:56:01 UTC (rev 619)
@@ -27,6 +27,8 @@
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.services.BeanModelSource;
+import de.hsofttec.t5components.annotations.SetterGetter;
+
import fr.cemagref.simexplorer.is.security.entities.User;
import fr.cemagref.simexplorer.is.service.SimExplorerServiceException;
import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException;
@@ -38,7 +40,8 @@
@Retain
private BeanModel model;
- private User user;
+ @SetterGetter
+ private User _user;
@Inject
private BeanModelSource beanModelSource;
@@ -52,7 +55,7 @@
public String getWindowTitle() {
return "";
}
-
+
void pageLoaded() {
model = beanModelSource.create(User.class, true, resources);
List<String> wantedProperties = new ArrayList<String>();
@@ -103,14 +106,6 @@
return userEdit;
}
- public User getUser() {
- return user;
- }
-
- public void setUser(User user) {
- this.user = user;
- }
-
public UserEdit getUserEdit() {
return userEdit;
}
Modified: trunk/simexplorer-is-web/src/main/webapp/ExceptionReport.tml
===================================================================
--- trunk/simexplorer-is-web/src/main/webapp/ExceptionReport.tml 2008-02-04 13:55:08 UTC (rev 618)
+++ trunk/simexplorer-is-web/src/main/webapp/ExceptionReport.tml 2008-02-04 13:56:01 UTC (rev 619)
@@ -4,36 +4,40 @@
${errormessage}
<t:if test="unknown">
+
+ <h1>${message:unknowException}</h1>
- <h1>Unknown Exception</h1>
-
- <div class="t-exception-report" id="errordetail">
- <ul>
- <t:loop source="stack" value="info">
- <li><span class="t-exception-class-name">${info.className}</span>
+ <p>${message:errorMessage}</p>
- <t:if test="info.message">
- <div class="t-exception-message">${info.message}</div>
- </t:if> <t:if test="showPropertyList">
- <dl>
- <t:loop source="info.propertyNames" value="propertyName">
- <dt>${propertyName}</dt>
- <dd><t:renderobject object="propertyValue" /></dd>
- </t:loop>
- <t:if test="info.stackTrace">
- <dt>Stack trace</dt>
- <dd>
- <ul class="t-stack-trace">
- <t:loop source="info.stackTrace" value="frame">
- <li>${frame}</li>
- </t:loop>
- </ul>
- </dd>
- </t:if>
- </dl>
- </t:if></li>
- </t:loop>
- </ul>
+ <div t:type="t5components/SlidingPanel" closed="true" subject="${message:exceptionDetails}">
+ <div class="t-exception-report" id="errordetail">
+ <ul>
+ <t:loop source="stack" value="info">
+ <li><span class="t-exception-class-name">${info.className}</span>
+
+ <t:if test="info.message">
+ <div class="t-exception-message">${info.message}</div>
+ </t:if> <t:if test="showPropertyList">
+ <dl>
+ <t:loop source="info.propertyNames" value="propertyName">
+ <dt>${propertyName}</dt>
+ <dd><t:renderobject object="propertyValue" /></dd>
+ </t:loop>
+ <t:if test="info.stackTrace">
+ <dt>Stack trace</dt>
+ <dd>
+ <ul class="t-stack-trace">
+ <t:loop source="info.stackTrace" value="frame">
+ <li>${frame}</li>
+ </t:loop>
+ </ul>
+ </dd>
+ </t:if>
+ </dl>
+ </t:if></li>
+ </t:loop>
+ </ul>
+ </div>
</div>
</t:if>
1
0
r618 - trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database
by glandais@users.labs.libre-entreprise.org 04 Feb '08
by glandais@users.labs.libre-entreprise.org 04 Feb '08
04 Feb '08
Author: glandais
Date: 2008-02-04 13:55:08 +0000 (Mon, 04 Feb 2008)
New Revision: 618
Modified:
trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/DatabaseConstants.java
Log:
Externalize .
Modified: trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/DatabaseConstants.java
===================================================================
--- trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/DatabaseConstants.java 2008-02-04 13:54:31 UTC (rev 617)
+++ trunk/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/DatabaseConstants.java 2008-02-04 13:55:08 UTC (rev 618)
@@ -25,6 +25,7 @@
*/
public interface DatabaseConstants {
+ public static final String DOT = ".";
/**
* Field name for id
*/
1
0
r617 - in trunk/simexplorer-is-service: . src/java/fr/cemagref/simexplorer/is/service
by glandais@users.labs.libre-entreprise.org 04 Feb '08
by glandais@users.labs.libre-entreprise.org 04 Feb '08
04 Feb '08
Author: glandais
Date: 2008-02-04 13:54:31 +0000 (Mon, 04 Feb 2008)
New Revision: 617
Modified:
trunk/simexplorer-is-service/pom.xml
trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java
Log:
Send mails in service
Modified: trunk/simexplorer-is-service/pom.xml
===================================================================
--- trunk/simexplorer-is-service/pom.xml 2008-02-04 13:53:37 UTC (rev 616)
+++ trunk/simexplorer-is-service/pom.xml 2008-02-04 13:54:31 UTC (rev 617)
@@ -55,5 +55,11 @@
<artifactId>commons-lang</artifactId>
<version>2.3</version>
</dependency>
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>1.4</version>
+ </dependency>
+
</dependencies>
</project>
Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java
===================================================================
--- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java 2008-02-04 13:53:37 UTC (rev 616)
+++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java 2008-02-04 13:54:31 UTC (rev 617)
@@ -17,6 +17,8 @@
* ##% */
package fr.cemagref.simexplorer.is.service;
+import static org.codelutin.i18n.I18n._;
+
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
@@ -32,6 +34,12 @@
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
+import javax.mail.MessagingException;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.jboss.annotation.ejb.RemoteBinding;
@@ -55,19 +63,37 @@
private static boolean superAdminCheck = false;
- private void sendMail(String login, String mail, String password) {
- /*
- javax.mail.Session mailSession = (javax.mail.Session) new InitialContext().lookup("java:/Mail");
- javax.mail.Message msg = new MimeMessage(mailSession);
- msg.setRecipients(javax.mail.Message.RecipientType.TO, InternetAddress.parse(mail, false));
- msg.setSubject("");
- msg.setContent("", "text/text");
- msg.setHeader("X-Mailer", "JavaMailer");
- msg.setSentDate(new java.util.Date());
- Transport.send(msg);
- */
+ private String getMailContentWithPassword(String login, String password) {
+ StringBuffer sb = new StringBuffer("");
+ sb.append(_("simexplorer.service.mail.header")).append("\n");
+ sb.append(_("simexplorer.service.mail.login")).append(" : ").append(
+ login).append("\n");
+ sb.append(_("simexplorer.service.mail.password")).append(" : ").append(
+ password).append("\n");
+ sb.append(_("simexplorer.service.mail.footer")).append("\n");
+ return sb.toString();
}
+ private void sendMail(String mail, String subject, String content)
+ throws SimExplorerServiceException {
+ try {
+ javax.mail.Session mailSession = (javax.mail.Session) new InitialContext()
+ .lookup("java:/Mail");
+ javax.mail.Message msg = new MimeMessage(mailSession);
+ msg.setRecipients(javax.mail.Message.RecipientType.TO,
+ InternetAddress.parse(mail, false));
+ msg.setSubject(subject);
+ msg.setContent(content, "text/plain");
+ msg.setHeader("X-Mailer", "JavaMailer");
+ msg.setSentDate(new java.util.Date());
+ Transport.send(msg);
+ } catch (MessagingException e) {
+ throw new SimExplorerServiceException(e);
+ } catch (NamingException e) {
+ throw new SimExplorerServiceException(e);
+ }
+ }
+
private String computeHash(String clearString)
throws SimExplorerServiceException {
MessageDigest messageDigest = null;
@@ -152,7 +178,8 @@
if (canAdminGroup(token, id)) {
dao.deleteGroup(id);
}
- throw new SimExplorerServiceException("simexplorer.security.norights");
+ throw new SimExplorerServiceException(
+ _("simexplorer.service.security.norights"));
}
public void deleteUser(String token, Integer id)
@@ -160,7 +187,8 @@
if (canAdminUser(token, id)) {
dao.deleteUser(id);
}
- throw new SimExplorerServiceException("simexplorer.security.norights");
+ throw new SimExplorerServiceException(
+ _("simexplorer.service.security.norights"));
}
public Group getGroup(String token, Integer id)
@@ -168,7 +196,8 @@
if (canAdminGroup(token, id)) {
return dao.getGroup(id);
}
- throw new SimExplorerServiceException("simexplorer.security.norights");
+ throw new SimExplorerServiceException(
+ _("simexplorer.service.security.norights"));
}
public Group getGroup(String token, String name)
@@ -177,7 +206,8 @@
if (canAdminGroup(token, group.getId())) {
return group;
}
- throw new SimExplorerServiceException("simexplorer.security.norights");
+ throw new SimExplorerServiceException(
+ _("simexplorer.service.security.norights"));
}
public User getUser(String token, Integer id)
@@ -185,7 +215,8 @@
if (canAdminUser(token, id)) {
return dao.getUser(id);
}
- throw new SimExplorerServiceException("simexplorer.security.norights");
+ throw new SimExplorerServiceException(
+ _("simexplorer.service.security.norights"));
}
public User getUser(String token, String login)
@@ -194,7 +225,8 @@
if (canAdminUser(token, user.getId())) {
return user;
}
- throw new SimExplorerServiceException("simexplorer.security.norights");
+ throw new SimExplorerServiceException(
+ _("simexplorer.service.security.norights"));
}
public Group saveGroup(String token, String name)
@@ -208,7 +240,8 @@
group = getGroup(token, group.getId());
return group;
}
- throw new SimExplorerServiceException("simexplorer.security.norights");
+ throw new SimExplorerServiceException(
+ _("simexplorer.service.security.norights"));
}
public User saveUser(String token, String login, String mail)
@@ -219,7 +252,8 @@
user.setLogin(login);
user.setMail(mail);
String password = generatePassword();
- sendMail(login, mail, password);
+ sendMail(mail, _("simexplorer.service.mail.subject"),
+ getMailContentWithPassword(login, password));
String passwordHash = computeHash(password);
user.setPasswordHash(passwordHash);
user.setAdmin(false);
@@ -228,7 +262,8 @@
user = getUser(token, user.getId());
return user;
}
- throw new SimExplorerServiceException("simexplorer.security.norights");
+ throw new SimExplorerServiceException(
+ _("simexplorer.service.security.norights"));
}
public Group updateGroup(String token, Group group)
@@ -236,7 +271,8 @@
if (canAdminGroup(token, group.getId())) {
return dao.updateGroup(group);
}
- throw new SimExplorerServiceException("simexplorer.security.norights");
+ throw new SimExplorerServiceException(
+ _("simexplorer.service.security.norights"));
}
public User updateUser(String token, User user)
@@ -244,7 +280,8 @@
if (canAdminUser(token, user.getId())) {
return dao.updateUser(user);
}
- throw new SimExplorerServiceException("simexplorer.security.norights");
+ throw new SimExplorerServiceException(
+ _("simexplorer.service.security.norights"));
}
public User getLoggedUser(String token) throws SimExplorerServiceException {
@@ -256,7 +293,8 @@
if (loggedUser != null) {
return loggedUser;
}
- throw new SimExplorerServiceException("simexplorer.security.loggedoff");
+ throw new SimExplorerServiceException(
+ _("simexplorer.service.security.norights"));
}
private void checkSuperAdmin() throws SimExplorerServiceException {
@@ -327,8 +365,10 @@
String passwordHash = computeHash(password);
user.setPasswordHash(passwordHash);
dao.updateUser(user);
+ } else {
+ throw new SimExplorerServiceException(
+ _("simexplorer.service.security.norights"));
}
- throw new SimExplorerServiceException("simexplorer.security.norights");
}
public Group[] getGroups(String token) {
1
0
r616 - in trunk/simexplorer-is-entities/src: java/fr/cemagref/simexplorer/is/attachment java/fr/cemagref/simexplorer/is/entities java/fr/cemagref/simexplorer/is/entities/data java/fr/cemagref/simexplorer/is/entities/metadata java/fr/cemagref/simexplorer/is/factories test/fr/cemagref/simexplorer/is/entities/metadata
by glandais@users.labs.libre-entreprise.org 04 Feb '08
by glandais@users.labs.libre-entreprise.org 04 Feb '08
04 Feb '08
Author: glandais
Date: 2008-02-04 13:53:37 +0000 (Mon, 04 Feb 2008)
New Revision: 616
Modified:
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/Attachment.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentType.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentTypeFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/RawType.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/LoggableElement.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/Version.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/BaseEntityFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/CodeFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ComponentFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantValueFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationApplicationFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LibraryFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/RepositoryFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ResultFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/StructureFactory.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XMLStreamEncoder.java
trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XmlConstants.java
trunk/simexplorer-is-entities/src/test/fr/cemagref/simexplorer/is/entities/metadata/VersionTest.java
Log:
Javadoc
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/Attachment.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/Attachment.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/Attachment.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -21,44 +21,104 @@
import org.apache.commons.lang.StringUtils;
+/**
+ * Represents data attached to metadata.
+ *
+ * @author glandais
+ */
public class Attachment implements Serializable {
+ /** Serial version ID. */
private static final long serialVersionUID = 5467615366054227592L;
+ /** Filename. */
private String fileName;
+
+ /** Content type. */
private ContentType contentType;
+
+ /** Data hash. */
private int dataHash;
+ /**
+ * Gets the file name.
+ *
+ * @return the file name
+ */
public String getFileName() {
return fileName;
}
+ /**
+ * Sets the file name.
+ *
+ * @param fileName
+ * the new file name
+ */
public void setFileName(String fileName) {
this.fileName = fileName;
}
+ /**
+ * Gets the content type.
+ *
+ * @return the content type
+ */
public ContentType getContentType() {
return contentType;
}
+ /**
+ * Sets the content type.
+ *
+ * @param contentType
+ * the new content type
+ */
public void setContentType(ContentType contentType) {
this.contentType = contentType;
}
+ /**
+ * Gets the data hash.
+ *
+ * @return the data hash
+ */
public int getDataHash() {
return dataHash;
}
+ /**
+ * Sets the data hash.
+ *
+ * @param dataHash
+ * the new data hash
+ */
public void setDataHash(int dataHash) {
this.dataHash = dataHash;
}
+ /**
+ * Gets the unique id.
+ *
+ * @return the unique id
+ */
public String getUniqueId() {
String hexDataHash = StringUtils.leftPad(Integer.toHexString(dataHash),
8, '0');
return hexDataHash + fileName;
}
+ /**
+ * Int from hex string.
+ *
+ * @param nm
+ * the nm
+ *
+ * @return the int
+ *
+ * @throws NumberFormatException
+ * the number format exception
+ */
public static int intFromHexString(String nm) throws NumberFormatException {
int radix = 16;
int index = 0;
@@ -88,11 +148,27 @@
return result;
}
+ /**
+ * Gets the hash from unique id.
+ *
+ * @param uniqueId
+ * the unique id
+ *
+ * @return the hash from unique id
+ */
public static int getHashFromUniqueId(String uniqueId) {
String hexHash = uniqueId.substring(0, 8);
return intFromHexString("0X" + hexHash);
}
+ /**
+ * Gets the file name from unique id.
+ *
+ * @param uniqueId
+ * the unique id
+ *
+ * @return the file name from unique id
+ */
public static String getFileNameFromUniqueId(String uniqueId) {
return uniqueId.substring(9);
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentType.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentType.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentType.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -21,29 +21,35 @@
import java.io.Reader;
/**
- * Content handler
+ * Content handler.
*
* @author landais
- *
*/
public abstract class ContentType {
/**
- * Index content
+ * Index content.
*
* @param is
* Input stream
+ *
* @return Indexable text
+ *
* @throws Exception
+ * the exception
*/
public abstract Reader renderToText(InputStream is) throws Exception;
/**
+ * Gets the mime type.
+ *
* @return the mimeType
*/
public abstract String getMimeType();
/**
+ * Gets the description.
+ *
* @return the description
*/
public abstract String getDescription();
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentTypeFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentTypeFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentTypeFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -21,25 +21,25 @@
import java.util.Map;
/**
- * Cache content types
+ * Cache content types.
*
* @author landais
- *
*/
public class ContentTypeFactory {
- /**
- * Content type cache
- */
+ /** Content type cache. */
private static Map<String, ContentType> contentTypes = null;
/**
- * Retrieve a content type instance
+ * Retrieve a content type instance.
*
* @param contentTypeClassSimpleName
* Class required
+ *
* @return Instance
+ *
* @throws Exception
+ * the exception
*/
public static ContentType getContentTypeInstance(
String contentTypeClassSimpleName) throws Exception {
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/RawType.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/RawType.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/RawType.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -17,32 +17,43 @@
* ##% */
package fr.cemagref.simexplorer.is.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
+ * Raw content type.
*
* @author landais
- *
*/
public class RawType extends ContentType implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -8010160085848440286L;
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.attachment.ContentType#renderToText(java.io.InputStream)
+ */
@Override
public Reader renderToText(InputStream is) {
// No parsing
return new InputStreamReader(is);
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.attachment.ContentType#getDescription()
+ */
@Override
public String getDescription() {
- return "rawtype";
+ return _("simexplorer.contenttype.rawtype");
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.attachment.ContentType#getMimeType()
+ */
@Override
public String getMimeType() {
return "text/text";
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -19,6 +19,11 @@
import java.io.Serializable;
+/**
+ * The Class BaseEntity.
+ */
public abstract class BaseEntity implements Serializable {
+ // empty class
+
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -19,29 +19,61 @@
import java.io.Serializable;
+/**
+ * The Class Code.
+ */
public class Code extends DataEntity implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 1232989963544650014L;
-
+
+ /** The language. */
private String language;
+
+ /** The code. */
private String code;
+ /**
+ * Gets the language.
+ *
+ * @return the language
+ */
public String getLanguage() {
return language;
}
+ /**
+ * Sets the language.
+ *
+ * @param language
+ * the new language
+ */
public void setLanguage(String language) {
this.language = language;
}
+ /**
+ * Gets the code.
+ *
+ * @return the code
+ */
public String getCode() {
return code;
}
+ /**
+ * Sets the code.
+ *
+ * @param code
+ * the new code
+ */
public void setCode(String code) {
this.code = code;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
return getCode() + " : " + getLanguage();
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -22,47 +22,105 @@
import java.util.List;
import java.util.Set;
+/**
+ * The Class Component.
+ */
public class Component extends LoggableElement implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -1759921918565071510L;
-
+
+ /** The constants. */
Set<Constant> constants;
+
+ /** The structures. */
Set<Structure> structures;
+
+ /** The codes. */
Set<Code> codes;
+
+ /** The libraries. */
Set<Library> libraries;
+ /**
+ * Gets the constants.
+ *
+ * @return the constants
+ */
public Set<Constant> getConstants() {
return constants;
}
+ /**
+ * Sets the constants.
+ *
+ * @param constants
+ * the new constants
+ */
public void setConstants(Set<Constant> constants) {
this.constants = constants;
}
+ /**
+ * Gets the structures.
+ *
+ * @return the structures
+ */
public Set<Structure> getStructures() {
return structures;
}
+ /**
+ * Sets the structures.
+ *
+ * @param structures
+ * the new structures
+ */
public void setStructures(Set<Structure> structures) {
this.structures = structures;
}
+ /**
+ * Gets the codes.
+ *
+ * @return the codes
+ */
public Set<Code> getCodes() {
return codes;
}
+ /**
+ * Sets the codes.
+ *
+ * @param codes
+ * the new codes
+ */
public void setCodes(Set<Code> codes) {
this.codes = codes;
}
+ /**
+ * Gets the libraries.
+ *
+ * @return the libraries
+ */
public Set<Library> getLibraries() {
return libraries;
}
+ /**
+ * Sets the libraries.
+ *
+ * @param libraries
+ * the new libraries
+ */
public void setLibraries(Set<Library> libraries) {
this.libraries = libraries;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.data.LoggableElement#getDirectChildren()
+ */
@Override
public List<LoggableElement> getDirectChildren() {
List<LoggableElement> directChildren = new ArrayList<LoggableElement>();
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -19,31 +19,63 @@
import java.io.Serializable;
+/**
+ * The Class Constant.
+ */
public class Constant extends DataEntity implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 5473300963328292128L;
-
+
+ /** The name. */
private String name;
+
+ /** The type. */
private Class<?> type;
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
public String getName() {
return name;
}
+ /**
+ * Sets the name.
+ *
+ * @param name
+ * the new name
+ */
public void setName(String name) {
this.name = name;
}
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
public Class<?> getType() {
return type;
}
+ /**
+ * Sets the type.
+ *
+ * @param type
+ * the new type
+ */
public void setType(Class<?> type) {
this.type = type;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
- return getName()+ " : " +getType().getSimpleName();
+ return getName() + " : " + getType().getSimpleName();
}
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -19,25 +19,54 @@
import java.io.Serializable;
+/**
+ * The Class ConstantValue.
+ */
public class ConstantValue extends DataEntity implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -5434140706898012637L;
-
+
+ /** The value. */
private String value;
+
+ /** The constant. */
private Constant constant;
+ /**
+ * Gets the value.
+ *
+ * @return the value
+ */
public String getValue() {
return value;
}
+ /**
+ * Sets the value.
+ *
+ * @param value
+ * the new value
+ */
public void setValue(String value) {
this.value = value;
}
+ /**
+ * Gets the constant.
+ *
+ * @return the constant
+ */
public Constant getConstant() {
return constant;
}
+ /**
+ * Sets the constant.
+ *
+ * @param constant
+ * the new constant
+ */
public void setConstant(Constant constant) {
this.constant = constant;
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -19,19 +19,28 @@
import fr.cemagref.simexplorer.is.entities.BaseEntity;
+/**
+ * The Class DataEntity.
+ */
public abstract class DataEntity extends BaseEntity {
+ /** The parent data. */
private DataEntity parentData;
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -2570073990226703994L;
+ /**
+ * Gets the parent loggable element.
+ *
+ * @return the parent loggable element
+ */
public LoggableElement getParentLoggableElement() {
LoggableElement parentLoggableElement = null;
if (getParentData() instanceof LoggableElement) {
parentLoggableElement = (LoggableElement) getParentData();
} else {
- if (getParentData() == null) {
- parentLoggableElement = null;
- } else {
+ if (getParentData() != null) {
parentLoggableElement = getParentData()
.getParentLoggableElement();
}
@@ -40,6 +49,8 @@
}
/**
+ * Gets the parent data.
+ *
* @return the parentData
*/
public DataEntity getParentData() {
@@ -47,6 +58,8 @@
}
/**
+ * Sets the parent data.
+ *
* @param parentData
* the parentData to set
*/
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -22,34 +22,67 @@
import java.util.List;
import java.util.Set;
-public class ExplorationApplication extends LoggableElement implements Serializable {
+/**
+ * The Class ExplorationApplication.
+ */
+public class ExplorationApplication extends LoggableElement implements
+ Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 122049347724394193L;
-
+
+ /** The explorations. */
private Set<ExplorationData> explorations;
+
+ /** The components. */
private Set<Component> components;
+ /**
+ * Gets the explorations.
+ *
+ * @return the explorations
+ */
public Set<ExplorationData> getExplorations() {
return explorations;
}
+ /**
+ * Sets the explorations.
+ *
+ * @param explorations
+ * the new explorations
+ */
public void setExplorations(Set<ExplorationData> explorations) {
this.explorations = explorations;
}
+ /**
+ * Gets the components.
+ *
+ * @return the components
+ */
public Set<Component> getComponents() {
return components;
}
+ /**
+ * Sets the components.
+ *
+ * @param components
+ * the new components
+ */
public void setComponents(Set<Component> components) {
this.components = components;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.data.LoggableElement#getDirectChildren()
+ */
@Override
public List<LoggableElement> getDirectChildren() {
List<LoggableElement> directChildren = new ArrayList<LoggableElement>();
directChildren.addAll(explorations);
- directChildren.addAll(components);
+ directChildren.addAll(components);
return directChildren;
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -21,13 +21,28 @@
import java.util.List;
import java.util.Set;
+/**
+ * The Class ExplorationData.
+ */
public class ExplorationData extends LoggableElement implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -6439801837608358754L;
-
+
+ /** The values map. */
private Set<ConstantValue> valuesMap;
+
+ /** The result. */
private Result result;
+ /**
+ * Find constant value.
+ *
+ * @param c
+ * the constant to find
+ *
+ * @return the constant value
+ */
private ConstantValue findConstantValue(Constant c) {
for (ConstantValue constantValue : valuesMap) {
if (c.equals(constantValue.getConstant())) {
@@ -37,6 +52,14 @@
return null;
}
+ /**
+ * Sets the constant value.
+ *
+ * @param c
+ * the constant to set
+ * @param value
+ * the value
+ */
public void setConstantValue(Constant c, String value) {
ConstantValue constantValue = findConstantValue(c);
if (constantValue == null) {
@@ -47,31 +70,63 @@
constantValue.setValue(value);
}
+ /**
+ * Gets the constant value.
+ *
+ * @param c
+ * the c
+ *
+ * @return the constant value
+ */
public Object getConstantValue(Constant c) {
ConstantValue constantValue = findConstantValue(c);
if (constantValue == null) {
return null;
- } else {
- return constantValue.getValue();
}
+ return constantValue.getValue();
}
+ /**
+ * Gets the result.
+ *
+ * @return the result
+ */
public Result getResult() {
return result;
}
+ /**
+ * Sets the result.
+ *
+ * @param result
+ * the new result
+ */
public void setResult(Result result) {
this.result = result;
}
+ /**
+ * Gets the values map.
+ *
+ * @return the values map
+ */
public Set<ConstantValue> getValuesMap() {
return valuesMap;
}
+ /**
+ * Sets the values map.
+ *
+ * @param valuesMap
+ * the new values map
+ */
public void setValuesMap(Set<ConstantValue> valuesMap) {
this.valuesMap = valuesMap;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.data.LoggableElement#getDirectChildren()
+ */
@Override
public List<LoggableElement> getDirectChildren() {
return null;
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -20,10 +20,17 @@
import java.io.Serializable;
import java.util.List;
+/**
+ * The Class Library.
+ */
public class Library extends LoggableElement implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -5635619075345573945L;
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.data.LoggableElement#getDirectChildren()
+ */
@Override
public List<LoggableElement> getDirectChildren() {
return null;
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/LoggableElement.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/LoggableElement.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/LoggableElement.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -22,12 +22,20 @@
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+/**
+ * The Class LoggableElement.
+ */
public abstract class LoggableElement extends DataEntity {
+ /** The meta data. */
private MetaData metaData;
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 2000267650904269217L;
/**
+ * Gets the meta data.
+ *
* @return the metaData
*/
public MetaData getMetaData() {
@@ -35,13 +43,17 @@
}
/**
- * @param metaData
- * the metaData to set
+ * Sets the meta data.
+ *
+ * @param metaData the metaData to set
*/
public void setMetaData(MetaData metaData) {
this.metaData = metaData;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
if (metaData == null) {
@@ -50,8 +62,18 @@
return metaData.getName() + " [" + metaData.getVersion() + ']';
}
+ /**
+ * Gets the direct children.
+ *
+ * @return the direct children
+ */
public abstract List<LoggableElement> getDirectChildren();
+ /**
+ * Gets the children.
+ *
+ * @return the children
+ */
public List<LoggableElement> getChildren() {
List<LoggableElement> directChildren = getDirectChildren();
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -19,8 +19,12 @@
import java.io.Serializable;
+/**
+ * The Class Repository.
+ */
public class Repository extends DataEntity implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 1232065724338066924L;
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -19,8 +19,12 @@
import java.io.Serializable;
+/**
+ * The Class Result.
+ */
public class Result extends DataEntity implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 2111484866027162494L;
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -17,7 +17,11 @@
* ##% */
package fr.cemagref.simexplorer.is.entities.data;
+/**
+ * The Class Structure.
+ */
public abstract class Structure extends DataEntity {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 2594331198459134006L;
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -26,27 +26,59 @@
import fr.cemagref.simexplorer.is.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.BaseEntity;
+/**
+ * The Class MetaData.
+ */
public class MetaData extends BaseEntity implements Serializable {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -7916932464982315229L;
+ /** The uuid. */
private String uuid;
+
+ /** The name. */
private String name;
+
+ /** The type. */
private String type;
+
+ /** The description. */
private String description;
+
+ /** The version. */
private Version version;
+
+ /** The creation date. */
private Date creationDate;
+
+ /** The hash. */
private String hash;
+
+ /** The descriptors. */
private Map<String, String> descriptors;
+
+ /** The attachments. */
private List<Attachment> attachments;
+
+ /** The parent data uuid. */
private String parentDataUuid;
- //TODO Why String representation, instead of Version ?
+ // TODO Why String representation, instead of Version ?
+ /** The parent data version. */
private String parentDataVersion;
+
+ /** The parent version uuid. */
private String parentVersionUuid;
+
+ /** The parent version version. */
private String parentVersionVersion;
+
+ /** The latest. */
private boolean latest;
/**
+ * Gets the uuid.
+ *
* @return the uuid
*/
public String getUuid() {
@@ -54,6 +86,8 @@
}
/**
+ * Sets the uuid.
+ *
* @param uuid
* the uuid to set
*/
@@ -62,6 +96,8 @@
}
/**
+ * Gets the name.
+ *
* @return the name
*/
public String getName() {
@@ -69,6 +105,8 @@
}
/**
+ * Sets the name.
+ *
* @param name
* the name to set
*/
@@ -77,6 +115,8 @@
}
/**
+ * Gets the type.
+ *
* @return the type
*/
public String getType() {
@@ -84,6 +124,8 @@
}
/**
+ * Sets the type.
+ *
* @param type
* the type to set
*/
@@ -92,6 +134,8 @@
}
/**
+ * Gets the description.
+ *
* @return the description
*/
public String getDescription() {
@@ -99,6 +143,8 @@
}
/**
+ * Sets the description.
+ *
* @param description
* the description to set
*/
@@ -107,6 +153,8 @@
}
/**
+ * Gets the version.
+ *
* @return the version
*/
public Version getVersion() {
@@ -114,6 +162,8 @@
}
/**
+ * Sets the version.
+ *
* @param version
* the version to set
*/
@@ -122,6 +172,8 @@
}
/**
+ * Gets the creation date.
+ *
* @return the creationDate
*/
public Date getCreationDate() {
@@ -129,6 +181,8 @@
}
/**
+ * Sets the creation date.
+ *
* @param creationDate
* the creationDate to set
*/
@@ -137,6 +191,8 @@
}
/**
+ * Gets the hash.
+ *
* @return the hash
*/
public String getHash() {
@@ -144,6 +200,8 @@
}
/**
+ * Sets the hash.
+ *
* @param hash
* the hash to set
*/
@@ -152,6 +210,8 @@
}
/**
+ * Gets the descriptors.
+ *
* @return the descriptors
*/
public Map<String, String> getDescriptors() {
@@ -159,6 +219,8 @@
}
/**
+ * Sets the descriptors.
+ *
* @param descriptors
* the descriptors to set
*/
@@ -167,6 +229,8 @@
}
/**
+ * Gets the attachments.
+ *
* @return the attachments
*/
public List<Attachment> getAttachments() {
@@ -177,6 +241,8 @@
}
/**
+ * Sets the attachments.
+ *
* @param attachments
* the attachments to set
*/
@@ -185,6 +251,8 @@
}
/**
+ * Gets the parent data uuid.
+ *
* @return the parentDataUuid
*/
public String getParentDataUuid() {
@@ -192,6 +260,8 @@
}
/**
+ * Sets the parent data uuid.
+ *
* @param parentDataUuid
* the parentDataUuid to set
*/
@@ -200,6 +270,8 @@
}
/**
+ * Gets the parent data version.
+ *
* @return the parentDataVersion
*/
public String getParentDataVersion() {
@@ -207,6 +279,8 @@
}
/**
+ * Sets the parent data version.
+ *
* @param parentDataVersion
* the parentDataVersion to set
*/
@@ -215,6 +289,8 @@
}
/**
+ * Gets the parent version uuid.
+ *
* @return the parentVersionUuid
*/
public String getParentVersionUuid() {
@@ -222,6 +298,8 @@
}
/**
+ * Sets the parent version uuid.
+ *
* @param parentVersionUuid
* the parentVersionUuid to set
*/
@@ -230,6 +308,8 @@
}
/**
+ * Gets the parent version version.
+ *
* @return the parentVersionVersion
*/
public String getParentVersionVersion() {
@@ -237,6 +317,8 @@
}
/**
+ * Sets the parent version version.
+ *
* @param parentVersionVersion
* the parentVersionVersion to set
*/
@@ -244,10 +326,21 @@
this.parentVersionVersion = parentVersionVersion;
}
+ /**
+ * Checks if is latest.
+ *
+ * @return true, if is latest
+ */
public boolean isLatest() {
return latest;
}
+ /**
+ * Sets the latest.
+ *
+ * @param latest
+ * the new latest
+ */
public void setLatest(boolean latest) {
this.latest = latest;
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/Version.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/Version.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/Version.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -23,23 +23,27 @@
import java.util.StringTokenizer;
/**
- * Pointed version class
- *
+ * Pointed version class.
+ *
* @author glandais
*/
public class Version implements Comparable<Version>, Serializable, Cloneable {
- /** Inner storage */
+ /** Inner storage. */
protected List<Integer> pointedVersion;
+ /** The Constant EMPTY_VERSION. */
private static final String EMPTY_VERSION = "";
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 8931989369617566434L;
/**
- * Static public factory of Version from his string representation
- *
- * @param version the string representation of the version
+ * Static public factory of Version from his string representation.
+ *
+ * @param version
+ * the string representation of the version
+ *
* @return a new instance of version
*/
public static Version valueOf(String version) {
@@ -47,9 +51,10 @@
}
/**
- * Default constructor
- *
- * @param version String version
+ * Default constructor.
+ *
+ * @param version
+ * String version
*/
public Version(String version) {
// Initialize list
@@ -58,32 +63,35 @@
// tokenize on dot
StringTokenizer st = new StringTokenizer(version, ".");
while (st.hasMoreTokens()) {
- addSubVersion(Integer.valueOf(st.nextToken()));
+ addSubVersion(Integer.valueOf(st.nextToken()).intValue());
}
}
}
/**
- * Retrieve sub version
- *
- * @param position Sub version wanted
+ * Retrieve sub version.
+ *
+ * @param position
+ * Sub version wanted
+ *
* @return the sub version number
*/
public Integer getVersion(int position) {
if (position < pointedVersion.size()) {
return pointedVersion.get(position);
- } else {
- return null;
}
+ return null;
}
/**
- * Set a sub version
- *
- * @param position Sub version to modify
- * @param subVersion New value
+ * Set a sub version.
+ *
+ * @param position
+ * Sub version to modify
+ * @param subVersion
+ * New value
*/
- public void setVersion(int position, int subVersion) {
+ public void setVersion(int position, Integer subVersion) {
while (getVersion(position) == null) {
addSubVersion(0);
}
@@ -91,20 +99,22 @@
}
/**
- * Add a new sub version
- *
- * @param subVersion Sub version value
+ * Add a new sub version.
+ *
+ * @param subVersion
+ * Sub version value
*/
- public void addSubVersion(int subVersion) {
+ public void addSubVersion(Integer subVersion) {
pointedVersion.add(subVersion);
}
/**
- * Clone current instance and Increment a sub version.
- * <p/>
- * Note : <b>The current instance is NOT modified</b>
- *
- * @param position Sub version position
+ * Clone current instance and Increment a sub version. <p/> Note : <b>The
+ * current instance is NOT modified</b>
+ *
+ * @param position
+ * Sub version position
+ *
* @return the new instance of version object updated
*/
public Version incVersion(int position) {
@@ -118,14 +128,17 @@
}
/**
- * Length of version
- *
+ * Length of version.
+ *
* @return Number of subversions
*/
public int getLength() {
return pointedVersion.size();
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
if (getLength() == 0) {
@@ -169,26 +182,44 @@
return result;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#clone()
+ */
@Override
public Version clone() throws CloneNotSupportedException {
Version version = (Version) super.clone();
// must defined a new instance of list(otherwise it will use the same
// instance than the original Version instance, and we don not want this
- version.pointedVersion=new ArrayList<Integer>(pointedVersion);
+ version.pointedVersion = new ArrayList<Integer>(pointedVersion);
return version;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
@Override
public boolean equals(Object o) {
- return this == o || (o instanceof Version &&
- pointedVersion.equals(((Version) o).pointedVersion));
+ return this == o
+ || (o instanceof Version && pointedVersion
+ .equals(((Version) o).pointedVersion));
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
@Override
public int hashCode() {
return pointedVersion.hashCode();
}
+ /**
+ * Safe clone.
+ *
+ * @return the version
+ *
+ * @throws RuntimeException
+ * the runtime exception
+ */
public Version safeClone() throws RuntimeException {
try {
return clone();
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/BaseEntityFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/BaseEntityFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/BaseEntityFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -38,11 +38,17 @@
import fr.cemagref.simexplorer.is.entities.BaseEntity;
import fr.cemagref.simexplorer.is.entities.data.DataEntity;
+/**
+ * A factory for creating BaseEntity objects.
+ * @param <E> Entity type
+ */
public abstract class BaseEntityFactory<E extends BaseEntity> implements
XmlConstants {
+ /** The document builder. */
private static DocumentBuilder documentBuilder = null;
+ /** The factories. */
private static Map<String, BaseEntityFactory<? extends DataEntity>> factories = new HashMap<String, BaseEntityFactory<? extends DataEntity>>();
/*
@@ -50,12 +56,16 @@
*/
/**
- * Retrieve instance of the factory
+ * Retrieve instance of the factory.
+ * @param <E> Entity type
*
* @param entityClass
* Class wanted
+ *
* @return Factory
+ *
* @throws Exception
+ * the exception
*/
@SuppressWarnings("unchecked")
public static <E extends DataEntity> BaseEntityFactory<E> getFactory(
@@ -65,7 +75,7 @@
if (result == null) {
String elementFactoryClassName = BaseEntityFactory.class
.getPackage().getName()
- + "." + entityClass.getSimpleName() + "Factory";
+ + "." + entityClass.getSimpleName() + FACTORY_SUFFIX;
Class<? extends BaseEntityFactory<E>> factoryClass = (Class<? extends BaseEntityFactory<E>>) Class
.forName(elementFactoryClassName).asSubclass(
@@ -78,11 +88,15 @@
}
/**
- * Retrieve a factory with class name
+ * Retrieve a factory with class name.
*
* @param entityClassName
- * @return
+ * the entity class name
+ *
+ * @return the factory
+ *
* @throws Exception
+ * the exception
*/
public static BaseEntityFactory<? extends DataEntity> getFactory(
String entityClassName) throws Exception {
@@ -92,10 +106,12 @@
}
/**
- * Retrieve an instance of document builder
+ * Retrieve an instance of document builder.
*
* @return XML document builder
+ *
* @throws Exception
+ * the exception
*/
public static synchronized DocumentBuilder getXMLBuilder() throws Exception {
if (documentBuilder == null) {
@@ -112,18 +128,22 @@
*/
/**
- * Instanciate an element
+ * Instanciate an element.
*
* @return Element
*/
public abstract E createInstance();
/**
- * Load an element from an XML node
+ * Load an element from an XML node.
*
* @param xmlElement
- * @return
+ * the xml element
+ *
+ * @return the E
+ *
* @throws Exception
+ * the exception
*/
public E loadElement(Element xmlElement) throws Exception {
E element = createInstance();
@@ -131,11 +151,15 @@
}
/**
- * Load an element from a XML stream
+ * Load an element from a XML stream.
*
* @param stream
- * @return
+ * the stream
+ *
+ * @return the E
+ *
* @throws Exception
+ * the exception
*/
public E loadElement(InputStream stream) throws Exception {
Document document = getXMLBuilder().parse(stream);
@@ -145,7 +169,7 @@
}
/**
- * Save an element to a XML node
+ * Save an element to a XML node.
*
* @param document
* XML document
@@ -153,18 +177,25 @@
* XML node storing the element (not null)
* @param element
* Element to save
+ *
* @throws Exception
+ * the exception
*/
public abstract void saveElement(Document document, Element xmlElement,
E element) throws Exception;
/**
- * Save an element to a XML stream
+ * Save an element to a XML stream.
*
* @param rootNodeName
+ * the root node name
* @param element
- * @return
+ * the element
+ *
+ * @return the input stream
+ *
* @throws Exception
+ * the exception
*/
public InputStream saveElement(String rootNodeName, E element)
throws Exception {
@@ -194,10 +225,9 @@
*/
/**
- * Load a collection inside a node
+ * Load a collection inside a node.
+ * @param <T> Entity type
*
- * @param <T>
- * Type of element of the collection
* @param tagSetName
* Tag of the node of the collection
* @param tagName
@@ -208,8 +238,11 @@
* Node containing the collection
* @param parentData
* Element holding the collection
- * @return
+ *
+ * @return the set< t>
+ *
* @throws Exception
+ * the exception
*/
public <T extends DataEntity> Set<T> loadCollection(String tagSetName,
String tagName, Class<T> clazz, Element xmlElement,
@@ -236,16 +269,24 @@
}
/**
- * Save a collection of elements to XML node
+ * Save a collection of elements to XML node.
+ * @param <T> Entity type
*
- * @param <T>
* @param entities
+ * the entities
* @param tagSetName
+ * the tag set name
* @param tagName
+ * the tag name
* @param clazz
+ * the clazz
* @param document
+ * the document
* @param xmlElement
+ * the xml element
+ *
* @throws Exception
+ * the exception
*/
public <T extends DataEntity> void saveCollection(Set<T> entities,
String tagSetName, String tagName, Class<T> clazz,
@@ -263,11 +304,15 @@
}
/**
- * Save an element as a XML stream
+ * Save an element as a XML stream.
*
* @param node
- * @return
+ * the node
+ *
+ * @return the input stream
+ *
* @throws Exception
+ * the exception
*/
public static InputStream serializeElement(Element node) throws Exception {
org.w3c.dom.Document xmlDocument = getXMLBuilder().newDocument();
@@ -292,7 +337,7 @@
*/
/**
- * Set a property in XML
+ * Set a property in XML.
*
* @param document
* XML document
@@ -314,21 +359,21 @@
}
/**
- * Get a property in XML
+ * Get a property in XML.
*
* @param xmlElement
* Source node
* @param tagName
* Tag name of property
+ *
* @return Property value
*/
public String getXMLProperty(Element xmlElement, String tagName) {
Element element = getXMLElementByTagName(xmlElement, tagName);
if (element != null) {
return element.getFirstChild().getNodeValue();
- } else {
- return null;
}
+ return null;
}
/*
@@ -336,27 +381,32 @@
*/
/**
- * Retrieve XML element just under with specified tag name
+ * Retrieve XML element just under with specified tag name.
*
* @param xmlElement
+ * the xml element
* @param tagName
- * @return
+ * the tag name
+ *
+ * @return First child element with tagName
*/
public Element getXMLElementByTagName(Element xmlElement, String tagName) {
Set<Element> elements = getXMLElementsByTagName(xmlElement, tagName);
if (elements.size() > 0) {
return elements.iterator().next();
- } else {
- return null;
}
+ return null;
}
/**
- * Retrieve all XML elements just under with specified tag name
+ * Retrieve all XML elements just under with specified tag name.
*
* @param xmlElement
+ * the xml element
* @param tagName
- * @return
+ * the tag name
+ *
+ * @return Children with tagName
*/
public Set<Element> getXMLElementsByTagName(Element xmlElement,
String tagName) {
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/CodeFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/CodeFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/CodeFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -22,13 +22,23 @@
import fr.cemagref.simexplorer.is.entities.data.Code;
+/**
+ * A factory for creating Code objects.
+ * @param <E> Code
+ */
public class CodeFactory<E extends Code> extends BaseEntityFactory<Code> {
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance()
+ */
@Override
public Code createInstance() {
return new Code();
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element)
+ */
@Override
public Code loadElement(Element xmlElement) throws Exception {
Code code = super.loadElement(xmlElement);
@@ -37,6 +47,9 @@
return code;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity)
+ */
@Override
public void saveElement(Document document, Element xmlElement, Code element)
throws Exception {
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ComponentFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ComponentFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ComponentFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -26,14 +26,24 @@
import fr.cemagref.simexplorer.is.entities.data.Library;
import fr.cemagref.simexplorer.is.entities.data.Structure;
+/**
+ * A factory for creating Component objects.
+ * @param <E> Component
+ */
public class ComponentFactory<E extends Component> extends
LoggableElementFactory<Component> {
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance()
+ */
@Override
public Component createInstance() {
return new Component();
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#loadElement(org.w3c.dom.Element)
+ */
@Override
public Component loadElement(Element xmlElement) throws Exception {
Component component = super.loadElement(xmlElement);
@@ -53,6 +63,9 @@
return component;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.data.LoggableElement)
+ */
@Override
public void saveElement(Document document, Element xmlElement,
Component element) throws Exception {
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -22,14 +22,24 @@
import fr.cemagref.simexplorer.is.entities.data.Constant;
+/**
+ * A factory for creating Constant objects.
+ * @param <E> Constant
+ */
public class ConstantFactory<E extends Constant> extends
BaseEntityFactory<Constant> {
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance()
+ */
@Override
public Constant createInstance() {
return new Constant();
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element)
+ */
@Override
public Constant loadElement(Element xmlElement) throws Exception {
Constant constant = super.loadElement(xmlElement);
@@ -39,6 +49,9 @@
return constant;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity)
+ */
@Override
public void saveElement(Document document, Element xmlElement,
Constant element) throws Exception {
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantValueFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantValueFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantValueFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -23,14 +23,24 @@
import fr.cemagref.simexplorer.is.entities.data.Constant;
import fr.cemagref.simexplorer.is.entities.data.ConstantValue;
+/**
+ * A factory for creating ConstantValue objects.
+ * @param <E> ConstantValue
+ */
public class ConstantValueFactory<E extends ConstantValue> extends
BaseEntityFactory<ConstantValue> {
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance()
+ */
@Override
public ConstantValue createInstance() {
return new ConstantValue();
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element)
+ */
@Override
public ConstantValue loadElement(Element xmlElement) throws Exception {
ConstantValue constantValue = super.loadElement(xmlElement);
@@ -43,6 +53,9 @@
return constantValue;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity)
+ */
@Override
public void saveElement(Document document, Element xmlElement,
ConstantValue element) throws Exception {
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationApplicationFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationApplicationFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationApplicationFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -24,35 +24,53 @@
import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication;
import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
+/**
+ * A factory for creating ExplorationApplication objects.
+ */
public class ExplorationApplicationFactory extends
LoggableElementFactory<ExplorationApplication> {
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance()
+ */
@Override
public ExplorationApplication createInstance() {
return new ExplorationApplication();
}
-
+
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.data.LoggableElement)
+ */
@Override
public void saveElement(Document document, Element xmlElement,
ExplorationApplication element) throws Exception {
super.saveElement(document, xmlElement, element);
- saveCollection(element.getExplorations(), KEY_EXPLORATIONAPPLICATION_DATA, KEY_EXPLORATIONAPPLICATION_DATA_NODE,
- ExplorationData.class, document, xmlElement);
- saveCollection(element.getComponents(), KEY_EXPLORATIONAPPLICATION_COMPONENTS,
- KEY_EXPLORATIONAPPLICATION_COMPONENT_NODE, Component.class, document, xmlElement);
+ saveCollection(element.getExplorations(),
+ KEY_EXPLORATIONAPPLICATION_DATA,
+ KEY_EXPLORATIONAPPLICATION_DATA_NODE, ExplorationData.class,
+ document, xmlElement);
+ saveCollection(element.getComponents(),
+ KEY_EXPLORATIONAPPLICATION_COMPONENTS,
+ KEY_EXPLORATIONAPPLICATION_COMPONENT_NODE, Component.class,
+ document, xmlElement);
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#loadElement(org.w3c.dom.Element)
+ */
@Override
public ExplorationApplication loadElement(Element xmlElement)
throws Exception {
ExplorationApplication explorationApplication = super
.loadElement(xmlElement);
- explorationApplication.setExplorations(loadCollection(KEY_EXPLORATIONAPPLICATION_DATA,
- KEY_EXPLORATIONAPPLICATION_DATA_NODE, ExplorationData.class, xmlElement,
- explorationApplication));
- explorationApplication.setComponents(loadCollection(KEY_EXPLORATIONAPPLICATION_COMPONENTS,
- KEY_EXPLORATIONAPPLICATION_COMPONENT_NODE, Component.class, xmlElement,
- explorationApplication));
+ explorationApplication.setExplorations(loadCollection(
+ KEY_EXPLORATIONAPPLICATION_DATA,
+ KEY_EXPLORATIONAPPLICATION_DATA_NODE, ExplorationData.class,
+ xmlElement, explorationApplication));
+ explorationApplication.setComponents(loadCollection(
+ KEY_EXPLORATIONAPPLICATION_COMPONENTS,
+ KEY_EXPLORATIONAPPLICATION_COMPONENT_NODE, Component.class,
+ xmlElement, explorationApplication));
return explorationApplication;
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -24,14 +24,23 @@
import fr.cemagref.simexplorer.is.entities.data.ExplorationData;
import fr.cemagref.simexplorer.is.entities.data.Result;
+/**
+ * A factory for creating ExplorationData objects.
+ */
public class ExplorationDataFactory extends
LoggableElementFactory<ExplorationData> {
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance()
+ */
@Override
public ExplorationData createInstance() {
return new ExplorationData();
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#loadElement(org.w3c.dom.Element)
+ */
@Override
public ExplorationData loadElement(Element xmlElement) throws Exception {
ExplorationData explorationData = super.loadElement(xmlElement);
@@ -45,6 +54,9 @@
return explorationData;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.data.LoggableElement)
+ */
@Override
public void saveElement(Document document, Element xmlElement,
ExplorationData element) throws Exception {
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LibraryFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LibraryFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LibraryFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -19,8 +19,14 @@
import fr.cemagref.simexplorer.is.entities.data.Library;
+/**
+ * A factory for creating Library objects.
+ */
public class LibraryFactory extends LoggableElementFactory<Library> {
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance()
+ */
@Override
public Library createInstance() {
return new Library();
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -22,14 +22,24 @@
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+/**
+ * A factory for creating LoggableElement objects.
+ *
+ * @param <E>
+ * LoggableElement subtype
+ */
public abstract class LoggableElementFactory<E extends LoggableElement> extends
BaseEntityFactory<E> {
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element)
+ */
@Override
public E loadElement(Element xmlElement) throws Exception {
E element = super.loadElement(xmlElement);
- MetaDataFactory elementFactory = MetaDataFactory.getFactory(MetaData.class);
+ MetaDataFactory elementFactory = MetaDataFactory
+ .getFactory(MetaData.class);
// Load metadata informations
Element mdeElement = getXMLElementByTagName(xmlElement, KEY_METADATA);
@@ -39,10 +49,14 @@
return element;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity)
+ */
@Override
public void saveElement(org.w3c.dom.Document document, Element xmlElement,
E element) throws Exception {
- MetaDataFactory elementFactory = MetaDataFactory.getFactory(MetaData.class);
+ MetaDataFactory elementFactory = MetaDataFactory
+ .getFactory(MetaData.class);
// Save metadata informations
Element mdeElement = document.createElement(KEY_METADATA);
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -34,22 +34,41 @@
import fr.cemagref.simexplorer.is.attachment.ContentTypeFactory;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+/**
+ * A factory for creating MetaData objects.
+ * @param <E> MetaData
+ */
public class MetaDataFactory<E extends MetaData> extends
BaseEntityFactory<MetaData> {
+ /** The Constant sdf. */
private static final SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd'T'HH:mm:ss");
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance()
+ */
@Override
public MetaData createInstance() {
return new MetaData();
}
+ /**
+ * Gets the factory.
+ * @param <E> Metadata
+ *
+ * @param entityClass
+ * the entity class
+ *
+ * @return the factory
+ *
+ * @throws Exception
+ * the exception
+ */
@SuppressWarnings( { "unchecked" })
public static <E extends MetaData> MetaDataFactory<E> getFactory(
Class<E> entityClass) throws Exception {
- return (MetaDataFactory) BaseEntityFactory
- .getFactory(entityClass);
+ return (MetaDataFactory) BaseEntityFactory.getFactory(entityClass);
}
/*
@@ -143,6 +162,9 @@
return entity;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity)
+ */
@Override
public void saveElement(Document document, Element xmlElement,
MetaData element) throws Exception {
@@ -230,11 +252,15 @@
/**
* As metadata is stored inside an entity, this method loads metadata with
- * parsing stream and retrieve metadata node
+ * parsing stream and retrieve metadata node.
*
* @param xmlStream
- * @return
+ * the xml stream
+ *
+ * @return the meta data
+ *
* @throws Exception
+ * the exception
*/
public MetaData loadElementFromParentXML(InputStream xmlStream)
throws Exception {
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/RepositoryFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/RepositoryFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/RepositoryFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -22,23 +22,36 @@
import fr.cemagref.simexplorer.is.entities.data.Repository;
+/**
+ * A factory for creating Repository objects.
+ * @param <E> Repository
+ */
public class RepositoryFactory<E extends Repository> extends
BaseEntityFactory<Repository> {
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance()
+ */
@Override
public Repository createInstance() {
return new Repository();
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element)
+ */
@Override
public Repository loadElement(Element xmlElement) throws Exception {
return super.loadElement(xmlElement);
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity)
+ */
@Override
public void saveElement(Document document, Element xmlElement,
Repository element) throws Exception {
-
+ // nothing to do yet
}
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ResultFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ResultFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ResultFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -22,21 +22,36 @@
import fr.cemagref.simexplorer.is.entities.data.Result;
+/**
+ * A factory for creating Result objects.
+ * @param <E> Result
+ */
public class ResultFactory<E extends Result> extends BaseEntityFactory<Result> {
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance()
+ */
@Override
public Result createInstance() {
return new Result();
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element)
+ */
@Override
public Result loadElement(Element xmlElement) throws Exception {
return super.loadElement(xmlElement);
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity)
+ */
@Override
public void saveElement(Document document, Element xmlElement,
Result element) throws Exception {
+
+ // not used yet
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/StructureFactory.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/StructureFactory.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/StructureFactory.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -19,7 +19,13 @@
import fr.cemagref.simexplorer.is.entities.data.Structure;
+/**
+ * A factory for creating Structure objects.
+ *
+ * @param <E>
+ * Structure subtype
+ */
public abstract class StructureFactory<E extends Structure> extends
BaseEntityFactory<Structure> {
-
+ // nothing to do yet
}
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XMLStreamEncoder.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XMLStreamEncoder.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XMLStreamEncoder.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -27,14 +27,35 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+/**
+ * The Class XMLStreamEncoder.
+ */
public class XMLStreamEncoder extends Thread {
+ /** The dom source. */
private DOMSource domSource;
+
+ /** The os. */
+ @SuppressWarnings("unused")
private PipedOutputStream os;
+ /** The result. */
private StreamResult result;
+
+ /** The transformer. */
private Transformer transformer;
+ /**
+ * Instantiates a new xML stream encoder.
+ *
+ * @param domSource
+ * the dom source
+ * @param os
+ * the os
+ *
+ * @throws TransformerConfigurationException
+ * the transformer configuration exception
+ */
public XMLStreamEncoder(DOMSource domSource, PipedOutputStream os)
throws TransformerConfigurationException {
super();
@@ -46,6 +67,10 @@
transformer = tf.newTransformer();
}
+ /* (non-Javadoc)
+ * @see java.lang.Thread#run()
+ */
+ @Override
public void run() {
try {
transformer.transform(domSource, result);
Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XmlConstants.java
===================================================================
--- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XmlConstants.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XmlConstants.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -18,73 +18,157 @@
package fr.cemagref.simexplorer.is.factories;
/**
- * Store all XML constants
+ * Store all XML constants.
*
* @author glandais
- *
*/
public interface XmlConstants {
+ /** The Constant FACTORY_SUFFIX. */
+ public static final String FACTORY_SUFFIX = "language";
+
+ /** The Constant KEY_CODE_LANGUAGE. */
public static final String KEY_CODE_LANGUAGE = "language";
+
+ /** The Constant KEY_CODE_CODE. */
public static final String KEY_CODE_CODE = "code";
+ /** The Constant KEY_COMPONENT_CONSTANTS. */
public static final String KEY_COMPONENT_CONSTANTS = "constants";
+
+ /** The Constant KEY_COMPONENT_CONSTANT_NODE. */
public static final String KEY_COMPONENT_CONSTANT_NODE = "constant";
+
+ /** The Constant KEY_COMPONENT_STRUCTURE. */
public static final String KEY_COMPONENT_STRUCTURE = "structures";
+
+ /** The Constant KEY_COMPONENT_STRUCTURE_NODE. */
public static final String KEY_COMPONENT_STRUCTURE_NODE = "structure";
+
+ /** The Constant KEY_COMPONENT_CODES. */
public static final String KEY_COMPONENT_CODES = "codes";
+
+ /** The Constant KEY_COMPONENT_CODE_NODE. */
public static final String KEY_COMPONENT_CODE_NODE = "code";
+
+ /** The Constant KEY_COMPONENT_LIBRARIES. */
public static final String KEY_COMPONENT_LIBRARIES = "libraries";
+
+ /** The Constant KEY_COMPONENT_LIBRARY_NODE. */
public static final String KEY_COMPONENT_LIBRARY_NODE = "library";
+ /** The Constant KEY_CONSTANT_NAME. */
public static final String KEY_CONSTANT_NAME = "name";
+
+ /** The Constant KEY_CONSTANT_TYPE. */
public static final String KEY_CONSTANT_TYPE = "type";
+ /** The Constant KEY_CONSTANTVALUE_CONSTANT. */
public static final String KEY_CONSTANTVALUE_CONSTANT = "constant";
+
+ /** The Constant KEY_CONSTANTVALUE_VALUE. */
public static final String KEY_CONSTANTVALUE_VALUE = "value";
+ /** The Constant KEY_EXPLORATIONAPPLICATION_DATA. */
public static final String KEY_EXPLORATIONAPPLICATION_DATA = "data";
+
+ /** The Constant KEY_EXPLORATIONAPPLICATION_DATA_NODE. */
public static final String KEY_EXPLORATIONAPPLICATION_DATA_NODE = "explorationdata";
+
+ /** The Constant KEY_EXPLORATIONAPPLICATION_COMPONENTS. */
public static final String KEY_EXPLORATIONAPPLICATION_COMPONENTS = "components";
+
+ /** The Constant KEY_EXPLORATIONAPPLICATION_COMPONENT_NODE. */
public static final String KEY_EXPLORATIONAPPLICATION_COMPONENT_NODE = "component";
+ /** The Constant KEY_EXPLORATIONDATA_RESULT. */
public static final String KEY_EXPLORATIONDATA_RESULT = "result";
+
+ /** The Constant KEY_EXPLORATIONDATA_VALUES. */
public static final String KEY_EXPLORATIONDATA_VALUES = "values";
+
+ /** The Constant KEY_EXPLORATIONDATA_VALUE. */
public static final String KEY_EXPLORATIONDATA_VALUE = "value";
+ /** The Constant KEY_RESULT_FILE. */
public static final String KEY_RESULT_FILE = "file";
+ /** The Constant KEY_METADATA. */
public static final String KEY_METADATA = "metadata";
+ /** The Constant KEY_METADATA_UUID. */
public static final String KEY_METADATA_UUID = "uuid";
+
+ /** The Constant KEY_METADATA_VERSION. */
public static final String KEY_METADATA_VERSION = "version";
+
+ /** The Constant KEY_METADATA_LATESTVERSION. */
public static final String KEY_METADATA_LATESTVERSION = "latestversion";
+
+ /** The Constant KEY_METADATA_NAME. */
public static final String KEY_METADATA_NAME = "name";
+ /** The Constant KEY_METADATA_TYPE. */
public static final String KEY_METADATA_TYPE = "type";
+
+ /** The Constant VALUE_METADATA_TYPE_EA. */
public static final String VALUE_METADATA_TYPE_EA = "ExplorationApplication";
+
+ /** The Constant VALUE_METADATA_TYPE_COMPONENT. */
public static final String VALUE_METADATA_TYPE_COMPONENT = "Component";
+ /** The Constant KEY_METADATA_DESCRIPTION. */
public static final String KEY_METADATA_DESCRIPTION = "description";
+
+ /** The Constant KEY_METADATA_CREATIONDATE. */
public static final String KEY_METADATA_CREATIONDATE = "creationdate";
+
+ /** The Constant KEY_METADATA_HASH. */
public static final String KEY_METADATA_HASH = "hash";
+
+ /** The Constant KEY_METADATA_PARENTDATA_UUID. */
public static final String KEY_METADATA_PARENTDATA_UUID = "parentdatauuid";
+
+ /** The Constant KEY_METADATA_PARENTDATA_VERSION. */
public static final String KEY_METADATA_PARENTDATA_VERSION = "parentdataversion";
+
+ /** The Constant KEY_METADATA_PARENTVERSION_UUID. */
public static final String KEY_METADATA_PARENTVERSION_UUID = "parentversionuuid";
+
+ /** The Constant KEY_METADATA_PARENTVERSION_VERSION. */
public static final String KEY_METADATA_PARENTVERSION_VERSION = "parentversionversion";
+
+ /** The Constant KEY_METADATA_DESCRIPTORS. */
public static final String KEY_METADATA_DESCRIPTORS = "descriptors";
+
+ /** The Constant KEY_METADATA_DESCRIPTOR. */
public static final String KEY_METADATA_DESCRIPTOR = "descriptor";
+
+ /** The Constant KEY_METADATA_ATTACHMENTS. */
public static final String KEY_METADATA_ATTACHMENTS = "attachments";
+
+ /** The Constant KEY_METADATA_ATTACHMENT. */
public static final String KEY_METADATA_ATTACHMENT = "attachment";
+ /** The Constant KEY_METADATA_DESCRIPTOR_NAME. */
public static final String KEY_METADATA_DESCRIPTOR_NAME = "name";
+
+ /** The Constant KEY_METADATA_DESCRIPTOR_VALUE. */
public static final String KEY_METADATA_DESCRIPTOR_VALUE = "value";
+ /** The Constant KEY_METADATA_ATTACHMENT_NAME. */
public static final String KEY_METADATA_ATTACHMENT_NAME = "name";
+
+ /** The Constant KEY_METADATA_ATTACHMENT_TYPE. */
public static final String KEY_METADATA_ATTACHMENT_TYPE = "type";
+
+ /** The Constant KEY_METADATA_ATTACHMENT_HASH. */
public static final String KEY_METADATA_ATTACHMENT_HASH = "hash";
+ /** The Constant FILE_XML. */
public static final String FILE_XML = "data.xml";
+
+ /** The Constant FILE_DATA_PREFIX. */
public static final String FILE_DATA_PREFIX = "attachment";
}
Modified: trunk/simexplorer-is-entities/src/test/fr/cemagref/simexplorer/is/entities/metadata/VersionTest.java
===================================================================
--- trunk/simexplorer-is-entities/src/test/fr/cemagref/simexplorer/is/entities/metadata/VersionTest.java 2008-02-04 11:42:56 UTC (rev 615)
+++ trunk/simexplorer-is-entities/src/test/fr/cemagref/simexplorer/is/entities/metadata/VersionTest.java 2008-02-04 13:53:37 UTC (rev 616)
@@ -21,22 +21,49 @@
/**
* Version Tester.
- *
+ *
* @author chemit
* @version 1.0
- * @since <pre>02/02/2008</pre>
+ * @since
+ *
+ * <pre>
+ * 02 / 02 / 2008
+ * </pre>
*/
public class VersionTest extends TestCase {
- Version v0, v1;
+ /** The v0. */
+ Version v0;
+
+ /** The v1. */
+ Version v1;
+
+ /**
+ * Instantiates a new version test.
+ *
+ * @param name
+ * the name
+ */
public VersionTest(String name) {
super(name);
}
+ /**
+ * Test set get version.
+ *
+ * @throws Exception
+ * the exception
+ */
public void testSetGetVersion() throws Exception {
- //TODO: Test goes here...
+ // TODO: Test goes here...
}
+ /**
+ * Test get length.
+ *
+ * @throws Exception
+ * the exception
+ */
public void testGetLength() throws Exception {
v0 = Version.valueOf("");
@@ -52,6 +79,12 @@
assertEquals(3, v0.getLength());
}
+ /**
+ * Test equals.
+ *
+ * @throws Exception
+ * the exception
+ */
public void testEquals() throws Exception {
v0 = Version.valueOf("");
@@ -71,6 +104,12 @@
assertEquals(v0, v1);
}
+ /**
+ * Test inc sub version.
+ *
+ * @throws Exception
+ * the exception
+ */
public void testIncSubVersion() throws Exception {
v0 = Version.valueOf("0.1");
@@ -87,32 +126,62 @@
assertEquals(Version.valueOf("0.1.1"), v1);
}
+ /**
+ * Test order.
+ *
+ * @throws Exception
+ * the exception
+ */
public void testOrder() throws Exception {
v0 = Version.valueOf("1");
v1 = Version.valueOf("1");
- assertEqualsVersion(v0,v1);
+ assertEqualsVersion(v0, v1);
v1 = Version.valueOf("1.0");
- assertSmallerVersion(v0,v1);
+ assertSmallerVersion(v0, v1);
v1 = Version.valueOf("2");
- assertSmallerVersion(v0,v1);
+ assertSmallerVersion(v0, v1);
v1 = Version.valueOf("0");
- assertGreaterVersion(v0,v1);
+ assertGreaterVersion(v0, v1);
v1 = Version.valueOf("0.1");
- assertGreaterVersion(v0,v1);
+ assertGreaterVersion(v0, v1);
}
- private void assertEqualsVersion(Version v0, Version v1) {
- assertEquals(0, v0.compareTo(v1));
+ /**
+ * Assert equals version.
+ *
+ * @param va
+ * the va
+ * @param vb
+ * the vb
+ */
+ private void assertEqualsVersion(Version va, Version vb) {
+ assertEquals(0, va.compareTo(vb));
}
- private void assertSmallerVersion(Version v0, Version v1) {
- assertEquals(-1, v0.compareTo(v1));
+ /**
+ * Assert smaller version.
+ *
+ * @param va
+ * the va
+ * @param vb
+ * the vb
+ */
+ private void assertSmallerVersion(Version va, Version vb) {
+ assertEquals(-1, va.compareTo(vb));
}
- private void assertGreaterVersion(Version v0, Version v1) {
- assertEquals(1, v0.compareTo(v1));
+ /**
+ * Assert greater version.
+ *
+ * @param va
+ * the va
+ * @param vb
+ * the vb
+ */
+ private void assertGreaterVersion(Version va, Version vb) {
+ assertEquals(1, va.compareTo(vb));
}
}
1
0