]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Fix of checkin and removeDocument.
authorrkv <rkv@opencascade.com>
Tue, 26 Mar 2013 12:59:07 +0000 (12:59 +0000)
committerrkv <rkv@opencascade.com>
Tue, 26 Mar 2013 12:59:07 +0000 (12:59 +0000)
Workspace/Siman-Common/src/org/splat/dal/bo/som/Publication.hbm.xml
Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AbstractGenericDAOImpl.java
Workspace/Siman-Common/src/org/splat/dal/dao/kernel/GenericDAO.java
Workspace/Siman-Common/src/org/splat/service/StepServiceImpl.java
Workspace/Siman-Common/src/test/splat/service/TestStepService.java

index d91597245ad7f0d4a00f432c68007eb5cd4c03c2..a78f1daf92e68577ec529c56229413134ecda8a4 100644 (file)
@@ -13,7 +13,7 @@
 <!-- Publication properties
   -->
     <!-- Document       mydoc -->    
-    <many-to-one  name="mydoc" column="doc" cascade="merge,evict"  access="field" not-null="true"/>
+    <many-to-one  name="mydoc" column="doc" cascade="merge"  access="field" not-null="true"/>
     
     <!-- ProjectElement owner -->    
     <many-to-one  name="owner" column="owner" cascade="merge" access="field" not-null="true" />
index 296df7384492598f41d8dcee70e50c1e9936f908..778ac116ae7be19c48bc66cff16788506f309880 100644 (file)
@@ -262,24 +262,36 @@ public abstract class AbstractGenericDAOImpl<T, PK extends Serializable>
        }
 
        /**
-        * Save changes made to a persistent object.
+        * Update the persistent instance with the identifier of the given detached <BR>
+        * instance. If there is a persistent instance with the same identifier, an <BR>
+        * exception is thrown. This operation cascades to associated instances if <BR>
+        * the association is mapped with cascade="save-update".
         * 
-        * @param transientObject
+        * @param detachedObject
         *            transient instance of the object to update
+        * @see Session#update(Object)
         */
