From d322fbe7cd10ebd0a6e698b1c0e5402582e5d98c Mon Sep 17 00:00:00 2001 From: rkv Date: Wed, 7 Nov 2012 08:01:13 +0000 Subject: [PATCH] Modifications done to respect PMD rules. Versioning a document is fixed. Validation cycle adding in study configuration is fixed. --- .../src/org/splat/dal/bo/som/Document.java | 8 +- .../dal/dao/kernel/AbstractDatabase.java | 4 +- ...OImpl.java => AbstractGenericDAOImpl.java} | 48 +- .../src/org/splat/dal/dao/kernel/AnyDAO.java | 3 +- .../org/splat/dal/dao/kernel/AnyDAOImpl.java | 7 +- .../splat/dal/dao/kernel/AttributeDAO.java | 3 +- .../dal/dao/kernel/AttributeDAOImpl.java | 7 +- .../org/splat/dal/dao/kernel/EntityDAO.java | 3 +- .../splat/dal/dao/kernel/EntityDAOImpl.java | 7 +- .../splat/dal/dao/kernel/PersistentDAO.java | 3 +- .../dal/dao/kernel/PersistentDAOImpl.java | 7 +- .../org/splat/dal/dao/kernel/RelationDAO.java | 3 +- .../splat/dal/dao/kernel/RelationDAOImpl.java | 7 +- .../src/org/splat/dal/dao/kernel/RoleDAO.java | 3 +- .../org/splat/dal/dao/kernel/RoleDAOImpl.java | 7 +- .../dal/dao/kernel/TextAttributeDAO.java | 3 +- .../dal/dao/kernel/TextAttributeDAOImpl.java | 7 +- .../src/org/splat/dal/dao/kernel/UserDAO.java | 3 +- .../org/splat/dal/dao/kernel/UserDAOImpl.java | 7 +- .../dal/dao/som/CommentAttributeDAO.java | 22 + .../dal/dao/som/CommentAttributeDAOImpl.java | 33 ++ .../dal/dao/som/ContributorRelationDAO.java | 2 +- .../dao/som/ContributorRelationDAOImpl.java | 8 +- .../dal/dao/som/ConvertsRelationDAO.java | 2 +- .../dal/dao/som/ConvertsRelationDAOImpl.java | 8 +- .../src/org/splat/dal/dao/som/Database.java | 40 +- .../dal/dao/som/DescriptionAttributeDAO.java | 22 + .../dao/som/DescriptionAttributeDAOImpl.java | 33 ++ .../org/splat/dal/dao/som/DocumentDAO.java | 2 +- .../splat/dal/dao/som/DocumentDAOImpl.java | 8 +- .../splat/dal/dao/som/DocumentTypeDAO.java | 2 +- .../dal/dao/som/DocumentTypeDAOImpl.java | 8 +- .../src/org/splat/dal/dao/som/FileDAO.java | 2 +- .../org/splat/dal/dao/som/FileDAOImpl.java | 8 +- .../org/splat/dal/dao/som/IDBuilderDAO.java | 2 +- .../splat/dal/dao/som/IDBuilderDAOImpl.java | 8 +- .../dal/dao/som/KnowledgeElementDAO.java | 2 +- .../dal/dao/som/KnowledgeElementDAOImpl.java | 8 +- .../dal/dao/som/KnowledgeElementTypeDAO.java | 2 +- .../dao/som/KnowledgeElementTypeDAOImpl.java | 8 +- .../splat/dal/dao/som/ProjectElementDAO.java | 2 +- .../dal/dao/som/ProjectElementDAOImpl.java | 8 +- .../org/splat/dal/dao/som/PublicationDAO.java | 2 +- .../splat/dal/dao/som/PublicationDAOImpl.java | 8 +- .../org/splat/dal/dao/som/ScenarioDAO.java | 2 +- .../splat/dal/dao/som/ScenarioDAOImpl.java | 8 +- .../dal/dao/som/SimulationContextDAO.java | 2 +- .../dal/dao/som/SimulationContextDAOImpl.java | 8 +- .../dal/dao/som/SimulationContextTypeDAO.java | 2 +- .../dao/som/SimulationContextTypeDAOImpl.java | 8 +- .../splat/dal/dao/som/StampRelationDAO.java | 2 +- .../dal/dao/som/StampRelationDAOImpl.java | 8 +- .../src/org/splat/dal/dao/som/StudyDAO.java | 2 +- .../org/splat/dal/dao/som/StudyDAOImpl.java | 8 +- .../org/splat/dal/dao/som/TimestampDAO.java | 2 +- .../splat/dal/dao/som/TimestampDAOImpl.java | 8 +- .../splat/dal/dao/som/UsedByRelationDAO.java | 2 +- .../dal/dao/som/UsedByRelationDAOImpl.java | 8 +- .../splat/dal/dao/som/UsesRelationDAO.java | 2 +- .../dal/dao/som/UsesRelationDAOImpl.java | 8 +- .../splat/dal/dao/som/ValidationCycleDAO.java | 2 +- .../dal/dao/som/ValidationCycleDAOImpl.java | 8 +- .../dao/som/ValidationCycleRelationDAO.java | 2 +- .../som/ValidationCycleRelationDAOImpl.java | 8 +- .../dal/dao/som/VersionsRelationDAO.java | 2 +- .../dal/dao/som/VersionsRelationDAOImpl.java | 8 +- .../Siman-Common/src/org/splat/kernel/Do.java | 100 +++-- .../org/splat/kernel/MismatchException.java | 17 +- .../kernel/MultiplyDefinedException.java | 15 +- .../org/splat/kernel/RealmLoginModule.java | 220 ++++----- .../org/splat/service/DocumentService.java | 43 +- .../splat/service/DocumentServiceImpl.java | 23 +- .../splat/service/DocumentTypeService.java | 14 +- .../service/DocumentTypeServiceImpl.java | 25 +- .../service/KnowledgeElementService.java | 14 +- .../service/KnowledgeElementServiceImpl.java | 4 +- .../service/KnowledgeElementTypeService.java | 14 +- .../org/splat/service/LockServiceImpl.java | 90 ++-- .../splat/service/ProjectElementService.java | 7 +- .../service/ProjectElementServiceImpl.java | 21 +- .../org/splat/service/PublicationService.java | 31 +- .../splat/service/PublicationServiceImpl.java | 416 ++++++++++-------- .../org/splat/service/ScenarioService.java | 16 +- .../splat/service/ScenarioServiceImpl.java | 14 +- .../src/org/splat/service/SearchService.java | 11 +- .../org/splat/service/SearchServiceImpl.java | 60 +-- .../src/org/splat/service/ServiceLocator.java | 6 +- .../org/splat/service/ServiceLocatorImpl.java | 11 +- .../service/SimulationContextService.java | 24 +- .../service/SimulationContextServiceImpl.java | 48 +- .../service/SimulationContextTypeService.java | 4 +- .../src/org/splat/service/StepService.java | 20 +- .../org/splat/service/StepServiceImpl.java | 128 +++--- .../src/org/splat/service/StudyService.java | 39 +- .../org/splat/service/StudyServiceImpl.java | 29 +- .../src/org/splat/service/UserService.java | 16 +- .../org/splat/service/UserServiceImpl.java | 49 ++- .../org/splat/service/UtilServiceImpl.java | 5 +- .../service/dto/KnowledgeElementTypeDTO.java | 61 ++- .../src/org/splat/service/dto/Proxy.java | 23 +- .../src/org/splat/service/dto/RoleDTO.java | 65 ++- .../service/dto/SimulationContextFacade.java | 39 +- .../src/org/splat/service/dto/UserDTO.java | 106 +++-- .../service/technical/IndexServiceImpl.java | 235 +++++----- .../technical/ProjectSettingsService.java | 44 +- .../technical/ProjectSettingsServiceImpl.java | 182 ++++---- .../src/org/splat/som/ApplicationRights.java | 137 +++--- .../src/org/splat/som/Revision.java | 127 +++--- .../Siman-Common/src/org/splat/som/Step.java | 181 ++++---- .../src/org/splat/som/StepRights.java | 40 +- .../src/org/splat/som/StudyRights.java | 60 +-- .../src/org/splat/util/DTOTransformer.java | 50 +-- .../Siman-Common/src/spring/daoContext.xml | 10 +- .../Siman-Common/src/spring/globalContext.xml | 2 +- .../org/splat/simer/ApplicationSettings.java | 266 ++++++----- .../Siman/src/org/splat/simer/OpenObject.java | 14 +- 116 files changed, 2034 insertions(+), 1642 deletions(-) rename Workspace/Siman-Common/src/org/splat/dal/dao/kernel/{GenericDAOImpl.java => AbstractGenericDAOImpl.java} (84%) create mode 100644 Workspace/Siman-Common/src/org/splat/dal/dao/som/CommentAttributeDAO.java create mode 100644 Workspace/Siman-Common/src/org/splat/dal/dao/som/CommentAttributeDAOImpl.java create mode 100644 Workspace/Siman-Common/src/org/splat/dal/dao/som/DescriptionAttributeDAO.java create mode 100644 Workspace/Siman-Common/src/org/splat/dal/dao/som/DescriptionAttributeDAOImpl.java diff --git a/Workspace/Siman-Common/src/org/splat/dal/bo/som/Document.java b/Workspace/Siman-Common/src/org/splat/dal/bo/som/Document.java index d312469..bb5d140 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/bo/som/Document.java +++ b/Workspace/Siman-Common/src/org/splat/dal/bo/som/Document.java @@ -289,8 +289,8 @@ public class Document extends Entity { } } - // Database fetch constructor protected Document() { + // Database fetch constructor } // Internal constructor @@ -363,10 +363,10 @@ public class Document extends Entity { public Document getPreviousVersion() { // ------------------------------------- Relation previous = getFirstRelation(VersionsRelation.class); - if (previous != null) { - return (Document) previous.getTo(); - } else { + if (previous == null) { return null; + } else { + return (Document) previous.getTo(); } } diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AbstractDatabase.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AbstractDatabase.java index 0bfef74..2f24877 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AbstractDatabase.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AbstractDatabase.java @@ -21,8 +21,8 @@ public abstract class AbstractDatabase extends HibernateDaoSupport { return res;// TODO: Get schema version from the specific object/table } - protected void setSchemaVersion(final String version) { - // TODO: Set schema version into specific object/table: myIDpool = new IDPool(version); + protected void setSchemaVersion(final String version) { // RKV: NOPMD: TODO: Set schema version into specific object/table + // RKV: NOPMD: TODO: Set schema version into specific object/table: myIDpool = new IDPool(version); // getSession().save(myIDpool); } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/GenericDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AbstractGenericDAOImpl.java similarity index 84% rename from Workspace/Siman-Common/src/org/splat/dal/dao/kernel/GenericDAOImpl.java rename to Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AbstractGenericDAOImpl.java index 55ed8bb..b1276d2 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/GenericDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AbstractGenericDAOImpl.java @@ -29,8 +29,12 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport; * @param * Primary key class */ -public abstract class GenericDAOImpl extends +public abstract class AbstractGenericDAOImpl extends HibernateDaoSupport implements GenericDAO { + /** + * Unchecked warning specification. + */ + private static final String UNCHECKED = "unchecked"; /** * Persist the newInstance object into database. * @@ -38,8 +42,8 @@ public abstract class GenericDAOImpl extends * new object as a transient instance * @return new primary key for the created persistent object */ - @SuppressWarnings("unchecked") - public PK create(T newInstance) { + @SuppressWarnings(UNCHECKED) + public PK create(final T newInstance) { return (PK) getSession().save(newInstance); } @@ -50,8 +54,8 @@ public abstract class GenericDAOImpl extends * primary key of an object to read * @return an object found by the given key */ - @SuppressWarnings("unchecked") - public T get(PK id) { + @SuppressWarnings(UNCHECKED) + public T get(final PK id) { return (T) getSession().get(getType(), id); } @@ -62,8 +66,8 @@ public abstract class GenericDAOImpl extends * a search condition * @return an object found according to the given criteria */ - @SuppressWarnings("unchecked") - public T findByCriteria(Criterion aCondition) { + @SuppressWarnings(UNCHECKED) + public T findByCriteria(final Criterion aCondition) { return (T) getSession().createCriteria(getType()).add(aCondition) .uniqueResult(); } @@ -75,7 +79,7 @@ public abstract class GenericDAOImpl extends * a properties values to filter with AND condition * @return an object found according to the given criteria */ - public T findByCriteria(Properties andParams) { + public T findByCriteria(final Properties andParams) { Criterion aCondition = null; for (String aName: andParams.stringPropertyNames()) { aCondition = Restrictions.and(aCondition, Restrictions.eq(aName, andParams.get(aName))); @@ -88,7 +92,7 @@ public abstract class GenericDAOImpl extends * * @return a list of all objects of the considered type T */ - @SuppressWarnings("unchecked") + @SuppressWarnings(UNCHECKED) public List getAll() { return getSession().createCriteria(getType()).list(); } @@ -100,8 +104,8 @@ public abstract class GenericDAOImpl extends * a result list order. Null is ignored and in such case the result list is unordered. * @return an ordered list of all objects of the considered type T */ - @SuppressWarnings("unchecked") - public List getAll(Order ... anOrder) { + @SuppressWarnings(UNCHECKED) + public List getAll(final Order ... anOrder) { Criteria aCriteria = getSession().createCriteria(getType()); for (Order order : anOrder) { if (anOrder != null) { @@ -118,8 +122,8 @@ public abstract class GenericDAOImpl extends * a search condition * @return a list of objects filtered according to the given criteria */ - @SuppressWarnings("unchecked") - public List getFilteredList(Criterion aCondition) { + @SuppressWarnings(UNCHECKED) + public List getFilteredList(final Criterion aCondition) { return getSession().createCriteria(getType()).add(aCondition).list(); } @@ -132,8 +136,8 @@ public abstract class GenericDAOImpl extends * a result list order. Null is ignored and in such case the result list is unordered. * @return a list of objects filtered according to the given criteria */ - @SuppressWarnings("unchecked") - public List getFilteredList(Criterion aCondition, Order ... anOrder) { + @SuppressWarnings(UNCHECKED) + public List getFilteredList(final Criterion aCondition, final Order ... anOrder) { Criteria aCriteria = getSession().createCriteria(getType()).add( aCondition); for (Order order : anOrder) { @@ -151,7 +155,7 @@ public abstract class GenericDAOImpl extends * a properties values to filter with AND condition * @return a list of objects filtered according to the given criteria */ - public List getFilteredList(Properties andParams) { + public List getFilteredList(final Properties andParams) { return getFilteredList(andParams); } @@ -164,7 +168,7 @@ public abstract class GenericDAOImpl extends * a result list order. Null is ignored and in such case the result list is unordered. * @return a list of objects filtered according to the given criteria */ - public List getFilteredList(Properties andParams, Order ... anOrder) { + public List getFilteredList(final Properties andParams, final Order ... anOrder) { Criterion aCondition = null; for (String aName: andParams.stringPropertyNames()) { aCondition = Restrictions.and(aCondition, Restrictions.eq(aName, andParams.get(aName))); @@ -178,7 +182,7 @@ public abstract class GenericDAOImpl extends * @param transientObject * transient instance of the object to update */ - public void update(T transientObject) { + public void update(final T transientObject) { getSession().update(transientObject); } @@ -188,7 +192,7 @@ public abstract class GenericDAOImpl extends * @param persistentObject * a persistent object to delete from the database */ - public void delete(T persistentObject) { + public void delete(final T persistentObject) { getSession().delete(persistentObject); } @@ -198,7 +202,7 @@ public abstract class GenericDAOImpl extends * @param transientObject * transient instance of the object to be made persistent */ - public void persist(T transientObject) { + public void persist(final T transientObject) { getSession().persist(transientObject); } @@ -209,8 +213,8 @@ public abstract class GenericDAOImpl extends * transient instance of the object to be merged with persistent data * @return merged persistent object */ - @SuppressWarnings("unchecked") - public T merge(T transientObject) { + @SuppressWarnings(UNCHECKED) + public T merge(final T transientObject) { return (T) getSession().merge(transientObject); } diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AnyDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AnyDAO.java index 1afa838..ed354a2 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AnyDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AnyDAO.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.Any; -import org.splat.dal.dao.kernel.GenericDAO; /** * Any DAO class implementation. diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AnyDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AnyDAOImpl.java index 2a8d646..ecdc7b5 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AnyDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AnyDAOImpl.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.Any; -import org.splat.dal.dao.kernel.GenericDAOImpl; /** * Any DAO. @@ -19,11 +18,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class AnyDAOImpl extends - GenericDAOImpl implements AnyDAO { + AbstractGenericDAOImpl implements AnyDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AttributeDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AttributeDAO.java index 22e7036..533f9c9 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AttributeDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AttributeDAO.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.Attribute; -import org.splat.dal.dao.kernel.GenericDAO; /** * Attribute DAO class implementation. diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AttributeDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AttributeDAOImpl.java index fc639d1..41576bf 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AttributeDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AttributeDAOImpl.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.Attribute; -import org.splat.dal.dao.kernel.GenericDAOImpl; /** * Attribute DAO. @@ -19,11 +18,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class AttributeDAOImpl extends - GenericDAOImpl implements AttributeDAO { + AbstractGenericDAOImpl implements AttributeDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/EntityDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/EntityDAO.java index 9b219dc..aa8d3a1 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/EntityDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/EntityDAO.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.Entity; -import org.splat.dal.dao.kernel.GenericDAO; /** * Entity DAO class implementation. diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/EntityDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/EntityDAOImpl.java index 62e383b..1f2e911 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/EntityDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/EntityDAOImpl.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.Entity; -import org.splat.dal.dao.kernel.GenericDAOImpl; /** * Entity DAO. @@ -19,11 +18,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class EntityDAOImpl extends - GenericDAOImpl implements EntityDAO { + AbstractGenericDAOImpl implements EntityDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/PersistentDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/PersistentDAO.java index a7ad02f..31d22ec 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/PersistentDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/PersistentDAO.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.Persistent; -import org.splat.dal.dao.kernel.GenericDAO; /** * Persistent DAO class implementation. diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/PersistentDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/PersistentDAOImpl.java index a95ea66..97b3df4 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/PersistentDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/PersistentDAOImpl.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.Persistent; -import org.splat.dal.dao.kernel.GenericDAOImpl; /** * Persistent DAO. @@ -19,11 +18,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class PersistentDAOImpl extends - GenericDAOImpl implements PersistentDAO { + AbstractGenericDAOImpl implements PersistentDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RelationDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RelationDAO.java index 10820f1..7670ff0 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RelationDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RelationDAO.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.Relation; -import org.splat.dal.dao.kernel.GenericDAO; /** * Relation DAO class implementation. diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RelationDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RelationDAOImpl.java index 2e78522..5843cfd 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RelationDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RelationDAOImpl.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.Relation; -import org.splat.dal.dao.kernel.GenericDAOImpl; /** * Relation DAO. @@ -19,11 +18,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class RelationDAOImpl extends - GenericDAOImpl implements RelationDAO { + AbstractGenericDAOImpl implements RelationDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RoleDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RoleDAO.java index 900f464..826504b 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RoleDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RoleDAO.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.Role; -import org.splat.dal.dao.kernel.GenericDAO; /** * Role DAO class implementation. diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RoleDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RoleDAOImpl.java index 732abb2..bb4659e 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RoleDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/RoleDAOImpl.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.Role; -import org.splat.dal.dao.kernel.GenericDAOImpl; /** * Role DAO. @@ -19,11 +18,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class RoleDAOImpl extends - GenericDAOImpl implements RoleDAO { + AbstractGenericDAOImpl implements RoleDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/TextAttributeDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/TextAttributeDAO.java index 6e46390..304d2f2 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/TextAttributeDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/TextAttributeDAO.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.TextAttribute; -import org.splat.dal.dao.kernel.GenericDAO; /** * TextAttribute DAO class implementation. diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/TextAttributeDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/TextAttributeDAOImpl.java index eef3992..af30aa2 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/TextAttributeDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/TextAttributeDAOImpl.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.TextAttribute; -import org.splat.dal.dao.kernel.GenericDAOImpl; /** * TextAttribute DAO. @@ -19,11 +18,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class TextAttributeDAOImpl extends - GenericDAOImpl implements TextAttributeDAO { + AbstractGenericDAOImpl implements TextAttributeDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/UserDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/UserDAO.java index 3bb4f41..a560c94 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/UserDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/UserDAO.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.User; -import org.splat.dal.dao.kernel.GenericDAO; /** * User DAO class implementation. diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/UserDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/UserDAOImpl.java index be18440..04c4bbc 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/UserDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/UserDAOImpl.java @@ -5,13 +5,12 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.kernel; import org.splat.dal.bo.kernel.User; -import org.splat.dal.dao.kernel.GenericDAOImpl; /** * User DAO. @@ -19,11 +18,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class UserDAOImpl extends - GenericDAOImpl implements UserDAO { + AbstractGenericDAOImpl implements UserDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/CommentAttributeDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/CommentAttributeDAO.java new file mode 100644 index 0000000..a96aa45 --- /dev/null +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/CommentAttributeDAO.java @@ -0,0 +1,22 @@ +/***************************************************************************** + * Company OPEN CASCADE + * Application SIMAN + * File $Id$ + * Creation date 06.10.2012 + * @author $Author$ + * @version $Revision$ + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 + *****************************************************************************/ + +package org.splat.dal.dao.som; + +import org.splat.dal.bo.som.CommentAttribute; +import org.splat.dal.dao.kernel.GenericDAO; + +/** + * CommentAttribute DAO class implementation. + * @author Roman Kozlov (RKV) + * + */ +public interface CommentAttributeDAO extends GenericDAO { +} diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/CommentAttributeDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/CommentAttributeDAOImpl.java new file mode 100644 index 0000000..00e68b6 --- /dev/null +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/CommentAttributeDAOImpl.java @@ -0,0 +1,33 @@ +/***************************************************************************** + * Company OPEN CASCADE + * Application SIMAN + * File $Id$ + * Creation date 06.10.2012 + * @author $Author$ + * @version $Revision$ + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 + *****************************************************************************/ + +package org.splat.dal.dao.som; + +import org.splat.dal.bo.som.CommentAttribute; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; + +/** + * CommentAttribute DAO. + * @author RKV + * + */ +public class CommentAttributeDAOImpl extends + AbstractGenericDAOImpl implements CommentAttributeDAO { + + /** + * {@inheritDoc} + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() + */ + @Override + protected Class getType() { + return CommentAttribute.class; + } + +} \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ContributorRelationDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ContributorRelationDAO.java index 4ca3260..b083ab6 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ContributorRelationDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ContributorRelationDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ContributorRelationDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ContributorRelationDAOImpl.java index e908dfb..6245113 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ContributorRelationDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ContributorRelationDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.ContributorRelation; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * ContributorRelation DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class ContributorRelationDAOImpl extends - GenericDAOImpl implements ContributorRelationDAO { + AbstractGenericDAOImpl implements ContributorRelationDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ConvertsRelationDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ConvertsRelationDAO.java index 4cd4c87..d71c439 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ConvertsRelationDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ConvertsRelationDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ConvertsRelationDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ConvertsRelationDAOImpl.java index 43c5e54..919cdd0 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ConvertsRelationDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ConvertsRelationDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.ConvertsRelation; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * ConvertsRelation DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class ConvertsRelationDAOImpl extends - GenericDAOImpl implements ConvertsRelationDAO { + AbstractGenericDAOImpl implements ConvertsRelationDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/Database.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/Database.java index c878606..ec6639d 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/Database.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/Database.java @@ -24,7 +24,9 @@ import org.springframework.transaction.annotation.Transactional; public class Database extends org.splat.dal.dao.kernel.AbstractDatabase { - private int uplevel = 0; // Level of database upgrade + public final static Logger LOG = org.splat.dal.dao.som.Database.LOG; + + private transient int _uplevel = 0; // Level of database upgrade private RepositoryService _repositoryService; private IndexService _indexService; private UserService _userService; @@ -40,33 +42,38 @@ public class Database extends org.splat.dal.dao.kernel.AbstractDatabase { protected class CheckVersion implements Work { /** * {@inheritDoc} + * @throws SQLException * @see org.hibernate.jdbc.Work#execute(java.sql.Connection) */ public void execute(final Connection connex) throws SQLException { DatabaseMetaData dbmdata = connex.getMetaData(); String dbname = connex.getCatalog(); - ResultSet table; + ResultSet table = null; - table = dbmdata.getTables(dbname, null, "study", null); - if (table.next()) { - return; + try { + table = dbmdata.getTables(dbname, null, "study", null); + if (table.next()) { + return; + } + } catch (SQLException e) { + LOG.debug("Can't check the database version: ", e); + throw e; + } finally { + if (table != null) { + table.close(); + } } - uplevel = -1; // Database not initialized + _uplevel = -1; // Database not initialized } } - public final static Logger logger = org.splat.dal.dao.som.Database.logger; - // ============================================================================================================================== // Construction // ============================================================================================================================== - private static Database myDB; + private static Database myDB = new Database(); public static Database getInstance() { - if (myDB == null) { - myDB = new Database(); - } return myDB; } @@ -80,7 +87,7 @@ public class Database extends org.splat.dal.dao.kernel.AbstractDatabase { my = this; my.checkVersion(); } catch (Exception error) { - logger.fatal("Could not access the database, reason:", error); + LOG.fatal("Could not access the database, reason:", error); } } return my; @@ -102,11 +109,11 @@ public class Database extends org.splat.dal.dao.kernel.AbstractDatabase { // ============================================================================================================================== public boolean isInitialized() { - return (uplevel >= 0); + return (_uplevel >= 0); } public void initialize() throws IOException, SQLException { - logger.info("Creation of the database."); + LOG.info("Creation of the database."); // Creation of the Lucene index getIndexService().create(); // May throw IOException if the index repository is improperly configured @@ -116,7 +123,7 @@ public class Database extends org.splat.dal.dao.kernel.AbstractDatabase { // Population of the database with customized data this.populate(); - uplevel = 0; // The database is now up-to-date + _uplevel = 0; // The database is now up-to-date } // ============================================================================================================================== @@ -145,6 +152,7 @@ public class Database extends org.splat.dal.dao.kernel.AbstractDatabase { getUserService().createUser(uprop); } catch (Exception e) { // Let's continue, hoping the best... + LOG.debug(e.getMessage(), e); } } diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/DescriptionAttributeDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/DescriptionAttributeDAO.java new file mode 100644 index 0000000..c064f0b --- /dev/null +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/DescriptionAttributeDAO.java @@ -0,0 +1,22 @@ +/***************************************************************************** + * Company OPEN CASCADE + * Application SIMAN + * File $Id$ + * Creation date 06.10.2012 + * @author $Author$ + * @version $Revision$ + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 + *****************************************************************************/ + +package org.splat.dal.dao.som; + +import org.splat.dal.bo.som.DescriptionAttribute; +import org.splat.dal.dao.kernel.GenericDAO; + +/** + * DescriptionAttribute DAO class implementation. + * @author Roman Kozlov (RKV) + * + */ +public interface DescriptionAttributeDAO extends GenericDAO { +} diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/DescriptionAttributeDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/DescriptionAttributeDAOImpl.java new file mode 100644 index 0000000..fa2e3f8 --- /dev/null +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/DescriptionAttributeDAOImpl.java @@ -0,0 +1,33 @@ +/***************************************************************************** + * Company OPEN CASCADE + * Application SIMAN + * File $Id$ + * Creation date 06.10.2012 + * @author $Author$ + * @version $Revision$ + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 + *****************************************************************************/ + +package org.splat.dal.dao.som; + +import org.splat.dal.bo.som.DescriptionAttribute; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; + +/** + * DescriptionAttribute DAO. + * @author RKV + * + */ +public class DescriptionAttributeDAOImpl extends + AbstractGenericDAOImpl implements DescriptionAttributeDAO { + + /** + * {@inheritDoc} + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() + */ + @Override + protected Class getType() { + return DescriptionAttribute.class; + } + +} \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentDAO.java index c56c730..c43c21a 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentDAOImpl.java index 74a3b16..3440914 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.Document; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * Document DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class DocumentDAOImpl extends - GenericDAOImpl implements DocumentDAO { + AbstractGenericDAOImpl implements DocumentDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentTypeDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentTypeDAO.java index 2f47380..14e4110 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentTypeDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentTypeDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentTypeDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentTypeDAOImpl.java index 5004061..0f35e8f 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentTypeDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/DocumentTypeDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.DocumentType; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * DocumentType DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class DocumentTypeDAOImpl extends - GenericDAOImpl implements DocumentTypeDAO { + AbstractGenericDAOImpl implements DocumentTypeDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/FileDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/FileDAO.java index 9677aaa..d953284 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/FileDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/FileDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/FileDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/FileDAOImpl.java index 3a0ed00..e557d4b 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/FileDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/FileDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.File; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * File DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class FileDAOImpl extends - GenericDAOImpl implements FileDAO { + AbstractGenericDAOImpl implements FileDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/IDBuilderDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/IDBuilderDAO.java index 96163ef..7f0b754 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/IDBuilderDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/IDBuilderDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/IDBuilderDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/IDBuilderDAOImpl.java index ca139e3..1d178bb 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/IDBuilderDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/IDBuilderDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.IDBuilder; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * IDBuilder DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class IDBuilderDAOImpl extends - GenericDAOImpl implements IDBuilderDAO { + AbstractGenericDAOImpl implements IDBuilderDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementDAO.java index dcdc8ba..571f262 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementDAOImpl.java index d559ebc..925ff5f 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.KnowledgeElement; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * KnowledgeElement DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class KnowledgeElementDAOImpl extends - GenericDAOImpl implements KnowledgeElementDAO { + AbstractGenericDAOImpl implements KnowledgeElementDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementTypeDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementTypeDAO.java index 1541a10..e99aafa 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementTypeDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementTypeDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementTypeDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementTypeDAOImpl.java index 00590cc..54f4f27 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementTypeDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/KnowledgeElementTypeDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.KnowledgeElementType; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * KnowledgeElementType DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class KnowledgeElementTypeDAOImpl extends - GenericDAOImpl implements KnowledgeElementTypeDAO { + AbstractGenericDAOImpl implements KnowledgeElementTypeDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ProjectElementDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ProjectElementDAO.java index 99218cd..7c33c5e 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ProjectElementDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ProjectElementDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ProjectElementDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ProjectElementDAOImpl.java index 7d660ea..246bfa3 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ProjectElementDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ProjectElementDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.ProjectElement; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * ProjectElement DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class ProjectElementDAOImpl extends - GenericDAOImpl implements ProjectElementDAO { + AbstractGenericDAOImpl implements ProjectElementDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/PublicationDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/PublicationDAO.java index e25072a..49bc702 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/PublicationDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/PublicationDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/PublicationDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/PublicationDAOImpl.java index a5a70ec..c013d72 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/PublicationDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/PublicationDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.Publication; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * Publication DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class PublicationDAOImpl extends - GenericDAOImpl implements PublicationDAO { + AbstractGenericDAOImpl implements PublicationDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ScenarioDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ScenarioDAO.java index 8391883..b4f94c5 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ScenarioDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ScenarioDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ScenarioDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ScenarioDAOImpl.java index 920e530..3697307 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ScenarioDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ScenarioDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.Scenario; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * Scenario DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class ScenarioDAOImpl extends - GenericDAOImpl implements ScenarioDAO { + AbstractGenericDAOImpl implements ScenarioDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextDAO.java index baef74c..0484882 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextDAOImpl.java index 4c1a7ec..2131193 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.SimulationContext; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * SimulationContext DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class SimulationContextDAOImpl extends - GenericDAOImpl implements SimulationContextDAO { + AbstractGenericDAOImpl implements SimulationContextDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextTypeDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextTypeDAO.java index bd1ad8c..3c8aa68 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextTypeDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextTypeDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextTypeDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextTypeDAOImpl.java index 3066bc4..524269a 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextTypeDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/SimulationContextTypeDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.SimulationContextType; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * SimulationContextType DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class SimulationContextTypeDAOImpl extends - GenericDAOImpl implements SimulationContextTypeDAO { + AbstractGenericDAOImpl implements SimulationContextTypeDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/StampRelationDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/StampRelationDAO.java index 78c50a7..07677ab 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/StampRelationDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/StampRelationDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/StampRelationDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/StampRelationDAOImpl.java index 9f66a7d..3ff680b 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/StampRelationDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/StampRelationDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.StampRelation; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * StampRelation DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class StampRelationDAOImpl extends - GenericDAOImpl implements StampRelationDAO { + AbstractGenericDAOImpl implements StampRelationDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/StudyDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/StudyDAO.java index 5b3c513..e7c70f1 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/StudyDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/StudyDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/StudyDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/StudyDAOImpl.java index e6e3aa6..9b8847e 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/StudyDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/StudyDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.Study; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * Study DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class StudyDAOImpl extends - GenericDAOImpl implements StudyDAO { + AbstractGenericDAOImpl implements StudyDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/TimestampDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/TimestampDAO.java index 2639da2..636eea2 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/TimestampDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/TimestampDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/TimestampDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/TimestampDAOImpl.java index dca4c40..4bc7f75 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/TimestampDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/TimestampDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.Timestamp; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * Timestamp DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class TimestampDAOImpl extends - GenericDAOImpl implements TimestampDAO { + AbstractGenericDAOImpl implements TimestampDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsedByRelationDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsedByRelationDAO.java index dfb2487..dfae560 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsedByRelationDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsedByRelationDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsedByRelationDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsedByRelationDAOImpl.java index 1b4078c..e8da8b1 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsedByRelationDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsedByRelationDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.UsedByRelation; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * UsedByRelation DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class UsedByRelationDAOImpl extends - GenericDAOImpl implements UsedByRelationDAO { + AbstractGenericDAOImpl implements UsedByRelationDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsesRelationDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsesRelationDAO.java index 0c5254b..646fccd 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsesRelationDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsesRelationDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsesRelationDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsesRelationDAOImpl.java index 2d6a3a4..fb1cddb 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsesRelationDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/UsesRelationDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.UsesRelation; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * UsesRelation DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class UsesRelationDAOImpl extends - GenericDAOImpl implements UsesRelationDAO { + AbstractGenericDAOImpl implements UsesRelationDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleDAO.java index a89ce09..2a9c9c0 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleDAOImpl.java index da0ad86..fcc2074 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.ValidationCycle; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * ValidationCycle DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class ValidationCycleDAOImpl extends - GenericDAOImpl implements ValidationCycleDAO { + AbstractGenericDAOImpl implements ValidationCycleDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleRelationDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleRelationDAO.java index fbae333..cd4f74d 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleRelationDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleRelationDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleRelationDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleRelationDAOImpl.java index fae40ce..e787dad 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleRelationDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/ValidationCycleRelationDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.ValidationCycleRelation; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * ValidationCycleRelation DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class ValidationCycleRelationDAOImpl extends - GenericDAOImpl implements ValidationCycleRelationDAO { + AbstractGenericDAOImpl implements ValidationCycleRelationDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/VersionsRelationDAO.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/VersionsRelationDAO.java index 468549a..e5f360f 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/VersionsRelationDAO.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/VersionsRelationDAO.java @@ -5,7 +5,7 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/som/VersionsRelationDAOImpl.java b/Workspace/Siman-Common/src/org/splat/dal/dao/som/VersionsRelationDAOImpl.java index 247e0be..67b07b7 100644 --- a/Workspace/Siman-Common/src/org/splat/dal/dao/som/VersionsRelationDAOImpl.java +++ b/Workspace/Siman-Common/src/org/splat/dal/dao/som/VersionsRelationDAOImpl.java @@ -5,13 +5,13 @@ * Creation date 06.10.2012 * @author $Author$ * @version $Revision$ - * Generated by Siman Generator on Wed Oct 17 14:28:24 MSD 2012 + * Generated by Siman Generator on Tue Nov 06 13:38:56 MSK 2012 *****************************************************************************/ package org.splat.dal.dao.som; import org.splat.dal.bo.som.VersionsRelation; -import org.splat.dal.dao.kernel.GenericDAOImpl; +import org.splat.dal.dao.kernel.AbstractGenericDAOImpl; /** * VersionsRelation DAO. @@ -19,11 +19,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl; * */ public class VersionsRelationDAOImpl extends - GenericDAOImpl implements VersionsRelationDAO { + AbstractGenericDAOImpl implements VersionsRelationDAO { /** * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() + * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType() */ @Override protected Class getType() { diff --git a/Workspace/Siman-Common/src/org/splat/kernel/Do.java b/Workspace/Siman-Common/src/org/splat/kernel/Do.java index c770290..7c6d4f2 100644 --- a/Workspace/Siman-Common/src/org/splat/kernel/Do.java +++ b/Workspace/Siman-Common/src/org/splat/kernel/Do.java @@ -31,39 +31,70 @@ import org.splat.dal.bo.kernel.User; public class Do { - public static boolean containsIllicitCharacter (String name) { + public static boolean containsIllicitCharacter (final String name) { // ------------------------------------------------------------ char parse[] = name.toCharArray(); for (int i=0; i state, Map opts) { -// -------------------------------------------------------------------------------------------------------- - subject = user; - callbackHandler = handler; -// sharedState = state; -// options = opts; -// debug = "true".equalsIgnoreCase((String)options.get("debug")); - logger = Logger.getLogger(RealmLoginModule.class); - } - -// ============================================================================================================================== -// Public services -// ============================================================================================================================== + + // Initial state + private transient Subject _subject; + private transient CallbackHandler _callbackHandler; + // private Map sharedState; + // private Map options; + + // Authentication status + private transient boolean _succeeded = false; + private transient boolean _commit = false; + + // Principal + private transient User _identity = null; + + private static final Logger LOG = Logger.getLogger(RealmLoginModule.class); + + // ============================================================================================================================== + // Constructor + // ============================================================================================================================== + + public void initialize(final Subject user, final CallbackHandler handler, + final Map state, final Map opts) { + // -------------------------------------------------------------------------------------------------------- + _subject = user; + _callbackHandler = handler; + // sharedState = state; + // options = opts; + // debug = "true".equalsIgnoreCase((String)options.get("debug")); + //_logger = Logger.getLogger(RealmLoginModule.class); + } + + // ============================================================================================================================== + // Public services + // ============================================================================================================================== public boolean login() throws LoginException { -// ---------------------- - try { -// Ask for username password - Callback[] callbacks = new Callback[2]; - callbacks[0] = new NameCallback("username"); - callbacks[1] = new PasswordCallback("password", false); - - callbackHandler.handle(callbacks); - - String username = ((NameCallback)callbacks[0]).getName(); - String password = null; - char[] entered = ((PasswordCallback)callbacks[1]).getPassword(); - if (entered != null) { - password = new String(entered); - ((PasswordCallback)callbacks[1]).clearPassword(); - } - -// Authentication - User found = ServiceLocatorImpl.getInstance().getUserService().selectUser(username, password); - if (found != null) { - identity = found; - succeeded = true; - Calendar today = java.util.Calendar.getInstance(); - Date datime = today.getTime(); - logger.info("Connection of " + identity.toString() + " " + datime.toString() + "."); - return true; - } else { - identity = null; - succeeded = false; - found = ServiceLocatorImpl.getInstance().getUserService().selectUser(username); - String reason = "password"; - if (found == null) reason = "username"; - logger.info("Connection attempt as " + username + "."); - throw new FailedLoginException(reason); - } - } - catch (java.io.IOException ioe) { - throw new LoginException(ioe.toString()); - } - catch (UnsupportedCallbackException uce) { - throw new LoginException("Error: " + uce.getCallback().toString() + - " not available to garner authentication information" + - " from the user"); - } + boolean res = false; + try { + // Ask for username password + Callback[] callbacks = new Callback[2]; + callbacks[0] = new NameCallback("username"); + callbacks[1] = new PasswordCallback("password", false); + + _callbackHandler.handle(callbacks); + + String username = ((NameCallback) callbacks[0]).getName(); + String password = null; + char[] entered = ((PasswordCallback) callbacks[1]).getPassword(); + if (entered != null) { + password = new String(entered); + ((PasswordCallback) callbacks[1]).clearPassword(); + } + + // Authentication + User found = ServiceLocatorImpl.getInstance().getUserService() + .selectUser(username, password); + _identity = found; + _succeeded = (found != null); + if (_succeeded) { + Calendar today = java.util.Calendar.getInstance(); + Date datime = today.getTime(); + LOG.info("Connection of " + _identity.toString() + " " + + datime.toString() + "."); + res = true; + } else { + found = ServiceLocatorImpl.getInstance().getUserService() + .selectUser(username); + String reason = "password"; + if (found == null) { + reason = "username"; + } + LOG.info("Connection attempt as " + username + "."); + throw new FailedLoginException(reason); + } + } catch (java.io.IOException ioe) { + throw new LoginException(ioe.getMessage()); // RKV: NOPMD: The message is sent into the constructor + } catch (UnsupportedCallbackException uce) { + throw new LoginException("Error: " + uce.getCallback().toString() // RKV: NOPMD: Stacktrace is printed + + " not available to garner authentication information" + + " from the user"); + } + return res; } public boolean commit() throws LoginException { -// ----------------------- - if (!succeeded) return false; - - if (!subject.getPrincipals().contains(identity)) subject.getPrincipals().add(identity); - identity = null; - commit = true; - return true; + boolean res = _succeeded; + if (res) { + if (!_subject.getPrincipals().contains(_identity)) { + _subject.getPrincipals().add(_identity); + } + _identity = null; + _commit = true; + } + return res; } public boolean abort() throws LoginException { -// ---------------------- - if (!succeeded) { - return false; - } else - if (succeeded && !commit) { - identity = null; - succeeded = false; - } else { - logout(); - } - return true; + boolean res = _succeeded; + if (res) { + if (_succeeded && !_commit) { + _identity = null; + _succeeded = false; + } else { + logout(); + } + } + return res; } public boolean logout() throws LoginException { -// ----------------------- - subject.getPrincipals().remove(identity); - identity = null; - succeeded = false; - commit = false; // To be validated - return true; + _subject.getPrincipals().remove(_identity); + _identity = null; + _succeeded = false; + _commit = false; // To be validated + return true; } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/service/DocumentService.java b/Workspace/Siman-Common/src/org/splat/service/DocumentService.java index c4b2c3c..1c65b18 100644 --- a/Workspace/Siman-Common/src/org/splat/service/DocumentService.java +++ b/Workspace/Siman-Common/src/org/splat/service/DocumentService.java @@ -9,8 +9,6 @@ package org.splat.service; -import java.util.List; - import org.splat.dal.bo.som.ConvertsRelation; import org.splat.dal.bo.som.Document; import org.splat.dal.bo.som.DocumentType; @@ -21,12 +19,9 @@ import org.splat.dal.bo.som.Timestamp; import org.splat.dal.bo.som.Document.Properties; import org.splat.kernel.InvalidPropertyException; import org.splat.kernel.MissedPropertyException; -import org.splat.kernel.MultiplyDefinedException; import org.splat.kernel.NotApplicableException; -import org.splat.service.technical.ProjectSettingsService; import org.splat.som.Revision; import org.splat.som.Step; -import org.springframework.transaction.annotation.Transactional; /** * Document service interface. @@ -43,7 +38,7 @@ public interface DocumentService { * the document path * @return the document if found or null */ - public Document getDocumentByPath(String path); + Document getDocumentByPath(String path); /** * Defines this document. @@ -61,7 +56,7 @@ public interface DocumentService { * @see Step#createDocument(Properties) * @see #isUndefined() */ - public void initialize(Document aDoc, Properties dprop) + void initialize(Document aDoc, Properties dprop) throws MissedPropertyException, InvalidPropertyException, NotApplicableException; @@ -72,7 +67,7 @@ public interface DocumentService { * document id * @return found document */ - public Document selectDocument(long index); + Document selectDocument(long index); /** * Find a document by its reference and version. @@ -83,7 +78,7 @@ public interface DocumentService { * document version * @return found document */ - public Document selectDocument(String refid, String version); + Document selectDocument(String refid, String version); /** * Generate document reference. @@ -93,7 +88,7 @@ public interface DocumentService { * @param dprop * document properties (owner project element is used) */ - public void generateDocumentId(Document aDoc, Properties dprop); + void generateDocumentId(Document aDoc, Properties dprop); /** * Get a directory where the document file is saved. @@ -102,7 +97,7 @@ public interface DocumentService { * the document * @return a directory */ - public java.io.File getSaveDirectory(Document aDoc); + java.io.File getSaveDirectory(Document aDoc); /** * Extract title and reference properties from the given file. @@ -111,7 +106,7 @@ public interface DocumentService { * the file to parse * @return the extracted properties */ - public Properties extractProperties(java.io.File file); + Properties extractProperties(java.io.File file); /** * Create "Converts" relation for the given document and the given format. @@ -122,7 +117,7 @@ public interface DocumentService { * the format * @return the created "Converts" relation */ - public ConvertsRelation attach(Document aDoc, String format); + ConvertsRelation attach(Document aDoc, String format); /** * Create "Converts" relation for the given document, format and description. @@ -135,7 +130,7 @@ public interface DocumentService { * the description of the relation * @return the created "Converts" relation */ - public ConvertsRelation attach(Document aDoc, String format, + ConvertsRelation attach(Document aDoc, String format, String description); /** @@ -149,7 +144,7 @@ public interface DocumentService { * the original document * @return true if the new reference is set */ - public boolean buildReferenceFrom(Document aDoc, ProjectElement scope, + boolean buildReferenceFrom(Document aDoc, ProjectElement scope, Document lineage); /** @@ -161,7 +156,7 @@ public interface DocumentService { * the study * @return true if the new reference is set */ - public boolean buildReferenceFrom(Document aDoc, Study scope); + boolean buildReferenceFrom(Document aDoc, Study scope); /** * Demote a document. @@ -170,7 +165,7 @@ public interface DocumentService { * the document to demote * @return true if demoting succeeded */ - public boolean demote(Document aDoc); + boolean demote(Document aDoc); /** * Promote a document. @@ -181,7 +176,7 @@ public interface DocumentService { * the timestamp of the promotion * @return true if promotion succeeded */ - public boolean promote(Document aDoc, Timestamp stamp); + boolean promote(Document aDoc, Timestamp stamp); /** * Increments the reference count of this document following its publication in a Study step. @@ -190,7 +185,7 @@ public interface DocumentService { * the document to hold * @see #release() */ - public void hold(Document aDoc); + void hold(Document aDoc); /** * Decrements the reference count of this document following the removal of a Publication from a Study step. @@ -199,7 +194,7 @@ public interface DocumentService { * the document to release * @see #hold() */ - public void release(Document aDoc); + void release(Document aDoc); /** * Rename a document. @@ -211,7 +206,7 @@ public interface DocumentService { * @throws InvalidPropertyException * if the new title is empty */ - public void rename(Document aDoc, String title) + void rename(Document aDoc, String title) throws InvalidPropertyException; /** @@ -222,7 +217,7 @@ public interface DocumentService { * @param newvers * the new version */ - public void updateAs(Document aDoc, Revision newvers); + void updateAs(Document aDoc, Revision newvers); /** * Update a state of the given document. @@ -232,7 +227,7 @@ public interface DocumentService { * @param state * the new state */ - public void updateAs(Document aDoc, ProgressState state); + void updateAs(Document aDoc, ProgressState state); /** * Checks if documents of this type are result of a study. A document is the result of a study when it is the result of the last step of @@ -244,5 +239,5 @@ public interface DocumentService { * @see #isStepResult() * @see #isResultOf(org.splat.service.technical.ProjectSettingsServiceImpl.Step) */ - public boolean isStudyResult(DocumentType aType); + boolean isStudyResult(DocumentType aType); } diff --git a/Workspace/Siman-Common/src/org/splat/service/DocumentServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/DocumentServiceImpl.java index 5c87bae..4391e4e 100644 --- a/Workspace/Siman-Common/src/org/splat/service/DocumentServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/DocumentServiceImpl.java @@ -38,6 +38,7 @@ import org.splat.dal.dao.som.StudyDAO; import org.splat.kernel.InvalidPropertyException; import org.splat.kernel.MissedPropertyException; import org.splat.kernel.NotApplicableException; +import org.splat.log.AppLogger; import org.splat.manox.Reader; import org.splat.manox.Toolbox; import org.splat.service.technical.ProjectSettingsService; @@ -54,6 +55,12 @@ import org.springframework.transaction.annotation.Transactional; */ public class DocumentServiceImpl implements DocumentService { + /** + * The logger for the service. + */ + public final static AppLogger LOG = AppLogger + .getLogger(DocumentServiceImpl.class); + /** * Injected study service. */ @@ -61,7 +68,7 @@ public class DocumentServiceImpl implements DocumentService { /** * Injected project settings service. */ - private ProjectSettingsService _projectSettingsService; + private ProjectSettingsService _projectSettings; /** * Injected repository service. */ @@ -122,7 +129,7 @@ public class DocumentServiceImpl implements DocumentService { // Synchronize the object with the current Hibernate session. owner = getStudyDAO().get(owner.getIndex()); - SimpleDateFormat tostring = new SimpleDateFormat("yyyy"); + SimpleDateFormat tostring = new SimpleDateFormat("yyyy"); //RKV: NOPMD: TODO: Use locale here? String year = tostring.format(owner.getDate()); String filename = generateEncodedName(aDoc, owner); String path = owner.getReference(); @@ -266,6 +273,7 @@ public class DocumentServiceImpl implements DocumentService { fprop.setReference(value); } } catch (Exception e) { + LOG.debug(e.getMessage(), e); } } return fprop; @@ -325,8 +333,8 @@ public class DocumentServiceImpl implements DocumentService { * the original document * @return true if the new reference is set */ - public boolean buildReferenceFrom(final Document aDoc, final ProjectElement scope, - final Document lineage) { + public boolean buildReferenceFrom(final Document aDoc, + final ProjectElement scope, final Document lineage) { if (aDoc.getProgressState() != ProgressState.inWORK) { return false; } @@ -637,7 +645,7 @@ public class DocumentServiceImpl implements DocumentService { * @return Project settings service */ private ProjectSettingsService getProjectSettings() { - return _projectSettingsService; + return _projectSettings; } /** @@ -646,8 +654,9 @@ public class DocumentServiceImpl implements DocumentService { * @param projectSettingsService * project settings service */ - public void setProjectSettings(final ProjectSettingsService projectSettingsService) { - _projectSettingsService = projectSettingsService; + public void setProjectSettings( + final ProjectSettingsService projectSettingsService) { + _projectSettings = projectSettingsService; } /** diff --git a/Workspace/Siman-Common/src/org/splat/service/DocumentTypeService.java b/Workspace/Siman-Common/src/org/splat/service/DocumentTypeService.java index 1033ece..349218a 100644 --- a/Workspace/Siman-Common/src/org/splat/service/DocumentTypeService.java +++ b/Workspace/Siman-Common/src/org/splat/service/DocumentTypeService.java @@ -29,14 +29,14 @@ public interface DocumentTypeService { * * @return the list of all document types */ - public List selectAllTypes(); + List selectAllTypes(); /** * Find all result document types. * * @return the list of found types */ - public List selectResultTypes(); + List selectResultTypes(); /** * Get document type by the given type name. @@ -45,7 +45,7 @@ public interface DocumentTypeService { * the type name * @return the found document type */ - public DocumentType selectType(String name); + DocumentType selectType(String name); /** * Get document type by the given id. @@ -54,7 +54,7 @@ public interface DocumentTypeService { * the id * @return the found document type */ - public DocumentType selectType(long index); + DocumentType selectType(long index); /** * Create a new document type. @@ -69,7 +69,7 @@ public interface DocumentTypeService { * @throws MultiplyDefinedException * if some property is defined several times */ - public DocumentType createType(DocumentType.Properties tprop) + DocumentType createType(DocumentType.Properties tprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException; @@ -80,7 +80,7 @@ public interface DocumentTypeService { * the step (study activity) * @return the list of found document types */ - public List selectTypesOf(ProjectSettingsService.Step step); + List selectTypesOf(ProjectSettingsService.Step step); /** * Approve the document type. @@ -89,5 +89,5 @@ public interface DocumentTypeService { * the document type to approve * @return true if approval succeeded */ - public boolean approve(DocumentType aType); + boolean approve(DocumentType aType); } diff --git a/Workspace/Siman-Common/src/org/splat/service/DocumentTypeServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/DocumentTypeServiceImpl.java index 874bcb3..5fa287e 100644 --- a/Workspace/Siman-Common/src/org/splat/service/DocumentTypeServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/DocumentTypeServiceImpl.java @@ -17,7 +17,6 @@ import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.splat.dal.bo.som.DocumentType; import org.splat.dal.bo.som.ProgressState; -import org.splat.dal.dao.som.Database; import org.splat.dal.dao.som.DocumentTypeDAO; import org.splat.kernel.InvalidPropertyException; import org.splat.kernel.MissedPropertyException; @@ -71,7 +70,7 @@ public class DocumentTypeServiceImpl implements DocumentTypeService { * @return the found document type */ @Transactional(readOnly = true) - public DocumentType selectType(String name) { + public DocumentType selectType(final String name) { return getDocumentTypeDAO().findByCriteria( Restrictions.eq("name", name)); } @@ -84,7 +83,7 @@ public class DocumentTypeServiceImpl implements DocumentTypeService { * @return the found document type */ @Transactional(readOnly = true) - public DocumentType selectType(long index) { + public DocumentType selectType(final long index) { return getDocumentTypeDAO().get(index); } @@ -102,7 +101,7 @@ public class DocumentTypeServiceImpl implements DocumentTypeService { * if some property is defined several times */ @Transactional - public DocumentType createType(DocumentType.Properties tprop) + public DocumentType createType(final DocumentType.Properties tprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException { // TODO: Check for duplicate definition @@ -119,7 +118,7 @@ public class DocumentTypeServiceImpl implements DocumentTypeService { * @return the list of found document types */ @Transactional(readOnly = true) - public List selectTypesOf(ProjectSettingsService.Step step) { + public List selectTypesOf(final ProjectSettingsService.Step step) { Integer number = step.getNumber(); String sampleStr = new StringBuffer("%-").append(number).append("-%") .toString(); @@ -137,12 +136,14 @@ public class DocumentTypeServiceImpl implements DocumentTypeService { * @return true if approval succeeded */ @Transactional - public boolean approve (DocumentType aType) { - if (aType.getState() != ProgressState.inCHECK) return false; - aType.setState(ProgressState.APPROVED); // The type name is supposed being localized - getDocumentTypeDAO().update(aType); - return true; - } + public boolean approve(final DocumentType aType) { + boolean res = (aType.getState() == ProgressState.inCHECK); + if (res) { + aType.setState(ProgressState.APPROVED); // The type name is supposed being localized + getDocumentTypeDAO().update(aType); + } + return res; + } /** * Get the documentTypeDAO. @@ -159,7 +160,7 @@ public class DocumentTypeServiceImpl implements DocumentTypeService { * @param documentTypeDAO * the documentTypeDAO to set */ - public void setDocumentTypeDAO(DocumentTypeDAO documentTypeDAO) { + public void setDocumentTypeDAO(final DocumentTypeDAO documentTypeDAO) { _documentTypeDAO = documentTypeDAO; } } diff --git a/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementService.java b/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementService.java index 5ad86c6..f5835bf 100644 --- a/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementService.java +++ b/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementService.java @@ -27,7 +27,7 @@ public interface KnowledgeElementService { * the knowledge element to approve * @return true if approving succeeded */ - public boolean approve(KnowledgeElement knowledgeElement); + boolean approve(KnowledgeElement knowledgeElement); /** * Demote the knowledge element. @@ -36,7 +36,7 @@ public interface KnowledgeElementService { * the knowledge element to demote * @return true if demoting succeeded */ - public boolean demote(KnowledgeElement knowledgeElement); + boolean demote(KnowledgeElement knowledgeElement); /** * Promote the knowledge element. @@ -45,7 +45,7 @@ public interface KnowledgeElementService { * the knowledge element to promote * @return true if promotion succeeded */ - public boolean promote(KnowledgeElement knowledgeElement); + boolean promote(KnowledgeElement knowledgeElement); /** * Rename the knowledge element. @@ -57,7 +57,7 @@ public interface KnowledgeElementService { * @throws InvalidPropertyException * if renaming is failed */ - public void rename(KnowledgeElementDTO knowledgeElement, String title) + void rename(KnowledgeElementDTO knowledgeElement, String title) throws InvalidPropertyException; /** @@ -67,7 +67,7 @@ public interface KnowledgeElementService { * the knowledge element id * @return the found knowledge element */ - public KnowledgeElement selectKnowledgeElement(long index); + KnowledgeElement selectKnowledgeElement(long index); /** * Get a knowledge element DTO by id. @@ -76,7 +76,7 @@ public interface KnowledgeElementService { * the knowledge element id * @return the found knowledge element as DTO */ - public KnowledgeElementDTO getKnowledgeElement(long index); + KnowledgeElementDTO getKnowledgeElement(long index); /** * Update the description of the knowledge element. @@ -86,5 +86,5 @@ public interface KnowledgeElementService { * @param description * the new description */ - public void update(KnowledgeElementDTO kelm, String description); + void update(KnowledgeElementDTO kelm, String description); } diff --git a/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementServiceImpl.java index 3c92945..2171ff9 100644 --- a/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementServiceImpl.java @@ -34,7 +34,7 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService { /** * The logger for the service. */ - public final static AppLogger LOGGER = AppLogger + public final static AppLogger LOG = AppLogger .getLogger(KnowledgeElementServiceImpl.class); /** @@ -96,7 +96,7 @@ public class KnowledgeElementServiceImpl implements KnowledgeElementService { getIndexService().update(knowledgeElement); return true; } catch (Exception error) { - LOGGER.error("Unable to re-index the knowledge '" + LOG.error("Unable to re-index the knowledge '" + knowledgeElement.getIndex() + "', reason:", error); return false; } diff --git a/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementTypeService.java b/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementTypeService.java index 3bc8ca7..d7391d6 100644 --- a/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementTypeService.java +++ b/Workspace/Siman-Common/src/org/splat/service/KnowledgeElementTypeService.java @@ -29,7 +29,7 @@ public interface KnowledgeElementTypeService { * the knowledge type name * @return the found knowledge type */ - public KnowledgeElementType selectType(String name); + KnowledgeElementType selectType(String name); /** * Create a knowledge element type with the given name. @@ -38,14 +38,14 @@ public interface KnowledgeElementTypeService { * the new type name * @return the created knowledge type */ - public KnowledgeElementType createType(String name); + KnowledgeElementType createType(String name); /** * Get all knowledge types from the database. * * @return the list of all knowledge types */ - public List selectAllTypes(); + List selectAllTypes(); /** * Get knowledge types which have the given progress state. @@ -54,7 +54,7 @@ public interface KnowledgeElementTypeService { * the progress state * @return the list of found knowledge types */ - public List selectTypesWhere(ProgressState state); + List selectTypesWhere(ProgressState state); /** * Get a knowledge type by its id. @@ -63,7 +63,7 @@ public interface KnowledgeElementTypeService { * the id of a knowledge type * @return the found knowledge type */ - public KnowledgeElementType selectType(long index); + KnowledgeElementType selectType(long index); /** * Approve the knowledge type. @@ -72,7 +72,7 @@ public interface KnowledgeElementTypeService { * the knowledge type to approve * @return true if approval succeeded */ - public boolean approve(KnowledgeElementType kelt); + boolean approve(KnowledgeElementType kelt); /** * Reserves this type for the management of simulation contexts. For being able to get the studies in which simulation contexts are @@ -82,5 +82,5 @@ public interface KnowledgeElementTypeService { * the knowledge type to approve * @return true if approval succeeded */ - public boolean reserve(KnowledgeElementType kelt); + boolean reserve(KnowledgeElementType kelt); } diff --git a/Workspace/Siman-Common/src/org/splat/service/LockServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/LockServiceImpl.java index 9df0f08..b2f7f0d 100644 --- a/Workspace/Siman-Common/src/org/splat/service/LockServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/LockServiceImpl.java @@ -7,7 +7,7 @@ * @version $Revision$ *****************************************************************************/ -package org.splat.service; +package org.splat.service; import org.splat.exception.LockAlreadyExistsException; import org.splat.exception.LockNotExistsException; @@ -16,67 +16,91 @@ import org.splat.exception.LockProtectedException; import org.splat.log.AppLogger; /** + * The service to lock objects in the database. + * * @author Maria KRUCHININA - * */ public class LockServiceImpl implements LockService { - + /** * logger. */ - private final static AppLogger LOG = AppLogger.getLogger(LockService.class); + private final static AppLogger LOG = AppLogger.getLogger(LockService.class); // RKV: NOPMD: TODO: Complete the service. /** * Lock timeout period in milliseconds. A 24 hours by default. */ - private long _timeoutPeriod = 86400000L; + private final long _timeoutPeriod = 86400000L; // RKV: NOPMD: TODO: Complete the service. /** * Lock a data row or update lock on a data row for one user. - * @param rowUid Row uid - * @param tableUid Table uid - * @param userUid User uid - * @throws LockAlreadyExistsException when a lock already exists for row uid and another user id + * + * @param rowUid + * Row uid + * @param tableUid + * Table uid + * @param userUid + * User uid + * @throws LockAlreadyExistsException + * when a lock already exists for row uid and another user id */ - public void lock(final String rowUid, final String tableUid, final String userUid) throws LockAlreadyExistsException { - //TODO: + public void lock(final String rowUid, final String tableUid, + final String userUid) throws LockAlreadyExistsException { + // TODO: } - + /** * Unlock a data row for one user. - * @param rowUid Row uid - * @param tableUid Table uid - * @param userUid User uid - * @throws LockNotExistsException when lock does not exist - * @throws LockProtectedException lock exists for another user + * + * @param rowUid + * Row uid + * @param tableUid + * Table uid + * @param userUid + * User uid + * @throws LockNotExistsException + * when lock does not exist + * @throws LockProtectedException + * lock exists for another user */ - public void unlock(final String rowUid, final String tableUid, final String userUid) throws LockNotExistsException, LockProtectedException { - //TODO: + public void unlock(final String rowUid, final String tableUid, + final String userUid) throws LockNotExistsException, + LockProtectedException { + // TODO: } - /** + /** * Unlock all datas rox for one user. - * @param userUid User uid + * + * @param userUid + * User uid */ @Override - public void unlockAll(String userUid) { + public void unlockAll(final String userUid) { // TODO Auto-generated method stub } - + /** * Check lock on a data row in a table for a user. - * @param rowUid Row uid - * @param tableUid Table uid - * @param userUid User uid - * @throws LockNotExistsException when lock does not exist - * @throws LockProtectedException lock exists for another user - * @throws LockOutdatedException when lock on object is in timeout but the - * owner of lock is another user + * + * @param rowUid + * Row uid + * @param tableUid + * Table uid + * @param userUid + * User uid + * @throws LockNotExistsException + * when lock does not exist + * @throws LockProtectedException + * lock exists for another user + * @throws LockOutdatedException + * when lock on object is in timeout but the owner of lock is another user */ - public void check(final String rowUid, final String tableUid, final String userUid) throws LockNotExistsException, LockProtectedException, LockOutdatedException { - //TODO: + public void check(final String rowUid, final String tableUid, + final String userUid) throws LockNotExistsException, + LockProtectedException, LockOutdatedException { + // TODO: } - } diff --git a/Workspace/Siman-Common/src/org/splat/service/ProjectElementService.java b/Workspace/Siman-Common/src/org/splat/service/ProjectElementService.java index b686dec..81792bb 100644 --- a/Workspace/Siman-Common/src/org/splat/service/ProjectElementService.java +++ b/Workspace/Siman-Common/src/org/splat/service/ProjectElementService.java @@ -11,7 +11,6 @@ package org.splat.service; import org.splat.dal.bo.som.ProjectElement; import org.splat.som.Step; -import org.springframework.transaction.annotation.Transactional; /** * Project element service interface. @@ -28,7 +27,7 @@ public interface ProjectElementService { * a study or a scenario * @return the first activity (step) of the project element */ - public Step getFirstStep(ProjectElement elem); + Step getFirstStep(ProjectElement elem); /** * Get activities of the project element. @@ -37,7 +36,7 @@ public interface ProjectElementService { * a study or a scenario * @return array of activities (steps). */ - public Step[] getSteps(ProjectElement elem); + Step[] getSteps(ProjectElement elem); /** * Refreshes the internal data potentially out-of-date. This function needs to be called when Publication objects are added to this @@ -47,5 +46,5 @@ public interface ProjectElementService { * @param elem * the project element to refresh */ - public void refresh(ProjectElement elem); + void refresh(ProjectElement elem); } diff --git a/Workspace/Siman-Common/src/org/splat/service/ProjectElementServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/ProjectElementServiceImpl.java index b8a3535..f5ec91e 100644 --- a/Workspace/Siman-Common/src/org/splat/service/ProjectElementServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/ProjectElementServiceImpl.java @@ -30,7 +30,7 @@ public class ProjectElementServiceImpl implements ProjectElementService { /** * Injected project settings service. */ - private ProjectSettingsService _projectSettingsService; + private ProjectSettingsService _projectSettings; /** * Injected project element DAO. */ @@ -41,11 +41,11 @@ public class ProjectElementServiceImpl implements ProjectElementService { * * @see org.splat.service.ProjectElementService#getFirstStep(org.splat.dal.bo.som.ProjectElement) */ - public Step getFirstStep(ProjectElement elem) { + public Step getFirstStep(final ProjectElement elem) { return getSteps(elem)[0]; } - public Step getLastStep(ProjectElement elem) { + public Step getLastStep(final ProjectElement elem) { Step[] mystep = getSteps(elem); // For getting the folders length, if null return mystep[mystep.length - 1]; } @@ -55,7 +55,7 @@ public class ProjectElementServiceImpl implements ProjectElementService { * * @see org.splat.service.ProjectElementService#getSteps(org.splat.dal.bo.som.ProjectElement) */ - public Step[] getSteps(ProjectElement elem) { + public Step[] getSteps(final ProjectElement elem) { if (elem.getFolders() == null) { List steps = getProjectSettings() .getStepsOf(elem.getClass()); @@ -76,15 +76,16 @@ public class ProjectElementServiceImpl implements ProjectElementService { * @param elem the project element to refresh */ @Transactional - public void refresh(ProjectElement elem) { + public void refresh(final ProjectElement elem) { // ------------------------- Publication[] curdoc = elem.getDocums().toArray( new Publication[elem.getDocums().size()]); elem.setFolders(null); // Just in case elem.getDocums().clear(); - for (int i = 0; i < curdoc.length; i++) + for (int i = 0; i < curdoc.length; i++) { elem.getDocums().add(curdoc[i]); + } // No need to rebuild the list of SimulationContext as it does not use hashcodes getProjectElementDAO().update(elem); } @@ -95,7 +96,7 @@ public class ProjectElementServiceImpl implements ProjectElementService { * @return Project settings service */ private ProjectSettingsService getProjectSettings() { - return _projectSettingsService; + return _projectSettings; } /** @@ -104,8 +105,8 @@ public class ProjectElementServiceImpl implements ProjectElementService { * @param projectSettingsService * project settings service */ - public void setProjectSettings(ProjectSettingsService projectSettingsService) { - _projectSettingsService = projectSettingsService; + public void setProjectSettings(final ProjectSettingsService projectSettingsService) { + _projectSettings = projectSettingsService; } /** @@ -120,7 +121,7 @@ public class ProjectElementServiceImpl implements ProjectElementService { * Set the projectElementDAO. * @param projectElementDAO the projectElementDAO to set */ - public void setProjectElementDAO(ProjectElementDAO projectElementDAO) { + public void setProjectElementDAO(final ProjectElementDAO projectElementDAO) { _projectElementDAO = projectElementDAO; } } diff --git a/Workspace/Siman-Common/src/org/splat/service/PublicationService.java b/Workspace/Siman-Common/src/org/splat/service/PublicationService.java index 85a1604..9abcf75 100644 --- a/Workspace/Siman-Common/src/org/splat/service/PublicationService.java +++ b/Workspace/Siman-Common/src/org/splat/service/PublicationService.java @@ -46,7 +46,7 @@ public interface PublicationService { * the target project element * @return the created copy of the publication */ - public Publication copy(Publication aPublication, ProjectElement publisher); + Publication copy(Publication aPublication, ProjectElement publisher); /** * Create a new version of the document. @@ -68,7 +68,7 @@ public interface PublicationService { * @throws NotApplicableException if publication's document is undefined * @throws InterruptedException by Thread.sleep if interrupted */ - public void versionDocument(Step step, User user, String filename, + void versionDocument(Step step, User user, String filename, long docIndex, String docver, String summary, ProgressState state, Date date, String[] docuses, long[] docusedby) throws MissedPropertyException, InvalidPropertyException, @@ -82,7 +82,7 @@ public interface PublicationService { * the document publication * @return study step */ - public Step getInvolvedStep(Publication aPublication); + Step getInvolvedStep(Publication aPublication); /** * Promotes the document referenced by this publication from In-Check to Approved state, if not out-dated, and attaches the @@ -100,7 +100,7 @@ public interface PublicationService { * @see DocumentType#isStudyResult() * @see Study#getApproverOf(Publication) */ - public Timestamp approve(Publication aPublication, Date adate); + Timestamp approve(Publication aPublication, Date adate); /** * Demotes the document referenced by this publication to In-Work state, and removes the Promoter of the document, if exist.
The @@ -115,7 +115,7 @@ public interface PublicationService { * @see DocumentRights#canDemote() * @see DocumentType#isStudyResult() */ - public boolean demote(Publication aPublication); + boolean demote(Publication aPublication); /** * Undo the review operation by demoting the document referenced by this publication from In-Check to In-Draft state and removing the @@ -130,7 +130,7 @@ public interface PublicationService { * @see DocumentRights#canInvalidate() * @see DocumentType#isStudyResult() */ - public boolean invalidate(Publication aPublication); + boolean invalidate(Publication aPublication); /** * Promotes the document referenced by this publication from In-Work to In-Draft or In-Check state, if not out-dated, and attaches the @@ -149,7 +149,7 @@ public interface PublicationService { * @see DocumentRights#canPromote() * @see DocumentType#isStudyResult() */ - public Timestamp promote(Publication aPublication, Date pdate); + Timestamp promote(Publication aPublication, Date pdate); /** * Promotes the document referenced by this publication from In-Draft to In-Check state, if not out-dated, and attaches the @@ -168,7 +168,7 @@ public interface PublicationService { * @see DocumentType#isStudyResult() * @see Study#getReviewerOf(Publication) */ - public Timestamp review(Publication aPublication, Date rdate); + Timestamp review(Publication aPublication, Date rdate); /** * Publishes the document referenced by this publication into the owner Project Element under the given state, the revision number of @@ -184,7 +184,7 @@ public interface PublicationService { * @throws NotApplicableException * If the referenced document is undefined */ - public void saveAs(Publication aPublication, ProgressState state) + void saveAs(Publication aPublication, ProgressState state) throws FileNotFoundException, NotApplicableException; /** @@ -204,7 +204,8 @@ public interface PublicationService { * If the referenced document is undefined * @deprecated */ - public void saveAs(Publication aPublication, Revision newvers) + @Deprecated + void saveAs(Publication aPublication, Revision newvers) throws FileNotFoundException, NotApplicableException; /** @@ -217,7 +218,7 @@ public interface PublicationService { * @throws InvalidPropertyException * if the new title is empty */ - public void rename(Publication aPublication, String title) + void rename(Publication aPublication, String title) throws InvalidPropertyException; /** @@ -229,7 +230,7 @@ public interface PublicationService { * the format * @return the created "Converts" relation */ - public ConvertsRelation attach(Publication aPublication, String format); + ConvertsRelation attach(Publication aPublication, String format); /** * Create "Converts" relation for the given document publication, format and description. @@ -242,7 +243,7 @@ public interface PublicationService { * the description of the relation * @return the created "Converts" relation */ - public ConvertsRelation attach(Publication aPublication, String format, + ConvertsRelation attach(Publication aPublication, String format, String description); /** @@ -254,7 +255,7 @@ public interface PublicationService { * @see #outdate() * @see DocumentRights#canAccept() */ - public boolean actualize(Publication aPublication); + boolean actualize(Publication aPublication); /** * Out-dates this publication and recursively all publications using this one. Typically, a publication is out-dated when modifying a @@ -266,5 +267,5 @@ public interface PublicationService { * @see #getProgressState() * @see #actualize() */ - public void outdate(Publication aPublication); + void outdate(Publication aPublication); } diff --git a/Workspace/Siman-Common/src/org/splat/service/PublicationServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/PublicationServiceImpl.java index 08fd40d..9e3a570 100644 --- a/Workspace/Siman-Common/src/org/splat/service/PublicationServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/PublicationServiceImpl.java @@ -59,7 +59,7 @@ public class PublicationServiceImpl implements PublicationService { /** * Logger for this class. */ - protected final static Logger logger = Logger + protected final static Logger LOG = Logger .getLogger(PublicationServiceImpl.class); /** @@ -104,7 +104,7 @@ public class PublicationServiceImpl implements PublicationService { * * @see org.splat.service.PublicationService#copy(org.splat.dal.bo.som.Publication, org.splat.dal.bo.som.ProjectElement) */ - public Publication copy(Publication aPublication, ProjectElement publisher) { + public Publication copy(final Publication aPublication, final ProjectElement publisher) { Publication copy = new Publication(); copy.setValue(aPublication.value()); copy.setStep(aPublication.getStep()); // May not be initialized yet @@ -121,9 +121,10 @@ public class PublicationServiceImpl implements PublicationService { * @see org.splat.service.PublicationService#versionDocument(org.splat.som.Step, org.splat.dal.bo.kernel.User, java.lang.String, long, java.lang.String, java.lang.String, org.splat.dal.bo.som.ProgressState, java.util.Date, java.lang.String[], long[]) */ @Transactional - public void versionDocument(Step step, User user, String filename, - long docIndex, String docver, String summary, ProgressState state, - Date date, String[] docuses, long[] docusedby) + public void versionDocument(final Step step, final User user, + final String filename, final long docIndex, final String docver, + final String summary, final ProgressState state, final Date date, + final String[] docuses, final long[] docusedby) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException, IOException, MismatchException, NotApplicableException, InterruptedException { @@ -135,49 +136,56 @@ public class PublicationServiceImpl implements PublicationService { Publication current = step.getDocument(docIndex); Publication next; - if (docver.length() == 0) { // Importation of a foreign document - next = getStepService().versionDocument(step, current, - dprop.setAuthor(user).setDescription(summary)); - updir = next.getSourceFile().asFile(); - if (logger.isInfoEnabled()) - logger.info("Moving \"" + upfile.getName() + "\" to \"" - + updir.getPath() + "\"."); - upfile.renameTo(updir); - try { + if ((docver.length() != 0) && // Importation of a not foreign document + (date != null)) { + dprop.setDate(date); + } + next = getStepService().versionDocument(step, current, + dprop.setAuthor(user).setDescription(summary)); + updir = next.getSourceFile().asFile(); + if (LOG.isInfoEnabled()) { + LOG.info("Moving \"" + upfile.getName() + "\" to \"" + + updir.getPath() + "\"."); + } + upfile.renameTo(updir); + + try { + if (docver.length() == 0) { // Importation of a foreign document saveAs(next, state); // May throw FileNotFound if rename was not done - } catch (FileNotFoundException saverror) { - Thread.sleep(1000); - logger.info("Waiting for the file."); - upfile.renameTo(updir); - saveAs(next, state); // Forget it if throw again FileNotFound - } - } else { - if (date != null) { - dprop.setDate(date); - } - next = getStepService().versionDocument(step, current, - dprop.setAuthor(user).setDescription(summary)); - updir = next.getSourceFile().asFile(); - if (logger.isInfoEnabled()) - logger.info("Moving \"" + upfile.getName() + "\" to \"" - + updir.getPath() + "\"."); - upfile.renameTo(updir); - try { + } else { saveAs(next, new Revision(docver)); - } catch (FileNotFoundException saverror) { - Thread.sleep(1000); - logger.info("Waiting for the file."); - upfile.renameTo(updir); - saveAs(next, state); } + } catch (FileNotFoundException saverror) { + Thread.sleep(1000); + LOG.info("Waiting for the file."); + upfile.renameTo(updir); + saveAs(next, state); } // TODO: Remove current document details from the contents of open study // Creation of uses relations + updateRelations(current, next, docuses, docusedby); + } + + /** + * Update relations after creation of a new document version. + * + * @param current + * the current version + * @param next + * the new version + * @param docuses + * ids of used documents + * @param docusedby + * ids of documents used by the versioned one. + */ + private void updateRelations(final Publication current, + final Publication next, final String[] docuses, + final long[] docusedby) { if (docuses != null) { for (int i = 0; i < docuses.length; i++) { Long index = Long.valueOf(docuses[i].trim()); - Publication used = getPublicationDAO().get(index);//RKV: getPublication(index, steps); + Publication used = getPublicationDAO().get(index);// RKV: getPublication(index, steps); next.addDependency(used); } } @@ -191,10 +199,10 @@ public class PublicationServiceImpl implements PublicationService { List relist = current.getRelations(UsedByRelation.class); for (Iterator i = relist.iterator(); i.hasNext();) { Publication using = i.next(); - if (!compatible.contains(using.getIndex())) + if (!compatible.contains(using.getIndex())) { outdate(using); + } } - } /* protected Publication getPublication(int index, List steps) { @@ -215,27 +223,27 @@ public class PublicationServiceImpl implements PublicationService { * @see org.splat.service.PublicationService#approve(org.splat.dal.bo.som.Publication, java.util.Date) */ @Transactional - public Timestamp approve(Publication aPublication, Date adate) { - if (aPublication.isOutdated()) - return null; - else if (aPublication.value().getProgressState() != ProgressState.inCHECK) - return null; // This statement must conform to the corresponding right - - DocumentType type = aPublication.value().getType(); - Study owner = aPublication.getOwnerStudy(); - ValidationCycle cycle = getStudyService().getValidationCycleOf(owner, - type); - User approver = cycle.getActor(ValidationStep.APPROVAL); - Timestamp stamp = new Timestamp(ValidationStep.APPROVAL, aPublication - .value(), approver, adate); - getTimestampDAO().create(stamp); - - if (!getDocumentService().promote(aPublication.value(), stamp)) - return null; - if (getDocumentService().isStudyResult(type) - && owner.getProgressState() == ProgressState.inCHECK) - getStudyService().promote(owner); - return stamp; // Hoping that promotion of the study succeeded + public Timestamp approve(final Publication aPublication, final Date adate) { + Timestamp res = null; + if (!(aPublication.isOutdated() || (aPublication.value().getProgressState() != ProgressState.inCHECK))) { + DocumentType type = aPublication.value().getType(); + Study owner = aPublication.getOwnerStudy(); + ValidationCycle cycle = getStudyService().getValidationCycleOf(owner, + type); + User approver = cycle.getActor(ValidationStep.APPROVAL); + Timestamp stamp = new Timestamp(ValidationStep.APPROVAL, aPublication + .value(), approver, adate); + getTimestampDAO().create(stamp); + + if (getDocumentService().promote(aPublication.value(), stamp)) { + res = stamp; + if (getDocumentService().isStudyResult(type) + && owner.getProgressState() == ProgressState.inCHECK) { + getStudyService().promote(owner); + } + } + } + return res; // Hoping that promotion of the study succeeded } /** @@ -244,7 +252,8 @@ public class PublicationServiceImpl implements PublicationService { * @see org.splat.service.PublicationService#demote(org.splat.dal.bo.som.Publication) */ @Transactional - public boolean demote(Publication aPublication) { + public boolean demote(final Publication aPublication) { + boolean res = false; DocumentType type = aPublication.value().getType(); Study owner = aPublication.getOwnerStudy(); @@ -252,23 +261,21 @@ public class PublicationServiceImpl implements PublicationService { ValidationCycle cycle = getStudyService().getValidationCycleOf( owner, type); if (cycle.enables(ValidationStep.REVIEW)) { - if (!getDocumentService().demote(aPublication.value())) - return false; + res = getDocumentService().demote(aPublication.value()); } else { - if (!getDocumentService().demote(aPublication.value())) - return false; - getDocumentService().demote(aPublication.value()); + res = getDocumentService().demote(aPublication.value()); + if (res) { + getDocumentService().demote(aPublication.value()); + } } } else if (aPublication.value().getProgressState() == ProgressState.inDRAFT) { - if (!getDocumentService().demote(aPublication.value())) - return false; - } else { - return false; + res = getDocumentService().demote(aPublication.value()); } - if (getDocumentService().isStudyResult(type) - && owner.getProgressState() != ProgressState.inWORK) + if (res && getDocumentService().isStudyResult(type) + && owner.getProgressState() != ProgressState.inWORK) { getStudyService().demote(owner); - return true; + } + return res; } /** @@ -277,17 +284,19 @@ public class PublicationServiceImpl implements PublicationService { * @see org.splat.service.PublicationService#invalidate(org.splat.dal.bo.som.Publication) */ @Transactional - public boolean invalidate(Publication aPublication) { - if (aPublication.value().getProgressState() != ProgressState.inCHECK) - return false; - if (!getDocumentService().demote(aPublication.value())) // Removes the reviewer if this document is In-Check - return false; - DocumentType type = aPublication.value().getType(); - Study owner = aPublication.getOwnerStudy(); - if (getDocumentService().isStudyResult(type) - && owner.getProgressState() == ProgressState.inCHECK) - getStudyService().demote(owner); - return true; + public boolean invalidate(final Publication aPublication) { + boolean res = false; + if ((aPublication.value().getProgressState() == ProgressState.inCHECK) + && getDocumentService().demote(aPublication.value())) { + DocumentType type = aPublication.value().getType(); + Study owner = aPublication.getOwnerStudy(); + if (getDocumentService().isStudyResult(type) + && owner.getProgressState() == ProgressState.inCHECK) { + getStudyService().demote(owner); + } + res = true; + } + return res; } /** @@ -296,35 +305,37 @@ public class PublicationServiceImpl implements PublicationService { * @see org.splat.service.PublicationService#promote(org.splat.dal.bo.som.Publication, java.util.Date) */ @Transactional - public Timestamp promote(Publication aPublication, Date pdate) { - if (aPublication.isOutdated()) - return null; - else if (aPublication.value().getProgressState() != ProgressState.inWORK) - return null; // This statement must conform to the corresponding right - else { + public Timestamp promote(final Publication aPublication, final Date pdate) { + Timestamp res = null; + if ((!aPublication.isOutdated()) + && (aPublication.value().getProgressState() == ProgressState.inWORK)) { DocumentType type = aPublication.value().getType(); Study owner = aPublication.getOwnerStudy(); ValidationCycle cycle = getStudyService().getValidationCycleOf( owner, type); User promoter = cycle.getActor(ValidationStep.PROMOTION); - if (promoter == null) + if (promoter == null) { promoter = getInvolvedStep(aPublication).getActor(); - if (promoter == null) + } + if (promoter == null) { promoter = owner.getAuthor(); + } Timestamp stamp = new Timestamp(ValidationStep.PROMOTION, aPublication.value(), promoter, pdate); getTimestampDAO().create(stamp); - if (!getDocumentService().promote(aPublication.value(), stamp)) // Promotion to being reviewed - return null; - if (!cycle.enables(ValidationStep.REVIEW)) { - getDocumentService().promote(aPublication.value(), null); + if (getDocumentService().promote(aPublication.value(), stamp)) { + res = stamp; + if (!cycle.enables(ValidationStep.REVIEW)) { + getDocumentService().promote(aPublication.value(), null); + } + if (getDocumentService().isStudyResult(type) + && owner.getProgressState() == ProgressState.inWORK) { + getStudyService().promote(owner); + } } - if (getDocumentService().isStudyResult(type) - && owner.getProgressState() == ProgressState.inWORK) - getStudyService().promote(owner); - return stamp; // Hoping that promotion of the study succeeded } + return res; // Hoping that promotion of the study succeeded } /** @@ -333,27 +344,29 @@ public class PublicationServiceImpl implements PublicationService { * @see org.splat.service.PublicationService#review(org.splat.dal.bo.som.Publication, java.util.Date) */ @Transactional - public Timestamp review(Publication aPublication, Date rdate) { - if (aPublication.isOutdated()) - return null; - else if (aPublication.value().getProgressState() != ProgressState.inDRAFT) - return null; // This statement must conform to the corresponding right + public Timestamp review(final Publication aPublication, final Date rdate) { + Timestamp res = null; + if (!aPublication.isOutdated() + && !(aPublication.value().getProgressState() != ProgressState.inDRAFT)) { - DocumentType type = aPublication.value().getType(); - Study owner = aPublication.getOwnerStudy(); - ValidationCycle cycle = getStudyService().getValidationCycleOf(owner, - type); - User reviewer = cycle.getActor(ValidationStep.REVIEW); - Timestamp stamp = new Timestamp(ValidationStep.REVIEW, aPublication - .value(), reviewer, rdate); - getTimestampDAO().create(stamp); - - if (!getDocumentService().promote(aPublication.value(), stamp)) - return null; - if (getDocumentService().isStudyResult(type) - && owner.getProgressState() == ProgressState.inDRAFT) - getStudyService().promote(owner); - return stamp; // Hoping that promotion of the study succeeded + DocumentType type = aPublication.value().getType(); + Study owner = aPublication.getOwnerStudy(); + ValidationCycle cycle = getStudyService().getValidationCycleOf( + owner, type); + User reviewer = cycle.getActor(ValidationStep.REVIEW); + Timestamp stamp = new Timestamp(ValidationStep.REVIEW, aPublication + .value(), reviewer, rdate); + getTimestampDAO().create(stamp); + + if (getDocumentService().promote(aPublication.value(), stamp)) { + res = stamp; + if (getDocumentService().isStudyResult(type) + && owner.getProgressState() == ProgressState.inDRAFT) { + getStudyService().promote(owner); + } + } + } + return res; // Hoping that promotion of the study succeeded } /** @@ -362,14 +375,17 @@ public class PublicationServiceImpl implements PublicationService { * @see org.splat.service.PublicationService#saveAs(org.splat.dal.bo.som.Publication, org.splat.som.Revision) * @deprecated */ + @Deprecated @Transactional - public void saveAs(Publication aPublication, Revision newvers) + public void saveAs(final Publication aPublication, final Revision newvers) throws FileNotFoundException, NotApplicableException { - if (aPublication.value().isUndefined()) + if (aPublication.value().isUndefined()) { throw new NotApplicableException( "Cannot save a Publication object refering an undefined Document"); - if (!aPublication.value().getSourceFile().exists()) + } + if (!aPublication.value().getSourceFile().exists()) { throw new FileNotFoundException(); + } getPublicationDAO().create(aPublication); // Must be done before updating the study in order to fix this final (rid-based) hascode getDocumentService().updateAs(aPublication.value(), newvers); // May change the branch name of given revision @@ -382,13 +398,15 @@ public class PublicationServiceImpl implements PublicationService { * @see org.splat.service.PublicationService#saveAs(org.splat.dal.bo.som.Publication, org.splat.dal.bo.som.ProgressState) */ @Transactional - public void saveAs(Publication aPublication, ProgressState state) + public void saveAs(final Publication aPublication, final ProgressState state) throws FileNotFoundException, NotApplicableException { - if (aPublication.value().isUndefined()) + if (aPublication.value().isUndefined()) { throw new NotApplicableException( "Cannot save a Publication object refering an undefined Document"); - if (!aPublication.value().getSourceFile().exists()) + } + if (!aPublication.value().getSourceFile().exists()) { throw new FileNotFoundException(); + } if (state == ProgressState.inWORK || state == ProgressState.EXTERN) { getPublicationDAO().create(aPublication); // Must be done before updating the study in order to fix this final (rid-based) @@ -424,7 +442,7 @@ public class PublicationServiceImpl implements PublicationService { * the document publication */ @Transactional - private void updateOwner(Publication aPublication) { + private void updateOwner(final Publication aPublication) { Step step = getInvolvedStep(aPublication); // Update of involved step @@ -455,51 +473,58 @@ public class PublicationServiceImpl implements PublicationService { * @param to * the study step */ - private void forwardProperties(Publication aPublication, java.io.File from, - Step to) { + private void forwardProperties(final Publication aPublication, + final java.io.File from, final Step to) { Reader tool = Toolbox.getReader(from); - if (tool == null) - return; // No properties extractor available for this type of document - - SimulationContextType.Properties sprop = new SimulationContextType.Properties() - .setStep(to.getStep()).setProgressState(ProgressState.APPROVED); - List contype = getSimulationContextService() - .selectTypesWhere(sprop); - if (contype.isEmpty()) - return; // No approved property type configured at this step - - SimulationContext.Properties cprop = new SimulationContext.Properties(); - List context = to.getAllSimulationContexts(); - - context = new ArrayList(context.size()); - context.addAll(to.getAllSimulationContexts()); - cprop.disableCheck(); - for (Iterator i = contype.iterator(); i - .hasNext();) { - SimulationContextType property = i.next(); - for (Iterator j = context.iterator(); j - .hasNext();) { - SimulationContext existing = j.next(); - if (!existing.getType().equals(property)) - continue; - property = null; // Forget this property as it is already set - break; - } - if (property != null) - try { - String value = tool.extractProperty(property.getName()); - if (value == null) - continue; // Property not defined into the document - - cprop.setType(property).setValue(value); - if (aPublication.getOwner() instanceof Study) - getStudyService().addProjectContext( - (Study) aPublication.getOwner(), cprop); // Re-indexes knowledges and the study - else - getStepService().addSimulationContext(to, cprop); // Re-indexes knowledges only - } catch (Exception e) { - break; + if (tool != null) { // Properties extractor available for this type of document + SimulationContextType.Properties sprop = new SimulationContextType.Properties() + .setStep(to.getStep()).setProgressState( + ProgressState.APPROVED); + List contype = getSimulationContextService() + .selectTypesWhere(sprop); + if (!contype.isEmpty()) { // There is an approved property type configured at this step + + SimulationContext.Properties cprop = new SimulationContext.Properties(); + List context = to.getAllSimulationContexts(); + + context = new ArrayList(context.size()); + context.addAll(to.getAllSimulationContexts()); + cprop.disableCheck(); + for (Iterator i = contype.iterator(); i + .hasNext();) { + SimulationContextType property = i.next(); + boolean isFound = false; + for (Iterator j = context.iterator(); j + .hasNext();) { + SimulationContext existing = j.next(); + isFound = existing.getType().equals(property); + if (isFound) { + // Forget this property as it is already set + break; + } + } + if (!isFound) { + try { + String value = tool.extractProperty(property + .getName()); + if (value == null) { + continue; // Property not defined into the document + } + + cprop.setType(property).setValue(value); + if (aPublication.getOwner() instanceof Study) { + getStudyService().addProjectContext( + (Study) aPublication.getOwner(), cprop); // Re-indexes knowledges and the study + } else { + getStepService() + .addSimulationContext(to, cprop); // Re-indexes knowledges only + } + } catch (Exception e) { + break; + } + } } + } } } @@ -510,14 +535,15 @@ public class PublicationServiceImpl implements PublicationService { * the document publication * @return the study step where the document is published */ - public Step getInvolvedStep(Publication aPublication) { + public Step getInvolvedStep(final Publication aPublication) { if (aPublication.getStep() == null) { Step[] step = getProjectElementService().getSteps( aPublication.getOwner()); for (int i = 0; i < step.length; i++) { aPublication.setStep(step[i]); // The involved step necessarily exists - if (aPublication.value().isInto(aPublication.getStep())) + if (aPublication.value().isInto(aPublication.getStep())) { break; + } } } return aPublication.getStep(); @@ -533,12 +559,13 @@ public class PublicationServiceImpl implements PublicationService { * @see DocumentRights#canAccept() */ @Transactional - public boolean actualize(Publication aPublication) { - if (!aPublication.isOutdated()) - return false; - aPublication.setIsnew('Y'); - getPublicationDAO().update(aPublication); - return true; + public boolean actualize(final Publication aPublication) { + boolean res = aPublication.isOutdated(); + if (res) { + aPublication.setIsnew('Y'); + getPublicationDAO().update(aPublication); + } + return res; } /** @@ -551,9 +578,10 @@ public class PublicationServiceImpl implements PublicationService { * @see #getProgressState() * @see #actualize() */ - public void outdate(Publication aPublication) { - if (aPublication.isOutdated()) + public void outdate(final Publication aPublication) { + if (aPublication.isOutdated()) { return; + } List relist = aPublication .getRelations(UsedByRelation.class); @@ -573,7 +601,7 @@ public class PublicationServiceImpl implements PublicationService { * the format * @return the created "Converts" relation */ - public ConvertsRelation attach(Publication aPublication, String format) { + public ConvertsRelation attach(final Publication aPublication, final String format) { return getDocumentService().attach(aPublication.value(), format); } @@ -588,8 +616,8 @@ public class PublicationServiceImpl implements PublicationService { * the description of the relation * @return the created "Converts" relation */ - public ConvertsRelation attach(Publication aPublication, String format, - String description) { + public ConvertsRelation attach(final Publication aPublication, final String format, + final String description) { return getDocumentService().attach(aPublication.value(), format, description); } @@ -604,7 +632,7 @@ public class PublicationServiceImpl implements PublicationService { * @throws InvalidPropertyException * if the new title is empty */ - public void rename(Publication aPublication, String title) + public void rename(final Publication aPublication, final String title) throws InvalidPropertyException { getDocumentService().rename(aPublication.value(), title); } @@ -625,7 +653,7 @@ public class PublicationServiceImpl implements PublicationService { * the projectElementService to set */ public void setProjectElementService( - ProjectElementService projectElementService) { + final ProjectElementService projectElementService) { _projectElementService = projectElementService; } @@ -645,7 +673,7 @@ public class PublicationServiceImpl implements PublicationService { * the simulationContextService to set */ public void setSimulationContextService( - SimulationContextService simulationContextService) { + final SimulationContextService simulationContextService) { _simulationContextService = simulationContextService; } @@ -664,7 +692,7 @@ public class PublicationServiceImpl implements PublicationService { * @param studyService * the studyService to set */ - public void setStudyService(StudyService studyService) { + public void setStudyService(final StudyService studyService) { _studyService = studyService; } @@ -683,7 +711,7 @@ public class PublicationServiceImpl implements PublicationService { * @param stepService * the stepService to set */ - public void setStepService(StepService stepService) { + public void setStepService(final StepService stepService) { _stepService = stepService; } @@ -702,7 +730,7 @@ public class PublicationServiceImpl implements PublicationService { * @param documentService * the documentService to set */ - public void setDocumentService(DocumentService documentService) { + public void setDocumentService(final DocumentService documentService) { _documentService = documentService; } @@ -721,7 +749,7 @@ public class PublicationServiceImpl implements PublicationService { * @param publicationDAO * the publicationDAO to set */ - public void setPublicationDAO(PublicationDAO publicationDAO) { + public void setPublicationDAO(final PublicationDAO publicationDAO) { _publicationDAO = publicationDAO; } @@ -740,7 +768,7 @@ public class PublicationServiceImpl implements PublicationService { * @param projectElementDAO * the projectElementDAO to set */ - public void setProjectElementDAO(ProjectElementDAO projectElementDAO) { + public void setProjectElementDAO(final ProjectElementDAO projectElementDAO) { _projectElementDAO = projectElementDAO; } @@ -759,7 +787,7 @@ public class PublicationServiceImpl implements PublicationService { * @param repositoryService * the repositoryService to set */ - public void setRepositoryService(RepositoryService repositoryService) { + public void setRepositoryService(final RepositoryService repositoryService) { _repositoryService = repositoryService; } @@ -775,7 +803,7 @@ public class PublicationServiceImpl implements PublicationService { * Set the timestampDAO. * @param timestampDAO the timestampDAO to set */ - public void setTimestampDAO(TimestampDAO timestampDAO) { + public void setTimestampDAO(final TimestampDAO timestampDAO) { _timestampDAO = timestampDAO; } } diff --git a/Workspace/Siman-Common/src/org/splat/service/ScenarioService.java b/Workspace/Siman-Common/src/org/splat/service/ScenarioService.java index 025a6cb..84bf9c7 100644 --- a/Workspace/Siman-Common/src/org/splat/service/ScenarioService.java +++ b/Workspace/Siman-Common/src/org/splat/service/ScenarioService.java @@ -43,7 +43,7 @@ public interface ScenarioService { * @throws MultiplyDefinedException * if some property occurs several times */ - public Study createStudy(Study.Properties sprop, Scenario.Properties oprop, + Study createStudy(Study.Properties sprop, Scenario.Properties oprop, SimulationContext.Properties cprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException; @@ -62,7 +62,7 @@ public interface ScenarioService { * @throws MultiplyDefinedException * if some property occurs several times */ - public Scenario addScenario(Study aStudy, Scenario.Properties sprop) + Scenario addScenario(Study aStudy, Scenario.Properties sprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException; @@ -81,7 +81,7 @@ public interface ScenarioService { * @throws MultiplyDefinedException * if some property is defined several times */ - public KnowledgeElement addKnowledgeElement(Scenario aScenario, + KnowledgeElement addKnowledgeElement(Scenario aScenario, KnowledgeElement.Properties kprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException; @@ -91,7 +91,7 @@ public interface ScenarioService { * @param aScenario * the scenario to check in */ - public void checkin(Scenario aScenario); + void checkin(Scenario aScenario); /** * Check out the scenario. @@ -102,7 +102,7 @@ public interface ScenarioService { * the current user * @return true if check out operation succeeded */ - public boolean checkout(Scenario aScenario, User user); + boolean checkout(Scenario aScenario, User user); /** * Copy contents from other scenario up to its given step into the given scenario. @@ -112,7 +112,7 @@ public interface ScenarioService { * @param lastep * the last processed step of the source scenario */ - public void copyContentsUpTo(Scenario scenario, Step lastep); + void copyContentsUpTo(Scenario scenario, Step lastep); /** * Check if the scenario is empty, i.d. no one of its steps doesn't contain any knowledge elements or documents. @@ -121,7 +121,7 @@ public interface ScenarioService { * the scenario to check * @return true if the scenario is empty */ - public boolean isEmpty(Scenario scenario); + boolean isEmpty(Scenario scenario); /** * Remove a knowledge element from a scenario. @@ -132,6 +132,6 @@ public interface ScenarioService { * the knowledge element to remove * @return true if removal succeeded */ - public boolean removeKnowledgeElement(Scenario scenario, + boolean removeKnowledgeElement(Scenario scenario, KnowledgeElement kelm); } diff --git a/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java index 6adbaba..79c424d 100644 --- a/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java @@ -44,7 +44,7 @@ public class ScenarioServiceImpl implements ScenarioService { /** * Logger for this class. */ - protected final static Logger logger = Logger + protected final static Logger LOG = Logger .getLogger(ScenarioServiceImpl.class); /** @@ -212,8 +212,8 @@ public class ScenarioServiceImpl implements ScenarioService { KnowledgeElement kelm = null; try { long aScenarioId = aScenarioDTO.getIndex(); - if (logger.isDebugEnabled()) { - logger.debug("Add a knowledge element to the scenario #" + if (LOG.isDebugEnabled()) { + LOG.debug("Add a knowledge element to the scenario #" + aScenarioId); } // Get the persistent scenario. @@ -239,12 +239,12 @@ public class ScenarioServiceImpl implements ScenarioService { // Update the lucene index of knowledge elements. getIndexService().add(kelm); - if (logger.isDebugEnabled()) { - logger.debug("A knowledge element #" + kelm.getIndex() + if (LOG.isDebugEnabled()) { + LOG.debug("A knowledge element #" + kelm.getIndex() + " is added to the scenario #" + aScenario.getIndex()); } } catch (IOException error) { - logger.error("Unable to index the knowedge element '" + LOG.error("Unable to index the knowedge element '" + kelm.getIndex() + "', reason:", error); kelm = null; } @@ -266,7 +266,7 @@ public class ScenarioServiceImpl implements ScenarioService { getScenarioDAO().update(aScenario); // Update of relational base isOk = true; } catch (Exception error) { - logger.error("Unable to re-index the knowledge element '" + LOG.error("Unable to re-index the knowledge element '" + aScenario.getIndex() + "', reason:", error); } return isOk; diff --git a/Workspace/Siman-Common/src/org/splat/service/SearchService.java b/Workspace/Siman-Common/src/org/splat/service/SearchService.java index cda12a1..18a024d 100644 --- a/Workspace/Siman-Common/src/org/splat/service/SearchService.java +++ b/Workspace/Siman-Common/src/org/splat/service/SearchService.java @@ -10,6 +10,7 @@ package org.splat.service; import java.util.List; + import org.splat.dal.bo.som.KnowledgeElement; import org.splat.dal.bo.som.Study; import org.splat.service.dto.ImportedStudyDTO; @@ -27,7 +28,7 @@ public interface SearchService { * * @return list of ImportedStudy DTO */ - public List selectStudies(); + List selectStudies(); /** * Refresh lucene index for studies. @@ -35,7 +36,7 @@ public interface SearchService { * @param ridlist * list of studies id's */ - public void reindexStudies(String[] ridlist); + void reindexStudies(String[] ridlist); /** * Find knowledge elements with given properties. @@ -44,7 +45,7 @@ public interface SearchService { * search filter parameters * @return the list of found knowledge elements as proxiy results of lucene search */ - public List selectKnowledgeElementsWhere( + List selectKnowledgeElementsWhere( KnowledgeElement.Properties... kprop); /** @@ -54,7 +55,7 @@ public interface SearchService { * search filter parameters * @return the list of found studies as proxiy results of lucene search */ - public List selectStudiesWhere(Study.Properties... sprop); + List selectStudiesWhere(Study.Properties... sprop); /** * Refresh lucene index for a study. @@ -62,5 +63,5 @@ public interface SearchService { * @param study * the study to reindex */ - public void indexStudy(Study study); + void indexStudy(Study study); } diff --git a/Workspace/Siman-Common/src/org/splat/service/SearchServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/SearchServiceImpl.java index d58620a..8fcb669 100644 --- a/Workspace/Siman-Common/src/org/splat/service/SearchServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/SearchServiceImpl.java @@ -39,11 +39,11 @@ import org.splat.dal.bo.som.SimulationContext; import org.splat.dal.bo.som.Study; import org.splat.dal.bo.som.Visibility; import org.splat.dal.dao.som.StudyDAO; +import org.splat.service.dto.ImportedStudyDTO; import org.splat.service.dto.Proxy; import org.splat.service.technical.IndexService; import org.splat.service.technical.IndexServiceImpl; import org.splat.service.technical.RepositoryService; -import org.splat.service.dto.ImportedStudyDTO; import org.splat.util.BeanHelper; import org.springframework.transaction.annotation.Transactional; @@ -57,7 +57,7 @@ public class SearchServiceImpl implements SearchService { /** * The service logger. */ - public final static Logger logger = Logger + public final static Logger LOG = Logger .getLogger(org.splat.service.SearchServiceImpl.class); /** @@ -113,7 +113,7 @@ public class SearchServiceImpl implements SearchService { * list of studies id's */ @Transactional(readOnly = true) - public void reindexStudies(String[] ridlist) { + public void reindexStudies(final String[] ridlist) { for (int i = 0; i < ridlist.length; i++) { long index = Long.valueOf(ridlist[i].trim()); Study study = getStudyService().selectStudy(index); @@ -127,7 +127,7 @@ public class SearchServiceImpl implements SearchService { * @see org.splat.service.SearchService#selectKnowledgeElementsWhere(org.splat.dal.bo.som.KnowledgeElement.Properties[]) */ public List selectKnowledgeElementsWhere( - KnowledgeElement.Properties... kprop) { + final KnowledgeElement.Properties... kprop) { List result = new ArrayList(); int hitsize = 20; try { @@ -187,8 +187,9 @@ public class SearchServiceImpl implements SearchService { BooleanQuery critext = new BooleanQuery(); String operator = "AND"; // Future user input BooleanClause.Occur clause = BooleanClause.Occur.MUST; - if (operator.equals("OR")) + if (operator.equals("OR")) { clause = BooleanClause.Occur.SHOULD; + } String[] word = title.split(" "); for (int j = 0; j < word.length; j++) { critext.add(new TermQuery(input.createTerm(word[j])), @@ -212,8 +213,8 @@ public class SearchServiceImpl implements SearchService { } fulquery.add(query, BooleanClause.Occur.SHOULD); } - if (logger.isInfoEnabled()) { - logger.info("Searching knowledges by Lucene query \"" + if (LOG.isInfoEnabled()) { + LOG.info("Searching knowledges by Lucene query \"" + fulquery.toString() + "\"."); } // Creation of the knowledge filter @@ -230,8 +231,9 @@ public class SearchServiceImpl implements SearchService { TopFieldDocs found = searcher.search(fulquery, filter, hitsize, sort); - if (found.totalHits < 1) + if (found.totalHits < 1) { return result; // No study found + } // Construction of the result list ScoreDoc[] hits = found.scoreDocs; @@ -241,7 +243,7 @@ public class SearchServiceImpl implements SearchService { } searcher.close(); } catch (Exception error) { - logger.error("Error during Lucene search, reason:", error); + LOG.error("Error during Lucene search, reason:", error); } return result; } @@ -251,7 +253,7 @@ public class SearchServiceImpl implements SearchService { * * @see org.splat.service.SearchService#selectStudiesWhere(org.splat.dal.bo.som.Study.Properties[]) */ - public List selectStudiesWhere(Study.Properties... sprop) { + public List selectStudiesWhere(final Study.Properties... sprop) { List result = new ArrayList(); int hitsize = 20; try { @@ -317,8 +319,9 @@ public class SearchServiceImpl implements SearchService { BooleanQuery critext = new BooleanQuery(); String operator = "AND"; // Future user input BooleanClause.Occur clause = BooleanClause.Occur.MUST; - if (operator.equals("OR")) + if (operator.equals("OR")) { clause = BooleanClause.Occur.SHOULD; + } String[] word = title.split(" "); for (int j = 0; j < word.length; j++) { critext.add(new TermQuery(input.createTerm(word[j])), @@ -342,8 +345,8 @@ public class SearchServiceImpl implements SearchService { } fulquery.add(query, BooleanClause.Occur.SHOULD); } - if (logger.isInfoEnabled()) { - logger.info("Searching studies by Lucene query \"" + if (LOG.isInfoEnabled()) { + LOG.info("Searching studies by Lucene query \"" + fulquery.toString() + "\"."); } // Creation of the studies filter @@ -360,8 +363,9 @@ public class SearchServiceImpl implements SearchService { TopFieldDocs found = searcher.search(fulquery, filter, hitsize, sort); - if (found.totalHits < 1) + if (found.totalHits < 1) { return result; // No study found + } // Construction of the result list ScoreDoc[] hits = found.scoreDocs; @@ -371,7 +375,7 @@ public class SearchServiceImpl implements SearchService { } searcher.close(); } catch (Exception error) { - logger.error("Error during Lucene search, reason:", error); + LOG.error("Error during Lucene search, reason:", error); } return result; } @@ -381,8 +385,8 @@ public class SearchServiceImpl implements SearchService { * * @see org.splat.service.SearchService#indexStudy(org.splat.dal.bo.som.Study) */ - public void indexStudy(Study study) { - logger.debug("Index study: id=" + study.getRid() + "; reference=" + public void indexStudy(final Study study) { + LOG.debug("Index study: id=" + study.getRid() + "; reference=" + study.getReference()); try { Study.Properties sprop = new Study.Properties(); @@ -390,29 +394,30 @@ public class SearchServiceImpl implements SearchService { .getReference())); if (index.size() != 0) { - logger.debug("The given study is already indexed."); + LOG.debug("The given study is already indexed."); return; // The given study is already indexed } IndexService lucin = getIndex(); Scenario[] scenes = study.getScenarii(); - logger.debug("Number of study " + study.getReference() + LOG.debug("Number of study " + study.getReference() + " actors: " + study.getActor().size()); lucin.add(study); - if (study.getProgressState() != ProgressState.inWORK) + if (study.getProgressState() != ProgressState.inWORK) { for (int i = 0; i < scenes.length; i++) { List list = scenes[i] .getAllKnowledgeElements(); for (Iterator j = list.iterator(); j .hasNext();) { lucin.add(j.next()); - logger.debug("Knowlegge added: id=" + LOG.debug("Knowlegge added: id=" + j.next().getIndex()); } } + } } catch (Exception error) { - logger.error("Unable to index the study '" + study.getIndex() + LOG.error("Unable to index the study '" + study.getIndex() + "', reason:", error); } } @@ -426,8 +431,9 @@ public class SearchServiceImpl implements SearchService { */ private IndexService getIndex() throws IOException { IndexService lucin = getIndexService(); - if (!lucin.exists()) + if (!lucin.exists()) { lucin.create(); // Happens when re-indexing all studies + } return lucin; } @@ -446,7 +452,7 @@ public class SearchServiceImpl implements SearchService { * @param repositoryService * the repositoryService to set */ - public void setRepositoryService(RepositoryService repositoryService) { + public void setRepositoryService(final RepositoryService repositoryService) { _repositoryService = repositoryService; } @@ -465,7 +471,7 @@ public class SearchServiceImpl implements SearchService { * @param indexService * the indexService to set */ - public void setIndexService(IndexService indexService) { + public void setIndexService(final IndexService indexService) { _indexService = indexService; } @@ -484,7 +490,7 @@ public class SearchServiceImpl implements SearchService { * @param studyService * the studyService to set */ - public void setStudyService(StudyService studyService) { + public void setStudyService(final StudyService studyService) { _studyService = studyService; } @@ -503,7 +509,7 @@ public class SearchServiceImpl implements SearchService { * @param studyDAO * the studyDAO to set */ - public void setStudyDAO(StudyDAO studyDAO) { + public void setStudyDAO(final StudyDAO studyDAO) { _studyDAO = studyDAO; } } diff --git a/Workspace/Siman-Common/src/org/splat/service/ServiceLocator.java b/Workspace/Siman-Common/src/org/splat/service/ServiceLocator.java index e1b9133..b4f0ae1 100644 --- a/Workspace/Siman-Common/src/org/splat/service/ServiceLocator.java +++ b/Workspace/Siman-Common/src/org/splat/service/ServiceLocator.java @@ -30,14 +30,14 @@ public interface ServiceLocator { * @param studyService * the studyService to set */ - public void setStudyService(StudyService studyService); + void setStudyService(StudyService studyService); /** * Get the userService. * * @return the userService */ - public UserService getUserService(); + UserService getUserService(); /** * Set the userService. @@ -45,5 +45,5 @@ public interface ServiceLocator { * @param userService * the userService to set */ - public void setUserService(UserService userService); + void setUserService(UserService userService); } diff --git a/Workspace/Siman-Common/src/org/splat/service/ServiceLocatorImpl.java b/Workspace/Siman-Common/src/org/splat/service/ServiceLocatorImpl.java index 5810b0a..966d882 100644 --- a/Workspace/Siman-Common/src/org/splat/service/ServiceLocatorImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/ServiceLocatorImpl.java @@ -16,21 +16,18 @@ package org.splat.service; * @author Roman Kozlov (RKV) */ @Deprecated -public class ServiceLocatorImpl implements ServiceLocator { +public final class ServiceLocatorImpl implements ServiceLocator { /** * The Locator instance. */ - static ServiceLocator theInstance; + static private ServiceLocator theInstance = new ServiceLocatorImpl(); /** * Get the locator instance. * @return the locator instance */ public static ServiceLocator getInstance() { - if (theInstance == null) { - theInstance = new ServiceLocatorImpl(); - } return theInstance; } @@ -61,7 +58,7 @@ public class ServiceLocatorImpl implements ServiceLocator { * Set the studyService. * @param studyService the studyService to set */ - public void setStudyService(StudyService studyService) { + public void setStudyService(final StudyService studyService) { _studyService = studyService; } @@ -77,7 +74,7 @@ public class ServiceLocatorImpl implements ServiceLocator { * Set the userService. * @param userService the userService to set */ - public void setUserService(UserService userService) { + public void setUserService(final UserService userService) { _userService = userService; } } diff --git a/Workspace/Siman-Common/src/org/splat/service/SimulationContextService.java b/Workspace/Siman-Common/src/org/splat/service/SimulationContextService.java index e82b810..866f29f 100644 --- a/Workspace/Siman-Common/src/org/splat/service/SimulationContextService.java +++ b/Workspace/Siman-Common/src/org/splat/service/SimulationContextService.java @@ -36,7 +36,7 @@ public interface SimulationContextService { * @throws InvalidPropertyException * if the given state is invalid */ - public Vector getSimulationContextsInState( + Vector getSimulationContextsInState( ProgressState aState) throws InvalidPropertyException; /** @@ -46,7 +46,7 @@ public interface SimulationContextService { * simulation context id. * @return found context */ - public SimulationContext selectSimulationContext(long index); + SimulationContext selectSimulationContext(long index); /** * Find simulation context by its type and value. @@ -57,7 +57,7 @@ public interface SimulationContextService { * context value * @return found context */ - public SimulationContext selectSimulationContext( + SimulationContext selectSimulationContext( SimulationContextType celt, String value); /** @@ -67,7 +67,7 @@ public interface SimulationContextService { * example properties * @return list of contexts */ - public List selectSimulationContextsWhere( + List selectSimulationContextsWhere( SimulationContext.Properties cprop); /** @@ -75,7 +75,7 @@ public interface SimulationContextService { * * @return list of context types */ - public List selectAllTypes(); + List selectAllTypes(); /** * Get simulation context types related to given activities. @@ -84,7 +84,7 @@ public interface SimulationContextService { * the activity * @return list of found context types */ - public List selectTypesOf( + List selectTypesOf( ProjectSettingsService.Step... step); /** @@ -94,7 +94,7 @@ public interface SimulationContextService { * the example * @return list of found context types */ - public List selectTypesWhere( + List selectTypesWhere( SimulationContextType.Properties sprop); /** @@ -104,7 +104,7 @@ public interface SimulationContextService { * name of the context type * @return found context type */ - public SimulationContextType selectType(String name); + SimulationContextType selectType(String name); /** * Get simulation context type by its id. @@ -113,7 +113,7 @@ public interface SimulationContextService { * simulation context type id. * @return found context type */ - public SimulationContextType selectType(long index); + SimulationContextType selectType(long index); /** * Hold the simulation context. @@ -121,7 +121,7 @@ public interface SimulationContextService { * @param simCtx * the context to hold. */ - public void hold(SimulationContext simCtx); + void hold(SimulationContext simCtx); /** * Release the simulation context. @@ -129,7 +129,7 @@ public interface SimulationContextService { * @param simCtx * the context to release */ - public void release(SimulationContext simCtx); + void release(SimulationContext simCtx); /** * Get the simulation context list for displaying drop-down list values populating on the "Create new study" screen. @@ -142,6 +142,6 @@ public interface SimulationContextService { * @param simCtxType * @return */ - public ProjectSettingsService.Step getAttachedStep( + ProjectSettingsService.Step getAttachedStep( SimulationContextType simCtxType); } diff --git a/Workspace/Siman-Common/src/org/splat/service/SimulationContextServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/SimulationContextServiceImpl.java index 209d963..34a5cf3 100644 --- a/Workspace/Siman-Common/src/org/splat/service/SimulationContextServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/SimulationContextServiceImpl.java @@ -38,8 +38,14 @@ public class SimulationContextServiceImpl implements SimulationContextService { /** * logger for the service. */ - public final static AppLogger logger = AppLogger + public final static AppLogger LOG = AppLogger .getLogger(SimulationContextServiceImpl.class); + + /** + * Step property name. + */ + public final static String STEP_PROP = "step"; + /** * Injected simulation context DAO. */ @@ -52,7 +58,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { /** * Injected project settings service. */ - private ProjectSettingsService _projectSettingsService; + private ProjectSettingsService _projectSettings; /** * Get simulation contexts which are currently in the given state. @@ -104,7 +110,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { result = clist.get(0); // Supposed being the most used one if many exist } } catch (InvalidPropertyException error) { - logger.info("Attempt to select a simulation context \"" + LOG.info("Attempt to select a simulation context \"" + celt.getName() + "\" with an invalid value."); } return result; @@ -179,7 +185,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { public List selectAllTypes() { // Useless to order by names as the result mixes localized // and non localized types - return getSimulationContextTypeDAO().getAll(Order.asc("step")); + return getSimulationContextTypeDAO().getAll(Order.asc(STEP_PROP)); } /** @@ -197,13 +203,13 @@ public class SimulationContextServiceImpl implements SimulationContextService { // .append("'"); // } // query = query.append(" order by step asc"); - Criterion aCondition = Restrictions.eq("step", step[0].getNumber()); + Criterion aCondition = Restrictions.eq(STEP_PROP, step[0].getNumber()); for (int i = 1; i < step.length; i++) { // Useless to order as the result mixes localized and non localized types - aCondition = Restrictions.or(aCondition, Restrictions.eq("step", + aCondition = Restrictions.or(aCondition, Restrictions.eq(STEP_PROP, step[i].getNumber())); } return getSimulationContextTypeDAO().getFilteredList(aCondition, - Order.asc("step")); + Order.asc(STEP_PROP)); } /** @@ -238,19 +244,19 @@ public class SimulationContextServiceImpl implements SimulationContextService { // } // query = query.append(order); Criterion aCondition = null; - Order anOrder = Order.asc("step"); + Order anOrder = Order.asc(STEP_PROP); if (step != null) { - aCondition = Restrictions.eq("step", step.getNumber()); + aCondition = Restrictions.eq(STEP_PROP, step.getNumber()); anOrder = Order.desc("state"); // APPROVED (upper case A) is grater than inCHECK (lower case i) } if (state != null) { aCondition = Restrictions.and(aCondition, Restrictions.eq("state", state)); if (step != null) { - if (state != ProgressState.APPROVED) { - anOrder = Order.asc("name"); - } else { + if (state == ProgressState.APPROVED) { anOrder = null; // Approved types are localized + } else { + anOrder = Order.asc("name"); } } } @@ -310,14 +316,14 @@ public class SimulationContextServiceImpl implements SimulationContextService { * @return true if approval succeeded */ public boolean approve(final SimulationContext simCtx) { - if (simCtx.getProgressState() != ProgressState.inCHECK) { - return false; - } - simCtx.setProgressState(ProgressState.APPROVED); // The type name is supposed being localized - if (simCtx.isSaved()) { - getSimulationContextDAO().update(simCtx); + boolean res = (simCtx.getProgressState() == ProgressState.inCHECK); + if (res) { + simCtx.setProgressState(ProgressState.APPROVED); // The type name is supposed being localized + if (simCtx.isSaved()) { + getSimulationContextDAO().update(simCtx); + } } - return true; + return res; } /** @@ -375,7 +381,7 @@ public class SimulationContextServiceImpl implements SimulationContextService { * @return Project settings service */ private ProjectSettingsService getProjectSettings() { - return _projectSettingsService; + return _projectSettings; } /** @@ -385,6 +391,6 @@ public class SimulationContextServiceImpl implements SimulationContextService { * project settings service */ public void setProjectSettings(final ProjectSettingsService projectSettingsService) { - _projectSettingsService = projectSettingsService; + _projectSettings = projectSettingsService; } } diff --git a/Workspace/Siman-Common/src/org/splat/service/SimulationContextTypeService.java b/Workspace/Siman-Common/src/org/splat/service/SimulationContextTypeService.java index 10d50f6..0d73fd5 100644 --- a/Workspace/Siman-Common/src/org/splat/service/SimulationContextTypeService.java +++ b/Workspace/Siman-Common/src/org/splat/service/SimulationContextTypeService.java @@ -32,7 +32,7 @@ public interface SimulationContextTypeService { * @throws InvalidPropertyException * if some property of the type to be created is invalid */ - public SimulationContextType createType(String name, + SimulationContextType createType(String name, ProjectSettingsService.Step step) throws InvalidPropertyException; /** @@ -42,6 +42,6 @@ public interface SimulationContextTypeService { * the type to approve * @return true if approval succeeded */ - public boolean approve(SimulationContextType simCtxType); + boolean approve(SimulationContextType simCtxType); } diff --git a/Workspace/Siman-Common/src/org/splat/service/StepService.java b/Workspace/Siman-Common/src/org/splat/service/StepService.java index 35a8ad0..bc93b46 100644 --- a/Workspace/Siman-Common/src/org/splat/service/StepService.java +++ b/Workspace/Siman-Common/src/org/splat/service/StepService.java @@ -47,7 +47,7 @@ public interface StepService { * @throws IOException * if a file system error occurs */ - public Publication createDocument(Step aStep, Document.Properties dprop) + Publication createDocument(Step aStep, Document.Properties dprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException, IOException; @@ -66,7 +66,7 @@ public interface StepService { * @throws NotApplicableException * if the document is undefined */ - public Publication assignDocument(Step aStep, Document.Properties dprop) + Publication assignDocument(Step aStep, Document.Properties dprop) throws MissedPropertyException, InvalidPropertyException, NotApplicableException; @@ -91,7 +91,7 @@ public interface StepService { * @throws MismatchException * if the document is not applicable to the given study step */ - public Publication versionDocument(Step aStep, Publication base, + Publication versionDocument(Step aStep, Publication base, Document.Properties dprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException, IOException, MismatchException; @@ -111,7 +111,7 @@ public interface StepService { * @throws MultiplyDefinedException * if some property is defined several times */ - public SimulationContext addSimulationContext(Step aStep, + SimulationContext addSimulationContext(Step aStep, SimulationContext.Properties dprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException; @@ -124,7 +124,7 @@ public interface StepService { * the simulation context to add * @return the added simulation context */ - public SimulationContext addSimulationContext(Step firstStep, + SimulationContext addSimulationContext(Step firstStep, SimulationContext context); /** @@ -136,7 +136,7 @@ public interface StepService { * the simulation context to remove * @return true if removal succeeded */ - public boolean removeSimulationContext(Step aStep, SimulationContext context); + boolean removeSimulationContext(Step aStep, SimulationContext context); /** * Add a document publication to the given step. @@ -147,7 +147,7 @@ public interface StepService { * the document publication to add * @return true if publication succeeded */ - public boolean add(Step aStep, Publication newdoc); + boolean add(Step aStep, Publication newdoc); /** * Remove a document publication from the given step. @@ -158,7 +158,7 @@ public interface StepService { * the document publication to remove * @return true if removing of the publication succeeded */ - public boolean remove(Step aStep, Publication oldoc); + boolean remove(Step aStep, Publication oldoc); /** * Remove a document from the given step. @@ -169,7 +169,7 @@ public interface StepService { * the document publication * @return true if removing of the document succeeded */ - public boolean removeDocument(Step aStep, Publication doctag); + boolean removeDocument(Step aStep, Publication doctag); /** * Get document types which are applicable for the given study step (activity). @@ -178,5 +178,5 @@ public interface StepService { * the study step * @return the list of document types */ - public List getValidDocumentTypes(Step aStep); + List getValidDocumentTypes(Step aStep); } diff --git a/Workspace/Siman-Common/src/org/splat/service/StepServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/StepServiceImpl.java index ea57a73..fbbcb08 100644 --- a/Workspace/Siman-Common/src/org/splat/service/StepServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/StepServiceImpl.java @@ -10,10 +10,10 @@ package org.splat.service; import java.io.IOException; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; -import java.util.Vector; import org.splat.dal.bo.kernel.Relation; import org.splat.dal.bo.som.ConvertsRelation; @@ -55,7 +55,7 @@ public class StepServiceImpl implements StepService { /** * logger for the service. */ - public final static AppLogger logger = AppLogger + public final static AppLogger LOG = AppLogger .getLogger(StepServiceImpl.class); /** * Injected index service. @@ -96,7 +96,7 @@ public class StepServiceImpl implements StepService { /** * Injected project service. */ - private ProjectSettingsService _projectSettingsService; + private ProjectSettingsService _projectSettings; /** * {@inheritDoc} @@ -119,6 +119,7 @@ public class StepServiceImpl implements StepService { @Transactional public SimulationContext addSimulationContext(final Step aStep, final SimulationContext context) { + SimulationContext res = null; getSimulationContextService().hold(context); // Increments the reference count of simulation context if (aStep.getOwner().isSaved()) { try { @@ -129,15 +130,17 @@ public class StepServiceImpl implements StepService { aStep.getContex().add(context); // The context is also referenced from this (transient) Step getProjectElementDAO().update(aStep.getOwner()); updateKnowledgeElementsIndex(aStep); + res = context; } catch (Exception error) { - return null; + LOG.debug(error.getMessage(), error); } } else { // Happens when copying a scenario aStep.getOwner().add(context); aStep.getContex().add(context); // The context is also referenced from this (transient) Step // In case of owner scenario, the Knowledge Element index will be updated later, when saving the scenario + res = context; } - return context; + return res; } /** @@ -166,7 +169,7 @@ public class StepServiceImpl implements StepService { updateScenarioIndex(scene); } } catch (Exception error) { - logger.error("Unable to re-index Knowledge Elements, reason:", + LOG.error("Unable to re-index Knowledge Elements, reason:", error); } } @@ -201,11 +204,11 @@ public class StepServiceImpl implements StepService { */ @Transactional public boolean removeSimulationContext(final Step aStep, final SimulationContext context) { - boolean isOk = false; SimulationContext torem = aStep .getSimulationContext(context.getIndex()); - if ((torem != null) && (aStep.getOwner().remove(torem))) { + boolean isOk = (torem != null) && (aStep.getOwner().remove(torem)); + if (isOk) { aStep.getContex().remove(torem); getProjectElementDAO().update(aStep.getOwner()); @@ -215,7 +218,6 @@ public class StepServiceImpl implements StepService { } else { getSimulationContextDAO().delete(torem); } - isOk = true; } return isOk; } @@ -235,11 +237,9 @@ public class StepServiceImpl implements StepService { // Creation of the save directory java.io.File wdir = getDocumentService().getSaveDirectory(newdoc); - if (!wdir.exists()) { - if (!wdir.mkdirs()) { - throw new IOException( - "Cannot create the repository vault directory"); - } + if ((!wdir.exists()) && (!wdir.mkdirs())) { + throw new IOException( + "Cannot create the repository vault directory"); } // Identification and save @@ -254,26 +254,21 @@ public class StepServiceImpl implements StepService { * * @see org.splat.service.StepService#assignDocument(org.splat.som.Step, org.splat.dal.bo.som.Document.Properties) */ - public Publication assignDocument(final Step aStep, final Document.Properties dprop) - throws MissedPropertyException, InvalidPropertyException, - NotApplicableException { + public Publication assignDocument(final Step aStep, + final Document.Properties dprop) throws MissedPropertyException, + InvalidPropertyException, NotApplicableException { String refid = dprop.getReference(); - if (refid == null) { - return null; - } - - Document slot = getDocumentService().selectDocument(refid, - new Revision().toString()); - if (slot == null) { - return null; - } - if (!slot.isUndefined()) { - return null; // Should not happen + Publication res = null; + if (refid != null) { + Document slot = getDocumentService().selectDocument(refid, + new Revision().toString()); + if ((slot != null) && (slot.isUndefined())) { + getDocumentService().initialize(slot, + dprop.setOwner(aStep.getOwnerStudy())); + res = new Publication(slot, aStep.getOwner()); + } } - - getDocumentService().initialize(slot, - dprop.setOwner(aStep.getOwnerStudy())); - return new Publication(slot, aStep.getOwner()); + return res; } /** @@ -418,14 +413,14 @@ public class StepServiceImpl implements StepService { * @return true if publication succeeded */ public boolean add(final Step aStep, final Publication newdoc) { - if (!aStep.getOwner().add(newdoc)) { - return false; // Updates the study in memory + boolean res = aStep.getOwner().add(newdoc); // Updates the study in memory + if (res) { + aStep.getDocuments().add(0, newdoc); // Updates this step + getDocumentService().hold(newdoc.value()); // Increments the configuration tag count of document + // If not yet saved, the Publication MUST NOT be saved here, although this creates a temporary inconsistent state into the + // database (it will be saved later by cascading the update of owner scenario). } - aStep.getDocuments().add(0, newdoc); // Updates this step - getDocumentService().hold(newdoc.value()); // Increments the configuration tag count of document - // If not yet saved, the Publication MUST NOT be saved here, although this creates a temporary inconsistent state into the - // database (it will be saved later by cascading the update of owner scenario). - return true; + return res; } /** @@ -438,13 +433,13 @@ public class StepServiceImpl implements StepService { * @return true if removing of the publication succeeded */ public boolean remove(final Step aStep, final Publication oldoc) { - if (!aStep.getOwner().remove(oldoc)) { - return false; // Updates the study in memory + boolean res = aStep.getOwner().remove(oldoc); // Updates the study in memory + if (res) { + aStep.getDocuments().remove(oldoc); // Updates this step + getDocumentService().release(oldoc.value()); // Decrements the configuration tag count of document + // The publication becoming orphan, it should automatically be removed from the database when updating of owner scenario. } - aStep.getDocuments().remove(oldoc); // Updates this step - getDocumentService().release(oldoc.value()); // Decrements the configuration tag count of document - // The publication becoming orphan, it should automatically be removed from the database when updating of owner scenario. - return true; + return res; } /** @@ -462,29 +457,28 @@ public class StepServiceImpl implements StepService { getDocumentDAO().update(value); Publication torem = aStep.getDocument(value.getIndex()); - if (torem == null) { - return false; - } - - remove(aStep, torem); - getProjectElementDAO().update(aStep.getOwner()); - if (!value.isPublished() && !value.isVersioned()) { // The referenced document is no more used - Set links = value.getAllRelations(); // Get all relation of the document to remove them - List using = new Vector(); - for (Iterator i = links.iterator(); i.hasNext();) { - Relation link = i.next(); - if (link.getClass().equals(ConvertsRelation.class)) { // File conversion - getFileDAO().delete((File) link.getTo()); // The corresponding physical file is not removed from the vault - } else if (link.getClass().equals(UsesRelation.class)) { // Document dependency - using.add((Document) link.getTo()); + boolean res = (torem != null); + if (res) { + remove(aStep, torem); + getProjectElementDAO().update(aStep.getOwner()); + if (!value.isPublished() && !value.isVersioned()) { // The referenced document is no more used + Set links = value.getAllRelations(); // Get all relation of the document to remove them + List using = new ArrayList(); + for (Iterator i = links.iterator(); i.hasNext();) { + Relation link = i.next(); + if (link.getClass().equals(ConvertsRelation.class)) { // File conversion + getFileDAO().delete((File) link.getTo()); // The corresponding physical file is not removed from the vault + } else if (link.getClass().equals(UsesRelation.class)) { // Document dependency + using.add((Document) link.getTo()); + } } + for (Iterator i = using.iterator(); i.hasNext();) { + i.next().removeRelation(UsedByRelation.class, value); // TODO: RKV: don't use Database.getSession in removeRelation + } + getDocumentDAO().delete(value); // The corresponding physical file is not removed from the vault } - for (Iterator i = using.iterator(); i.hasNext();) { - i.next().removeRelation(UsedByRelation.class, value); // TODO: RKV: don't use Database.getSession in removeRelation - } - getDocumentDAO().delete(value); // The corresponding physical file is not removed from the vault } - return true; + return res; } /** @@ -663,7 +657,7 @@ public class StepServiceImpl implements StepService { * @return Project settings service */ private ProjectSettingsService getProjectSettings() { - return _projectSettingsService; + return _projectSettings; } /** @@ -674,6 +668,6 @@ public class StepServiceImpl implements StepService { */ public void setProjectSettings( final ProjectSettingsService projectSettingsService) { - _projectSettingsService = projectSettingsService; + _projectSettings = projectSettingsService; } } diff --git a/Workspace/Siman-Common/src/org/splat/service/StudyService.java b/Workspace/Siman-Common/src/org/splat/service/StudyService.java index 5059552..9ba7225 100644 --- a/Workspace/Siman-Common/src/org/splat/service/StudyService.java +++ b/Workspace/Siman-Common/src/org/splat/service/StudyService.java @@ -14,7 +14,6 @@ import java.util.List; import org.splat.dal.bo.kernel.User; import org.splat.dal.bo.som.DocumentType; import org.splat.dal.bo.som.Publication; -import org.splat.dal.bo.som.Scenario; import org.splat.dal.bo.som.SimulationContext; import org.splat.dal.bo.som.Study; import org.splat.dal.bo.som.ValidationCycle; @@ -38,7 +37,7 @@ public interface StudyService { * the study * @return incremented docount value */ - public int generateLocalIndex(Study aStudy); + int generateLocalIndex(Study aStudy); /** * Get study by its id. @@ -47,7 +46,7 @@ public interface StudyService { * the study id * @return found study or null */ - public Study selectStudy(long index); + Study selectStudy(long index); /** * Create a new study. @@ -62,7 +61,7 @@ public interface StudyService { * @throws MultiplyDefinedException * if some property is defined several times */ - public Study createStudy(Study.Properties sprop) + Study createStudy(Study.Properties sprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException; @@ -81,7 +80,7 @@ public interface StudyService { * @throws MultiplyDefinedException * if some property occurs several times */ - public SimulationContext addProjectContext(Study aStudy, + SimulationContext addProjectContext(Study aStudy, SimulationContext.Properties cprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException; @@ -94,7 +93,7 @@ public interface StudyService { * the simulation context to add * @return the added simulation context */ - public SimulationContext addProjectContext(Study aStudy, + SimulationContext addProjectContext(Study aStudy, SimulationContext context); /** @@ -106,7 +105,7 @@ public interface StudyService { * the simulation context to remove * @return true if removing succeeded */ - public boolean removeProjectContext(Study aStudy, SimulationContext context); + boolean removeProjectContext(Study aStudy, SimulationContext context); /** * Demotes this study from In-Check to In-Draft then In-Work states. This function is called internally when demoting the final result @@ -116,7 +115,7 @@ public interface StudyService { * the study to demote * @return true if the demotion succeeded. */ - public boolean demote(Study aStudy); + boolean demote(Study aStudy); /** * Promotes this study from In-Work to In-Draft then In-Check and APPROVED states. This function is called internally when promoting the @@ -126,7 +125,7 @@ public interface StudyService { * the study to promote * @return true if the promotion succeeded. */ - public boolean promote(Study aStudy); + boolean promote(Study aStudy); /** * Add a contributor to the study. @@ -137,7 +136,7 @@ public interface StudyService { * the contributor * @return true if addition succeeded */ - public boolean addContributor(Study aStudy, User user); + boolean addContributor(Study aStudy, User user); /** * Remove contributors from the study. @@ -148,7 +147,7 @@ public interface StudyService { * contributor(s) * @return true if removing succeeded */ - public boolean removeContributor(Study aStudy, User... users); + boolean removeContributor(Study aStudy, User... users); /** * Set a validation cycle for documents of the given type in the given study. @@ -160,7 +159,7 @@ public interface StudyService { * @param vprop * validation cycle properties */ - public void setValidationCycle(Study aStudy, DocumentType type, + void setValidationCycle(Study aStudy, DocumentType type, ValidationCycle.Properties vprop); /** @@ -171,7 +170,7 @@ public interface StudyService { * @return true if the move succeeded. * @see #isPublic() */ - public boolean moveToPublic(Study aStudy); + boolean moveToPublic(Study aStudy); /** * Moves this study from the Public to the Reference area of the repository. For being moved to the Reference area, the study must @@ -184,7 +183,7 @@ public interface StudyService { * @see #isPublic() * @see Publication#approve(Date) */ - public boolean moveToReference(Study aStudy); + boolean moveToReference(Study aStudy); /** * Update a study. @@ -197,7 +196,7 @@ public interface StudyService { * @throws InvalidPropertyException * if some property doesn't exist */ - public boolean update(Study aStudy, Properties sprop) + boolean update(Study aStudy, Properties sprop) throws InvalidPropertyException; /** @@ -206,7 +205,7 @@ public interface StudyService { * @param aStudy * the study */ - public void loadWorkflow(Study aStudy); + void loadWorkflow(Study aStudy); /** * Returns the validation cycle of the given document type. @@ -217,7 +216,7 @@ public interface StudyService { * the document type being subject of validation * @return the validation cycle of the document, or null if not defined. */ - public ValidationCycle getValidationCycleOf(Study aStudy, DocumentType type); + ValidationCycle getValidationCycleOf(Study aStudy, DocumentType type); /** * Checks if the given user participates to this study. The Study staff includes the author and contributors. @@ -229,7 +228,7 @@ public interface StudyService { * @return true if the given user is actor of this study. * @see #getContributors() */ - public boolean isStaffedBy(Study aStudy, User user); + boolean isStaffedBy(Study aStudy, User user); /** * Checks if the given user is actor of this study. Actors include contributors, reviewers and approvers. @@ -241,7 +240,7 @@ public interface StudyService { * @return true if the given user is actor of this study. * @see #getActors() */ - public boolean hasActor(Study aStudy, User user); + boolean hasActor(Study aStudy, User user); /** * Returns unmodifiable initialized transient list of contributors of this study. @@ -250,5 +249,5 @@ public interface StudyService { * the study * @return the unmodifiable not null transient list of contributors of this study */ - public List getContributors(Study aStudy); + List getContributors(Study aStudy); } diff --git a/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java index b035562..0d133d1 100644 --- a/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java @@ -26,7 +26,6 @@ import org.splat.dal.bo.kernel.User; import org.splat.dal.bo.som.ActorRelation; import org.splat.dal.bo.som.ContributorRelation; import org.splat.dal.bo.som.DescriptionAttribute; -import org.splat.dal.bo.som.Document; import org.splat.dal.bo.som.DocumentType; import org.splat.dal.bo.som.IDBuilder; import org.splat.dal.bo.som.KnowledgeElement; @@ -66,7 +65,7 @@ public class StudyServiceImpl implements StudyService { /** * logger for the service. */ - public final static AppLogger logger = AppLogger + public final static AppLogger LOG = AppLogger .getLogger(StudyServiceImpl.class); /** @@ -164,7 +163,7 @@ public class StudyServiceImpl implements StudyService { IndexService lucin = getIndex(); lucin.add(study); } catch (IOException error) { - logger.error("Unable to index the study '" + study.getIndex() + LOG.error("Unable to index the study '" + study.getIndex() + "', reason:", error); // Continue and try to index later } @@ -277,7 +276,7 @@ public class StudyServiceImpl implements StudyService { * the document * @return true if the document is published in the study */ - private boolean publishes(final Study aStudy, final Document doc) { +/* private boolean publishes(final Study aStudy, final Document doc) { if (!aStudy.publishes(doc)) { Scenario[] scene = aStudy.getScenarii(); for (int i = 0; i < scene.length; i++) { @@ -288,7 +287,7 @@ public class StudyServiceImpl implements StudyService { } return false; } - +*/ /** * {@inheritDoc} * @@ -337,13 +336,15 @@ public class StudyServiceImpl implements StudyService { * org.splat.dal.bo.som.ValidationCycle.Properties) */ @Transactional - public void setValidationCycle(final Study aStudy, final DocumentType type, + public void setValidationCycle(final Study aStudyDTO, final DocumentType type, final ValidationCycle.Properties vprop) { - Map validactor = aStudy.getValidationCycles(); + Map validactor = aStudyDTO.getValidationCycles(); if (validactor == null) { - setShortCuts(aStudy); // Initializes validactor and actor + setShortCuts(aStudyDTO); // Initializes validactor and actor } + Study aStudy = selectStudy(aStudyDTO.getIndex()); + String cname = type.getName(); ValidationCycle cycle = validactor.get(cname); @@ -357,16 +358,16 @@ public class StudyServiceImpl implements StudyService { ValidationCycleRelation link = cycle.getContext(); // RKV: aStudy.addRelation(link); - aStudy.getAllRelations().add(link); // RKV + aStudyDTO.getAllRelations().add(link); // RKV validactor.put(cname, link.getTo()); // Replaces the cycle if exists as default, } catch (Exception error) { - logger.error("Unable to re-index Knowledge Elements, reason:", + LOG.error("Unable to re-index Knowledge Elements, reason:", error); return; } } - resetActorsShortCut(aStudy); + resetActorsShortCut(aStudyDTO); update(aStudy); // Re-index the study, just in case } @@ -463,7 +464,7 @@ public class StudyServiceImpl implements StudyService { getIndex().update(aStudy); // Update of Lucene index isOk = true; } catch (Exception e) { - logger.error("STD-000001", e, aStudy.getIndex(), e.getMessage()); + LOG.error("STD-000001", e, aStudy.getIndex(), e.getMessage()); } return isOk; } @@ -520,7 +521,7 @@ public class StudyServiceImpl implements StudyService { break; } } - SimpleDateFormat tostring = new SimpleDateFormat("yyyy"); + SimpleDateFormat tostring = new SimpleDateFormat("yyyy"); //RKV: NOPMD: TODO: Use locale here? String year = tostring.format(study.getDate()); year = year.substring(4 - (i - n), 4); // 4-(i-n) must be equal to either 0 or 2 for (int j = 0; j < year.length(); j++) { @@ -623,7 +624,7 @@ public class StudyServiceImpl implements StudyService { } isOk = true; } catch (Exception error) { - logger.error("Unable to re-index Knowledge Elements, reason:", + LOG.error("Unable to re-index Knowledge Elements, reason:", error); } return isOk; diff --git a/Workspace/Siman-Common/src/org/splat/service/UserService.java b/Workspace/Siman-Common/src/org/splat/service/UserService.java index b170020..168a6ce 100644 --- a/Workspace/Siman-Common/src/org/splat/service/UserService.java +++ b/Workspace/Siman-Common/src/org/splat/service/UserService.java @@ -28,11 +28,11 @@ import org.splat.manox.XMLException; */ public interface UserService { - public User createUser(User.Properties uprop) + User createUser(User.Properties uprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException; - public Set importUsers(File xfile) throws XMLException, + Set importUsers(File xfile) throws XMLException, MismatchException; /** @@ -48,15 +48,15 @@ public interface UserService { * the user whose manager is get * @return the manager of the given user, if defined */ - public User getManagerOf(User user); + User getManagerOf(User user); - public List selectAllUsers(); + List selectAllUsers(); - public User selectUser(String username); + User selectUser(String username); - public User selectUser(String username, String password); + User selectUser(String username, String password); - public User selectUser(long index); + User selectUser(long index); - public List selectUsersWhere(User.Properties... uprop); + List selectUsersWhere(User.Properties... uprop); } diff --git a/Workspace/Siman-Common/src/org/splat/service/UserServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/UserServiceImpl.java index f19dea8..862f30e 100644 --- a/Workspace/Siman-Common/src/org/splat/service/UserServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/UserServiceImpl.java @@ -47,7 +47,7 @@ public class UserServiceImpl implements UserService { /** * The service logger. */ - final static Logger logger = Logger.getLogger(UserServiceImpl.class); + protected final static Logger LOG = Logger.getLogger(UserServiceImpl.class); /** * Injected user DAO. @@ -64,7 +64,7 @@ public class UserServiceImpl implements UserService { * @see org.splat.service.UserService#createUser(org.splat.dal.bo.kernel.User.Properties) */ @Transactional - public User createUser(User.Properties uprop) + public User createUser(final User.Properties uprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException, RuntimeException { User nuser = new User(uprop); @@ -74,21 +74,23 @@ public class UserServiceImpl implements UserService { // For the casting List @Transactional - public Set importUsers(File xfile) throws XMLException, + public Set importUsers(final File xfile) throws XMLException, MismatchException { String[] name = xfile.getName().split("\\x2E"); // Split by '.' (period) character String fext = name[name.length - 1]; - if (!fext.equals("xml")) + if (!fext.equals("xml")) { throw new MismatchException("filetype"); + } try { DocumentBuilderFactory dfactory = javax.xml.parsers.DocumentBuilderFactory .newInstance(); DocumentBuilder dBuilder = dfactory.newDocumentBuilder(); org.w3c.dom.Document inDoc = dBuilder.parse(xfile); String xtag = inDoc.getDocumentElement().getNodeName(); - if (!xtag.equals("users")) + if (!xtag.equals("users")) { throw new MismatchException("filetype"); + } org.w3c.dom.NodeList ulist = inDoc.getElementsByTagName("user"); // List result = (List) session @@ -97,8 +99,9 @@ public class UserServiceImpl implements UserService { List users = getUserDAO().getAll(); HashSet members = new HashSet(); HashSet imported = new HashSet(); - for (Iterator i = users.iterator(); i.hasNext();) + for (Iterator i = users.iterator(); i.hasNext();) { members.add(i.next().getUsername()); + } for (int i = 0; i < ulist.getLength(); i++) { HashMap row = XDOM.getNamedChildNodes(ulist @@ -107,8 +110,9 @@ public class UserServiceImpl implements UserService { // Mandatory properties String uname = row.get("username").getTextContent(); - if (members.contains(uname)) + if (members.contains(uname)) { continue; // This user already exists + } uprop.setUsername(uname) .setFirstName(row.get("first").getTextContent()) .setName(row.get("last").getTextContent()) @@ -136,11 +140,14 @@ public class UserServiceImpl implements UserService { } return imported; } catch (IOException error) { - throw new XMLException("XML users file not found"); + LOG.debug(error.getMessage(), error); + throw new XMLException("XML users file not found"); //RKV: NOPMD: Original message is printed } catch (ParserConfigurationException e) { - throw new XMLException("XML Organization parser not accessible"); + LOG.debug(e.getMessage(), e); + throw new XMLException("XML Organization parser not accessible"); //RKV: NOPMD: Original message is printed } catch (Exception e) { - throw new XMLException("XML users file not valid"); + LOG.debug(e.getMessage(), e); + throw new XMLException("XML users file not valid"); //RKV: NOPMD: Original message is printed } } @@ -157,17 +164,19 @@ public class UserServiceImpl implements UserService { * the user whose manager is get * @return the manager of the given user, if defined */ - public User getManagerOf(User user) { + public User getManagerOf(final User user) { User result = null; String orgname = user.getOrganizationName(); - if (orgname.equals("Nx2")) + if (orgname.equals("Nx2")) { return result; - if (orgname.equals("Nx1")) + } + if (orgname.equals("Nx1")) { orgname = "Nx2"; - else { - if (user.getRoleNames().equals("customer")) + } else { + if (user.getRoleNames().equals("customer")) { return result; + } orgname = "Nx1"; } try { @@ -187,12 +196,12 @@ public class UserServiceImpl implements UserService { } @Transactional(readOnly = true) - public User selectUser(String username) { + public User selectUser(final String username) { return getUserDAO().findByCriteria( Restrictions.eq("username", username)); } - public User selectUser(String username, String password) { + public User selectUser(final String username, final String password) { // WARNING: For not encoding the password here, we better call a selectUsersWhere(User.Properties), // but this requires a getPassword in User.Properties nested class. Criterion aCondition = Restrictions.eq("username", username); @@ -209,12 +218,12 @@ public class UserServiceImpl implements UserService { } @Transactional(readOnly = true) - public User selectUser(long index) { + public User selectUser(final long index) { return getUserDAO().get(index); } @SuppressWarnings("unchecked") - public List selectUsersWhere(User.Properties... uprop) { + public List selectUsersWhere(final User.Properties... uprop) { // StringBuffer query = new StringBuffer("FROM User"); // String separator = " where ("; // String value; @@ -260,7 +269,7 @@ public class UserServiceImpl implements UserService { * @param userDAO * the userDAO to set */ - public void setUserDAO(UserDAO userDAO) { + public void setUserDAO(final UserDAO userDAO) { _userDAO = userDAO; } } diff --git a/Workspace/Siman-Common/src/org/splat/service/UtilServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/UtilServiceImpl.java index 4bd90ae..a7f410e 100644 --- a/Workspace/Siman-Common/src/org/splat/service/UtilServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/UtilServiceImpl.java @@ -9,10 +9,7 @@ package org.splat.service; -import java.util.Map; - import org.splat.log.AppLogger; -import org.splat.som.ApplicationRights; /** * @author Maria KRUCHININA @@ -23,7 +20,7 @@ public class UtilServiceImpl implements UtilService { /** * logger for the service. */ - private static final AppLogger LOG = AppLogger.getLogger(UtilServiceImpl.class); + private static final AppLogger LOG = AppLogger.getLogger(UtilServiceImpl.class); //RKV: NOPMD: TODO: Complete the service /** * Get the connected user. diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/KnowledgeElementTypeDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/KnowledgeElementTypeDTO.java index 48cec3b..e6ea1b3 100644 --- a/Workspace/Siman-Common/src/org/splat/service/dto/KnowledgeElementTypeDTO.java +++ b/Workspace/Siman-Common/src/org/splat/service/dto/KnowledgeElementTypeDTO.java @@ -10,11 +10,11 @@ public class KnowledgeElementTypeDTO { /** * Type name. */ - private String name; + private String _name; /** * Persistent id of the type. */ - private long rid; + private long _index; // ============================================================================================================================== // Public member functions @@ -25,32 +25,47 @@ public class KnowledgeElementTypeDTO { * * @see java.lang.Object#equals(java.lang.Object) */ - public boolean equals(Object entity) { - if (entity == null) - return false; - if (entity instanceof String) { - return this.name.equals((String) entity); // Names are unique - } else if (entity instanceof KnowledgeElementTypeDTO) { - KnowledgeElementTypeDTO object = (KnowledgeElementTypeDTO) entity; - long he = object.getIndex(); - long me = this.getIndex(); - if (me * he != 0) { - return (he == me); - } else { - return this.getName().equals(object.getName()); + @Override + public boolean equals(final Object entity) { + boolean res = (entity != null); + if (res) { + if (entity instanceof String) { + res = this._name.equals(entity); // Names are unique + } else if (entity instanceof KnowledgeElementTypeDTO) { + KnowledgeElementTypeDTO object = (KnowledgeElementTypeDTO) entity; + long he = object.getIndex(); + long me = this.getIndex(); + if (me * he == 0) { + res = this.getName().equals(object.getName()); + } else { + res = (he == me); + } } - } else { - return false; } + return res; } + /** + * {@inheritDoc} + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + long oid = getIndex(); // getIndex() is supposed fetching the index if not yet done + if (oid == 0) { + oid = super.hashCode(); // WARNING: Must not call super.toString() as it goes back here (this.toString()) + } + return new StringBuffer("object ").append(getClass().getName()).append( + "@").append(oid).toString().hashCode(); + } + /** * Get the name of the knowledge type. * * @return the type name */ public String getName() { - return name; + return _name; } /** @@ -59,7 +74,7 @@ public class KnowledgeElementTypeDTO { * @return the rid */ public long getIndex() { - return rid; + return _index; } /** @@ -68,15 +83,15 @@ public class KnowledgeElementTypeDTO { * @param rid * the rid to set */ - public void setIndex(long rid) { - this.rid = rid; + public void setIndex(final long rid) { + this._index = rid; } /** * Set the name. * @param name the name to set */ - public void setName(String name) { - this.name = name; + public void setName(final String name) { + this._name = name; } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/Proxy.java b/Workspace/Siman-Common/src/org/splat/service/dto/Proxy.java index b17d99e..de0d20f 100644 --- a/Workspace/Siman-Common/src/org/splat/service/dto/Proxy.java +++ b/Workspace/Siman-Common/src/org/splat/service/dto/Proxy.java @@ -1,14 +1,7 @@ package org.splat.service.dto; import org.splat.dal.bo.som.ProgressState; -import org.splat.dal.dao.som.Database; - - import org.splat.service.technical.IndexServiceImpl; -import org.splat.dal.bo.som.KnowledgeElement; -import org.splat.dal.bo.som.ProgressState; -import org.splat.dal.bo.som.Study; -import org.splat.dal.bo.som.Study.Properties; /** * Stand proxy for entities such as Study and Knowledge Element returned by Lucene-based searches. @@ -18,10 +11,6 @@ import org.splat.dal.bo.som.Study.Properties; * One of these properties is the internal persistent identifier of the object represented by a proxy allowing the * user of this interface to load the object from the database. * - * @see Database#selectStudiesWhere(Study.Properties...) - * @see Database#selectKnowledgeElementsWhere(KnowledgeElement.Properties) - * @see Database#selectStudy(int) - * @see Database#selectKnowledgeElement(int) * @see IndexServiceImpl * @see IndexServiceImpl.ObjectProxy * @author Daniel Brunier-Coulin @@ -30,30 +19,30 @@ import org.splat.dal.bo.som.Study.Properties; public interface Proxy { - public String getAuthorName (); + String getAuthorName (); /** * Returns the internal persistent identifier of the object represented by this proxy. The returned identifier can be used * for selecting the corresponding persistent object from the database. * @return the internal persistent identifier of the object represented by this proxy. */ - public Long getIndex (); + Long getIndex (); - public ProgressState getProgressState (); + ProgressState getProgressState (); /** * Returns the external reference number of the object represented by this proxy. The returned reference is formated * according to the format defined in the configuration file of the application. * @return the external reference number of the object represented by this proxy. */ - public String getReference (); + String getReference (); - public String getTitle (); + String getTitle (); /** * Returns the type of the object represented by this proxy. Depending on the implementation, the returned type may or * may not be localized in the current locale of final user. * @return the type of the object represented by this proxy. */ - public String getType (); + String getType (); } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/RoleDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/RoleDTO.java index 5f9966c..7ac576c 100644 --- a/Workspace/Siman-Common/src/org/splat/service/dto/RoleDTO.java +++ b/Workspace/Siman-Common/src/org/splat/service/dto/RoleDTO.java @@ -1,45 +1,68 @@ package org.splat.service.dto; -import java.util.Vector; +import java.util.ArrayList; +import java.util.List; /** - * Role DTO. + * DTO for keeping roles of a user. * * @see UserDTO */ public class RoleDTO { - private String username; - private String role; + /** + * User name. + */ + private transient String _username; + /** + * Roles names. + */ + private String _name; // ============================================================================================================================== // Constructors // ============================================================================================================================== - // Database fetch constructor + /** + * Bean replication constructor. + */ protected RoleDTO() { + // Bean replication constructor } - // Initialization constructor - protected RoleDTO(String username, String role) { - this.username = username; - this.role = role; + /** + * Initialization constructor. + * @param username user name + * @param role role name + */ + protected RoleDTO(final String username, final String role) { + this._username = username; + this._name = role; } // ============================================================================================================================== // Protected member functions // ============================================================================================================================== - protected void addRole(String role) { - this.role = this.role + "," + role; + /** + * Add a role. + * @param role the role to add + */ + protected void addRole(final String role) { + this._name = this._name + "," + role; } + /** + * Get roles as an array of separate DTOs. + * @return array of roles + */ protected RoleDTO[] toArray() { - String[] name = role.split(","); - Vector role = new Vector(); + String[] name = _name.split(","); + List role = new ArrayList(); - for (int i = 0; i < name.length; i++) - role.add(new RoleDTO(username, name[i])); + for (int i = 0; i < name.length; i++) { + role.add(new RoleDTO(_username, name[i])); + } return role.toArray(new RoleDTO[name.length]); } @@ -49,18 +72,18 @@ public class RoleDTO { // In functions below, the role is supposed having previously been extracted as an array. public String getName() { - return role; + return _name; } public void setName(final String name) { - role = name; + _name = name; } - public boolean is(String name) { - return this.role.equals(name); + public boolean is(final String name) { + return this._name.equals(name); } - public boolean isSame(RoleDTO other) { - return this.role.equals(other.role); + public boolean isSame(final RoleDTO other) { + return this._name.equals(other._name); } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/SimulationContextFacade.java b/Workspace/Siman-Common/src/org/splat/service/dto/SimulationContextFacade.java index 77475ed..07b5de1 100644 --- a/Workspace/Siman-Common/src/org/splat/service/dto/SimulationContextFacade.java +++ b/Workspace/Siman-Common/src/org/splat/service/dto/SimulationContextFacade.java @@ -3,44 +3,45 @@ package org.splat.service.dto; import java.util.Iterator; import java.util.List; -import org.splat.service.technical.ProjectSettingsService; import org.splat.dal.bo.som.ProgressState; import org.splat.dal.bo.som.SimulationContext; import org.splat.dal.bo.som.SimulationContextType; +import org.splat.service.technical.ProjectSettingsService; public class SimulationContextFacade { - private SimulationContext my; - private String name; - private int at; - private ProgressState state; + private transient final SimulationContext _my; + private transient final String _name; + private transient int _at; + private transient ProgressState _state; // ============================================================================================================================== // Constructor // ============================================================================================================================== - public SimulationContextFacade(SimulationContext represented, - List steps) { + public SimulationContextFacade(final SimulationContext represented, + final List steps) { // -------------------------------------------------------------- SimulationContextType mytype; - my = represented; - mytype = my.getType(); + _my = represented; + mytype = _my.getType(); for (Iterator i = steps.iterator(); i .hasNext();) { ProjectSettingsService.Step step = i.next(); - if (!mytype.isAttachedTo(step)) + if (!mytype.isAttachedTo(step)) { continue; - at = step.getNumber(); // There is no direct service for getting the step number + } + _at = step.getNumber(); // There is no direct service for getting the step number break; } - name = my.getType().getName(); + _name = _my.getType().getName(); if (mytype.isApproved()) { - state = ProgressState.inCHECK; + _state = ProgressState.inCHECK; // RKV: TODO: Do translation in presentation layer by struts tools: name = ResourceBundle.getBundle("som", // ApplicationSettings.getCurrentLocale()).getString("type.context." + name); } else { - state = ProgressState.inDRAFT; + _state = ProgressState.inDRAFT; } } @@ -50,28 +51,28 @@ public class SimulationContextFacade { public String getEditIcon() { // ---------------------------- - StringBuffer result = new StringBuffer("icon.ed").append(state).append( + StringBuffer result = new StringBuffer("icon.ed").append(_state).append( ".png"); return result.toString(); } public String getIndex() { // ------------------------- - return String.valueOf(my.getIndex()); + return String.valueOf(_my.getIndex()); } public int getStepNumber() { // --------------------------- - return at; + return _at; } public String getTypeName() { // ---------------------------- - return name; + return _name; } public String getValue() { // ------------------------- - return my.getValue(); + return _my.getValue(); } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/service/dto/UserDTO.java b/Workspace/Siman-Common/src/org/splat/service/dto/UserDTO.java index 3d2b4c9..0109dac 100644 --- a/Workspace/Siman-Common/src/org/splat/service/dto/UserDTO.java +++ b/Workspace/Siman-Common/src/org/splat/service/dto/UserDTO.java @@ -1,6 +1,7 @@ package org.splat.service.dto; import java.security.Principal; + import org.splat.kernel.Name; /** @@ -10,90 +11,93 @@ import org.splat.kernel.Name; */ public class UserDTO implements Principal, Name { - private String password; // Property without getter function - private String username; // Unique in the user directory - private String first; - private String last; - private String display; // Optional - private RoleDTO role = new RoleDTO(); // Roles as list (as stored into the database) - private String email; - private String organid; + private String _password; // Property without getter function + private String _username; // Unique in the user directory + private String _firstName; + private String _name; + private String _displayName; // Optional + private RoleDTO _role = new RoleDTO(); // Roles as list (as stored into the database) + private String _mailAddress; + private String _organizationName; /** * Persistent id of the type. */ - private long rid; + private long _index; // ============================================================================================================================== // Public member functions // ============================================================================================================================== - public boolean equals(Object item) { - if (item == null) - return false; - if (item instanceof String) { - return this.username.equals((String) item); // Usernames are unique - } else if (item instanceof UserDTO) { - UserDTO given = (UserDTO) item; - return (given.username.equals(this.username)); // Usernames are unique - } else { - return false; + @Override + public boolean equals(final Object item) { + boolean res = (item != null); + if (res) { + if (item instanceof String) { + res = this._username.equals(item); // Usernames are unique + } else if (item instanceof UserDTO) { + UserDTO given = (UserDTO) item; + res = given._username.equals(this._username); // Usernames are unique + } } + return res; } public String getDisplayName() { - if (display == null) - return last + " " + first; - else - return display; + String res = _displayName; + if (res == null) { + res = _name + " " + _firstName; + } + return res; } public String getFirstName() { - return first; + return _firstName; } public void setFirstName(final String name) { - first = name; + _firstName = name; } public String getMailAddress() { - return email; + return _mailAddress; } public void setMailAddress(final String addr) { - email = addr; + _mailAddress = addr; } public String getName() { - return last; + return _name; } public void setName(final String name) { - last = name; + _name = name; } public String getOrganizationName() { - return organid; + return _organizationName; } - public void setOrganizationName(String name) { - organid = name; + public void setOrganizationName(final String name) { + _organizationName = name; } public String getRoleNames() { - return role.getName(); + return _role.getName(); } public RoleDTO[] getRoles() { - return role.toArray(); + return _role.toArray(); } public String getUsername() { - return username; + return _username; } + @Override public String toString() { - return last + " " + first; + return _name + " " + _firstName; } /** @@ -102,7 +106,7 @@ public class UserDTO implements Principal, Name { * @return the rid */ public long getIndex() { - return rid; + return _index; } /** @@ -111,8 +115,8 @@ public class UserDTO implements Principal, Name { * @param rid * the rid to set */ - public void setIndex(long rid) { - this.rid = rid; + public void setIndex(final long rid) { + this._index = rid; } /** @@ -120,23 +124,23 @@ public class UserDTO implements Principal, Name { * @return the password */ public String getPassword() { - return password; + return _password; } /** * Set the password. * @param password the password to set */ - public void setPassword(String password) { - this.password = password; + public void setPassword(final String password) { + this._password = password; } /** * Set the username. * @param username the username to set */ - public void setUsername(String username) { - this.username = username; + public void setUsername(final String username) { + this._username = username; } /** @@ -144,14 +148,22 @@ public class UserDTO implements Principal, Name { * @return the role */ public RoleDTO getRole() { - return role; + return _role; } /** * Set the role. * @param role the role to set */ - public void setRole(RoleDTO role) { - this.role = role; + public void setRole(final RoleDTO role) { + this._role = role; + } + + /** + * Set the displayName. + * @param displayName the displayName to set + */ + public void setDisplayName(final String displayName) { + _displayName = displayName; } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/service/technical/IndexServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/technical/IndexServiceImpl.java index 9ed81a7..7e76020 100644 --- a/Workspace/Siman-Common/src/org/splat/service/technical/IndexServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/technical/IndexServiceImpl.java @@ -14,7 +14,6 @@ import java.util.List; import java.util.Set; import org.apache.log4j.Logger; - import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Field; import org.apache.lucene.index.CorruptIndexException; @@ -40,93 +39,102 @@ import org.splat.som.Step; */ public class IndexServiceImpl implements IndexService { - private Directory index; - private org.apache.lucene.document.Document body; + /** + * The logger for this service. + */ + private static final Logger LOG = Logger + .getLogger(IndexServiceImpl.class); + + private final static String PROP_INDEX = "index"; + private final static String PROP_REF = "ref"; + private final static String PROP_STATE = "state"; + private final static String PROP_AUTHOR = "author"; + private final static String PROP_TITLE = "title"; + + private transient Directory _index; + private transient org.apache.lucene.document.Document _body; private ProjectElementService _projectElementService; private RepositoryService _repositoryService; protected static StandardAnalyzer analyzer = new StandardAnalyzer( Version.LUCENE_29); - private static final Logger logger = Logger - .getLogger(IndexServiceImpl.class); - private class Entry extends IndexWriter { - private org.apache.lucene.document.Document entry; + private transient final org.apache.lucene.document.Document _entry; - private Entry(Study study) throws CorruptIndexException, + private Entry(final Study study) throws CorruptIndexException, LockObtainFailedException, IOException { - super(index, analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED); + super(_index, analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED); // Addition of mandatory fields - entry = new org.apache.lucene.document.Document(); + _entry = new org.apache.lucene.document.Document(); Field field; - field = body.getField("index"); + field = _body.getField(PROP_INDEX); field.setValue(String.valueOf(study.getIndex())); - entry.add(field); - field = body.getField("class"); + _entry.add(field); + field = _body.getField("class"); field.setValue("Study"); - entry.add(field); - field = body.getField("type"); + _entry.add(field); + field = _body.getField("type"); field.setValue(""); // Reserved for configurable Study type - entry.add(field); - field = body.getField("ref"); + _entry.add(field); + field = _body.getField(PROP_REF); field.setValue(study.getReference()); - entry.add(field); - field = body.getField("area"); + _entry.add(field); + field = _body.getField("area"); field.setValue(study.getVisibility().toString()); - entry.add(field); - field = body.getField("state"); + _entry.add(field); + field = _body.getField(PROP_STATE); field.setValue(study.getProgressState().toString()); - entry.add(field); - field = body.getField("author"); + _entry.add(field); + field = _body.getField(PROP_AUTHOR); field.setValue(study.getAuthor().toString()); - entry.add(field); - field = body.getField("title"); + _entry.add(field); + field = _body.getField(PROP_TITLE); field.setValue(study.getTitle()); - entry.add(field); - field = body.getField("contents"); + _entry.add(field); + field = _body.getField("contents"); field.setValue(study.getTitle()); - entry.add(field); + _entry.add(field); // Addition of optional fields setActorsOf(study); setContextAt(getProjectElementService().getSteps(study)); } - private Entry(KnowledgeElement kelm) throws CorruptIndexException, + private Entry(final KnowledgeElement kelm) throws CorruptIndexException, LockObtainFailedException, IOException { - super(index, analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED); + super(_index, analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED); // Addition of mandatory fields - entry = new org.apache.lucene.document.Document(); + _entry = new org.apache.lucene.document.Document(); Field field; - field = body.getField("index"); + field = _body.getField(PROP_INDEX); field.setValue(String.valueOf(kelm.getIndex())); - entry.add(field); - field = body.getField("class"); + _entry.add(field); + field = _body.getField("class"); field.setValue("KnowledgeElement"); - entry.add(field); - field = body.getField("type"); + _entry.add(field); + field = _body.getField("type"); field.setValue(kelm.getType().getName()); - entry.add(field); - field = body.getField("ref"); + _entry.add(field); + field = _body.getField(PROP_REF); field.setValue(kelm.getReference()); - entry.add(field); - field = body.getField("area"); + _entry.add(field); + field = _body.getField("area"); field.setValue(kelm.getVisibility().toString()); - entry.add(field); - field = body.getField("state"); + _entry.add(field); + field = _body.getField(PROP_STATE); field.setValue(kelm.getProgressState().toString()); - entry.add(field); - field = body.getField("author"); + _entry.add(field); + field = _body.getField(PROP_AUTHOR); field.setValue(kelm.getAuthor().toString()); - entry.add(field); - field = body.getField("title"); + _entry.add(field); + field = _body.getField(PROP_TITLE); field.setValue(kelm.getTitle()); - entry.add(field); - field = body.getField("contents"); + _entry.add(field); + field = _body.getField("contents"); field.setValue(kelm.getTitle()); - entry.add(field); + _entry.add(field); // TODO: Addition of optional fields Scenario scene = kelm.getOwnerScenario(); @@ -137,22 +145,22 @@ public class IndexServiceImpl implements IndexService { } private void add() throws CorruptIndexException, IOException { - addDocument(entry); + addDocument(_entry); // Save the new entry optimize(); // Should be called before committing the index close(); // Commits the index } private void update() throws CorruptIndexException, IOException { - String value = entry.getField("ref").stringValue(); // Only field with unique value - Term term = new Term("ref").createTerm(value); - updateDocument(term, entry); + String value = _entry.getField(PROP_REF).stringValue(); // Only field with unique value + Term term = new Term(PROP_REF).createTerm(value); + updateDocument(term, _entry); // Save the updated entry optimize(); // Should be called before committing the index close(); // Commits the index } - private void setContextAt(Step[] step) { + private void setContextAt(final Step[] step) { for (int i = 0; i < step.length; i++) { List contexts = step[i] .getAllSimulationContexts(); @@ -161,72 +169,71 @@ public class IndexServiceImpl implements IndexService { SimulationContext context = j.next(); String type = String.valueOf(context.getType().getIndex()); String value = context.getValue(); - entry.add(new Field(type, value, Field.Store.NO, + _entry.add(new Field(type, value, Field.Store.NO, Field.Index.NOT_ANALYZED)); } } } - private void setActorsOf(Study study) { + private void setActorsOf(final Study study) { // RKV: This set is always not null. Let's assume that it must be initialized before reindexing: Set actors = // study.getActors(); Set actors = study.getActor(); // RKV - if (logger.isDebugEnabled()) { - logger.debug("Study " + study.getReference() + if (LOG.isDebugEnabled()) { + LOG.debug("Study " + study.getReference() + " actors number to be added to the lucen index: " + actors.size()); } for (Iterator i = actors.iterator(); i.hasNext();) { String value = i.next().toString(); - entry.add(new Field("actor", value, Field.Store.NO, + _entry.add(new Field("actor", value, Field.Store.NO, Field.Index.NOT_ANALYZED)); - if (logger.isDebugEnabled()) { - logger.debug(" actor added to the lucen index: " + value); + if (LOG.isDebugEnabled()) { + LOG.debug(" actor added to the lucen index: " + value); } } } } public static class ObjectProxy implements Proxy, Serializable { - // -------------------------------------------------------------- - private Long rid; - private String sid; - private ProgressState state; - private String title; - private String type; - private String name; + private transient final Long _rid; + private transient final String _sid; + private transient final ProgressState _state; + private transient final String _title; + private transient String _type; + private transient final String _name; private static final long serialVersionUID = -4386494192709562221L; - public ObjectProxy(org.apache.lucene.document.Document ludoc) { - rid = Long.valueOf(ludoc.get("index")); - sid = ludoc.get("ref"); - state = ProgressState.valueOf(ludoc.get("state")); - title = ludoc.get("title"); - name = ludoc.get("author"); + public ObjectProxy(final org.apache.lucene.document.Document ludoc) { + _rid = Long.valueOf(ludoc.get(PROP_INDEX)); + _sid = ludoc.get(PROP_REF); + _state = ProgressState.valueOf(ludoc.get(PROP_STATE)); + _title = ludoc.get(PROP_TITLE); + _name = ludoc.get(PROP_AUTHOR); } public String getAuthorName() { - return name; + return _name; } public Long getIndex() { - return rid; + return _rid; } public ProgressState getProgressState() { - return state; + return _state; } public String getReference() { - return sid; + return _sid; } public String getTitle() { - return title; + return _title; } public String getType() { - return type; + return _type; } } @@ -236,35 +243,35 @@ public class IndexServiceImpl implements IndexService { public void configure() throws IOException { File indir = getRepositoryService().getRepositoryIndexDirectory(); - index = FSDirectory.open(indir); - body = new org.apache.lucene.document.Document(); - body.add(new Field("index", "", Field.Store.YES, + _index = FSDirectory.open(indir); + _body = new org.apache.lucene.document.Document(); + _body.add(new Field(PROP_INDEX, "", Field.Store.YES, Field.Index.NOT_ANALYZED)); - body.add(new Field("class", "", Field.Store.NO, + _body.add(new Field("class", "", Field.Store.NO, Field.Index.NOT_ANALYZED)); - body.add(new Field("type", "", Field.Store.YES, + _body.add(new Field("type", "", Field.Store.YES, Field.Index.NOT_ANALYZED)); - body - .add(new Field("ref", "", Field.Store.YES, + _body + .add(new Field(PROP_REF, "", Field.Store.YES, Field.Index.NOT_ANALYZED)); - body + _body .add(new Field("area", "", Field.Store.NO, Field.Index.NOT_ANALYZED)); - body.add(new Field("state", "", Field.Store.YES, + _body.add(new Field(PROP_STATE, "", Field.Store.YES, Field.Index.NOT_ANALYZED)); - body.add(new Field("author", "", Field.Store.YES, + _body.add(new Field(PROP_AUTHOR, "", Field.Store.YES, Field.Index.NOT_ANALYZED)); - body.add(new Field("title", "", Field.Store.YES, + _body.add(new Field(PROP_TITLE, "", Field.Store.YES, Field.Index.NOT_ANALYZED)); - body + _body .add(new Field("contents", "", Field.Store.NO, Field.Index.ANALYZED)); - if (!this.exists()) + if (!this.exists()) { this.create(); // Happens when re-indexing all studies + } } public void create() throws IOException { - // ------------------------------- Directory index = FSDirectory.open(getRepositoryService() .getRepositoryIndexDirectory()); IndexWriter writer = new IndexWriter(index, analyzer, true, @@ -276,49 +283,45 @@ public class IndexServiceImpl implements IndexService { // Member functions // ============================================================================================================================== - public void add(Study study) throws IOException { - // -------------------------------- + public void add(final Study study) throws IOException { IndexServiceImpl.Entry entry = new Entry(study); entry.add(); - if (logger.isInfoEnabled()) { - logger.info("Study \"" + study.getIndex() + "\" indexed."); + if (LOG.isInfoEnabled()) { + LOG.info("Study \"" + study.getIndex() + "\" indexed."); } } - public void add(KnowledgeElement kelm) throws IOException { - // ------------------------------------------ + public void add(final KnowledgeElement kelm) throws IOException { IndexServiceImpl.Entry entry = new Entry(kelm); entry.add(); - if (logger.isInfoEnabled()) { - logger.info("Knowledge \"" + kelm.getIndex() + "\" indexed."); + if (LOG.isInfoEnabled()) { + LOG.info("Knowledge \"" + kelm.getIndex() + "\" indexed."); } } public boolean exists() { - // --------------------------- + boolean res = false; try { - return IndexReader.indexExists(index); + res = IndexReader.indexExists(_index); } catch (IOException error) { - error.printStackTrace(); - return false; + LOG.error(error.getMessage(), error); } + return res; } - public void update(Study study) throws IOException { - // ----------------------------------- + public void update(final Study study) throws IOException { IndexServiceImpl.Entry entry = new Entry(study); entry.update(); - if (logger.isInfoEnabled()) { - logger.info("Study \"" + study.getIndex() + "\" re-indexed."); + if (LOG.isInfoEnabled()) { + LOG.info("Study \"" + study.getIndex() + "\" re-indexed."); } } - public void update(KnowledgeElement kelm) throws IOException { - // --------------------------------------------- + public void update(final KnowledgeElement kelm) throws IOException { IndexServiceImpl.Entry entry = new Entry(kelm); entry.update(); - if (logger.isInfoEnabled()) { - logger.info("Knowledge \"" + kelm.getIndex() + "\" re-indexed."); + if (LOG.isInfoEnabled()) { + LOG.info("Knowledge \"" + kelm.getIndex() + "\" re-indexed."); } } @@ -338,7 +341,7 @@ public class IndexServiceImpl implements IndexService { * the projectElementService to set */ public void setProjectElementService( - ProjectElementService projectElementService) { + final ProjectElementService projectElementService) { _projectElementService = projectElementService; } @@ -357,7 +360,7 @@ public class IndexServiceImpl implements IndexService { * @param repositoryService * the repositoryService to set */ - public void setRepositoryService(RepositoryService repositoryService) { + public void setRepositoryService(final RepositoryService repositoryService) { _repositoryService = repositoryService; } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsService.java b/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsService.java index c6f4f97..b3c32c7 100644 --- a/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsService.java +++ b/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsService.java @@ -27,24 +27,24 @@ public interface ProjectSettingsService { /** * Transient study step data. */ - public static class Step { + class Step { /** * The sequential number of the step. */ - int number; + private int _number; /** * The owner of the step: study or scenario. */ - private Class level; + private Class _level; /** * Set of Document and/or Knowledge applicable on this step. */ - Set> contents; + protected Set> _contents; /** * Data path for this step. */ - private String path; + private String _path; /** * Create a transient study step definition. @@ -78,7 +78,7 @@ public interface ProjectSettingsService { final Class level, final Class contents, final String path) { this.initialize(number, level, path); - this.contents.add(contents); + this._contents.add(contents); } /** @@ -93,10 +93,10 @@ public interface ProjectSettingsService { */ private void initialize(final int number, final Class level, final String path) { - this.number = number; - this.level = level; - this.path = path + "/"; - this.contents = new HashSet>(); + this._number = number; + this._level = level; + this._path = path + "/"; + this._contents = new HashSet>(); } /** @@ -107,7 +107,7 @@ public interface ProjectSettingsService { * @return true if the step is applied to the given level */ public boolean appliesTo(final Class level) { - return (level == this.level); + return (level == this._level); } /** @@ -118,7 +118,7 @@ public interface ProjectSettingsService { * @return true if the step can contain data of the given type */ public boolean mayContain(final Class type) { - return contents.contains(type); + return _contents.contains(type); } /** @@ -127,7 +127,7 @@ public interface ProjectSettingsService { * @return the sequential number of the step */ public int getNumber() { - return number; + return _number; } /** @@ -136,7 +136,7 @@ public interface ProjectSettingsService { * @return data path for this step */ public String getPath() { - return path; + return _path; } } @@ -146,7 +146,7 @@ public interface ProjectSettingsService { * * @return the validation cycles of the workflow */ - public List getAllValidationCycles(); + List getAllValidationCycles(); /** * Get a study step by its sequential number. @@ -155,14 +155,14 @@ public interface ProjectSettingsService { * the step number * @return the step */ - public ProjectSettingsService.Step getStep(final int number); + ProjectSettingsService.Step getStep(final int number); /** * Get ordered list of (transient) study steps. * * @return the list of steps from project settings */ - public List getAllSteps(); + List getAllSteps(); /** * Get file naming scheme setting. @@ -170,21 +170,21 @@ public interface ProjectSettingsService { * @return file naming scheme * @see org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming */ - public FileNaming getFileNamingScheme(); + FileNaming getFileNamingScheme(); /** * Get a pattern of study references. * * @return the reference pattern */ - public String getReferencePattern(); + String getReferencePattern(); /** * Get a pattern of the presentation of version numbers. * * @return the version numbers presentation pattern */ - public String getRevisionPattern(); + String getRevisionPattern(); /** * Load workflow configuration from the given file.
Create necessary default staff in the database if it is not initialized yet. @@ -196,7 +196,7 @@ public interface ProjectSettingsService { * @throws SQLException * if there is a database population problem */ - public void configure(String filename) throws IOException, SQLException; + void configure(String filename) throws IOException, SQLException; /** * Get steps of the given project element (study or scenario). @@ -205,6 +205,6 @@ public interface ProjectSettingsService { * the project element (study or scenario) * @return the list of steps */ - public List getStepsOf( + List getStepsOf( Class level); } diff --git a/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java index b537b10..14e6e66 100644 --- a/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java @@ -10,13 +10,14 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.sql.SQLException; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Properties; import java.util.Set; -import java.util.Vector; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -48,56 +49,56 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { /** * The logger for the service. */ - protected final static Logger logger = Logger + protected final static Logger LOG = Logger .getLogger(ProjectSettingsServiceImpl.class); // Non persistent configuration information /** * Repository settings. */ - private final Properties reprop = new Properties(); + private transient final Properties _reprop = new Properties(); /** * Pattern of study references. */ - private String pattern; + private transient String _pattern; /** * Scheme of file names stored into the repository. */ - private FileNaming naming; + private transient FileNaming _naming; /** * Pattern of the presentation of version numbers. */ - private String versioning; + private transient String _versioning; /** * Ordered list of (transient) study steps. */ - private final Vector steps = new Vector(); + private transient final List _steps = new ArrayList(); /** * Configuration document validation cycles. */ - private Vector concycles; + private transient List _concycles; // Temporary attributes initialized from the configuration file for populating the database with object types /** * Document type names and uses mapping. */ - private LinkedHashMap mapuse; + private transient Map _mapuse; /** * Simulation Context type names. */ - private Vector context; + private transient List _context; /** * Knowledge Element type names. */ - private Vector kname; + private transient List _kname; /** * Document flows. */ - private Vector flows; + private transient List _flows; /** * Study classifications. */ - private Vector sclass; + private transient List _sclass; // Other resources /** @@ -128,18 +129,18 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { /** * Cycle (document) type name. */ - private final String name; + private final String _name; /** * Array of cycle actors positions in the organization. TODO: Must be replaced by Roles. */ - private final Actor[] actor; + private final Actor[] _actor; /** * Default constructor. */ private ProjectSettingsValidationCycle() { - this.name = "built-in"; - this.actor = new Actor[] { null, null, null }; + this._name = "built-in"; + this._actor = new Actor[] { null, null, null }; } /** @@ -152,8 +153,8 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { */ private ProjectSettingsValidationCycle(final String name, final Actor[] actor) { - this.name = name; - this.actor = actor; + this._name = name; + this._actor = actor; } /** @@ -162,7 +163,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * @return the document type name */ public String getName() { - return name; + return _name; } /** @@ -172,7 +173,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * @see org.splat.dal.bo.som.ValidationCycle.Actor */ public Actor[] getActorTypes() { - return actor; + return _actor; } } @@ -192,7 +193,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { */ public void configure(final String filename) throws IOException, SQLException { - if (!steps.isEmpty()) { + if (!_steps.isEmpty()) { return; // Project already configured } @@ -201,11 +202,11 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { if (config.exists()) { loadCustomization(config); } else { - logger.fatal("Could not find the database configuration file \"" + LOG.fatal("Could not find the database configuration file \"" + config.getAbsolutePath() + "\""); throw new FileNotFoundException(); } - base.configure(reprop); + base.configure(_reprop); if (!base.isInitialized()) { base.initialize(); initialize(); // Populates the database with all necessary stuff @@ -218,7 +219,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * @return the list of steps from project settings */ public List getAllSteps() { - return steps; + return _steps; } /** @@ -228,7 +229,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * @return the validation cycles of the workflow */ public List getAllValidationCycles() { - return concycles; + return _concycles; } /** @@ -238,7 +239,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * @see org.splat.service.technical.ProjectSettingsServiceImpl.FileNaming */ public FileNaming getFileNamingScheme() { - return naming; + return _naming; } /** @@ -247,7 +248,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * @return the reference pattern */ public String getReferencePattern() { - return pattern; + return _pattern; } /** @@ -256,7 +257,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * @return the version numbers presentation pattern */ public String getRevisionPattern() { - return versioning; + return _versioning; } /** @@ -267,13 +268,15 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * @return the step */ public ProjectSettingsService.Step getStep(final int number) { - for (int i = 0; i < steps.size(); i++) { - ProjectSettingsService.Step step = steps.get(i); - if (step.number == number) { - return step; + ProjectSettingsService.Step res = null; + for (int i = 0; i < _steps.size(); i++) { + ProjectSettingsService.Step step = _steps.get(i); + if (step.getNumber() == number) { + res = step; + break; } } - return null; + return res; } /** @@ -285,10 +288,10 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { */ public List getStepsOf( final Class level) { - Vector result = new Vector(); + List result = new ArrayList(); - for (int i = 0; i < steps.size(); i++) { - ProjectSettingsService.Step step = steps.get(i); + for (int i = 0; i < _steps.size(); i++) { + ProjectSettingsService.Step step = _steps.get(i); if (step.appliesTo(level)) { result.add(step); } @@ -334,29 +337,29 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { if (!disk.endsWith("/")) { disk = disk + "/"; } - logger.info("Database root set to " + disk); - reprop.setProperty("repository", disk); + LOG.info("Database root set to " + disk); + _reprop.setProperty("repository", disk); // Formats tag initializing the reference pattern and date attributes child = children.get("formats"); datag = XDOM.getNamedChildNodes(child); NamedNodeMap natr = datag.get("references").getAttributes(); - pattern = natr.getNamedItem("study").getNodeValue(); + _pattern = natr.getNamedItem("study").getNodeValue(); natr = datag.get("files").getAttributes(); - naming = FileNaming.valueOf(natr.getNamedItem("name") + _naming = FileNaming.valueOf(natr.getNamedItem("name") .getNodeValue()); natr = datag.get("versions").getAttributes(); - versioning = natr.getNamedItem("pattern").getNodeValue(); + _versioning = natr.getNamedItem("pattern").getNodeValue(); // Activities tag initializing the steps and rex attributes child = children.get("activities"); NodeList nlist = child.getChildNodes(); - Vector flist = new Vector(); - Vector resultype = new Vector(); - Vector clist = new Vector(); + List flist = new ArrayList(); + List resultype = new ArrayList(); + List clist = new ArrayList(); int snum = 1; // Base number of steps for (int i = 0; i < nlist.getLength(); i++) { @@ -385,20 +388,20 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { } child = tags.get("classification"); - if (child != null) { - clist.add(child.getAttributes()); - } else { + if (child == null) { clist.add(null); + } else { + clist.add(child.getAttributes()); } if (natr.getNamedItem("contents").getNodeValue() .equals("knowledge")) { // TODO In a given scenario, only one step must contain knowledges - step.contents.add(KnowledgeElement.class); + step._contents.add(KnowledgeElement.class); } else { - step.contents.add(Document.class); + step._contents.add(Document.class); } - steps.add(step); + _steps.add(step); snum += 1; } } else { @@ -421,25 +424,26 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { } child = tags.get("classification"); // Optional information - if (child != null) { - clist.add(child.getAttributes()); - } else { + if (child == null) { clist.add(null); + } else { + clist.add(child.getAttributes()); } if (natr.getNamedItem("contents").getNodeValue().equals( "knowledge")) { // TODO Error: knowledges must be attached to scenarios + LOG.error("Error: knowledges must be attached to scenarios."); } else { - step.contents.add(Document.class); + step._contents.add(Document.class); } - steps.add(step); + _steps.add(step); snum += 1; } } // Validations tag child = children.get("validations"); - concycles = new Vector(); + _concycles = new ArrayList(); datag = XDOM.getNamedChildNodes(child); String[] step = { "review", "approval", "acceptance" }; @@ -459,9 +463,9 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { } actor[j] = Actor.valueOf(child.getNodeValue()); } - concycles.add(new ProjectSettingsValidationCycle(name, actor)); + _concycles.add(new ProjectSettingsValidationCycle(name, actor)); } - concycles.add(new ProjectSettingsValidationCycle()); // Adds the built-in validation cycle + _concycles.add(new ProjectSettingsValidationCycle()); // Adds the built-in validation cycle if (getDatabase().getCheckedDB().isInitialized()) { return; // No need to load object type definitions as they are already stored @@ -471,9 +475,9 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { child = children.get("documents"); nlist = child.getChildNodes(); - flows = flist; // Kept for later use in document type definition - sclass = clist; // Kept for later use in simulation context type definition - mapuse = new LinkedHashMap(); + _flows = flist; // Kept for later use in document type definition + _sclass = clist; // Kept for later use in simulation context type definition + _mapuse = new LinkedHashMap(); for (int i = 0; i < nlist.getLength(); i++) { child = nlist.item(i); if (!child.getNodeName().equals("article")) { @@ -487,38 +491,38 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { if (child != null) { uses = child.getNodeValue(); } - mapuse.put(type, uses); // Must be added to the map even if no (null) uses + _mapuse.put(type, uses); // Must be added to the map even if no (null) uses } // Simulation Contexts tag child = children.get("contexts"); nlist = child.getChildNodes(); - context = new Vector(); + _context = new ArrayList(); for (int i = 0; i < nlist.getLength(); i++) { child = nlist.item(i); if (!child.getNodeName().equals("article")) { continue; } - context.add(child.getAttributes().getNamedItem("type") + _context.add(child.getAttributes().getNamedItem("type") .getNodeValue()); } // Knowledge Elements tag child = children.get("knowledges"); nlist = child.getChildNodes(); - kname = new Vector(); + _kname = new ArrayList(); for (int i = 0; i < nlist.getLength(); i++) { child = nlist.item(i); if (!child.getNodeName().equals("article")) { continue; } - kname.add(child.getAttributes().getNamedItem("type") + _kname.add(child.getAttributes().getNamedItem("type") .getNodeValue()); } } catch (Exception error) { - logger.info("Error in customization", error); + LOG.info("Error in customization", error); } } @@ -527,28 +531,28 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { */ private void createDocumentTypes() { DocumentType.Properties tprop = new DocumentType.Properties(); - HashMap> mapsteps = new HashMap>(); - HashMap mapresult = new HashMap(); - HashMap maptype = new HashMap(); + Map> mapsteps = new HashMap>(); + Map mapresult = new HashMap(); + Map maptype = new HashMap(); - Vector slist = null; // List of Steps to which each document type is valid + List slist = null; // List of Steps to which each document type is valid int snum = 0; // Step number String type = null; String uses = null; - for (Iterator i = flows.iterator(); i.hasNext(); snum++) { + for (Iterator i = _flows.iterator(); i.hasNext(); snum++) { NamedNodeMap flow = i.next(); - ProjectSettingsService.Step step = steps.get(snum); + ProjectSettingsService.Step step = _steps.get(snum); String[] contents = flow.getNamedItem("contents").getNodeValue() .split(","); for (int j = 0; j < contents.length; j++) { type = contents[j]; - if (!mapuse.containsKey(type)) { - logger.warn("Undefined \"" + type + "\" document type."); + if (!_mapuse.containsKey(type)) { + LOG.warn("Undefined \"" + type + "\" document type."); continue; } slist = mapsteps.get(type); if (slist == null) { - slist = new Vector(); + slist = new ArrayList(); } slist.add(step); mapsteps.put(type, slist); @@ -560,12 +564,12 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { } try { DocumentType tdoc = null; - Set tset = mapuse.keySet(); + Set tset = _mapuse.keySet(); ProjectSettingsService.Step step; for (Iterator i = tset.iterator(); i.hasNext();) { type = i.next(); slist = mapsteps.get(type); - uses = mapuse.get(type); + uses = _mapuse.get(type); step = mapresult.get(type); tprop.clear(); @@ -575,7 +579,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { if (uses != null) { tdoc = maptype.get(uses); if (tdoc == null) { - logger + LOG .warn("Undefined \"" + uses + "\" document type."); } else { @@ -592,7 +596,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { maptype.put(type, tdoc); } } catch (Exception error) { - logger.warn("Error creating document types, reason:", error); // Should not happen + LOG.warn("Error creating document types, reason:", error); // Should not happen } } @@ -604,14 +608,14 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { KnowledgeElementType ktype = getKnowledgeElementTypeService() .createType("usecase"); // Internal reserved knowledge element type getKnowledgeElementTypeService().reserve(ktype); - for (Iterator i = kname.iterator(); i.hasNext();) { + for (Iterator i = _kname.iterator(); i.hasNext();) { String type = i.next(); ktype = getKnowledgeElementTypeService().createType(type); // Knowledge Elements Types defined in the configuration getKnowledgeElementTypeService().approve(ktype); } } catch (Exception error) { - logger.warn("Error creating knowledge types, reason:", error); // Should not happen + LOG.warn("Error creating knowledge types, reason:", error); // Should not happen } } @@ -619,9 +623,9 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { * Create in the database simulation contexts types defined in the custom configuration. */ private void createSimulationContextTypes() { - HashMap mapstep = new HashMap(); + Map mapstep = new HashMap(); int snum = 0; - for (Iterator i = sclass.iterator(); i.hasNext(); snum++) { + for (Iterator i = _sclass.iterator(); i.hasNext(); snum++) { NamedNodeMap clatr = i.next(); if (clatr == null) { continue; @@ -630,15 +634,15 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { String[] clist = clatr.getNamedItem("context").getNodeValue() .split(","); for (int j = 0; j < clist.length; j++) { - mapstep.put(clist[j], steps.get(snum)); + mapstep.put(clist[j], _steps.get(snum)); } } try { SimulationContextType tctex = null; - for (Iterator i = context.iterator(); i.hasNext();) { + for (Iterator i = _context.iterator(); i.hasNext();) { String type = i.next(); if (!mapstep.containsKey(type)) { - logger + LOG .warn("Could not find \"" + type + "\" classification. Simulation Context type ignored."); @@ -649,7 +653,7 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { getSimulationContextTypeService().approve(tctex); } } catch (Exception error) { - logger.warn("Error creating context types, reason:", error); // Should not happen + LOG.warn("Error creating context types, reason:", error); // Should not happen } } diff --git a/Workspace/Siman-Common/src/org/splat/som/ApplicationRights.java b/Workspace/Siman-Common/src/org/splat/som/ApplicationRights.java index 4a4da8a..8c3fe90 100644 --- a/Workspace/Siman-Common/src/org/splat/som/ApplicationRights.java +++ b/Workspace/Siman-Common/src/org/splat/som/ApplicationRights.java @@ -1,4 +1,5 @@ package org.splat.som; + /** * * @author Daniel Brunier-Coulin @@ -11,80 +12,88 @@ import java.util.Set; import org.splat.dal.bo.kernel.Role; import org.splat.dal.bo.kernel.User; - public class ApplicationRights { - private User user; - private Set roles; + private static final String N_1 = "Nx1"; + private static final String N_2 = "Nx2"; + private transient final User _user; + private transient final Set _roles; -// ============================================================================================================================== -// Construction -// ============================================================================================================================== + // ============================================================================================================================== + // Construction + // ============================================================================================================================== - public ApplicationRights (User user) { // Warning: user may be null -// ------------------------------------ - this.roles = new HashSet(); - this.user = user; - if (user != null) { - Role[] role = user.getRoles(); - for (int i=0; i(); + this._user = user; + if (user != null) { + Role[] role = user.getRoles(); + for (int i = 0; i < role.length; i++) { + String iam = role[i].getName(); + _roles.add(iam); + } + } + } -// ============================================================================================================================== -// Public member functions -// ============================================================================================================================== + // ============================================================================================================================== + // Public member functions + // ============================================================================================================================== - public boolean canCreateStudy () { -// -------------------------------- - if (user != null) { - String position = user.getOrganizationName(); - if (position != null && position.equals("Nx2")) return false; - } - return roles.contains(Profile.manager.toString()); - } + public boolean canCreateStudy() { + boolean res = (_user == null); + if (res) { + res = _roles.contains(Profile.manager.toString()); + } else { + String position = _user.getOrganizationName(); + res = (position == null || !position.equals(N_2)); + } + return res; + } - public boolean canContributeToStudy () { -// -------------------------------------- - if (user != null) { - String position = user.getOrganizationName(); - if (position != null && (position.equals("Nx1") || position.equals("Nx2"))) return false; - } - return (roles.contains(Profile.manager.toString()) || roles.contains(Profile.studengineer.toString())); - } + public boolean canContributeToStudy() { + boolean res = (_user == null); + if (res) { + res = (_roles.contains(Profile.manager.toString()) || _roles + .contains(Profile.studengineer.toString())); + } else { + String position = _user.getOrganizationName(); + res = (position == null || ((!position.equals(N_1)) && (!position + .equals(N_2)))); + } + return res; + } - public boolean canValidate () { -// ----------------------------- - return roles.contains(Profile.manager.toString()); - } + public boolean canValidate() { + return _roles.contains(Profile.manager.toString()); + } - public boolean canManageKnowledges () { -// ------------------------------------- - if (user != null) { - String position = user.getOrganizationName(); - if (position != null && position.equals("Nx2")) return false; - } - return roles.contains(Profile.knowledgineer.toString()); - } + public boolean canManageKnowledges() { + boolean res = (_user == null); + if (res) { + res = _roles.contains(Profile.knowledgineer.toString()); + } else { + String position = _user.getOrganizationName(); + res = (position == null || (!position.equals(N_2))); + } + return res; + } - public boolean canManageDatabase () { -// ----------------------------------- - if (user != null) { - String position = user.getOrganizationName(); - if (position != null && position.equals("Nx2")) return false; - } - return roles.contains(Profile.sysadmin.toString()); - } + public boolean canManageDatabase() { + boolean res = (_user == null); + if (res) { + res = _roles.contains(Profile.sysadmin.toString()); + } else { + String position = _user.getOrganizationName(); + res = (position == null || (!position.equals(N_2))); + } + return res; + } -// ============================================================================================================================== -// Getters -// ============================================================================================================================== + // ============================================================================================================================== + // Getters + // ============================================================================================================================== - public User getUser () { -// ---------------------- - return user; // May be null - } + public User getUser() { + return _user; // May be null + } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/som/Revision.java b/Workspace/Siman-Common/src/org/splat/som/Revision.java index bc00b66..6e79a58 100644 --- a/Workspace/Siman-Common/src/org/splat/som/Revision.java +++ b/Workspace/Siman-Common/src/org/splat/som/Revision.java @@ -18,21 +18,20 @@ import org.splat.dal.bo.som.ProgressState; public class Revision { - private int major; - private int minor; - private int branch; + private transient int _major; + private transient int _minor; + private transient int _branch; public static class Format { -// -------------------------- - private String pattern; + private transient final String _pattern; - public Format (String pattern) { - this.pattern = pattern; + public Format (final String pattern) { + this._pattern = pattern; } - public String format (String verstring) { - CharBuffer version = CharBuffer.allocate(pattern.length() + 2*2); // Maximum possible size - char[] format = pattern.toCharArray(); + public String format (final String verstring) { + CharBuffer version = CharBuffer.allocate(_pattern.length() + 2*2); // Maximum possible size + char[] format = _pattern.toCharArray(); String[] vernum = verstring.split("\\x2E"); // version is suposed of the internal form (m.n.s) int branch = Integer.valueOf(vernum[2]); @@ -49,7 +48,11 @@ public class Revision { version.put(vernum[2]); } } else if (token == '[') { - if (branch == 0) while (format[i] != ']') i += 1; + if (branch == 0) { + while (format[i] != ']') { + i += 1; + } + } } else if (token == ']') { continue; } else { @@ -59,8 +62,8 @@ public class Revision { return new String(version.array(), 0, version.position()); } - public Revision parse (String verstring) throws ParseException { - char[] format = pattern.toCharArray(); + public Revision parse (final String verstring) throws ParseException { + char[] format = _pattern.toCharArray(); char[] version = verstring.toCharArray(); CharBuffer major = CharBuffer.allocate(4); CharBuffer minor = CharBuffer.allocate(4); @@ -74,19 +77,25 @@ public class Revision { token = format[i]; if (token == 'M') { while (cursor < version.length) { - if (!Character.isDigit(version[cursor])) break; + if (!Character.isDigit(version[cursor])) { + break; + } major.put(version[cursor]); cursor += 1; } } else if (token == 'm') { while (cursor < version.length) { - if (!Character.isDigit(version[cursor])) break; + if (!Character.isDigit(version[cursor])) { + break; + } minor.put(version[cursor]); cursor += 1; } } else if (token == 's') { while (cursor < version.length) { - if (!Character.isDigit(version[cursor])) break; + if (!Character.isDigit(version[cursor])) { + break; + } branch.put(version[cursor]); cursor += 1; } @@ -94,12 +103,18 @@ public class Revision { } else if (token == '[' || token == ']') { continue; } else { - if (version[cursor] != token) throw new ParseException(verstring, cursor); + if (version[cursor] != token) { + throw new ParseException(verstring, cursor); + } cursor += 1; } - if (cursor >= version.length) break; + if (cursor >= version.length) { + break; + } } - if (major.position() == 0) throw new ParseException(verstring, 0); + if (major.position() == 0) { + throw new ParseException(verstring, 0); + } String majnum = new String(major.array(), 0, major.position()); if (minor.position() == 0) { @@ -116,7 +131,7 @@ public class Revision { } public String toPattern () { - return pattern; + return _pattern; } } @@ -126,68 +141,73 @@ public class Revision { /** * Constructs a Revision object from the internal representation of a version number (m.n.s). */ - public Revision (String value) { + public Revision (final String value) { // ------------------------------ String[] vernum = value.split("\\x2E"); try { - this.major = Integer.valueOf(vernum[0]); - this.minor = Integer.valueOf(vernum[1]); - this.branch = Integer.valueOf(vernum[2]); + this._major = Integer.valueOf(vernum[0]); + this._minor = Integer.valueOf(vernum[1]); + this._branch = Integer.valueOf(vernum[2]); } catch (Exception e) { // NumberFormat or OutOfBound exception if value is not of the form m.n.s - this.major = 0; - this.minor = 0; - this.branch = 0; + this._major = 0; + this._minor = 0; + this._branch = 0; } } public Revision () { // ------------------ - this.major = 0; - this.minor = 0; - this.branch = 0; + this._major = 0; + this._minor = 0; + this._branch = 0; } - private Revision (int major, int minor) { + private Revision (final int major, final int minor) { // --------------------------------------- - this.major = major; - this.minor = minor; - this.branch = 0; + this._major = major; + this._minor = minor; + this._branch = 0; } - private Revision (int major, int minor, String branch) { + private Revision (final int major, final int minor, final String branch) { // ------------------------------------------------------ - this.major = major; - this.minor = minor; - this.branch = Integer.valueOf(branch); + this._major = major; + this._minor = minor; + this._branch = Integer.valueOf(branch); } // ============================================================================================================================== // Public member function // ============================================================================================================================== - public Revision incrementAs (ProgressState state) { + public Revision incrementAs (final ProgressState state) { // ------------------------------------------------- - if (state == ProgressState.inWORK || state == ProgressState.inDRAFT) minor += 1; - else if (state == ProgressState.inCHECK) { - major = major + 1; - minor = 0; + if (state == ProgressState.inWORK || state == ProgressState.inDRAFT) { + _minor += 1; + } else if (state == ProgressState.inCHECK) { + _major = _major + 1; + _minor = 0; } return this; } - public boolean isGraterThan (Revision base) { + public boolean isGraterThan (final Revision base) { // ------------------------------------------ - if (this.major > base.major) return true; - if (this.major < base.major) return false; - return (this.minor > base.minor); + if (this._major > base._major) { + return true; + } + if (this._major < base._major) { + return false; + } + return (this._minor > base._minor); } public boolean isMinor () { // ------------------------- - return (minor != 0); + return (_minor != 0); } public boolean isNull () { // ------------------------ - return (major+minor == 0); + return (_major+_minor == 0); } /** * Sets the branch name of this revision. @@ -195,19 +215,20 @@ public class Revision { * @param name the branch name or the internal representation of a version number (m.n.s) * @return this revision object */ - public Revision setBranch (String name) { + public Revision setBranch (final String name) { // --------------------------------------- String[] vernum = name.split("\\x2E"); - branch = Integer.valueOf(vernum[vernum.length-1]); + _branch = Integer.valueOf(vernum[vernum.length-1]); return this; } /** * Returns the internal representation of a version number (m.n.s) represented by this Revision object. */ - public String toString () { + @Override + public String toString () { // ------------------------- StringBuffer version = new StringBuffer(); - return version.append(major).append(".").append(minor).append(".").append(branch).toString(); + return version.append(_major).append(".").append(_minor).append(".").append(_branch).toString(); } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/som/Step.java b/Workspace/Siman-Common/src/org/splat/som/Step.java index 83cc7e2..b8a5cd7 100644 --- a/Workspace/Siman-Common/src/org/splat/som/Step.java +++ b/Workspace/Siman-Common/src/org/splat/som/Step.java @@ -6,10 +6,10 @@ package org.splat.som; * @copyright OPEN CASCADE 2012 */ +import java.util.ArrayList; import java.util.Collections; -import java.util.List; -import java.util.Vector; import java.util.Iterator; +import java.util.List; import org.splat.dal.bo.kernel.User; import org.splat.dal.bo.som.Document; @@ -26,38 +26,41 @@ import org.splat.service.technical.ProjectSettingsService; public class Step { - private ProjectSettingsService.Step step; - private ProjectElement owner; - private List contex; - private List docums; - private User actor; // Actor involved in operations on published documents and requiring a time-stamp + private transient final ProjectSettingsService.Step _step; + private transient final ProjectElement _owner; + private transient final List _contex; + private transient final List _docums; + private User _actor; // Actor involved in operations on published documents and requiring a time-stamp // ============================================================================================================================== // Constructor // ============================================================================================================================== - public Step(ProjectSettingsService.Step step, ProjectElement owner) { - // ---------------------------------------------------------------- - this.step = step; - this.owner = owner; - this.contex = new Vector(); - this.docums = new Vector(); - this.actor = null; + public Step(final ProjectSettingsService.Step step, + final ProjectElement owner) { + this._step = step; + this._owner = owner; + this._contex = new ArrayList(); + this._docums = new ArrayList(); + this._actor = null; // Filtering of Simulation contexts, if exist for (Iterator i = owner.SimulationContextIterator(); i .hasNext();) { SimulationContext adoc = i.next(); - if (!adoc.isInto(this)) + if (!adoc.isInto(this)) { continue; - this.contex.add(adoc); + } + this._contex.add(adoc); } // Filtering of Documents, if exist for (Iterator i = owner.PublicationIterator(); i.hasNext();) { Publication mydoc = i.next(); - if (!mydoc.value().isInto(this)) + if (!mydoc.value().isInto(this)) { continue; - this.docums.add(mydoc); + } + mydoc.setStep(this); //RKV + this._docums.add(mydoc); } } @@ -66,161 +69,161 @@ public class Step { // ============================================================================================================================== public User getActor() { - // ----------------------- - return actor; + return _actor; } public List getAllDocuments() { - // ------------------------------------------- - return Collections.unmodifiableList(docums); + return Collections.unmodifiableList(_docums); } /** * Get the persistent collection of step documents. + * * @return the list of documents */ public List getDocuments() { - return docums; + return _docums; } public List getAllSimulationContexts() { - // ---------------------------------------------------------- - return Collections.unmodifiableList(contex); + return Collections.unmodifiableList(_contex); } - public Publication getDocument(long l) { - // ------------------------------------------ - for (Iterator i = docums.iterator(); i.hasNext();) { + public Publication getDocument(final long docId) { + for (Iterator i = _docums.iterator(); i.hasNext();) { Publication found = i.next(); // In a given study step, - if (found.value().getIndex() == l) + if (found.value().getIndex() == docId) { return found; // there is only one publication of a given document + } } return null; } public int getNumber() { - // ----------------------- - return step.getNumber(); + return _step.getNumber(); } public ProjectElement getOwner() { - // --------------------------------- - return owner; // May be a Study or a Scenario + return _owner; // May be a Study or a Scenario } public Study getOwnerStudy() { - // ----------------------------- - if (owner instanceof Study) - return (Study) owner; - else - return ((Scenario) owner).getOwnerStudy(); + if (_owner instanceof Study) { + return (Study) _owner; + } else { + return ((Scenario) _owner).getOwnerStudy(); + } } public String getPath() { - // ------------------------ - return step.getPath(); + return _step.getPath(); } public List getResultDocuments() { - // ---------------------------------------------- - List result = new Vector(); + List result = new ArrayList(); - if (!docums.isEmpty()) - for (Iterator i = docums.iterator(); i.hasNext();) { + if (!_docums.isEmpty()) { + for (Iterator i = _docums.iterator(); i.hasNext();) { Publication content = i.next(); DocumentType type = content.value().getType(); - if (!type.isResultOf(this.getStep())) + if (!type.isResultOf(this.getStep())) { continue; + } result.add(content); } + } return result; } public ProjectSettingsService.Step getStep() { - // -------------------------------------- - return step; + return _step; } - public SimulationContext getSimulationContext(long l) { - // --------------------------------------------------------- - for (Iterator i = owner.SimulationContextIterator(); i + public SimulationContext getSimulationContext(final long l) { + for (Iterator i = _owner.SimulationContextIterator(); i .hasNext();) { SimulationContext myctex = i.next(); - if (myctex.getIndex() == l) + if (myctex.getIndex() == l) { return myctex; + } } return null; } public List getSimulationContext( - SimulationContextType type) { - // -------------------------------------------------------------------------------- - Vector result = new Vector(); + final SimulationContextType type) { + List result = new ArrayList(); - for (Iterator i = owner.SimulationContextIterator(); i + for (Iterator i = _owner.SimulationContextIterator(); i .hasNext();) { SimulationContext myctex = i.next(); - if (myctex.getType().equals(type)) + if (myctex.getType().equals(type)) { result.add(myctex); + } } return result; } public boolean isStarted() { - // --------------------------- - if (!step.mayContain(KnowledgeElement.class)) - return !docums.isEmpty(); - - List kelm = ((Scenario) owner) - .getAllKnowledgeElements(); - if (kelm.isEmpty() && docums.isEmpty()) - return false; - return true; + boolean res = _step.mayContain(KnowledgeElement.class); + if (res) { + List kelm = ((Scenario) _owner) + .getAllKnowledgeElements(); + res = (!kelm.isEmpty() || !_docums.isEmpty()); + } else { + res = (!_docums.isEmpty()); + } + return res; } public boolean isFinished() { - // ---------------------------- - if (!step.mayContain(KnowledgeElement.class)) { // Check if all result documents are approved - if (docums.isEmpty()) + if (_step.mayContain(KnowledgeElement.class)) { // Check if all result documents are approved + List kelm = ((Scenario) _owner) + .getAllKnowledgeElements(); + if (kelm.isEmpty()) { + return false; + } + for (Iterator i = kelm.iterator(); i.hasNext();) { + KnowledgeElement content = i.next(); + if (content.getProgressState() != ProgressState.APPROVED) { + return false; + } + } + return true; + } else { // Check if all existing knowledges are approved + if (_docums.isEmpty()) { return false; + } boolean result = false; - for (Iterator i = docums.iterator(); i.hasNext();) { + for (Iterator i = _docums.iterator(); i.hasNext();) { Document content = i.next().value(); DocumentType type = content.getType(); - if (!type.isResultOf(this.getStep())) + if (!type.isResultOf(this.getStep())) { continue; - if (content.getProgressState() == ProgressState.EXTERN) + } + if (content.getProgressState() == ProgressState.EXTERN) { continue; + } result = true; // There is at least 1 non external result document - if (content.getProgressState() != ProgressState.APPROVED) + if (content.getProgressState() != ProgressState.APPROVED) { return false; + } } return result; - } else { // Check if all existing knowledges are approved - List kelm = ((Scenario) owner) - .getAllKnowledgeElements(); - if (kelm.isEmpty()) - return false; - for (Iterator i = kelm.iterator(); i.hasNext();) { - KnowledgeElement content = i.next(); - if (content.getProgressState() != ProgressState.APPROVED) - return false; - } - return true; } } - public boolean mayContain(@SuppressWarnings("rawtypes") - Class type) { - return step.mayContain(type); + @SuppressWarnings("unchecked") + public boolean mayContain(final Class type) { + return _step.mayContain(type); } - public void setActor(User user) { - actor = user; + public void setActor(final User user) { + _actor = user; } public List getContex() { - return contex; + return _contex; } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/som/StepRights.java b/Workspace/Siman-Common/src/org/splat/som/StepRights.java index 22f462b..b91efd1 100644 --- a/Workspace/Siman-Common/src/org/splat/som/StepRights.java +++ b/Workspace/Siman-Common/src/org/splat/som/StepRights.java @@ -16,17 +16,17 @@ import org.splat.service.ServiceLocatorImpl; public class StepRights { - private User user; - private Step operand; - public StepRights (User user, Step step) { + private final transient User _user; + private final transient Step _operand; + public StepRights (final User user, final Step step) { // ---------------------------------------- - this.user = user; - this.operand = step; + this._user = user; + this._operand = step; } - public StepRights (Step step) { + public StepRights (final Step step) { // ----------------------------- - this.user = step.getOwner().getAuthor(); - this.operand = step; + this._user = step.getOwner().getAuthor(); + this._operand = step; } // ============================================================================================================================== @@ -41,8 +41,8 @@ public class StepRights { */ public boolean canAddComment () { // ------------------------------- - Study owner = operand.getOwnerStudy(); - return (owner.getAuthor().equals(user) || ServiceLocatorImpl.getInstance().getStudyService().hasActor(owner, user)); + Study owner = _operand.getOwnerStudy(); + return (owner.getAuthor().equals(_user) || ServiceLocatorImpl.getInstance().getStudyService().hasActor(owner, _user)); } /** @@ -53,8 +53,10 @@ public class StepRights { */ public boolean canCreateDocument () { // ----------------------------------- - if (!isEnabled()) return false; - return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(operand.getOwnerStudy(), user); + if (!isEnabled()) { + return false; + } + return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(_operand.getOwnerStudy(), _user); } /** @@ -65,7 +67,7 @@ public class StepRights { */ public boolean canCreateKnowledge () { // ------------------------------------ - return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(operand.getOwnerStudy(), user); + return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(_operand.getOwnerStudy(), _user); } /** @@ -76,8 +78,8 @@ public class StepRights { */ public boolean canEditSimulationContext () { // ------------------------------------------ - Study owner = operand.getOwnerStudy(); - return (owner.getAuthor().equals(user) || ServiceLocatorImpl.getInstance().getStudyService().hasActor(owner, user)); + Study owner = _operand.getOwnerStudy(); + return (owner.getAuthor().equals(_user) || ServiceLocatorImpl.getInstance().getStudyService().hasActor(owner, _user)); } /** @@ -88,11 +90,13 @@ public class StepRights { */ public boolean isEnabled () { // --------------------------- - ProjectElement owner = operand.getOwner(); + ProjectElement owner = _operand.getOwner(); if (owner instanceof Scenario) { Scenario scene = (Scenario)owner; - if (scene.isCheckedout()) return false; + if (scene.isCheckedout()) { + return false; + } } return true; } @@ -103,6 +107,6 @@ public class StepRights { public Step getOperand () { // ------------------------- - return operand; + return _operand; } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/som/StudyRights.java b/Workspace/Siman-Common/src/org/splat/som/StudyRights.java index c4bf7f9..7a724e1 100644 --- a/Workspace/Siman-Common/src/org/splat/som/StudyRights.java +++ b/Workspace/Siman-Common/src/org/splat/som/StudyRights.java @@ -16,23 +16,23 @@ import org.splat.service.ServiceLocatorImpl; public class StudyRights { - private User user; - private Study operand; - private boolean author = false; // For optimizing - public StudyRights (User user, Study study) { + private final transient User _user; + private final transient Study _operand; + private transient boolean _author = false; // For optimizing + public StudyRights (final User user, final Study study) { // ------------------------------------------- - this.user = user; - this.operand = study; + this._user = user; + this._operand = study; - if (operand != null && operand.getAuthor() != null) { - this.author = operand.getAuthor().equals(user); // user may be null + if (_operand != null && _operand.getAuthor() != null) { + this._author = _operand.getAuthor().equals(user); // user may be null } } - public StudyRights (Study study) { + public StudyRights (final Study study) { // -------------------------------- - this.user = study.getAuthor(); - this.operand = study; - this.author = true; // In order to ignore the author in this context + this._user = study.getAuthor(); + this._operand = study; + this._author = true; // In order to ignore the author in this context } // ============================================================================================================================== @@ -41,8 +41,10 @@ public class StudyRights { public boolean canAddScenario () { // -------------------------------- - if (operand.getProgressState() != ProgressState.inWORK && operand.getProgressState() != ProgressState.inDRAFT) return false; - return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(operand, user); + if (_operand.getProgressState() != ProgressState.inWORK && _operand.getProgressState() != ProgressState.inDRAFT) { + return false; + } + return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(_operand, _user); } /** @@ -53,12 +55,12 @@ public class StudyRights { */ public boolean canEditDescription () { // ------------------------------------ - return (operand.getAuthor().equals(user) || ServiceLocatorImpl.getInstance().getStudyService().hasActor(operand, user)); + return (_operand.getAuthor().equals(_user) || ServiceLocatorImpl.getInstance().getStudyService().hasActor(_operand, _user)); } public boolean canEditProperties () { // ----------------------------------- - return author; + return _author; } /** @@ -69,26 +71,34 @@ public class StudyRights { */ public boolean canPublish () { // ---------------------------- - if (!author) return false; - return (!operand.isPublic()); + if (!_author) { + return false; + } + return (!_operand.isPublic()); } public boolean canPurge () { // -------------------------- - if (!author) return false; - return operand.isVersioned(); + if (!_author) { + return false; + } + return _operand.isVersioned(); } public boolean canRemove () { // --------------------------- - if (operand.getProgressState() != ProgressState.inWORK && operand.getProgressState() != ProgressState.inDRAFT) return false; - return author; + if (_operand.getProgressState() != ProgressState.inWORK && _operand.getProgressState() != ProgressState.inDRAFT) { + return false; + } + return _author; } public boolean canVersion () { // ---------------------------- - if (operand.getProgressState() != ProgressState.inWORK && operand.getProgressState() != ProgressState.inDRAFT) return false; - return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(operand, user); + if (_operand.getProgressState() != ProgressState.inWORK && _operand.getProgressState() != ProgressState.inDRAFT) { + return false; + } + return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(_operand, _user); } // ============================================================================================================================== @@ -97,6 +107,6 @@ public class StudyRights { public Study getOperand () { // -------------------------- - return operand; + return _operand; } } \ No newline at end of file diff --git a/Workspace/Siman-Common/src/org/splat/util/DTOTransformer.java b/Workspace/Siman-Common/src/org/splat/util/DTOTransformer.java index 9af8ea4..7132e67 100644 --- a/Workspace/Siman-Common/src/org/splat/util/DTOTransformer.java +++ b/Workspace/Siman-Common/src/org/splat/util/DTOTransformer.java @@ -11,12 +11,12 @@ package org.splat.util; import java.util.Map; -import org.splat.log.AppLogger; - import net.sf.beanlib.PropertyInfo; import net.sf.beanlib.spi.BeanTransformerSpi; import net.sf.beanlib.spi.CustomBeanTransformerSpi; +import org.splat.log.AppLogger; + /** * DTO transformer used by BeanHelper. * @@ -27,13 +27,13 @@ public class DTOTransformer implements CustomBeanTransformerSpi { /** * The logger for the service. */ - public final static AppLogger logger = AppLogger + public final static AppLogger LOG = AppLogger .getLogger(DTOTransformer.class); /** * the bean transformer. */ - private final BeanTransformerSpi _beanTransformer; + private final transient BeanTransformerSpi _beanTransformer; /** * Constructor. @@ -54,21 +54,21 @@ public class DTOTransformer implements CustomBeanTransformerSpi { public boolean isTransformable(final Object from, final Class toClass, final net.sf.beanlib.PropertyInfo info) { boolean ok = false; - if (from != null) { + if (from == null) { + if (LOG.isDebugEnabled()) { + LOG.debug("From: null; To: " + toClass.getSimpleName()); + } + } else { String fromName = from.getClass().getSimpleName(); String toName = toClass.getSimpleName(); - if (logger.isDebugEnabled()) { - logger.debug("From: " + fromName + "; To: " + toName); + if (LOG.isDebugEnabled()) { + LOG.debug("From: " + fromName + "; To: " + toName); ok = (fromName.equals(toName + "DTO") || toName.equals(fromName + "DTO")); } - } else { - if (logger.isDebugEnabled()) { - logger.debug("From: null; To: " + toClass.getSimpleName()); - } } - if (logger.isDebugEnabled()) { - logger.debug("Can transform from " + info.getFromBean() + "." + if (LOG.isDebugEnabled()) { + LOG.debug("Can transform from " + info.getFromBean() + "." + info.getPropertyName() + " to " + info.getToBean() + "." + info.getPropertyName() + ": " + ok); } @@ -81,27 +81,25 @@ public class DTOTransformer implements CustomBeanTransformerSpi { * * @see net.sf.beanlib.spi.Transformable#transform(java.lang.Object, java.lang.Class, net.sf.beanlib.PropertyInfo) */ + @SuppressWarnings("unchecked") public T transform(final Object in, final Class toClass, final PropertyInfo info) { - if (logger.isDebugEnabled()) { - logger.debug("Transform " + in.getClass().getSimpleName() + ": " + if (LOG.isDebugEnabled()) { + LOG.debug("Transform " + in.getClass().getSimpleName() + ": " + in.toString() + " to " + toClass.getSimpleName()); } Map cloneMap = _beanTransformer.getClonedMap(); Object clone = cloneMap.get(in); - if (clone != null) { - return (T) clone; - } - - if (logger.isDebugEnabled()) { - logger.debug("Copy bean from " + info.getFromBean() + "." - + info.getPropertyName() + " to " + info.getToBean() + "." - + info.getPropertyName()); + if (clone == null) { + if (LOG.isDebugEnabled()) { + LOG.debug("Copy bean from " + info.getFromBean() + "." + + info.getPropertyName() + " to " + info.getToBean() + "." + + info.getPropertyName()); + } + clone = BeanHelper.copyBean(in, toClass); + cloneMap.put(in, clone); } - clone = BeanHelper.copyBean(in, toClass); - cloneMap.put(in, clone); - return (T) clone; } } diff --git a/Workspace/Siman-Common/src/spring/daoContext.xml b/Workspace/Siman-Common/src/spring/daoContext.xml index 3fd1378..168201b 100644 --- a/Workspace/Siman-Common/src/spring/daoContext.xml +++ b/Workspace/Siman-Common/src/spring/daoContext.xml @@ -4,7 +4,7 @@ xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - + @@ -50,6 +50,14 @@ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> class="org.splat.dal.dao.som.ScenarioDAOImpl"> + + + + + + diff --git a/Workspace/Siman-Common/src/spring/globalContext.xml b/Workspace/Siman-Common/src/spring/globalContext.xml index 596379d..1e9ac52 100644 --- a/Workspace/Siman-Common/src/spring/globalContext.xml +++ b/Workspace/Siman-Common/src/spring/globalContext.xml @@ -28,7 +28,7 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - diff --git a/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java b/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java index 9082d0e..427925a 100644 --- a/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java +++ b/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java @@ -2,6 +2,7 @@ package org.splat.simer; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -11,42 +12,40 @@ import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.Set; -import java.util.Vector; import javax.servlet.ServletContext; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.NamedNodeMap; import org.apache.log4j.Logger; import org.splat.dal.bo.kernel.User; -import org.splat.manox.XDOM; import org.splat.dal.bo.som.Document; -import org.splat.som.DocumentRights; import org.splat.dal.bo.som.DocumentType; import org.splat.dal.bo.som.KnowledgeElement; import org.splat.dal.bo.som.ProgressState; +import org.splat.dal.bo.som.SimulationContext; +import org.splat.manox.XDOM; import org.splat.service.DocumentTypeService; import org.splat.service.technical.ProjectSettingsService; -import org.splat.simer.Converter; -import org.splat.dal.bo.som.SimulationContext; +import org.splat.som.DocumentRights; import org.splat.som.Step; import org.splat.som.StudyRights; import org.splat.wapp.MenuItem; -import org.splat.wapp.PopupMenu; import org.splat.wapp.PopupItem; +import org.splat.wapp.PopupMenu; import org.splat.wapp.SimpleMenu; import org.splat.wapp.ToolBar; import org.springframework.web.context.ServletContextAware; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; public class ApplicationSettings implements ServletContextAware { /** * Application settings logger. */ - protected final static Logger logger = Logger + protected final static Logger LOG = Logger .getLogger(ApplicationSettings.class); /** @@ -56,9 +55,9 @@ public class ApplicationSettings implements ServletContextAware { private String wappserver; private String wappname; - private Properties wapprops = new Properties(); // General properties from the application properties files + private final Properties wapprops = new Properties(); // General properties from the application properties files private Locale locale; // Current user locale - private Map menus = new HashMap(); // Application menus + private final Map menus = new HashMap(); // Application menus private Map bars = null; // Study module-bars structured by steps private Map popups = null; private Map> filter = null; // Named search filters @@ -66,9 +65,9 @@ public class ApplicationSettings implements ServletContextAware { private Map tempfile = null; // Available template files private String[] viewermap = null; // List of file extensions mapped to a viewer private Map convertmap = null; // Available document format converters - private Properties jndprops = new Properties(); // JNDI context for launching converters + private final Properties jndprops = new Properties(); // JNDI context for launching converters - private static ApplicationSettings my = null; // Singleton instance + private static ApplicationSettings my = new ApplicationSettings(); // Singleton instance /** * Injected project settings service. */ @@ -93,7 +92,7 @@ public class ApplicationSettings implements ServletContextAware { * @param projectSettingsService * the projectSettingsService to set */ - public void setProjectSettings(ProjectSettingsService projectSettingsService) { + public void setProjectSettings(final ProjectSettingsService projectSettingsService) { _projectSettingsService = projectSettingsService; } @@ -202,34 +201,44 @@ public class ApplicationSettings implements ServletContextAware { .confirmation("message.delete.study")); } - public boolean isEnabled(String name) { - if (user == null) + @Override + public boolean isEnabled(final String name) { + if (user == null) { return false; // Should not happen + } Item item = Item.valueOf(name); - if (item == Item.publish) + if (item == Item.publish) { return user.canPublish(); - if (item == Item.edit) + } + if (item == Item.edit) { return user.canEditProperties(); - if (item == Item.script) + } + if (item == Item.script) { return user.canAddScenario(); - if (item == Item.version) + } + if (item == Item.version) { return user.canVersion(); - if (item == Item.remove) + } + if (item == Item.remove) { return user.canRemove(); - if (item == Item.purge) + } + if (item == Item.purge) { return user.canPurge(); + } return false; } - public void setContext(String name, Object context) { + @Override + public void setContext(final String name, final Object context) { if (context instanceof StudyRights) { user = (StudyRights) context; // Just for optimizing boolean history = user.getOperand().isVersioned(); PopupItem item = this.item("remove"); - if (history) + if (history) { item.rename("menu.remove.version"); - else + } else { item.rename("menu.remove.study"); + } } } } @@ -266,38 +275,50 @@ public class ApplicationSettings implements ServletContextAware { "message.delete.document")); } - public boolean isEnabled(String name) { - if (user == null) + @Override + public boolean isEnabled(final String name) { + if (user == null) { return false; // Should not happen + } Item item = Item.valueOf(name); - if (item == Item.accept) + if (item == Item.accept) { return user.canAccept(); - if (item == Item.promote) + } + if (item == Item.promote) { return user.canPromote(); - if (item == Item.rename) + } + if (item == Item.rename) { return user.canRename(); - if (item == Item.attach) + } + if (item == Item.attach) { return user.canAttach(); - if (item == Item.version) + } + if (item == Item.version) { return user.canVersion(); - if (item == Item.replace) + } + if (item == Item.replace) { return user.canReplace(); - if (item == Item.purge) + } + if (item == Item.purge) { return user.canPurge(); - if (item == Item.remove) + } + if (item == Item.remove) { return user.canRemove(); + } return false; } - public void setContext(String name, Object context) { + @Override + public void setContext(final String name, final Object context) { if (context instanceof DocumentRights) { user = (DocumentRights) context; // Just for optimizing Document downer = user.getOperand(); PopupItem item = this.item("remove"); - if (downer.isVersioned()) + if (downer.isVersioned()) { item.rename("menu.remove.version"); - else + } else { item.rename("menu.remove.document"); + } } } } @@ -325,24 +346,32 @@ public class ApplicationSettings implements ServletContextAware { "notyetimplemented").confirmation("message.purge.document")); } - public boolean isEnabled(String name) { - if (user == null) + @Override + public boolean isEnabled(final String name) { + if (user == null) { return false; // Should not happen + } Item item = Item.valueOf(name); - if (item == Item.demote) + if (item == Item.demote) { return user.canDemote(); - if (item == Item.promote) + } + if (item == Item.promote) { return user.canReview(); - if (item == Item.attach) + } + if (item == Item.attach) { return user.canAttach(); - if (item == Item.version) + } + if (item == Item.version) { return user.canVersion(); - if (item == Item.purge) + } + if (item == Item.purge) { return user.canPurge(); + } return false; } - public void setContext(String name, Object context) { + @Override + public void setContext(final String name, final Object context) { if (context instanceof DocumentRights) { user = (DocumentRights) context; // Just for optimizing } @@ -351,7 +380,7 @@ public class ApplicationSettings implements ServletContextAware { private static class NotResultDocumentPopup extends PopupMenu { // ---------------------------------------------------------------- - private DocumentRights user = null; + private final DocumentRights user = null; private NotResultDocumentPopup() { addItem("demote", new PopupItem("menu.demote").icon( @@ -390,20 +419,26 @@ public class ApplicationSettings implements ServletContextAware { .confirmation("message.approve.document")); } - public boolean isEnabled(String name) { - if (user == null) + @Override + public boolean isEnabled(final String name) { + if (user == null) { return false; // Should not happen + } Item item = Item.valueOf(name); - if (item == Item.undo) + if (item == Item.undo) { return user.canInvalidate(); - if (item == Item.demote) + } + if (item == Item.demote) { return user.canDemote(); - if (item == Item.approve) + } + if (item == Item.approve) { return user.canApprove(); + } return false; } - public void setContext(String name, Object context) { + @Override + public void setContext(final String name, final Object context) { if (context instanceof DocumentRights) { user = (DocumentRights) context; // Just for optimizing } @@ -438,20 +473,26 @@ public class ApplicationSettings implements ServletContextAware { "message.delete.document")); } - public boolean isEnabled(String name) { - if (user == null) + @Override + public boolean isEnabled(final String name) { + if (user == null) { return false; // Should not happen + } Item item = Item.valueOf(name); - if (item == Item.rename) + if (item == Item.rename) { return user.canRename(); - if (item == Item.replace) + } + if (item == Item.replace) { return user.canReplace(); - if (item == Item.remove) + } + if (item == Item.remove) { return user.canRemove(); + } return false; } - public void setContext(String name, Object context) { + @Override + public void setContext(final String name, final Object context) { if (context instanceof DocumentRights) { user = (DocumentRights) context; // Just for optimizing } @@ -474,7 +515,8 @@ public class ApplicationSettings implements ServletContextAware { "message.delete.context")); } - public boolean isEnabled(String name) { + @Override + public boolean isEnabled(final String name) { Item item = Item.valueOf(name); if (item == Item.rename) { @@ -486,7 +528,8 @@ public class ApplicationSettings implements ServletContextAware { return true; } - public void setContext(String name, Object context) { + @Override + public void setContext(final String name, final Object context) { if (context instanceof SimulationContextFacade) { owner = (SimulationContextFacade) context; // Just for optimizing } else { @@ -518,23 +561,27 @@ public class ApplicationSettings implements ServletContextAware { "message.delete.knowledge")); } - public boolean isEnabled(String name) { + @Override + public boolean isEnabled(final String name) { Item item = Item.valueOf(name); if (item == Item.promote) { - if (owner.getProgressState() != ProgressState.inDRAFT) + if (owner.getProgressState() != ProgressState.inDRAFT) { return false; + } } else if (item == Item.demote) { - if (owner.getProgressState() != ProgressState.inCHECK) + if (owner.getProgressState() != ProgressState.inCHECK) { return false; + } } return true; } - public void setContext(String name, Object context) { - if (context instanceof KnowledgeElement) + @Override + public void setContext(final String name, final Object context) { + if (context instanceof KnowledgeElement) { owner = (KnowledgeElement) context; // Just for optimizing - else { + } else { super.setContext(name, context); } } @@ -545,10 +592,6 @@ public class ApplicationSettings implements ServletContextAware { // ============================================================================================================================== public static ApplicationSettings getMe() { - // ------------------------------------------ - if (my == null) { - my = new ApplicationSettings(); - } return my; // The application is supposed being previously created below } @@ -557,7 +600,7 @@ public class ApplicationSettings implements ServletContextAware { * @param lang * @return */ - public ApplicationSettings init(String wappurl, Locale lang) + public ApplicationSettings init(final String wappurl, final Locale lang) throws IOException { ClassLoader cloader = getClass().getClassLoader(); String[] wurl = wappurl.split("/"); // [0]="http:", [1]="", [2]="{server}:{port}", [3]="name" @@ -570,7 +613,7 @@ public class ApplicationSettings implements ServletContextAware { wapprops.load(cloader.getResourceAsStream(wappname + ".properties")); jndprops.load(cloader.getResourceAsStream("jndi.properties")); - logger.info("Application root set to " + LOG.info("Application root set to " + wapprops.getProperty("wapp.root")); if (my == null) { my = this; @@ -584,7 +627,7 @@ public class ApplicationSettings implements ServletContextAware { // Public member functions // ============================================================================================================================== - public void configure(String filename) { + public void configure(final String filename) { // --------------------------------------- // Non customizable settings menus.clear(); @@ -619,7 +662,7 @@ public class ApplicationSettings implements ServletContextAware { fprop.put("author", "0"); fprop.put("reference", ""); fprop.put("title", ""); - fprop.put("context", new Vector()); + fprop.put("context", new ArrayList()); Map gprop = new HashMap(); gprop.put("visibility", "PUBLIC"); @@ -629,7 +672,7 @@ public class ApplicationSettings implements ServletContextAware { gprop.put("author", "0"); gprop.put("reference", ""); gprop.put("title", ""); - gprop.put("context", new Vector()); + gprop.put("context", new ArrayList()); defdoctype = new LinkedHashMap(); tempfile = new HashMap(); @@ -644,7 +687,7 @@ public class ApplicationSettings implements ServletContextAware { if (config.exists()) { loadCustomization(config); // Sets default document types, installed modules and available templates } else { - logger.info("Could not find the application configuration file \"" + LOG.info("Could not find the application configuration file \"" + config.getAbsolutePath() + "\", using default settings"); } // Settings based on the customization @@ -656,18 +699,21 @@ public class ApplicationSettings implements ServletContextAware { .hasNext();) { ProjectSettingsService.Step step = i.next(); List formats = getDefaultFormats(step); - if (formats.size() == 0) + if (formats.size() == 0) { continue; + } ToolBar bar = new ToolBar(24); // Height of the module-bar HashSet module = new HashSet(); // For not duplicating modules for (Iterator j = formats.iterator(); j.hasNext();) { String format = j.next(); String command = getApplicationProperty("executable." + format); - if (command == null) + if (command == null) { continue; // Module not installed - if (module.contains(command)) + } + if (module.contains(command)) { continue; + } module.add(command); String[] parsed = command.split("/"); String[] name = parsed[parsed.length - 1].split("\\x2E"); @@ -689,8 +735,9 @@ public class ApplicationSettings implements ServletContextAware { File image = new File(ApplicationSettings .getApplicationSkinPath() + icon); - if (!image.exists()) + if (!image.exists()) { icon = "tool.any.png"; + } bar.addTool(tool, icon, command); } else { docname = "/jsp/newDocument.jsp?type=" + docname; @@ -698,17 +745,19 @@ public class ApplicationSettings implements ServletContextAware { File image = new File(ApplicationSettings .getApplicationSkinPath() + icon); - if (!image.exists()) + if (!image.exists()) { icon = "tool.any.png"; + } bar.addTool(name[0], icon, command, docname); } } - if (!bar.isEmpty()) + if (!bar.isEmpty()) { bars.put(step.getNumber(), bar); + } } } - public String getApplicationProperty(String name) { + public String getApplicationProperty(final String name) { return wapprops.getProperty(name); // May be null } @@ -724,12 +773,12 @@ public class ApplicationSettings implements ServletContextAware { return url.toString(); } - public Map getFilter(String name) { + public Map getFilter(final String name) { // -------------------------------------------------- return filter.get(name); } - public ToolBar getModuleBar(Step step) { + public ToolBar getModuleBar(final Step step) { // ----------------------------------------- return bars.get(step.getNumber()); } @@ -758,19 +807,19 @@ public class ApplicationSettings implements ServletContextAware { return my.getApplicationRootPath() + "skin/"; } - public static Converter getConverter(DocumentType type, String format) { + public static Converter getConverter(final DocumentType type, final String format) { // ----------------------------------------------------------------------- return my.convertmap.get(format + type.getName()); // May be null; } - public static DocumentType getDefaultDocumentType(Step step, String format) { + public static DocumentType getDefaultDocumentType(final Step step, final String format) { // ---------------------------------------------------------------------------- String[] table = format.split("\\x2E"); return my.defdoctype.get(step.getNumber() + "." + table[table.length - 1]); // May be null } - public static String getDownloadURL(User user) { + public static String getDownloadURL(final User user) { // -------------------------------------------------- StringBuffer url = new StringBuffer("http://").append(my.wappserver) .append("/download/").append(user.getUsername()).append("/"); @@ -782,12 +831,12 @@ public class ApplicationSettings implements ServletContextAware { return my.locale; } - public static SimpleMenu getMenu(String name) { + public static SimpleMenu getMenu(final String name) { // ---------------------------------------------- return my.menus.get(name); } - public static PopupMenu getPopupMenu(String name) { + public static PopupMenu getPopupMenu(final String name) { // -------------------------------------------------- return my.popups.get(name); } @@ -803,8 +852,9 @@ public class ApplicationSettings implements ServletContextAware { // --------------------------------------------- String[] code = my.wapprops.getProperty("locale.supported").split(","); Locale[] result = new Locale[code.length]; - for (int i = 0; i < code.length; i++) + for (int i = 0; i < code.length; i++) { result[i] = new Locale(code[i]); + } return result; } @@ -827,24 +877,26 @@ public class ApplicationSettings implements ServletContextAware { // Private services // ============================================================================================================================== - private List getDefaultFormats(ProjectSettingsService.Step step) { + private List getDefaultFormats(final ProjectSettingsService.Step step) { // ------------------------------------------------------------------ Set keys = defdoctype.keySet(); int number = step.getNumber(); - Vector result = new Vector(); + List result = new ArrayList(); for (Iterator i = keys.iterator(); i.hasNext();) { String[] key = i.next().split("\\x2E"); - if (Integer.valueOf(key[0]) != number) + if (Integer.valueOf(key[0]) != number) { continue; - if (key[1].equals("pdf")) + } + if (key[1].equals("pdf")) { continue; // PDF is not an authoring format + } result.add(key[1]); // Formats are unique } return result; } - private void loadCustomization(File config) { + private void loadCustomization(final File config) { // -------------------------------------------- try { DocumentBuilderFactory dfactory = javax.xml.parsers.DocumentBuilderFactory @@ -868,16 +920,18 @@ public class ApplicationSettings implements ServletContextAware { } for (int i = 0; i < nlist.getLength(); i++) { child = nlist.item(i); - if (!child.getNodeName().equals("step")) + if (!child.getNodeName().equals("step")) { continue; + } String nstep = child.getAttributes().getNamedItem("number") .getNodeValue(); NodeList map = child.getChildNodes(); for (int j = 0; j < map.getLength(); j++) { child = map.item(j); - if (!child.getNodeName().equals("mapping")) + if (!child.getNodeName().equals("mapping")) { continue; + } NamedNodeMap natr = child.getAttributes(); String dext = natr.getNamedItem("extension").getNodeValue(); String type = natr.getNamedItem("type").getNodeValue(); @@ -889,8 +943,9 @@ public class ApplicationSettings implements ServletContextAware { nlist = child.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { child = nlist.item(i); - if (!child.getNodeName().equals("mapping")) + if (!child.getNodeName().equals("mapping")) { continue; + } NamedNodeMap natr = child.getAttributes(); String dext = natr.getNamedItem("extension").getNodeValue(); @@ -924,8 +979,9 @@ public class ApplicationSettings implements ServletContextAware { nlist = child.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { child = nlist.item(i); - if (!child.getNodeName().equals("document")) + if (!child.getNodeName().equals("document")) { continue; + } NamedNodeMap natr = child.getAttributes(); String type = natr.getNamedItem("type").getNodeValue(); @@ -933,7 +989,7 @@ public class ApplicationSettings implements ServletContextAware { tempfile.put(type, file); } } catch (Exception error) { - logger.info("Error in customization", error); + LOG.info("Error in customization", error); } } @@ -952,7 +1008,7 @@ public class ApplicationSettings implements ServletContextAware { * @param documentTypeService * the documentTypeService to set */ - public void setDocumentTypeService(DocumentTypeService documentTypeService) { + public void setDocumentTypeService(final DocumentTypeService documentTypeService) { _documentTypeService = documentTypeService; } @@ -961,7 +1017,7 @@ public class ApplicationSettings implements ServletContextAware { * @see org.apache.struts2.util.ServletContextAware#setServletContext(javax.servlet.ServletContext) */ @Override - public void setServletContext(ServletContext context) { + public void setServletContext(final ServletContext context) { _servletContext = context; } diff --git a/Workspace/Siman/src/org/splat/simer/OpenObject.java b/Workspace/Siman/src/org/splat/simer/OpenObject.java index b012106..2efe1b0 100644 --- a/Workspace/Siman/src/org/splat/simer/OpenObject.java +++ b/Workspace/Siman/src/org/splat/simer/OpenObject.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Vector; +import java.util.Map; import org.splat.dal.bo.kernel.User; import org.splat.dal.bo.som.Document; @@ -27,8 +27,8 @@ import org.splat.wapp.PopupMenu; public abstract class OpenObject implements Proxy { - protected static HashMap docpres = null; - protected static HashMap knowpres = null; + protected static Map docpres = null; + protected static Map knowpres = null; /** * Connected user. @@ -168,7 +168,7 @@ public abstract class OpenObject implements Proxy { public List collectInvolvedDocuments(final DocumentType type) { // ------------------------------------------------------------------ - List found = new Vector(); + List found = new ArrayList(); for (Iterator i = involving.iterator(); i.hasNext();) { Step step = i.next(); List exist = step.getAllDocuments(); @@ -299,11 +299,11 @@ public abstract class OpenObject implements Proxy { current = more.next(); } - knowledge = new Vector(types.size()); + knowledge = new ArrayList(types.size()); for (Iterator i = types.iterator(); i .hasNext();) { KnowledgeElementType type = i.next(); - List display = new Vector( + List display = new ArrayList( kelms.size()); while (current != null && current.getType().equals(type)) { KnowledgeElementFacade facade = knowpres.get(current @@ -328,7 +328,7 @@ public abstract class OpenObject implements Proxy { if (ustep.mayContain(Document.class)) { List list = ustep.getAllDocuments(); - contents = new Vector(list.size()); + contents = new ArrayList(list.size()); for (Iterator i = list.iterator(); i.hasNext();) { Publication present = i.next(); Long index = present.getIndex(); -- 2.39.2