Example #1
0
 /**
  * Converts a pipeline template resource to a JSON string.
  *
  * @param pipeline The pipeline template resource to convert.
  * @return A JSON string representing the pipeline template. This is id, if it is persistent, the
  *     owner name, the visibility (PUBLIC or PRIVATE) and the serialized requests.
  * @throws JsonSyntaxException Something is wrong with the JSON syntax. .
  */
 @SuppressWarnings("unused")
 public static String toJson(final eu.freme.common.persistence.model.Pipeline pipeline) {
   List<SerializedRequest> serializedRequests = fromJson(pipeline.getSerializedRequests());
   Pipeline pipelineObj =
       new Pipeline(
           pipeline.getId(),
           pipeline.getCreationTime(),
           pipeline.getLabel(),
           pipeline.getDescription(),
           pipeline.isPersistent(),
           pipeline.getOwner().getName(),
           pipeline.getVisibility().name(),
           serializedRequests);
   return gson.toJson(pipelineObj);
 }
Example #2
0
 /**
  * Converts a list of pipeline templates to a JSON string.
  *
  * @param pipelines The pipeline templates to convert.
  * @return A JSON string representing the pipeline templates. This is id, if it is persistent, the
  *     owner name, the visibility (PUBLIC or PRIVATE) and the serialized requests per pipeline.
  * @throws JsonSyntaxException Something is wrong with the JSON syntax. .
  */
 @SuppressWarnings("unused")
 public static String templatesToJson(
     final List<eu.freme.common.persistence.model.Pipeline> pipelines) {
   List<Pipeline> pipelineInfos = new ArrayList<>();
   for (eu.freme.common.persistence.model.Pipeline pipeline : pipelines) {
     List<SerializedRequest> serializedRequests = fromJson(pipeline.getSerializedRequests());
     Pipeline pipelineObj =
         new Pipeline(
             pipeline.getId(),
             pipeline.getCreationTime(),
             pipeline.getLabel(),
             pipeline.getDescription(),
             pipeline.isPersistent(),
             pipeline.getOwner().getName(),
             pipeline.getVisibility().name(),
             serializedRequests);
     pipelineInfos.add(pipelineObj);
   }
   return gson.toJson(pipelineInfos);
 }