-       public void update(final T transientObject) {
-               getSession().update(transientObject);
+       public void update(final T detachedObject) {
+               getSession().update(detachedObject);
        }
 
        /**
-        * Refresh a persistent object.
+        * Re-read the state of the given instance from the underlying database. <BR>
+        * It is inadvisable to use this to implement long-running sessions that <BR>
+        * span many business tasks. This method is, however, useful in certain <BR>
+        * special circumstances. For example
+        * <ul>
+        * <li>where a database trigger alters the object state upon insert or update</li>
+        * <li>after executing direct SQL (eg. a mass update) in the same session</li>
+        * <li>after inserting a Blob or Clob</li>
+        * </ul>
         * 
-        * @param transientObject
-        *            transient instance of the object to refresh
+        * @param anObject
+        *            a persistent or detached instance to refresh
         * @see Session#refresh(Object)
         */
-       public void refresh(final T transientObject) {
-               getSession().refresh(transientObject);
+       public void refresh(final T anObject) {
+               getSession().refresh(anObject);
        }
 
        /**
index 09ea36e505af76f9da7d9183d3af75d65de47a92..477ab48ae5c6a90b3d941f1e6b1d9bb927cd396d 100644 (file)
@@ -61,12 +61,16 @@ public interface GenericDAO<T, PK extends Serializable> {
        T get(PK id);
 
        /**
-        * Save changes made to a persistent object.
+        * Update the persistent instance with the identifier of the given detached <BR>
+        * instance. If there is a persistent instance with the same identifier, an <BR>
+        * exception is thrown. This operation cascades to associated instances if <BR>
+        * the association is mapped with cascade="save-update".
         * 
-        * @param transientObject
+        * @param detachedObject
         *            transient instance of the object to update
+        * @see Session#update(Object)
         */
-       void update(T transientObject);
+       public void update(final T detachedObject);
 
        /**
         * Refresh a persistent object.
index 9d933d2b0780a5a1f72d61525118523191980943..48840966b32ddc35f44d6ac1756d33664115dd71 100644 (file)
@@ -469,7 +469,7 @@ public class StepServiceImpl implements StepService {
        public boolean remove(final Step aStep, final Publication oldoc) {
                aStep.getDocuments().remove(oldoc); // Updates this step
                aStep.getOwner().remove(oldoc); // remove from the parent project element
-               getProjectElementDAO().merge(aStep.getOwner());
+               getProjectElementDAO().merge(aStep.getOwner().getOwnerStudy());
                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;
@@ -532,9 +532,10 @@ public class StepServiceImpl implements StepService {
                                // The corresponding physical file is not removed from the vault
                                getDocumentDAO().delete(getDocumentDAO().merge(torem.value()));
                                // Delete document's files
-                               for (File file : files) {
-                                       getFileDAO().delete(getFileDAO().merge(file)); // The corresponding physical file is not removed from the vault
-                               }
+                               //TODO: delete files from file system
+//                             for (File file : files) {
+//                                     getFileDAO().delete(getFileDAO().merge(file)); // The corresponding physical file is not removed from the vault
+//                             }
                        }
                }
                return res;
index 0003b00703063b60a112649fc219d173ae2b12f6..c81589f2cb358426b98d4c2d0d667615fb6b7131 100644 (file)
@@ -44,6 +44,7 @@ import org.splat.kernel.MissedPropertyException;
 import org.splat.kernel.MultiplyDefinedException;
 import org.splat.log.AppLogger;
 import org.splat.service.DocumentTypeService;
+import org.splat.service.ProjectElementService;
 import org.splat.service.PublicationService;
 import org.splat.service.StepService;
 import org.splat.service.StudyService;
@@ -114,7 +115,7 @@ public class TestStepService extends BaseTest {
        @Autowired
        @Qualifier("projectSettings")
        private transient ProjectSettingsService _projectSettings;
-       
+
        /**
         * The injected by Spring StepCommentAttributeDAO.
         */
@@ -129,7 +130,6 @@ public class TestStepService extends BaseTest {
        @Qualifier("userDAO")
        private transient UserDAO _userDAO;
 
-
        /**
         * The injected by Spring StudyDAO.
         */
@@ -144,6 +144,13 @@ public class TestStepService extends BaseTest {
        @Qualifier("documentTypeService")
        private transient DocumentTypeService _documentTypeService;
 
+       /**
+        * The ProjectElementService. Later injected by Spring.
+        */
+       @Autowired
+       @Qualifier("projectElementService")
+       private transient ProjectElementService _projectElementService;
+
        /**
         * Test removeDocument method.<BR>
         * <B>Description :</B> <BR>
@@ -266,6 +273,8 @@ public class TestStepService extends BaseTest {
                                                        .getRelations(UsedByRelation.class)) {
                                                LOG.debug(rel.value().getTitle());
                                        }
+                                       ht.flush();
+                                       ht.clear();
                                        try {
                                                ok = _stepService.removeDocument(aScStep, docId);
                                                Assert.fail("DocumentIsUsedException must be thrown.");
@@ -304,18 +313,23 @@ public class TestStepService extends BaseTest {
                // ////////////////////////////////////////////////////////
                // Call removeDocument method for each document
                // starting from the last activity.
+               Study aStudy = _studyService.selectStudy(aScen.getOwnerStudy()
+                               .getIndex());
+               aScen = aStudy.getScenarii()[0];
+               Map<Integer, org.splat.som.Step> stSteps = _projectElementService.getStepsMap(aStudy);
+               Map<Integer, org.splat.som.Step> scSteps = _projectElementService.getStepsMap(aScen);
+               org.splat.som.Step aScStep;
                for (int i = _projectSettings.getAllSteps().size(); i > 0; i--) {
                        LOG.debug("Remove documents from the step " + i);
                        step = _projectSettings.getStep(i);
                        if (step.appliesTo(Study.class)) {
-                               projElem = _studyService.selectStudy(aScen.getOwnerStudy()
-                                               .getIndex());
+                               projElem = aStudy;
+                               aScStep = stSteps.get(step.getNumber());
                        } else {
                                projElem = aScen;
+                               aScStep = scSteps.get(step.getNumber());
                        }
 
-                       org.splat.som.Step aScStep = new org.splat.som.Step(step, projElem);
-
                        if (aScStep.getDocuments().size() > 0) {
                                docId = aScStep.getDocuments().get(0).value().getIndex();
                                LOG.debug("Remove document#" + docId + " "
@@ -352,17 +366,17 @@ public class TestStepService extends BaseTest {
                                Assert.assertEquals(ht.find("from Document where rid=" + docId)
                                                .size(), 1, "Nothing to delete.");
 
+                                ht.evict(aScStep.getDocuments().get(0).value()
+                                .getFile());
+                                LOG.debug("Load file#" + aScStep.getDocuments().get(0).value()
+                                .getRelations(ConvertsRelation.class).get(0).getTo().getIndex());
                                
-                               ht.evict(aScStep.getDocuments().get(0).value()
-                                               .getFile());
-                               LOG.debug("Load file#" + aScStep.getDocuments().get(0).value()
-                                               .getRelations(ConvertsRelation.class).get(0).getTo().getIndex());
-
+                               ht.flush();
                                ht.clear();
-                               File f = _fileDAO.get(aScStep.getDocuments().get(0).value()
-                                               .getRelations(ConvertsRelation.class).get(0).getTo().getIndex());
-                               ht.evict(aScStep.getDocuments().get(0).value());
-                               
+                                File f = _fileDAO.get(aScStep.getDocuments().get(0).value()
+                                .getRelations(ConvertsRelation.class).get(0).getTo().getIndex());
+                                ht.evict(aScStep.getDocuments().get(0).value());
+
                                ok = _stepService.removeDocument(aScStep, docId);
 
                                nbRemovedDoc++;
@@ -661,71 +675,74 @@ public class TestStepService extends BaseTest {
 
                return pub;
        }
-       
+
        /**
         * Test of addition of a new step comment.
-        *
-        * @throws BusinessException if there is something wrong likely unrelated to the tested method
+        * 
+        * @throws BusinessException
+        *             if there is something wrong likely unrelated to the tested method
         */
        @Test
-       public void testAddStepComment() throws BusinessException{
+       public void testAddStepComment() throws BusinessException {
 
                User goodUser = TestEntitiesGenerator.getTestUser("goodUser");
                _userDAO.create(goodUser);
                Study goodStudy = TestEntitiesGenerator.getTestStudy(goodUser);
                _studyDAO.create(goodStudy);
                getHibernateTemplate().flush();
-               StepCommentDTO goodStepCommentDTO = createStepCommentDTO(goodUser, goodStudy);
+               StepCommentDTO goodStepCommentDTO = createStepCommentDTO(goodUser,
+                               goodStudy);
 
-               //valid DTO, existing params
+               // valid DTO, existing params
                _stepService.addStepComment(goodStepCommentDTO);
                Long id = goodStepCommentDTO.getId();
-               Assert.assertNotNull(id, "Add method returns null instead of a new id.");
+               Assert
+                               .assertNotNull(id,
+                                               "Add method returns null instead of a new id.");
                Assert.assertTrue(id > 0, "The new id is not a positive number.");
-               StepCommentDTO retrievedComment = getDTOfromStepCommentAttribute(
-                               _stepCommentAttributeDAO.get(id));
-               Assert.assertTrue(compareStepCommentDTO(goodStepCommentDTO, retrievedComment),
+               StepCommentDTO retrievedComment = getDTOfromStepCommentAttribute(_stepCommentAttributeDAO
+                               .get(id));
+               Assert.assertTrue(compareStepCommentDTO(goodStepCommentDTO,
+                               retrievedComment),
                                "The comment created in database has wrong data");
 
-               //valid DTO, non-existing user
+               // valid DTO, non-existing user
                {
-                       //get a non-existing id
+                       // get a non-existing id
                        User badUser = TestEntitiesGenerator.getTestUser("badUser");
                        _userDAO.create(badUser);
-                       getHibernateTemplate().evict(badUser);//so createStepCommentDTO will invoke an
-                                       //actual query to the base, not cache, in order to check if the user already exists
+                       getHibernateTemplate().evict(badUser);// so createStepCommentDTO will invoke an
+                       // actual query to the base, not cache, in order to check if the user already exists
                        StepCommentDTO aBadDTO = createStepCommentDTO(badUser, goodStudy);
 
-                       try{
+                       try {
                                _stepService.addStepComment(aBadDTO);
                                getHibernateTemplate().flush();
                                Assert.fail("Creation with non-existing user must be failed.");
-                       }
-                       catch(InvalidParameterException e){
+                       } catch (InvalidParameterException e) {
                                LOG.debug("Expected exception is thrown: "
-                                       + e.getClass().getSimpleName() + ": " + e.getMessage());
+                                               + e.getClass().getSimpleName() + ": " + e.getMessage());
                        }
                }
 
-               //valid DTO, non-existing project element
+               // valid DTO, non-existing project element
                {
                        Study badStudy = TestEntitiesGenerator.getTestStudy(goodUser);
                        _studyDAO.create(badStudy);
-                       getHibernateTemplate().evict(badStudy);//so createStepCommentDTO will invoke an
-                       //actual query to the base, not cache in order to check if the study already exists
+                       getHibernateTemplate().evict(badStudy);// so createStepCommentDTO will invoke an
+                       // actual query to the base, not cache in order to check if the study already exists
                        StepCommentDTO aBadDTO = createStepCommentDTO(goodUser, badStudy);
 
-                       try{
+                       try {
                                _stepService.addStepComment(aBadDTO);
                                Assert.fail("Creation with non-existing user must be failed.");
-                       }
-                       catch(InvalidParameterException e){
+                       } catch (InvalidParameterException e) {
                                LOG.debug("Expected exception is thrown: "
-                                       + e.getClass().getSimpleName() + ": " + e.getMessage());
+                                               + e.getClass().getSimpleName() + ": " + e.getMessage());
                        }
                }
 
-               //not valid DTO (id filled in)
+               // not valid DTO (id filled in)
                {
                        StepCommentDTO aBadDTO = createStepCommentDTO(goodUser, goodStudy);
                        aBadDTO.setId(goodStepCommentDTO.getId());
@@ -742,8 +759,9 @@ public class TestStepService extends BaseTest {
 
        /**
         * Test of retrieval of all comments corresponding to a step.
-        *
-        * @throws BusinessException if there is something wrong likely unrelated to the tested method
+        * 
+        * @throws BusinessException
+        *             if there is something wrong likely unrelated to the tested method
         */
        @Test
        public void testGetStepComments() throws BusinessException {
@@ -751,83 +769,96 @@ public class TestStepService extends BaseTest {
                User user = TestEntitiesGenerator.getTestUser("goodUser");
                _userDAO.create(user);
                Study study = TestEntitiesGenerator.getTestStudy(user);
-               
-               //Before we create the study in the database:
-               org.splat.som.Step step = new org.splat.som.Step(_projectSettings.getStep(1), study);
-               try{
+
+               // Before we create the study in the database:
+               org.splat.som.Step step = new org.splat.som.Step(_projectSettings
+                               .getStep(1), study);
+               try {
                        _stepService.getStepComments(step);
-                       Assert.fail("Retrieval by step with non-existing owner project element must be failed.");
-               }
-               catch(InvalidParameterException e){
+                       Assert
+                                       .fail("Retrieval by step with non-existing owner project element must be failed.");
+               } catch (InvalidParameterException e) {
                        LOG.debug("Expected exception is thrown: "
-                               + e.getClass().getSimpleName() + ": " + e.getMessage());
+                                       + e.getClass().getSimpleName() + ": " + e.getMessage());
                }
-               
+
                _studyDAO.create(study);
-               
+
                StepCommentAttribute matchingStepComment = new StepCommentAttribute(
-                               study, "matching test comment", new Date(), step.getNumber(), user, "matching test comment title");
+                               study, "matching test comment", new Date(), step.getNumber(),
+                               user, "matching test comment title");
                StepCommentAttribute notMatchingStepComment = new StepCommentAttribute(
-                               study, "not matching test comment", new Date(), 2, user, "not matching test comment title");
+                               study, "not matching test comment", new Date(), 2, user,
+                               "not matching test comment title");
                _stepCommentAttributeDAO.create(matchingStepComment);
                _stepCommentAttributeDAO.create(notMatchingStepComment);
                getHibernateTemplate().flush();
-               
+
                List<StepCommentDTO> stepComments = _stepService.getStepComments(step);
-               Assert.assertTrue(stepComments.size() == 1, "Wrong number of retrieved comments");
+               Assert.assertTrue(stepComments.size() == 1,
+                               "Wrong number of retrieved comments");
                StepCommentDTO stepCommentDTO = stepComments.get(0);
-               Assert.assertTrue(stepCommentDTO.getId().equals(matchingStepComment.getRid())
-                               && stepCommentDTO.getDate().equals(matchingStepComment.getDate())
-                               && stepCommentDTO.getText().equals(matchingStepComment.getValue())              
-                               && stepCommentDTO.getUser().getIndex() == matchingStepComment.getUser().getRid()
-                               && stepCommentDTO.getTitle().equals(matchingStepComment.getTitle()),
-                               "some of the needed fields of the retrieved comment doesn't match with original.");
+               Assert
+                               .assertTrue(
+                                               stepCommentDTO.getId().equals(
+                                                               matchingStepComment.getRid())
+                                                               && stepCommentDTO.getDate().equals(
+                                                                               matchingStepComment.getDate())
+                                                               && stepCommentDTO.getText().equals(
+                                                                               matchingStepComment.getValue())
+                                                               && stepCommentDTO.getUser().getIndex() == matchingStepComment
+                                                                               .getUser().getRid()
+                                                               && stepCommentDTO.getTitle().equals(
+                                                                               matchingStepComment.getTitle()),
+                                               "some of the needed fields of the retrieved comment doesn't match with original.");
        }
-       
+
        /**
         * Test of retrieval of all comments corresponding to a step.
-        *
-        * @throws BusinessException if there is something wrong likely unrelated to the tested method
+        * 
+        * @throws BusinessException
+        *             if there is something wrong likely unrelated to the tested method
         */
        @Test
        public void testEditStepComments() throws BusinessException {
                LOG.debug(">>>>> BEGIN testEditStepComments()");
                startNestedTransaction();
-               
+
                User goodUser = TestEntitiesGenerator.getTestUser("goodUser");
                _userDAO.create(goodUser);
                Study goodStudy = TestEntitiesGenerator.getTestStudy(goodUser);
                _studyDAO.create(goodStudy);
                getHibernateTemplate().flush();
 
-               org.splat.som.Step step = new org.splat.som.Step(_projectSettings.getStep(1), goodStudy);
-               
-               StepCommentAttribute comment = new StepCommentAttribute(goodStudy, "commentValue",
-                               new Date(), Integer.valueOf(step.getNumber()), goodUser, "commentTitle");
+               org.splat.som.Step step = new org.splat.som.Step(_projectSettings
+                               .getStep(1), goodStudy);
+
+               StepCommentAttribute comment = new StepCommentAttribute(goodStudy,
+                               "commentValue", new Date(), Integer.valueOf(step.getNumber()),
+                               goodUser, "commentTitle");
                _stepCommentAttributeDAO.saveOrUpdate(comment);
 
                getHibernateTemplate().flush();
-               
-               //non-existing id
-               StepCommentAttribute tmpComment = new StepCommentAttribute(goodStudy,"tmpCommentValue",
-                               new Date(), Integer.valueOf(step.getNumber()), goodUser, "tmpCommentTitle");
+
+               // non-existing id
+               StepCommentAttribute tmpComment = new StepCommentAttribute(goodStudy,
+                               "tmpCommentValue", new Date(), Integer
+                                               .valueOf(step.getNumber()), goodUser, "tmpCommentTitle");
                _stepCommentAttributeDAO.create(tmpComment);
                long nonExistingId = tmpComment.getIndex();
                _stepCommentAttributeDAO.delete(tmpComment);
-               //getHibernateTemplate().evict(goodUser);
-               
+               // getHibernateTemplate().evict(goodUser);
 
-               try{
+               try {
                        _stepService.editStepComment(nonExistingId, "newValue", "newTitle");
                        getHibernateTemplate().flush();
                        Assert.fail("Creation with non-existing user must be failed.");
-               }
-               catch(InvalidParameterException e){
+               } catch (InvalidParameterException e) {
                        LOG.debug("Expected exception is thrown: "
-                               + e.getClass().getSimpleName() + ": " + e.getMessage());
+                                       + e.getClass().getSimpleName() + ": " + e.getMessage());
                }
 
-               //different configurations with valid comment id
+               // different configurations with valid comment id
                testEdit(comment, "newValue", null);
                testEdit(comment, null, "newTitle");
                testEdit(comment, "veryNewValue", "veryNewTitle");
@@ -835,84 +866,95 @@ public class TestStepService extends BaseTest {
                rollbackNestedTransaction();
                LOG.debug(">>>>> END testEditStepComments()");
        }
-       
+
        /**
         * Test of comment editing.
-        * @param comment the comment
-        * @param value the value
-        * @param title the title
-        * @throws InvalidParameterException if there is something wrong likely unrelated to the tested method
+        * 
+        * @param comment
+        *            the comment
+        * @param value
+        *            the value
+        * @param title
+        *            the title
+        * @throws InvalidParameterException
+        *             if there is something wrong likely unrelated to the tested method
         */
-       private void testEdit(final StepCommentAttribute comment, final String value, final String title)
+       private void testEdit(final StepCommentAttribute comment,
+                       final String value, final String title)
                        throws InvalidParameterException {
                String oldValue = comment.getValue();
                String oldTitle = comment.getTitle();
-               
+
                _stepService.editStepComment(comment.getIndex(), value, title);
                _stepCommentAttributeDAO.flush();
                getHibernateTemplate().evict(comment);
                _stepCommentAttributeDAO.refresh(comment);
-               if(value == null) {
+               if (value == null) {
                        Assert.assertEquals(comment.getValue(), oldValue);
                } else {
                        Assert.assertEquals(comment.getValue(), value);
                }
-               if(title == null) {
+               if (title == null) {
                        Assert.assertEquals(comment.getTitle(), oldTitle);
                } else {
                        Assert.assertEquals(comment.getTitle(), title);
                }
        }
-       
-       
+
        /**
         * Create a transient StepCommentDTO.
-        *
-        * @param study must be already persisted into the database
-        * @param user must be already persisted into the database
+        * 
+        * @param study
+        *            must be already persisted into the database
+        * @param user
+        *            must be already persisted into the database
         * @return a transient StepCommentDTO
-        * @throws BusinessException if something's wrong
+        * @throws BusinessException
+        *             if something's wrong
         */
-       private StepCommentDTO createStepCommentDTO(final User user, final Study study) throws BusinessException {
+       private StepCommentDTO createStepCommentDTO(final User user,
+                       final Study study) throws BusinessException {
 
                return new StepCommentDTO(null, "A good comment", study.getRid(),
-                               new Integer(0), new Date(), user.getRid(), user.getName(), "Good comment title");
+                               new Integer(0), new Date(), user.getRid(), user.getName(),
+                               "Good comment title");
        }
 
        /**
         * Create StepCommentDTO with all the fields filled in from StepCommentAttribute.
-        * @param comment the comment
+        * 
+        * @param comment
+        *            the comment
         * @return Step Comment DTO
         */
-       private StepCommentDTO getDTOfromStepCommentAttribute(final StepCommentAttribute comment) {
-
-               StepCommentDTO stepCommentDTO = new StepCommentDTO(
-                               comment.getRid(),
-                               comment.getValue(),
-                               comment.getFrom().getRid(),
-                               comment.getStep(),
-                               comment.getDate(),
-                               comment.getUser().getRid(),
-                               comment.getUser().getName(),
-                               comment.getTitle()
-                       );
+       private StepCommentDTO getDTOfromStepCommentAttribute(
+                       final StepCommentAttribute comment) {
+
+               StepCommentDTO stepCommentDTO = new StepCommentDTO(comment.getRid(),
+                               comment.getValue(), comment.getFrom().getRid(), comment
+                                               .getStep(), comment.getDate(), comment.getUser()
+                                               .getRid(), comment.getUser().getName(), comment
+                                               .getTitle());
                return stepCommentDTO;
        }
 
        /**
         * Compare StepCommentDTO.
-        * @param a the first DTO to compare
-        * @param b the second DTO to compare
+        * 
+        * @param a
+        *            the first DTO to compare
+        * @param b
+        *            the second DTO to compare
         * @return true if comments are equal
         */
-       private Boolean compareStepCommentDTO(final StepCommentDTO a, final StepCommentDTO b){
-               return a.getId().equals(b.getId())
-                               && a.getId().equals(b.getId())
+       private Boolean compareStepCommentDTO(final StepCommentDTO a,
+                       final StepCommentDTO b) {
+               return a.getId().equals(b.getId()) && a.getId().equals(b.getId())
                                && a.getDate().equals(b.getDate())
                                && a.getStep().equals(b.getStep())
                                && a.getText().equals(b.getText())
                                && a.getUserId().equals(b.getUserId())
-                               && a.getProjectElementId().equals(b.getProjectElementId()) 
+                               && a.getProjectElementId().equals(b.getProjectElementId())
                                && a.getTitle().equals(b.getTitle());
        }
 }