]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman/src/org/splat/simer/VersionDocumentAction.java
Salome HOME
Fix for some problems with definition uses.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / VersionDocumentAction.java
index f533f66334f4293a8ca9fce0d07d7f23dc5ef026..1eeaabe06b8dfeabc5f4be792f2d9b03391f5ce6 100644 (file)
@@ -21,6 +21,8 @@ import org.splat.dal.bo.som.ValidationStep;
 import org.splat.kernel.InvalidPropertyException;
 import org.splat.manox.Reader;
 import org.splat.manox.Toolbox;
+import org.splat.service.PublicationService;
+import org.splat.service.StudyService;
 import org.splat.som.Revision;
 import org.splat.som.Step;
 import org.splat.wapp.Constants;
@@ -65,8 +67,10 @@ public class VersionDocumentAction extends BaseUploadDocumentAction {
                File upfile = commonInitialize(Constants.TRUE);
 
                _mystudy = getOpenStudy();
+               //updating relations of docs
+               _mystudy.updateCurrentStep();
                _defuses = new ArrayList<Document>();
-
+               
                Publication tag = _mystudy.getSelectedStep().getDocument(
                                Integer.valueOf(_index));
                Document doc = tag.value();
@@ -94,10 +98,12 @@ public class VersionDocumentAction extends BaseUploadDocumentAction {
                        
                        // Avoid using of documents dependent on the current version of the document being versioned
                        // (This case is possible only if both documents belong to the step of the same Project Element)
-                       for(Iterator<Document> document = _defuses.iterator(); document.hasNext(); ) {
-                               Publication pub = tag.getOwner().getPublication(document.next());
-                               if(pub != null && pub.getRelations(UsesRelation.class).contains(tag)) {
-                                       document.remove();
+                       List<Document> toDeleteFromDefuses = new ArrayList<Document>();
+                       getPublicationService().findSequenceUses(toDeleteFromDefuses, tag,
+                                       _defuses);
+                       for (Document document : toDeleteFromDefuses) {
+                               if (_defuses.contains(document)) {
+                                       _defuses.remove(document);
                                }
                        }