todo and ensure old annotation/groups are removed before new ones loaded back
authorjprocter <Jim Procter>
Wed, 5 Jan 2011 16:04:56 +0000 (16:04 +0000)
committerjprocter <Jim Procter>
Wed, 5 Jan 2011 16:04:56 +0000 (16:04 +0000)
src/jalview/ws/rest/RestJob.java

index 445c249..82b157d 100644 (file)
@@ -11,6 +11,7 @@ import java.util.Map.Entry;
 import java.util.Set;
 import java.util.Vector;
 
+import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.AlignmentOrder;
 import jalview.datamodel.AlignmentView;
@@ -96,6 +97,7 @@ public class RestJob extends AWsJob
         }
         else
         {
+          // TODO: move validation of input data to SeqGroupIndexVector
           if ((prm.getValue() instanceof SeqGroupIndexVector)
                   && (_input.getGroups() != null && _input.getGroups()
                           .size() > 0))
@@ -256,6 +258,19 @@ public class RestJob extends AWsJob
       context = new JalviewDataset(dsForIO, null, squniq, null);
       if (contextAl!=null)
       {
+        // TODO devise way of merging new annotation onto (identical) existing annotation that was used as input
+        // delete all input annotation 
+        if (contextAl.getAlignmentAnnotation()!=null) {
+          for (AlignmentAnnotation alan: contextAl.getAlignmentAnnotation()) {
+            contextAl.deleteAnnotation(alan);
+          }
+        }
+        // TODO devise way of merging new groups onto (identical) existing groups when they were used as input to service
+        // delete all existing groups 
+        if (contextAl.getGroups()!=null)
+        {
+          contextAl.deleteAllGroups();
+        }
         context.addAlignment(contextAl);
       }