Rotation.java [src/java/crlmod/nodes] Revision:   Date:
/*
 * $Id: 1.0+62 Rotation.java a170e1637ffa 2021-12-20 od $
 *
 * This file is part of the Cloud Services Integration Platform (CSIP),
 * a Model-as-a-Service framework, API, and application suite.
 *
 * 2012-2024, OMSLab, Colorado State University.
 *
 * OMSLab licenses this file to you under the MIT license.
 * See the LICENSE file in the project root for more information.
 */
package crlmod.nodes;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import translators.Translator;
import utils.Urls;

/**
 *
 * @author Lucas Yaege
 */
public class Rotation {

  public List<Management> managements = new ArrayList<>();
  public Integer duration;
  public Integer length;
  public String name;


  public JSONObject getJson() throws JSONException {
    Gson gson = new GsonBuilder()
        .setDateFormat("yyyy-MM-dd").create();
    return new JSONObject(gson.toJson(this));
  }


  public String getWEPSformat(Urls urls) throws Exception {
    Translator translator = new Translator(urls);
    return translator.translateToWEPSString(this.getJson());
  }
}