]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman-Common/src/org/splat/dal/bo/som/ProjectElement.java
Salome HOME
The draft of the "Copy from existing study" action is added. The YACS step is introdu...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / dal / bo / som / ProjectElement.java
index 62d1e876af8c1c2a65594b35d5408de1abc2275f..296b860f84df8754ce67407383d3e21687a331ea 100644 (file)
@@ -8,6 +8,7 @@ package org.splat.dal.bo.som;
 
 import java.util.Collections;
 import java.util.Date;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -180,8 +181,8 @@ public abstract class ProjectElement extends Entity {
        public boolean publishes(final Document doc) {
                boolean res = false;
                long index = doc.getIndex();
-               for (Iterator<Publication> i = docums.iterator(); i.hasNext();) {
-                       Document found = i.next().value();
+               for (Publication pub : docums) {
+                       Document found = pub.value();
                        res = (found.getIndex() == index);
                        if (res) {
                                break;
@@ -261,4 +262,25 @@ public abstract class ProjectElement extends Entity {
         * @return the project element study
         */
        public abstract Study getOwnerStudy();
+
+       /**
+        * {@inheritDoc}
+        * 
+        * @see org.splat.dal.bo.kernel.Entity#evict()
+        */
+       @Override
+       public void evict() {
+               super.evict();
+               // Evict all attributes of the persistent object
+               Set<Publication> tmpSet = new HashSet<Publication>();
+               tmpSet.addAll(docums);
+               docums.clear();
+               // Evict publications
+               for (Publication rel : tmpSet) {
+                       if (rel.isSaved()) { // to avoid recursive evict
+                               rel.evict();
+                       }
+                       docums.add(rel);
+               }
+       }
 }
\ No newline at end of file