JAL-3070 set calcId and autocalculated flags for annotation returned by the service
[jalview.git] / src / jalview / ws / jws2 / SeqAnnotationServiceCalcWorker.java
index fcb6e28..81dfa30 100644 (file)
@@ -276,7 +276,9 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker
         return;
       }
       // TODO: handle job submission error reporting here.
-      
+      Cache.log.debug("Service " + service.getUri() + "\nSubmitted job ID: "
+              + rslt);
+      ;
       // ///
       // otherwise, construct WsJob and any UI handlers
       running = new AnnotationWsJob();
@@ -422,6 +424,24 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker
         // sequence, excluding regions not annotated due to gapMap/column
         // visibility
 
+        // update calcId if it is not already set on returned annotation
+        if (returnedAnnot != null)
+        {
+          for (AlignmentAnnotation aa : returnedAnnot)
+          {
+            // assume that any CalcIds already set
+            if (getCalcId() != null && aa.getCalcId() == null
+                    || "".equals(aa.getCalcId()))
+            {
+              aa.setCalcId(getCalcId());
+            }
+            // autocalculated annotation are created by interactive alignment
+            // analysis services
+            aa.autoCalculated = service.isAlignmentAnalysis()
+                    && service.isInteractiveUpdate();
+          }
+        }
+
         running.setAnnotation(returnedAnnot);
 
         if (running.hasResults())