You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cmda.apache.org by xi...@apache.org on 2015/09/09 00:44:18 UTC
[43/49] incubator-cmda git commit: remove all
http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/controllers/ClimateServiceController.java
----------------------------------------------------------------------
diff --git a/app/controllers/ClimateServiceController.java b/app/controllers/ClimateServiceController.java
deleted file mode 100644
index 2c6aa1c..0000000
--- a/app/controllers/ClimateServiceController.java
+++ /dev/null
@@ -1,931 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import models.metadata.ClimateService;
-import models.metadata.DiffPlotTwoTimeAveragedVar;
-import models.metadata.RegridAndDownload;
-import models.metadata.TwoDVarZonalMean;
-import models.metadata.TwoDVarMap;
-import models.metadata.TwoDVarTimeSeries;
-import models.metadata.ThreeDVarZonalMean;
-import models.metadata.ThreeDVar2DSlice;
-import models.metadata.ThreeDVarAvgVertical4Profile;
-import models.metadata.ScatterHistogramTwoVar;
-import models.metadata.ConditionalSampling;
-import models.metadata.ServiceLog;
-import models.metadata.CorrelationMap;
-import models.metadata.ConditionalSampling2Var;
-import play.Logger;
-import play.data.Form;
-import play.libs.Json;
-import play.mvc.Controller;
-import play.mvc.Result;
-import scala.Console;
-import util.APICall;
-import util.APICall.ResponseType;
-import util.Constants;
-import views.html.climate.*;
-import play.data.DynamicForm;
-import java.io.File;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class ClimateServiceController extends Controller {
-
- final static Form<ClimateService> climateServiceForm = Form
- .form(ClimateService.class);
-
- public static Result home(String email, String vfile, String dataset) {
- return ok(home.render(email, vfile, dataset));
- }
-
- public static Result addClimateServices() {
- return ok(addClimateServices.render(climateServiceForm));
- }
-
- public static Result tutorial() {
- return ok(tutorial.render());
- }
-
- public static Result climateServices() {
- return ok(climateServices.render(ClimateService.all(),
- climateServiceForm));
- }
-
- public static Result mostRecentlyAddedClimateServices() {
- return ok(mostRecentlyAddedServices.render(ClimateService.getMostRecentlyAdded(),
- climateServiceForm));
- }
-
- public static Result mostRecentlyUsedClimateServices() {
- return ok(mostRecentlyUsedServices.render(ClimateService.getMostRecentlyUsed(),
- climateServiceForm));
- }
-
- public static Result mostPopularClimateServices() {
- return ok(mostPopularServices.render(ClimateService.getMostPopular(),
- climateServiceForm));
- }
-
- public static Result newClimateService() {
- Form<ClimateService> dc = climateServiceForm.bindFromRequest();
- ObjectNode jsonData = Json.newObject();
- try {
-
- String originalClimateServiceName = dc.field("Name").value();
- String newClimateServiceName = originalClimateServiceName.replace(' ', '-');
-
- if (newClimateServiceName != null && !newClimateServiceName.isEmpty()) {
- jsonData.put("name", newClimateServiceName);
- }
-
- jsonData.put("creatorId", 1);
- jsonData.put("purpose", dc.field("Purpose").value());
- jsonData.put("url", dc.field("Url").value());
- DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
- Date date = new Date();
- jsonData.put("createTime", dateFormat.format(date));
- jsonData.put("scenario", dc.field("Scenario").value());
- jsonData.put("versionNo", dc.field("Version").value());
- jsonData.put("rootServiceId", dc.field("Root_Service").value());
- JsonNode response = ClimateService.create(jsonData);
- Application.flashMsg(response);
- } catch (IllegalStateException e) {
- e.printStackTrace();
- Application.flashMsg(APICall
- .createResponse(ResponseType.CONVERSIONERROR));
- } catch (Exception e) {
- e.printStackTrace();
- Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
- }
- return redirect("/climate/climateServices");
- }
-
- public static Result editClimateService() {
-
- ObjectNode jsonData = Json.newObject();
- try {
- DynamicForm df = DynamicForm.form().bindFromRequest();
- String climateServiceName = df.field("pk").value();
-
- if (climateServiceName != null && !climateServiceName.isEmpty()) {
- jsonData.put("name", climateServiceName);
- }
- ClimateService originalService = ClimateService.findServiceByName(climateServiceName);
-
- if (originalService == null) {
- Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
- return notFound("not found original climateService " + climateServiceName);
- }
-
- jsonData.put("creatorId", 1);
- jsonData.put("purpose", originalService.getPurpose());
- jsonData.put("url", originalService.getUrl());
- jsonData.put("scenario", originalService.getScenario());
- jsonData.put("versionNo", originalService.getVersion());
-
- if (originalService.getRootservice() != null)
-
- jsonData.put("rootServiceId", originalService.getRootservice());
- String editField = df.field("name").value();
-
- if (editField != null && !editField.isEmpty()) {
- jsonData.put(editField, df.field("value").value());
- }
-
- if (editField == null || editField.isEmpty()) {
- Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
- return notFound("not found edit field");
- }
-
- JsonNode response = ClimateService.edit(climateServiceName, jsonData);
- Application.flashMsg(response);
-
- } catch (IllegalStateException e) {
- e.printStackTrace();
- Application.flashMsg(APICall
- .createResponse(ResponseType.CONVERSIONERROR));
- } catch (Exception e) {
- e.printStackTrace();
- Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
- }
- return ok("updated");
-
- }
-
- public static Result getConfigurationByConfId() {
- String output = "";
- TwoDVarMap twoDVarMap = new TwoDVarMap();
- TwoDVarZonalMean twoDVarZonalMean = new TwoDVarZonalMean();
- ScatterHistogramTwoVar scatterHistogram = new ScatterHistogramTwoVar();
- ThreeDVarAvgVertical4Profile threeDVarAvgVertical = new ThreeDVarAvgVertical4Profile();
- DiffPlotTwoTimeAveragedVar diffPlotTwoTimeAvg = new DiffPlotTwoTimeAveragedVar();
- ThreeDVar2DSlice threeDVar2DSlice = new ThreeDVar2DSlice();
- TwoDVarTimeSeries twoDVarTimeSeries = new TwoDVarTimeSeries();
- ThreeDVarZonalMean threeDVarZonalMean = new ThreeDVarZonalMean();
- ConditionalSampling conditionalSampling = new ConditionalSampling();
- RegridAndDownload regridAndDownload = new RegridAndDownload();
- CorrelationMap correlationMap = new CorrelationMap();
- ConditionalSampling2Var conditionalSampling2Var = new ConditionalSampling2Var();
-
- try {
- DynamicForm df = DynamicForm.form().bindFromRequest();
- String logId = df.field("logId").value();
-
- if (logId == null || logId.isEmpty()) {
- Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
- return notFound("confId is null or empty");
- }
-
- JsonNode response = APICall.callAPI(Constants.NEW_BACKEND + Constants.SERVICE_EXECUTION_LOG + Constants.SERVICE_EXECUTION_LOG_GET + logId);
- int configurationId = response.path("serviceConfiguration").path("id").asInt();
- JsonNode responseConfigItems = APICall.callAPI(Constants.NEW_BACKEND + Constants.CONFIG_ITEM + Constants.GET_CONFIG_ITEMS_BY_CONFIG + configurationId);
- String serviceName = response.path("climateService").path("name").asText();
- //TODO:
- if (serviceName.equals("2-D-Variable-Zonal-Mean")) {
- //TODO: DO NOT USE node.findPath(key)!!!!! use find(key) instead to get your immediate children if you know the json structure (and we do).
- //TODO: (con't) findPath returns the first occurence of a key string, including GRANDCHILDREN
- for (int i = 0; i < responseConfigItems.size(); i++) {
- String parameterName = responseConfigItems.get(i).path("parameter").path("purpose").textValue();
- String parameterValue = responseConfigItems.get(i).path("value").textValue();
-
- if (parameterName.equals("data source")) {
- twoDVarZonalMean.setDataSource(parameterValue);
- } else if (parameterName.equals("variable name")) {
- twoDVarZonalMean.setVariableName(parameterValue);
- } else if (parameterName.equals("start year-month")) {
- twoDVarZonalMean.setStartYearMonth(parameterValue);
- } else if (parameterName.equals("end year-month")) {
- twoDVarZonalMean.setEndYearMonth(parameterValue);
- } else if (parameterName.equals("select months")) {
- String[] months = parameterValue.split(",");
- for (int j = 0; j < months.length; j++) {
- if (months[j].equals("1")) {
- twoDVarZonalMean.addMonth("jan");
- } else if (months[j].equals("2")) {
- twoDVarZonalMean.addMonth("feb");
- } else if (months[j].equals("3")) {
- twoDVarZonalMean.addMonth("mar");
- } else if (months[j].equals("4")) {
- twoDVarZonalMean.addMonth("apr");
- } else if (months[j].equals("5")) {
- twoDVarZonalMean.addMonth("may");
- } else if (months[j].equals("6")) {
- twoDVarZonalMean.addMonth("jun");
- } else if (months[j].equals("7")) {
- twoDVarZonalMean.addMonth("jul");
- } else if (months[j].equals("8")) {
- twoDVarZonalMean.addMonth("aug");
- } else if (months[j].equals("9")) {
- twoDVarZonalMean.addMonth("sep");
- } else if (months[j].equals("10")) {
- twoDVarZonalMean.addMonth("oct");
- } else if (months[j].equals("11")) {
- twoDVarZonalMean.addMonth("nov");
- } else if (months[j].equals("12")) {
- twoDVarZonalMean.addMonth("dec");
- }
- }
- twoDVarZonalMean.changeSelectMonths();
- } else if (parameterName.equals("start lat (deg)")) {
- twoDVarZonalMean.setStartLat(parameterValue);
- } else if (parameterName.equals("end lat (deg)")) {
- twoDVarZonalMean.setEndLat(parameterValue);
- } else if (parameterName.equals("variable scale")) {
- twoDVarZonalMean.setVariableScale(parameterValue);
- }
- }
- twoDVarZonalMean.setExecutionPurpose(response.path("purpose").textValue());
- twoDVarZonalMean.setImage(response.path("plotUrl").textValue());
- twoDVarZonalMean.setDataURL(response.path("dataUrl").textValue());
- return ok(views.html.climate.twoDVariableZonelMean.render(twoDVarZonalMean));
- }
- else if (serviceName.equals("2-D-Variable-Map")) {
- for (int i = 0; i < responseConfigItems.size(); i++) {
- String parameterName = responseConfigItems.get(i).path("parameter").path("purpose").textValue();
- String parameterValue = responseConfigItems.get(i).path("value").textValue();
- if (parameterName.equals("model")) {
- twoDVarMap.setDataSource(parameterValue);
- } else if (parameterName.equals("var")) {
- twoDVarMap.setVariableName(parameterValue);
- } else if (parameterName.equals("startT")) {
- twoDVarMap.setStartYearMonth(parameterValue);
- } else if (parameterName.equals("endT")) {
- twoDVarMap.setEndYearMonth(parameterValue);
- } else if (parameterName.equals("months")) {
- String[] months = parameterValue.split(",");
- for (int j = 0; j < months.length; j++) {
- if (months[j].equals("1")) {
- twoDVarMap.addMonth("jan");
- } else if (months[j].equals("2")) {
- twoDVarMap.addMonth("feb");
- } else if (months[j].equals("3")) {
- twoDVarMap.addMonth("mar");
- } else if (months[j].equals("4")) {
- twoDVarMap.addMonth("apr");
- } else if (months[j].equals("5")) {
- twoDVarMap.addMonth("may");
- } else if (months[j].equals("6")) {
- twoDVarMap.addMonth("jun");
- } else if (months[j].equals("7")) {
- twoDVarMap.addMonth("jul");
- } else if (months[j].equals("8")) {
- twoDVarMap.addMonth("aug");
- } else if (months[j].equals("9")) {
- twoDVarMap.addMonth("sep");
- } else if (months[j].equals("10")) {
- twoDVarMap.addMonth("oct");
- } else if (months[j].equals("11")) {
- twoDVarMap.addMonth("nov");
- } else if (months[j].equals("12")) {
- twoDVarMap.addMonth("dec");
- }
- }
- twoDVarMap.changeSelectMonths();
- } else if (parameterName.equals("lat1")) {
- twoDVarMap.setStartLat(parameterValue);
- } else if (parameterName.equals("lat2")) {
- twoDVarMap.setEndLat(parameterValue);
- } else if (parameterName.equals("lon1")) {
- twoDVarMap.setStartLon(parameterValue);
- } else if (parameterName.equals("lon2")) {
- twoDVarMap.setEndLon(parameterValue);
- } else if (parameterName.equals("scale")) {
- twoDVarMap.setVariableScale(parameterValue);
- }
- }
- twoDVarMap.setExecutionPurpose(response.path("purpose").textValue());
- twoDVarMap.setImage(response.path("plotUrl").textValue());
- twoDVarMap.setDataURL(response.path("dataUrl").textValue());
- return ok(views.html.climate.twoDVariableMap.render(twoDVarMap));
- }
- else if (serviceName.equals("Conditional-Sampling-with-One-Variable")){
- for (int i = 0; i < responseConfigItems.size(); i++) {
- String parameterName = responseConfigItems.get(i).path("parameter").path("purpose").textValue();
- String parameterValue = responseConfigItems.get(i).path("value").textValue();
- if (parameterName.equals("model2")) {
- conditionalSampling.setDataSourceE(parameterValue);
- } else if (parameterName.equals("model1")) {
- conditionalSampling.setDataSourceP(parameterValue);
- } else if (parameterName.equals("var2")) {
- conditionalSampling.setVariableNameE(parameterValue);
- } else if (parameterName.equals("var1")) {
- conditionalSampling.setVariableNameP(parameterValue);
- } else if (parameterName.equals("pre1")) {
- conditionalSampling.setPressureRangeP(parameterValue);
- } else if (parameterName.equals("pre2")) {
- conditionalSampling.setPressureRangeE(parameterValue);
- } else if (parameterName.equals("startT")) {
- conditionalSampling.setStartYearMonth(parameterValue);
- } else if (parameterName.equals("endT")) {
- conditionalSampling.setEndYearMonth(parameterValue);
- } else if (parameterName.equals("lon1")) {
- conditionalSampling.setStartLon(parameterValue);
- } else if (parameterName.equals("lon2")) {
- conditionalSampling.setEndLon(parameterValue);
- } else if (parameterName.equals("lat1")) {
- conditionalSampling.setStartLat(parameterValue);
- } else if (parameterName.equals("lat2")) {
- conditionalSampling.setEndLat(parameterValue);
- } else if (parameterName.equals("months")) {
- String[] months = parameterValue.split(",");
- for (int j = 0; j < months.length; j++) {
- if (months[j].equals("1")) {
- conditionalSampling.addMonth("jan");
- } else if (months[j].equals("2")) {
- conditionalSampling.addMonth("feb");
- } else if (months[j].equals("3")) {
- conditionalSampling.addMonth("mar");
- } else if (months[j].equals("4")) {
- conditionalSampling.addMonth("apr");
- } else if (months[j].equals("5")) {
- conditionalSampling.addMonth("may");
- } else if (months[j].equals("6")) {
- conditionalSampling.addMonth("jun");
- } else if (months[j].equals("7")) {
- conditionalSampling.addMonth("jul");
- } else if (months[j].equals("8")) {
- conditionalSampling.addMonth("aug");
- } else if (months[j].equals("9")) {
- conditionalSampling.addMonth("sep");
- } else if (months[j].equals("10")) {
- conditionalSampling.addMonth("oct");
- } else if (months[j].equals("11")) {
- conditionalSampling.addMonth("nov");
- } else if (months[j].equals("12")) {
- conditionalSampling.addMonth("dec");
- }
-
- }
- conditionalSampling.changeSelectMonths();
- } else if (parameterName.equals("bin_min")) {
- conditionalSampling.setBin_min(parameterValue);
- } else if (parameterName.equals("bin_max")) {
- conditionalSampling.setBin_max(parameterValue);
- } else if (parameterName.equals("bin_n")) {
- conditionalSampling.setBin_n(parameterValue);
- } else if (parameterName.equals("displayOpt")) {
- int paramBit=Integer.parseInt(parameterValue);
- int bitmaskX = 0x1;
- int bitmaskY = 0x2;
- int bitmaskZ = 0x4;
- conditionalSampling.setX(Integer.toString(paramBit & bitmaskX, 2));
- conditionalSampling.setY(Integer.toString((paramBit & bitmaskY)>>1, 2));
- conditionalSampling.setZ(Integer.toString((paramBit & bitmaskZ)>>2, 2));
- }
- }
- conditionalSampling.setExecutionPurpose(response.path("purpose").textValue());
- conditionalSampling.setImage(response.path("plotUrl").textValue());
- conditionalSampling.setDataURL(response.path("dataUrl").textValue());
- return ok(views.html.climate.conditionalSampling.render(conditionalSampling));
- }else if (serviceName.equals("2-D-Variable-Time-Series")){
- for (int i = 0; i < responseConfigItems.size(); i++) {
- String parameterName = responseConfigItems.get(i).path("parameter").path("purpose").textValue();
- String parameterValue = responseConfigItems.get(i).path("value").textValue();
- if (parameterName.equals("model")) {
- twoDVarTimeSeries.setDataSource(parameterValue);
- } else if (parameterName.equals("var")) {
- twoDVarTimeSeries.setVariableName(parameterValue);
- } else if (parameterName.equals("startT")) {
- twoDVarTimeSeries.setStartYearMonth(parameterValue);
- } else if (parameterName.equals("endT")) {
- twoDVarTimeSeries.setEndYearMonth(parameterValue);
- } else if (parameterName.equals("lat1")) {
- twoDVarTimeSeries.setStartLat(parameterValue);
- } else if (parameterName.equals("lat2")) {
- twoDVarTimeSeries.setEndLat(parameterValue);
- } else if (parameterName.equals("lon1")) {
- twoDVarTimeSeries.setStartLon(parameterValue);
- } else if (parameterName.equals("lon2")) {
- twoDVarTimeSeries.setEndLon(parameterValue);
- } else if (parameterName.equals("scale")) {
- twoDVarTimeSeries.setVariableScale(parameterValue);
- }
- }
- twoDVarTimeSeries.setExecutionPurpose(response.path("purpose").textValue());
- twoDVarTimeSeries.setImage(response.path("plotUrl").textValue());
- twoDVarTimeSeries.setDataURL(response.path("dataUrl").textValue());
- return ok(views.html.climate.twoDVariableTimeSeries.render(twoDVarTimeSeries));
- }else if (serviceName.equals("Regrid-and-Download")){
- for (int i = 0; i < responseConfigItems.size(); i++) {
- String parameterName = responseConfigItems.get(i).path("parameter").path("purpose").textValue();
- String parameterValue = responseConfigItems.get(i).path("value").textValue();
- if (parameterName.equals("model")) {
- regridAndDownload.setDataSource(parameterValue);
- } else if (parameterName.equals("var")) {
- regridAndDownload.setVariableName(parameterValue);
- } else if (parameterName.equals("startT")) {
- regridAndDownload.setStartYearMonth(parameterValue);
- } else if (parameterName.equals("endT")) {
- regridAndDownload.setEndYearMonth(parameterValue);
- } else if (parameterName.equals("lat1")) {
- regridAndDownload.setStartLat(parameterValue);
- } else if (parameterName.equals("lat2")) {
- regridAndDownload.setEndLat(parameterValue);
- } else if (parameterName.equals("dlat")) {
- regridAndDownload.setDeltaLat(parameterValue);
- } else if (parameterName.equals("dlon")) {
- regridAndDownload.setDeltaLon(parameterValue);
- } else if (parameterName.equals("lon1")) {
- regridAndDownload.setStartLon(parameterValue);
- } else if (parameterName.equals("lon2")) {
- regridAndDownload.setEndLon(parameterValue);
- } else if (parameterName.equals("plev")) {
- regridAndDownload.setPressureLevel(parameterValue);
- }
- }
- regridAndDownload.setExecutionPurpose(response.path("purpose").textValue());
-
- regridAndDownload.setDataURL(response.path("dataUrl").textValue());
- return ok(views.html.climate.regridAndDownload.render(regridAndDownload));
- }else if (serviceName.equals("3-D-Variable-Zonal-Mean")){
- String press1 = "";
- String press2 = "";
- for (int i = 0; i < responseConfigItems.size(); i++) {
- String parameterName = responseConfigItems.get(i).path("parameter").path("purpose").textValue();
- String parameterValue = responseConfigItems.get(i).path("value").textValue();
- if (parameterName.equals("model")) {
- threeDVarZonalMean.setDataSource(parameterValue);
- } else if (parameterName.equals("var")) {
- threeDVarZonalMean.setVariableName(parameterValue);
- } else if (parameterName.equals("startT")) {
- threeDVarZonalMean.setStartYearMonth(parameterValue);
- } else if (parameterName.equals("endT")) {
- threeDVarZonalMean.setEndYearMonth(parameterValue);
- } else if (parameterName.equals("lat1")) {
- threeDVarZonalMean.setStartLat(parameterValue);
- } else if (parameterName.equals("lat2")) {
- threeDVarZonalMean.setEndLat(parameterValue);
- } else if (parameterName.equals("pres1")) {
- press1 = parameterValue;
- } else if (parameterName.equals("pres2")) {
- press2 = parameterValue;
- } else if (parameterName.equals("months")) {
- String[] months = parameterValue.split(",");
- for (int j = 0; j < months.length; j++) {
- if (months[j].equals("1")) {
- threeDVarZonalMean.addMonth("jan");
- } else if (months[j].equals("2")) {
- threeDVarZonalMean.addMonth("feb");
- } else if (months[j].equals("3")) {
- threeDVarZonalMean.addMonth("mar");
- } else if (months[j].equals("4")) {
- threeDVarZonalMean.addMonth("apr");
- } else if (months[j].equals("5")) {
- threeDVarZonalMean.addMonth("may");
- } else if (months[j].equals("6")) {
- threeDVarZonalMean.addMonth("jun");
- } else if (months[j].equals("7")) {
- threeDVarZonalMean.addMonth("jul");
- } else if (months[j].equals("8")) {
- threeDVarZonalMean.addMonth("aug");
- } else if (months[j].equals("9")) {
- threeDVarZonalMean.addMonth("sep");
- } else if (months[j].equals("10")) {
- threeDVarZonalMean.addMonth("oct");
- } else if (months[j].equals("11")) {
- threeDVarZonalMean.addMonth("nov");
- } else if (months[j].equals("12")) {
- threeDVarZonalMean.addMonth("dec");
- }
- }
- } else if (parameterName.equals("scale")) {
- if (parameterValue.equals("2")) {
- threeDVarZonalMean.setPressureScale("2");
- threeDVarZonalMean.setColorScale("0");
- } else if (parameterValue.equals("0")) {
- threeDVarZonalMean.setPressureScale("0");
- threeDVarZonalMean.setColorScale("0");
- } else if (parameterValue.equals("4")) {
- threeDVarZonalMean.setPressureScale("0");
- threeDVarZonalMean.setColorScale("4");
- } else if (parameterValue.equals("6")) {
- threeDVarZonalMean.setPressureScale("2");
- threeDVarZonalMean.setColorScale("4");
- }
- }
- }
- if (!press1.isEmpty() & !press2.isEmpty())
- threeDVarZonalMean.setPressureRange("" + (Integer.parseInt(press1) / 100) + "," + (Integer.parseInt(press2) / 100));
- threeDVarZonalMean.setExecutionPurpose(response.path("purpose").textValue());
- threeDVarZonalMean.setImage(response.path("plotUrl").textValue());
- threeDVarZonalMean.setDataURL(response.path("dataUrl").textValue());
- return ok(views.html.climate.threeDVariableZonalMean.render(threeDVarZonalMean));
- }else if (serviceName.equals("Scatter-and-Histogram-Plot-of-Two-Variables")){ //"19")){
- scatterHistogram.setPressureLevel1("N/A");
- scatterHistogram.setPressureLevel2("N/A");
- for (int i = 0; i < responseConfigItems.size(); i++) {
- String parameterName = responseConfigItems.get(i).path("parameter").path("purpose").textValue();
- String parameterValue = responseConfigItems.get(i).path("value").textValue();
- if (parameterName.equals("model1")) {
- scatterHistogram.setSource1(parameterValue);
-
- } else if (parameterName.equals("model2")) {
- scatterHistogram.setSource2(parameterValue);
-
- } else if (parameterName.equals("var1")) {
- scatterHistogram.setVaribaleName1(parameterValue);
-
- } else if (parameterName.equals("var2")) {
- scatterHistogram.setVaribaleName2(parameterValue);
- } else if (parameterName.equals("startT")) {
- scatterHistogram.setStartYear(parameterValue);
- } else if (parameterName.equals("endT")) {
- scatterHistogram.setEndYear(parameterValue);
- } else if (parameterName.equals("lon1")) {
- scatterHistogram.setStartLon(parameterValue);
- } else if (parameterName.equals("lon2")) {
- scatterHistogram.setEndLon(parameterValue);
- } else if (parameterName.equals("lat1")) {
- scatterHistogram.setStartLat(parameterValue);
- } else if (parameterName.equals("lat2")) {
- scatterHistogram.setEndLat(parameterValue);
- } else if (parameterName.equals("nSample")) {
- scatterHistogram.setSamples(parameterValue);
- }
- }
- scatterHistogram.setExecutionPurpose(response.path("purpose").textValue());
- scatterHistogram.setImage(response.path("plotUrl").textValue());
- scatterHistogram.setDataUrl(response.path("dataUrl").textValue());
- return ok(views.html.climate.scatterAndHistogramTwoVariable.render(scatterHistogram));
- }else if (serviceName.equals("Difference-Plot-of-Two-Time-Averaged-Variables")){ //"20")){
- diffPlotTwoTimeAvg.setPressureLevel1("N/A");
- Console.println(diffPlotTwoTimeAvg.getPressureLevel1());
- diffPlotTwoTimeAvg.setPressureLevel2("N/A");
- for (int i = 0; i < responseConfigItems.size(); i++) {
- String parameterName = responseConfigItems.get(i).path("parameter").path("purpose").textValue();
- String parameterValue = responseConfigItems.get(i).path("value").textValue();
- if (parameterName.equals("model1")) {
- diffPlotTwoTimeAvg.setSource1(parameterValue);
- } else if (parameterName.equals("model2")) {
- diffPlotTwoTimeAvg.setSource2(parameterValue);
- } else if (parameterName.equals("var1")) {
- diffPlotTwoTimeAvg.setVaribaleName1(parameterValue);
- } else if (parameterName.equals("var2")) {
- diffPlotTwoTimeAvg.setVaribaleName2(parameterValue);
- } else if (parameterName.equals("pre1")) {
- diffPlotTwoTimeAvg.setPressureLevel1(parameterValue);
- } else if (parameterName.equals("pre2")) {
- diffPlotTwoTimeAvg.setPressureLevel2(parameterValue);
- } else if (parameterName.equals("startT")) {
- diffPlotTwoTimeAvg.setStartYear(parameterValue);
- } else if (parameterName.equals("endT")) {
- diffPlotTwoTimeAvg.setEndYear(parameterValue);
- } else if (parameterName.equals("lon1")) {
- diffPlotTwoTimeAvg.setStartLon(parameterValue);
- } else if (parameterName.equals("lon2")) {
- diffPlotTwoTimeAvg.setEndLon(parameterValue);
- } else if (parameterName.equals("lat1")) {
- diffPlotTwoTimeAvg.setStartLat(parameterValue);
- } else if (parameterName.equals("lat2")) {
- diffPlotTwoTimeAvg.setEndLat(parameterValue);
- }
- }
- diffPlotTwoTimeAvg.setExecutionPurpose(response.path("purpose").textValue());
- diffPlotTwoTimeAvg.setImage(response.path("plotUrl").textValue());
- diffPlotTwoTimeAvg.setDataUrl(response.path("dataUrl").textValue());
- return ok(views.html.climate.differencePlotTwoTimeAveragedVariables.render(diffPlotTwoTimeAvg));
- }else if (serviceName.equals("3-D-Variable-Average-Vertical-Profile")){ //"18")){
- for (int i = 0; i < responseConfigItems.size(); i++) {
- String parameterName = responseConfigItems.get(i).path("parameter").path("purpose").textValue();
- String parameterValue = responseConfigItems.get(i).path("value").textValue();
- if (parameterName.equals("model")) {
- threeDVarAvgVertical.setDataSource(parameterValue);
- } else if (parameterName.equals("var")) {
- threeDVarAvgVertical.setVariableName(parameterValue);
- } else if (parameterName.equals("startT")) {
- threeDVarAvgVertical.setStartYearMonth(parameterValue);
- } else if (parameterName.equals("endT")) {
- threeDVarAvgVertical.setEndYearMonth(parameterValue);
- } else if (parameterName.equals("lon1")) {
- threeDVarAvgVertical.setStartLon(parameterValue);
- } else if (parameterName.equals("lon2")) {
- threeDVarAvgVertical.setEndLon(parameterValue);
- } else if (parameterName.equals("lat1")) {
- threeDVarAvgVertical.setStartLat(parameterValue);
- } else if (parameterName.equals("lat2")) {
- threeDVarAvgVertical.setEndLat(parameterValue);
- } else if (parameterName.equals("months")) {
- String[] months = parameterValue.split(",");
- for (int j = 0; j < months.length; j++) {
- if (months[j].equals("1")) {
- threeDVarAvgVertical.addMonth("jan");
- } else if (months[j].equals("2")) {
- threeDVarAvgVertical.addMonth("feb");
- } else if (months[j].equals("3")) {
- threeDVarAvgVertical.addMonth("mar");
- } else if (months[j].equals("4")) {
- threeDVarAvgVertical.addMonth("apr");
- } else if (months[j].equals("5")) {
- threeDVarAvgVertical.addMonth("may");
- } else if (months[j].equals("6")) {
- threeDVarAvgVertical.addMonth("jun");
- } else if (months[j].equals("7")) {
- threeDVarAvgVertical.addMonth("jul");
- } else if (months[j].equals("8")) {
- threeDVarAvgVertical.addMonth("aug");
- } else if (months[j].equals("9")) {
- threeDVarAvgVertical.addMonth("sep");
- } else if (months[j].equals("10")) {
- threeDVarAvgVertical.addMonth("oct");
- } else if (months[j].equals("11")) {
- threeDVarAvgVertical.addMonth("nov");
- } else if (months[j].equals("12")) {
- threeDVarAvgVertical.addMonth("dec");
- }
- }
- threeDVarAvgVertical.changeSelectMonths();
- } else if (parameterName.equals("scale")) {
- if (parameterValue.equals("2")) {
- threeDVarAvgVertical.setPressureLevelScale("2");
- threeDVarAvgVertical.setVariableScale("0");
- } else if (parameterValue.equals("0")) {
- threeDVarAvgVertical.setPressureLevelScale("0");
- threeDVarAvgVertical.setVariableScale("0");
- } else if (parameterValue.equals("1")) {
- threeDVarAvgVertical.setPressureLevelScale("0");
- threeDVarAvgVertical.setVariableScale("1");
- } else if (parameterValue.equals("3")) {
- threeDVarAvgVertical.setPressureLevelScale("2");
- threeDVarAvgVertical.setVariableScale("1");
- }
-
- }
- }
- threeDVarAvgVertical.setExecutionPurpose(response.path("purpose").textValue());
- threeDVarAvgVertical.setImage(response.path("plotUrl").textValue());
- threeDVarAvgVertical.setDataURL(response.path("dataUrl").textValue());
- return ok(views.html.climate.threeDVariableAerageVerticalProfile.render(threeDVarAvgVertical));
- }else if (serviceName.equals("3-D-Variable-2-D-Slice")){ //"16")){
- for (int i = 0; i < responseConfigItems.size(); i++) {
- String parameterName = responseConfigItems.get(i).path("parameter").path("purpose").textValue();
- String parameterValue = responseConfigItems.get(i).path("value").textValue();
- if (parameterName.equals("model")) {
- threeDVar2DSlice.setDataSource(parameterValue);
- } else if (parameterName.equals("var")) {
- threeDVar2DSlice.setVariableName(parameterValue);
- } else if (parameterName.equals("pr")) {
- threeDVar2DSlice.setPressureLevel(parameterValue);
- } else if (parameterName.equals("startT")) {
- threeDVar2DSlice.setStartYearMonth(parameterValue);
- } else if (parameterName.equals("endT")) {
- threeDVar2DSlice.setEndYearMonth(parameterValue);
- } else if (parameterName.equals("lon1")) {
- threeDVar2DSlice.setStartLon(parameterValue);
- } else if (parameterName.equals("lon2")) {
- threeDVar2DSlice.setEndLon(parameterValue);
- } else if (parameterName.equals("lat1")) {
- threeDVar2DSlice.setStartLat(parameterValue);
- } else if (parameterName.equals("lat2")) {
- threeDVar2DSlice.setEndLat(parameterValue);
- } else if (parameterName.equals("months")) {
- String[] months = parameterValue.split(",");
- for (int j = 0; j < months.length; j++) {
- if (months[j].equals("1")) {
- threeDVar2DSlice.addMonth("jan");
- } else if (months[j].equals("2")) {
- threeDVar2DSlice.addMonth("feb");
- } else if (months[j].equals("3")) {
- threeDVar2DSlice.addMonth("mar");
- } else if (months[j].equals("4")) {
- threeDVar2DSlice.addMonth("apr");
- } else if (months[j].equals("5")) {
- threeDVar2DSlice.addMonth("may");
- } else if (months[j].equals("6")) {
- threeDVar2DSlice.addMonth("jun");
- } else if (months[j].equals("7")) {
- threeDVar2DSlice.addMonth("jul");
- } else if (months[j].equals("8")) {
- threeDVar2DSlice.addMonth("aug");
- } else if (months[j].equals("9")) {
- threeDVar2DSlice.addMonth("sep");
- } else if (months[j].equals("10")) {
- threeDVar2DSlice.addMonth("oct");
- } else if (months[j].equals("11")) {
- threeDVar2DSlice.addMonth("nov");
- } else if (months[j].equals("12")) {
- threeDVar2DSlice.addMonth("dec");
- }
- }
- threeDVar2DSlice.changeSelectMonths();
- } else if (parameterName.equals("scale")) {
- threeDVar2DSlice.setColorScale(parameterValue);
- }
- }
- threeDVar2DSlice.setExecutionPurpose(response.path("purpose").textValue());
- threeDVar2DSlice.setImage(response.path("plotUrl").textValue());
- threeDVar2DSlice.setDataURL(response.path("dataUrl").textValue());
- return ok(views.html.climate.threeDVariableTwoDSlice.render(threeDVar2DSlice));
-
- }else if(serviceName.equals("Time-Lagged-Correlation-Map-of-Two-Variables")){
- correlationMap.setPressureLevel1("N/A");
- Console.println(correlationMap.getPressureLevel1());
- correlationMap.setPressureLevel2("N/A");
- for(int i = 0; i < responseConfigItems.size(); i++){
- String parameterName = responseConfigItems.get(i).path("parameter").path("purpose").textValue();
- String parameterValue = responseConfigItems.get(i).path("value").textValue();
- if (parameterName.equals("model1")) {
- correlationMap.setSource1(parameterValue);
- } else if (parameterName.equals("model2")) {
- correlationMap.setSource2(parameterValue);
- } else if (parameterName.equals("var1")) {
- correlationMap.setVariableName1(parameterValue);
- } else if (parameterName.equals("var2")) {
- correlationMap.setVariableName2(parameterValue);
- } else if (parameterName.equals("pres1")) {
- correlationMap.setPressureLevel1(parameterValue);
- } else if (parameterName.equals("pres2")) {
- correlationMap.setPressureLevel2(parameterValue);
- } else if (parameterName.equals("startT")) {
- correlationMap.setStartYear(parameterValue);
- } else if (parameterName.equals("endT")) {
- correlationMap.setEndYear(parameterValue);
- } else if (parameterName.equals("lon1")) {
- correlationMap.setStartLon(parameterValue);
- } else if (parameterName.equals("lon2")) {
- correlationMap.setEndLon(parameterValue);
- } else if (parameterName.equals("lat1")) {
- correlationMap.setStartLat(parameterValue);
- } else if (parameterName.equals("lat2")) {
- correlationMap.setEndLat(parameterValue);
- }else if (parameterName.equals("laggedTime")) {
- correlationMap.setLaggedTime(parameterValue);
- }
- }
- correlationMap.setExecutionPurpose(response.path("purpose").textValue());
- correlationMap.setImage(response.path("plotUrl").textValue());
- correlationMap.setDataURL(response.path("dataUrl").textValue());
- return ok(views.html.climate.correlationMap.render(correlationMap));
-
- }else if (serviceName.equals("Conditional-Sampling-with-Two-Variables")){
- for (int i = 0; i < responseConfigItems.size(); i++) {
- String parameterName = responseConfigItems.get(i).path("parameter").path("purpose").textValue();
- String parameterValue = responseConfigItems.get(i).path("value").textValue();
- if (parameterName.equals("model1")) {
- conditionalSampling2Var.setDataSourceP(parameterValue);
- } else if (parameterName.equals("model2")) {
- conditionalSampling2Var.setDataSourceE1(parameterValue);
- } else if (parameterName.equals("model3")) {
- conditionalSampling2Var.setDataSourceE2(parameterValue);
- } else if (parameterName.equals("var1")) {
- conditionalSampling2Var.setVariableNameP(parameterValue);
- } else if (parameterName.equals("var2")) {
- conditionalSampling2Var.setVariableNameE1(parameterValue);
- } else if (parameterName.equals("var3")) {
- conditionalSampling2Var.setVariableNameE2(parameterValue);
- } else if (parameterName.equals("pres1")) {
- conditionalSampling2Var.setPressureRange1(parameterValue);
- } else if (parameterName.equals("pres2")) {
- conditionalSampling2Var.setPressureRange2(parameterValue);
- } else if (parameterName.equals("startT")) {
- conditionalSampling2Var.setStartYearMonth(parameterValue);
- } else if (parameterName.equals("endT")) {
- conditionalSampling2Var.setEndYearMonth(parameterValue);
- } else if (parameterName.equals("lon1")) {
- conditionalSampling2Var.setStartLon(parameterValue);
- } else if (parameterName.equals("lon2")) {
- conditionalSampling2Var.setEndLon(parameterValue);
- } else if (parameterName.equals("lat1")) {
- conditionalSampling2Var.setStartLat(parameterValue);
- } else if (parameterName.equals("lat2")) {
- conditionalSampling2Var.setEndLat(parameterValue);
- } else if (parameterName.equals("months")) {
- String[] months = parameterValue.split(",");
- for (int j = 0; j < months.length; j++) {
- if (months[j].equals("1")) {
- conditionalSampling2Var.addMonth("jan");
- } else if (months[j].equals("2")) {
- conditionalSampling2Var.addMonth("feb");
- } else if (months[j].equals("3")) {
- conditionalSampling2Var.addMonth("mar");
- } else if (months[j].equals("4")) {
- conditionalSampling2Var.addMonth("apr");
- } else if (months[j].equals("5")) {
- conditionalSampling2Var.addMonth("may");
- } else if (months[j].equals("6")) {
- conditionalSampling2Var.addMonth("jun");
- } else if (months[j].equals("7")) {
- conditionalSampling2Var.addMonth("jul");
- } else if (months[j].equals("8")) {
- conditionalSampling2Var.addMonth("aug");
- } else if (months[j].equals("9")) {
- conditionalSampling2Var.addMonth("sep");
- } else if (months[j].equals("10")) {
- conditionalSampling2Var.addMonth("oct");
- } else if (months[j].equals("11")) {
- conditionalSampling2Var.addMonth("nov");
- } else if (months[j].equals("12")) {
- conditionalSampling2Var.addMonth("dec");
- }
- }
- conditionalSampling2Var.changeSelectMonths();
- } else if (parameterName.equals("bin_min1")) {
- conditionalSampling2Var.setBin_min1(parameterValue);
- } else if (parameterName.equals("bin_max1")) {
- conditionalSampling2Var.setBin_max1(parameterValue);
- } else if (parameterName.equals("bin_n1")) {
- conditionalSampling2Var.setBin_n1(parameterValue);
- } else if (parameterName.equals("bin_min2")) {
- conditionalSampling2Var.setBin_min2(parameterValue);
- } else if (parameterName.equals("bin_max2")) {
- conditionalSampling2Var.setBin_max2(parameterValue);
- } else if (parameterName.equals("bin_n2")) {
- conditionalSampling2Var.setBin_n2(parameterValue);
- } else if (parameterName.equals("env_var_plev1")) {
- conditionalSampling2Var.setEnableVarPlev1(parameterValue);
- } else if (parameterName.equals("env_var_plev2")) {
- conditionalSampling2Var.setEnableVarPlev2(parameterValue);
- } else if (parameterName.equals("displayOpt")) {
- int paramBit=Integer.parseInt(parameterValue);
- int bitmaskX = 0x1;
- int bitmaskY = 0x2;
- int bitmaskZ = 0x4;
- conditionalSampling2Var.setX(Integer.toString(paramBit & bitmaskX, 2));
- conditionalSampling2Var.setY(Integer.toString((paramBit & bitmaskY)>>1, 2));
- conditionalSampling2Var.setZ(Integer.toString((paramBit & bitmaskZ)>>2, 2));
- }
- }
- conditionalSampling2Var.setExecutionPurpose(response.path("purpose").textValue());
- conditionalSampling2Var.setImage(response.path("plotUrl").textValue());
- conditionalSampling2Var.setDataURL(response.path("dataUrl").textValue());
- return ok(views.html.climate.conditionalSampling2Var.render(conditionalSampling2Var));
- }else{
-
- }
- Application.flashMsg(response);
- Application.flashMsg(response);
- }catch (IllegalStateException e) {
- e.printStackTrace();
- Application.flashMsg(APICall
- .createResponse(ResponseType.CONVERSIONERROR));
- } catch (Exception e) {
- e.printStackTrace();
- Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
- }
- Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
-
- return ok();
- }
-
- public static Result deleteClimateService() throws UnsupportedEncodingException {
- DynamicForm df = DynamicForm.form().bindFromRequest();
- String climateServiceId = df.field("idHolder").value();
- Logger.debug(climateServiceId);
- JsonNode response = ClimateService.delete(climateServiceId);
- Application.flashMsg(response);
- return redirect("/climate/climateServices");
- }
-
- public static Result deleteServiceLog() throws UnsupportedEncodingException {
- DynamicForm df = DynamicForm.form().bindFromRequest();
- String confId = df.field("idHolder").value();
- Logger.debug(confId);
- JsonNode response = ServiceLog.deleteServiceLog(confId);
- Application.flashMsg(response);
- return redirect("/serviceLog");
- }
-
- public static Result downloadClimateService() {
- List<ClimateService> user = ClimateService.all();
- ObjectMapper mapper = new ObjectMapper();
- File file = new File("user.json");
- try {
- mapper.writeValue(file, user);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- response().setContentType("application/x-download");
- response().setHeader("Content-disposition",
- "attachment; filename=user.json");
- return ok(file);
- }
-
- public static Result oneService(String url) {
- return ok(oneService.render("/assets/html/" + url));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/controllers/DatasetController.java
----------------------------------------------------------------------
diff --git a/app/controllers/DatasetController.java b/app/controllers/DatasetController.java
deleted file mode 100644
index 0a226b6..0000000
--- a/app/controllers/DatasetController.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import models.DataSet;
-import play.data.Form;
-import play.libs.Json;
-import play.mvc.Controller;
-import play.mvc.Result;
-import util.APICall;
-import util.APICall.ResponseType;
-import views.html.climate.*;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-public class DatasetController extends Controller{
- final static Form<DataSet> dataSetForm = Form
- .form(DataSet.class);
-
- public static Result datasetList() {
- return ok(dataSetList.render(DataSet.all(),
- dataSetForm));
- }
-
- public static Result searchDataset(){
- return ok(searchDataSet.render(dataSetForm));
- }
-
- public static Result getSearchResult(){
- Form<DataSet> dc = dataSetForm.bindFromRequest();
- ObjectNode jsonData = Json.newObject();
- String dataSetName = "";
- String agency = "";
- String instrument = "";
- String physicalVariable = "";
- String gridDimension = "";
- String startTime = "";
- String endTime = "";
- Date dataSetStartTime = new Date(0), dataSetEndTime = new Date();
-
- try {
- dataSetName = dc.field("Dataset Name").value();
- agency = dc.field("Agency").value();
- instrument = dc.field("Instrument").value();
- physicalVariable = dc.field("Physical Variable").value();
- gridDimension = dc.field("Grid Dimension").value();
- startTime = dc.field("Dataset Start Time").value();
- endTime = dc.field("Dataset End Time").value();
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMM");
-
- if (!startTime.isEmpty()) {
- try {
- dataSetStartTime = simpleDateFormat.parse(startTime);
- Date min = new Date(0);
- Date max = new Date();
- if (dataSetStartTime.before(min)) {
- dataSetStartTime = min;
- } else if (dataSetStartTime.after(max)) {
- dataSetStartTime = max;
- }
- } catch (ParseException e) {
- System.out.println("Wrong Date Format :" + startTime);
- return badRequest("Wrong Date Format :" + startTime);
- }
- }
-
- if (!endTime.isEmpty()) {
- try {
- dataSetEndTime = simpleDateFormat.parse(endTime);
- Date min = new Date(0);
- Date max = new Date();
- if (dataSetEndTime.before(min)) {
- dataSetEndTime = min;
- }
- else if (dataSetEndTime.after(max)) {
- dataSetEndTime = max;
- }
- } catch (ParseException e) {
- System.out.println("Wrong Date Format :" + endTime);
- return badRequest("Wrong Date Format :" + endTime);
- }
- }
- } catch (IllegalStateException e) {
- e.printStackTrace();
- Application.flashMsg(APICall
- .createResponse(ResponseType.CONVERSIONERROR));
- } catch (Exception e) {
- e.printStackTrace();
- Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
- }
- List<DataSet> response = DataSet.queryDataSet(dataSetName, agency, instrument, physicalVariable, gridDimension, dataSetStartTime, dataSetEndTime);
- return ok(dataSetList.render(response, dataSetForm));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/controllers/HttpHelper.java
----------------------------------------------------------------------
diff --git a/app/controllers/HttpHelper.java b/app/controllers/HttpHelper.java
deleted file mode 100644
index 9dc17d0..0000000
--- a/app/controllers/HttpHelper.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package controllers;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import com.google.gson.JsonObject;
-
-public class HttpHelper {
- public static String HttpUserReg(String urlStr, JsonObject jsonObj, String operation)
- throws Exception {
- if (operation.equals("post")) {
- System.out.println("Reached inside post");
- return httpPost(urlStr, jsonObj.toString());
- }
- else if (operation.equals("get")) {
- System.out.println("Reached inside get");
- return httpGet(urlStr);
- } else if (operation.equals("delete")) {
- System.out.println("Reached inside delete");
- return httpDelete(urlStr);
- }
- return null;
- }
-
- public static String httpPost(String urlStr,
- String jsonString) throws Exception {
- URL url = new URL(urlStr);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.setRequestMethod("POST");
- conn.setRequestProperty("Content-Type", "application/json");
- conn.setRequestProperty("Accept", "application/json");
- conn.setDoOutput(true);
- OutputStream out = conn.getOutputStream();
- Writer writer = new OutputStreamWriter(out, "UTF-8");
- writer.write(jsonString);
- writer.close();
- out.close();
- return getHttpResponse(conn, 200);
- }
-
- public static String httpPostText(String urlStr,
- String textString) throws Exception {
- URL url = new URL(urlStr);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.setRequestMethod("POST");
- conn.setRequestProperty("Content-Type", "text/plain");
- conn.setRequestProperty("Accept", "application/json");
- conn.setDoOutput(true);
- OutputStream out = conn.getOutputStream();
- Writer writer = new OutputStreamWriter(out, "UTF-8");
- writer.write(textString);
- writer.close();
- out.close();
- return getHttpResponse(conn, 200);
- }
-
- public static String httpDelete(String urlStr)
- throws Exception {
- URL url = new URL(urlStr);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.setRequestMethod("DELETE");
- conn.setDoOutput(true);
- conn.connect();
- return getHttpResponse(conn, 201);
- }
-
- public static String httpGet(String urlStr)
- throws Exception {
- URL url = new URL(urlStr);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.setRequestMethod("GET");
- conn.setDoOutput(true);
- conn.connect();
- return getHttpResponse(conn, 200);
- }
-
- private static String getHttpResponse(HttpURLConnection conn, int expectedReturnCode) throws IOException {
- System.out.println("response code:" + conn.getResponseMessage());
- if (conn.getResponseCode() != expectedReturnCode) {
- System.out.println("Custom Error:" + conn.getResponseCode());
- throw new IOException(conn.getResponseMessage());
- }
-
- BufferedReader rd = new BufferedReader(new InputStreamReader(
- conn.getInputStream()));
- StringBuilder sb = new StringBuilder();
- String line;
- while ((line = rd.readLine()) != null) {
- sb.append(line);
- }
- rd.close();
- conn.disconnect();
- return sb.toString();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/models/.NasaRegistration.java.swp
----------------------------------------------------------------------
diff --git a/app/models/.NasaRegistration.java.swp b/app/models/.NasaRegistration.java.swp
deleted file mode 100644
index 081771e..0000000
Binary files a/app/models/.NasaRegistration.java.swp and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/models/BugReport.java
----------------------------------------------------------------------
diff --git a/app/models/BugReport.java b/app/models/BugReport.java
deleted file mode 100644
index 9842e09..0000000
--- a/app/models/BugReport.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package models;
-
-import java.util.*;
-import javax.persistence.*;
-import play.data.format.*;
-import play.data.validation.*;
-import java.sql.*;
-import java.sql.Date;
-import play.db.*;
-import play.db.jpa.*;
-
-public class BugReport {
-
- @Id
- private int id;
-
- @Constraints.Required
- private String title;
-
- @Constraints.Required
- private String email;
-
- @Constraints.Required
- private String name;
-
- private String organization;
- private String description;
- private int solved = 0;
-
- public BugReport() {
-
- }
-
- public BugReport(String title, String email, String name,
- String organization, String description, int solved,
- Date creationDate, Date updateDate) {
- super();
- this.title = title;
- this.email = email;
- this.name = name;
- this.organization = organization;
- this.description = description;
- this.solved = solved;
- this.creationDate = creationDate;
- this.updateDate = updateDate;
- }
-
- @Formats.DateTime(pattern = "MM/dd/yy")
- public java.sql.Date creationDate;
-
- @Formats.DateTime(pattern = "MM/dd/yy")
- public java.sql.Date updateDate;
-
- @play.db.jpa.Transactional
- public static List getAll() {
- Connection connection = DB.getConnection();
-
- try {
- Query query = JPA.em().createNativeQuery(
- "CREATE TABLE BUG_REPORT (id INT auto_increment, "
- + "title VARCHAR(255), "
- + "name VARCHAR(255), "
- + "email VARCHAR(255), "
- + "organization VARCHAR(255), "
- + "description VARCHAR(255), "
- + "solved TINYINT)");
- query.executeUpdate();
- System.out.println("created bug report table");
- } catch (Exception e) {
- System.out.println("Didn't create table");
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException e) {
- System.out.println(e);
- }
- }
- }
-
- Query query2 = JPA.em().createNativeQuery("SELECT * FROM BUG_REPORT order by solved");
- List<Object[]> list = query2.getResultList();
- return list;
- }
-
- @play.db.jpa.Transactional
- public boolean save() {
- Connection connection = DB.getConnection();
-
- try {
-
- Statement statement = connection.createStatement();
- String queryText = "INSERT INTO BUG_REPORT (title, name, email, organization, description, solved) VALUES ('"
- + this.title.replaceAll("\'", "\'\'")
- + "', '"
- + this.name.replaceAll("\'", "\'\'")
- + "', '"
- + this.email.replaceAll("\'", "\'\'")
- + "', '"
- + this.organization.replaceAll("\'", "\'\'")
- + "', '"
- + this.description.replaceAll("\'", "\'\'") + "', 0)";
- statement.executeUpdate(queryText);
- } catch (Exception e) {
- System.out.println(e.toString());
- return false;
- }
- finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException e) {
- System.out.println(e);
- }
- }
- }
- return true;
- }
-
- @play.db.jpa.Transactional
- public static boolean delete(int id) {
- Connection connection = DB.getConnection();
-
- try {
-
- Statement statement = connection.createStatement();
- String deleteText = "DELETE FROM BUG_REPORT WHERE ID = " + id;
- statement.executeUpdate(deleteText);
- } catch (Exception e) {
- e.printStackTrace();
- return false;
- }
- finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException e) {
- System.out.println(e);
- }
- }
- }
- return true;
- }
-
- @play.db.jpa.Transactional
- public static boolean solve(int id) {
- Connection connection = DB.getConnection();
- try {
-
- Statement statement = connection.createStatement();
- String solveText = "UPDATE BUG_REPORT SET SOLVED = 1 WHERE ID = " + id;
- statement.executeUpdate(solveText);
- } catch (Exception e) {
- e.printStackTrace();
- return false;
- }
- finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException e) {
- System.out.println(e);
- }
- }
- }
- return true;
- }
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String toString() {
- return "BugReport #" + id;
- }
-
- public String getTitle() {
- return this.title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getDescription() {
- return this.description;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getOrganization() {
- return organization;
- }
-
- public void setOrganization(String organization) {
- this.organization = organization;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public int getSolved() {
- return solved;
- }
-
- public void setSolved(int solved) {
- this.solved = solved;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/models/DataSet.java
----------------------------------------------------------------------
diff --git a/app/models/DataSet.java b/app/models/DataSet.java
deleted file mode 100644
index 929dce7..0000000
--- a/app/models/DataSet.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package models;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import util.APICall;
-import util.Constants;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class DataSet {
-
- private String id;
- private String dataSetName;
- private String agencyId;
- private String instrument;
- private String physicalVariable;
- private String CMIP5VarName;
- private String units;
- private String gridDimension;
- private String source;
- private String status;
- private String ResponsiblePerson;
- private String comments;
- private String dataSourceName;
- private String variableName;
- private String dataSourceInput;
- private String variableNameInput;
- private String startTime;
- private String endTime;
-
- public String getStartTime() {
- return startTime;
- }
-
- public String getEndTime() {
- return endTime;
- }
-
- public void setEndTime(String dataSetEndTime) {
- this.endTime = dataSetEndTime;
- }
-
- public void setStartTime(String dataSetStartTime) {
- this.startTime = dataSetStartTime;
- }
-
- public String getDataSetName() {
- return dataSetName;
- }
- public void setDataSetName(String dataSetName) {
- this.dataSetName = dataSetName;
- }
- public String getId() {
- return id;
- }
- public void setId(String id) {
- this.id = id;
- }
- public String getAgencyId() {
- return agencyId;
- }
- public void setAgencyId(String agencyId) {
- this.agencyId = agencyId;
- }
- public String getInstrument() {
- return instrument;
- }
- public void setInstrument(String instrument) {
- this.instrument = instrument;
- }
- public String getPhysicalVariable() {
- return physicalVariable;
- }
- public void setPhysicalVariable(String physicalVariable) {
- this.physicalVariable = physicalVariable;
- }
- public String getCMIP5VarName() {
- return CMIP5VarName;
- }
- public void setCMIP5VarName(String cMIP5VarName) {
- CMIP5VarName = cMIP5VarName;
- }
- public String getUnits() {
- return units;
- }
- public void setUnits(String units) {
- this.units = units;
- }
- public String getGridDimension() {
- return gridDimension;
- }
- public void setGridDimension(String gridDimension) {
- this.gridDimension = gridDimension;
- }
- public String getSource() {
- return source;
- }
- public void setSource(String source) {
- this.source = source;
- }
- public String getStatus() {
- return status;
- }
- public void setStatus(String status) {
- this.status = status;
- }
- public String getResponsiblePerson() {
- return ResponsiblePerson;
- }
- public void setResponsiblePerson(String responsiblePerson) {
- ResponsiblePerson = responsiblePerson;
- }
- public String getComments() {
- return comments;
- }
- public void setComments(String comments) {
- this.comments = comments;
- }
- public String getDataSourceName() {
- return dataSourceName;
- }
- public void setDataSourceName(String dataSourceName) {
- this.dataSourceName = dataSourceName;
- }
- public String getVariableName() {
- return variableName;
- }
- public void setVariableName(String variableName) {
- this.variableName = variableName;
- }
- public String getDataSourceInput() {
- return dataSourceInput;
- }
- public void setDataSourceInput(String dataSourceInput) {
- this.dataSourceInput = dataSourceInput;
- }
- public String getVariableNameInput() {
- return variableNameInput;
- }
- public void setVariableNameInput(String variableNameInput) {
- this.variableNameInput = variableNameInput;
- }
-
- private static final String GET_ALL_DATASET = Constants.NEW_BACKEND + "dataset/getAllDatasets/json";
- private static final String DATASET_QUERY = Constants.NEW_BACKEND + "dataset/queryDataset";
-
- public static List<DataSet> all() {
-
- List<DataSet> dataSets = new ArrayList<DataSet>();
-
- JsonNode dataSetNode = APICall.callAPI(GET_ALL_DATASET);
-
- if (dataSetNode == null || dataSetNode.has("error")
- || !dataSetNode.isArray()) {
- return dataSets;
- }
-
- for (int i = 0; i < dataSetNode.size(); i++) {
- JsonNode json = dataSetNode.path(i);
- DataSet dataset = new DataSet();
- dataset.setId(json.get("id").asText());
- dataset.setDataSetName(json.get("name").asText());
- dataset.setAgencyId(json.get("agencyId").asText());
- dataset.setInstrument(json.get("instrument").get("name").asText());
- dataset.setPhysicalVariable(json.get("physicalVariable").asText());
- dataset.setCMIP5VarName(json.get("CMIP5VarName").asText());
- dataset.setUnits(json.get("units").asText());
- dataset.setGridDimension(json.get("gridDimension").asText());
- dataset.setSource(json.get("source").asText());
- dataset.setStatus(json.get("status").asText());
- dataset.setResponsiblePerson(json.get("responsiblePerson").asText());
- dataset.setDataSourceName(json.get("dataSourceNameinWebInterface").asText());
- dataset.setVariableName(json.get("variableNameInWebInterface").asText());
- dataset.setDataSourceInput(json.get("dataSourceInputParameterToCallScienceApplicationCode").asText());
- dataset.setVariableNameInput(json.get("variableNameInputParameterToCallScienceApplicationCode").asText());
- String startTime = json.findPath("startTime").asText();
- String endTime = json.findPath("endTime").asText();
- Date tmpTime = null;
-
- try {
- tmpTime = (new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a")).parse(startTime);
-
- if (tmpTime != null) {
- dataset.setStartTime(new SimpleDateFormat("YYYYMM").format(tmpTime));
- }
- } catch (ParseException e){
-
- }
-
- try {
- tmpTime = (new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a")).parse(endTime);
-
- if (tmpTime != null) {
- dataset.setEndTime(new SimpleDateFormat("YYYYMM").format(tmpTime));
- }
- } catch (ParseException e){
-
- }
- dataSets.add(dataset);
- }
- return dataSets;
- }
-
-public static List<DataSet> queryDataSet(String dataSetName, String agency, String instrument, String physicalVariable, String gridDimension, Date dataSetStartTime, Date dataSetEndTime) {
-
- List<DataSet> dataset = new ArrayList<DataSet>();
- ObjectMapper mapper = new ObjectMapper();
- ObjectNode queryJson = mapper.createObjectNode();
- queryJson.put("name", dataSetName);
- queryJson.put("agencyId", agency);
- queryJson.put("instrument", instrument);
- queryJson.put("physicalVariable", physicalVariable);
- queryJson.put("gridDimension", gridDimension);
-
- if (dataSetEndTime != null) {
- queryJson.put("dataSetEndTime", dataSetEndTime.getTime());
- }
-
- if (dataSetStartTime != null) {
- queryJson.put("dataSetStartTime", dataSetStartTime.getTime());
- }
- JsonNode dataSetNode = APICall.postAPI(DATASET_QUERY, queryJson);
-
- if (dataSetNode == null || dataSetNode.has("error")
- || !dataSetNode.isArray()) {
- return dataset;
- }
-
- for (int i = 0; i < dataSetNode.size(); i++) {
- JsonNode json = dataSetNode.path(i);
- DataSet newDataSet = deserializeJsonToDataSet(json);
- dataset.add(newDataSet);
- }
- return dataset;
- }
-
- private static DataSet deserializeJsonToDataSet(JsonNode json) {
- DataSet newDataSet = new DataSet();
- newDataSet.setId(json.get("id").asText());
- newDataSet.setDataSetName(json.get("name").asText());
- newDataSet.setAgencyId(json.get("agencyId").asText());
- newDataSet.setInstrument(json.get("instrument").get("name").asText());
- newDataSet.setPhysicalVariable(json.get("physicalVariable").asText());
- newDataSet.setCMIP5VarName(json.get("CMIP5VarName").asText());
- newDataSet.setUnits(json.get("units").asText());
- newDataSet.setGridDimension(json.get("gridDimension").asText());
- newDataSet.setSource(json.get("source").asText());
- newDataSet.setStatus(json.get("status").asText());
- newDataSet.setResponsiblePerson(json.get("responsiblePerson").asText());
- newDataSet.setDataSourceName(json.get("dataSourceNameinWebInterface").asText());
- newDataSet.setVariableName(json.get("variableNameInWebInterface").asText());
- newDataSet.setDataSourceInput(json.get("dataSourceInputParameterToCallScienceApplicationCode").asText());
- newDataSet.setVariableNameInput(json.get("variableNameInputParameterToCallScienceApplicationCode").asText());
- String startTime = json.findPath("startTime").asText();
- String endTime = json.findPath("endTime").asText();
- Date tmpTime = null;
-
- try {
- tmpTime = (new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a")).parse(startTime);
-
- if (tmpTime != null) {
- newDataSet.setStartTime(new SimpleDateFormat("YYYYMM").format(tmpTime));
- }
- } catch (ParseException e){
- }
-
- try {
- tmpTime = (new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a")).parse(endTime);
-
- if (tmpTime != null) {
- newDataSet.setEndTime(new SimpleDateFormat("YYYYMM").format(tmpTime));
- }
- } catch (ParseException e){
-
- }
- return newDataSet;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/models/User.java
----------------------------------------------------------------------
diff --git a/app/models/User.java b/app/models/User.java
deleted file mode 100644
index becc703..0000000
--- a/app/models/User.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package models;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-
-import play.data.validation.Constraints;
-
-@Entity
-public class User {
-
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- private long id;
-
- private String userName;
- @Constraints.Required
- private String password;
- @Constraints.Required
- private String firstName;
- @Constraints.Required
- private String lastName;
- private String middleInitial;
- private String affiliation;
- private String title;
- @Constraints.Required
- private String email;
- private String mailingAddress;
- private String phoneNumber;
- private String faxNumber;
- private String researchFields;
- private String highestDegree;
-
- // @OneToMany(mappedBy = "user", cascade={CascadeType.ALL})
- // private Set<ClimateService> climateServices = new
- // HashSet<ClimateService>();
-
- public User() {
- }
-
- public User(String userName, String password, String firstName,
- String lastName, String middleInitial, String affiliation,
- String title, String email, String mailingAddress,
- String phoneNumber, String faxNumber, String researchFields,
- String highestDegree) {
- super();
- this.userName = userName;
- this.password = password;
- this.firstName = firstName;
- this.lastName = lastName;
- this.middleInitial = middleInitial;
- this.affiliation = affiliation;
- this.title = title;
- this.email = email;
- this.mailingAddress = mailingAddress;
- this.phoneNumber = phoneNumber;
- this.faxNumber = faxNumber;
- this.researchFields = researchFields;
- this.highestDegree = highestDegree;
- }
-
- public long getId() {
- return id;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public String getPassword() {
- return password;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public String getMiddleInitial() {
- return middleInitial;
- }
-
- public String getAffiliation() {
- return affiliation;
- }
-
- public String getTitle() {
- return title;
- }
-
- public String getEmail() {
- return email;
- }
-
- public String getMailingAddress() {
- return mailingAddress;
- }
-
- public String getPhoneNumber() {
- return phoneNumber;
- }
-
- public String getFaxNumber() {
- return faxNumber;
- }
-
- public String getResearchFields() {
- return researchFields;
- }
-
- public String getHighestDegree() {
- return highestDegree;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public void setMiddleInitial(String middleInitial) {
- this.middleInitial = middleInitial;
- }
-
- public void setAffiliation(String affiliation) {
- this.affiliation = affiliation;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public void setMailingAddress(String mailingAddress) {
- this.mailingAddress = mailingAddress;
- }
-
- public void setPhoneNumber(String phoneNumber) {
- this.phoneNumber = phoneNumber;
- }
-
- public void setFaxNumber(String faxNumber) {
- this.faxNumber = faxNumber;
- }
-
- public void setResearchFields(String researchFields) {
- this.researchFields = researchFields;
- }
-
- public void setHighestDegree(String highestDegree) {
- this.highestDegree = highestDegree;
- }
-
- @Override
- public String toString() {
- return "User [id=" + id + ", userName=" + userName + ", password="
- + password + ", firstName=" + firstName + ", lastName="
- + lastName + ", middleInitial=" + middleInitial
- + ", affiliation=" + affiliation + ", title=" + title
- + ", email=" + email + ", mailingAddress=" + mailingAddress
- + ", phoneNumber=" + phoneNumber + ", faxNumber=" + faxNumber
- + ", researchFields=" + researchFields + ", highestDegree="
- + highestDegree + "]";
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/models/metadata/ClimateService.java
----------------------------------------------------------------------
diff --git a/app/models/metadata/ClimateService.java b/app/models/metadata/ClimateService.java
deleted file mode 100644
index 63711e6..0000000
--- a/app/models/metadata/ClimateService.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package models.metadata;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.*;
-import com.fasterxml.jackson.databind.JsonNode;
-import util.APICall;
-import util.Constants;
-
-public class ClimateService {
-
- private String id;
- private String climateServiceName;
- private String purpose;
- private String url;
- private String scenario;
- private String version;
- private String rootservice;
- private String photo;
-
- public String getScenario() {
- return scenario;
- }
-
- public void setScenario(String scenario) {
- this.scenario = scenario;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getRootservice() {
- return rootservice;
- }
-
- public void setRootservice(String rootservice) {
- this.rootservice = rootservice;
- }
-
- private static final String GET_CLIMATE_SERVICES_CALL = Constants.NEW_BACKEND+"climateService/getAllClimateServices/json";
-
- private static final String GET_MOST_RECENTLY_ADDED_CLIMATE_SERVICES_CALL = Constants.NEW_BACKEND+"climateService/getAllMostRecentClimateServicesByCreateTime/json";
-
- private static final String GET_MOST_RECENTLY_USED_CLIMATE_SERVICES_CALL = Constants.NEW_BACKEND+"climateService/getAllMostRecentClimateServicesByLatestAccessTime/json";
-
- private static final String GET_MOST_POPULAR_CLIMATE_SERVICES_CALL = Constants.NEW_BACKEND+"climateService/getAllMostUsedClimateServices/json";
-
- private static final String ADD_CLIMATE_SERVICE_CALL = Constants.NEW_BACKEND+"climateService/addClimateService";
-
- private static final String DELETE_CLIMATE_SERVICE_CALL = Constants.NEW_BACKEND + util.Constants.NEW_DELETE_CLIMATE_SERVICE;
- private static final String EDIT_CLIMATE_SERVICE_CALL = Constants.NEW_BACKEND+ "climateService/"
- + util.Constants.NEW_EDIT_CLIMATE_SERVICE + "/name/";
-
- public ClimateService() {
- // TODO Auto-generated constructor stub
- }
-
- public String getId() {
- return id;
- }
-
- public String getClimateServiceName() {
- return climateServiceName;
- }
-
- public String getPurpose() {
- return purpose;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public void setClimateServiceName(String climateServiceName) {
- this.climateServiceName = climateServiceName;
- }
-
- public void setPurpose(String purpose) {
- this.purpose = purpose;
- }
-
- public void setUrl(String url) {
- this.url = url;
- setPhoto();
- }
-
- public static ClimateService find(String id) {
- ClimateService climateService = new ClimateService();
- climateService.setId(id);
- return climateService;
- }
-
- /**
- * find a climateService by its name
- *
- * @param climateServiceName
- * @return the founded result. If not found, return null
- */
- public static ClimateService findServiceByName(String climateServiceName){
- List<ClimateService> allList = all();
- for (ClimateService element : allList) {
- String elementUri = element.getClimateServiceName();
- if (elementUri.equals(climateServiceName))
- return element;
- }
- return null;
- }
-
- /**
- * Generate the list of all sensor categories
- *
- * @return a list of all the sensor categories
- */
- public static List<ClimateService> all() {
-
- List<ClimateService> climateServices = new ArrayList<ClimateService>();
-
- JsonNode climateServicesNode = APICall
- .callAPI(GET_CLIMATE_SERVICES_CALL);
-
- if (climateServicesNode == null || climateServicesNode.has("error")
- || !climateServicesNode.isArray()) {
- return climateServices;
- }
-
- for (int i = 0; i < climateServicesNode.size(); i++) {
- JsonNode json = climateServicesNode.path(i);
- ClimateService newService = new ClimateService();
- newService.setId(json.path("id").asText());
- newService.setClimateServiceName(json.get(
- "name").asText());
- newService.setPurpose(json.path("purpose").asText());
- newService.setUrl(json.path("url").asText());
- //newService.setCreateTime(json.path("createTime").asText());
- newService.setScenario(json.path("scenario").asText());
- newService.setVersion(json.path("versionNo").asText());
- newService.setRootservice(json.path("rootServiceId").asText());
- climateServices.add(newService);
- }
- return climateServices;
- }
-
- public static List<ClimateService> getMostRecentlyAdded() {
-
- List<ClimateService> climateServices = new ArrayList<ClimateService>();
-
- JsonNode climateServicesNode = APICall
- .callAPI(GET_MOST_RECENTLY_ADDED_CLIMATE_SERVICES_CALL);
- if (climateServicesNode == null || climateServicesNode.has("error")
- || !climateServicesNode.isArray()) {
- return climateServices;
- }
-
- for (int i = 0; i < climateServicesNode.size(); i++) {
- JsonNode json = climateServicesNode.path(i);
- ClimateService newService = new ClimateService();
- newService.setId(json.get("id").asText());
- newService.setClimateServiceName(json.get(
- "name").asText());
- newService.setPurpose(json.findPath("purpose").asText());
- newService.setUrl(json.findPath("url").asText());
- newService.setScenario(json.findPath("scenario").asText());
- newService.setVersion(json.findPath("versionNo").asText());
- newService.setRootservice(json.findPath("rootServiceId").asText());
- climateServices.add(newService);
- }
- return climateServices;
- }
-
- public static List<ClimateService> getMostRecentlyUsed() {
-
- List<ClimateService> climateServices = new ArrayList<ClimateService>();
-
- JsonNode climateServicesNode = APICall
- .callAPI(GET_MOST_RECENTLY_USED_CLIMATE_SERVICES_CALL);
-
- if (climateServicesNode == null || climateServicesNode.has("error")
- || !climateServicesNode.isArray()) {
- return climateServices;
- }
-
- for (int i = 0; i < climateServicesNode.size(); i++) {
- JsonNode json = climateServicesNode.path(i);
- ClimateService newService = new ClimateService();
- newService.setId(json.get("id").asText());
- newService.setClimateServiceName(json.get(
- "name").asText());
- newService.setPurpose(json.findPath("purpose").asText());
- newService.setUrl(json.findPath("url").asText());
- newService.setScenario(json.findPath("scenario").asText());
- newService.setVersion(json.findPath("versionNo").asText());
- newService.setRootservice(json.findPath("rootServiceId").asText());
- climateServices.add(newService);
- }
- return climateServices;
- }
-
- public static List<ClimateService> getMostPopular() {
-
- List<ClimateService> climateServices = new ArrayList<ClimateService>();
-
- JsonNode climateServicesNode = APICall
- .callAPI(GET_MOST_POPULAR_CLIMATE_SERVICES_CALL);
-
- if (climateServicesNode == null || climateServicesNode.has("error")
- || !climateServicesNode.isArray()) {
- return climateServices;
- }
-
- for (int i = 0; i < climateServicesNode.size(); i++) {
- JsonNode json = climateServicesNode.path(i);
- ClimateService newService = new ClimateService();
- newService.setId(json.get("id").asText());
- newService.setClimateServiceName(json.get(
- "name").asText());
- newService.setPurpose(json.findPath("purpose").asText());
- newService.setUrl(json.findPath("url").asText());
- newService.setScenario(json.findPath("scenario").asText());
- newService.setVersion(json.findPath("versionNo").asText());
- newService.setRootservice(json.findPath("rootServiceId").asText());
- climateServices.add(newService);
- }
- return climateServices;
- }
-
- /**
- * Create a new climate service
- *
- * @param jsonData
- * @return the response from the API server
- */
- public static JsonNode create(JsonNode jsonData) {
- return APICall.postAPI(ADD_CLIMATE_SERVICE_CALL, jsonData);
- }
-
- /**
- * Edit a climate service
- *
- * @param jsonData
- * @return
- * @throws UnsupportedEncodingException
- */
- public static JsonNode edit(String climateServiceName, JsonNode jsonData) throws UnsupportedEncodingException {
- return APICall.putAPI(EDIT_CLIMATE_SERVICE_CALL + URLEncoder.encode(climateServiceName, "UTF-8"), jsonData);
- }
-
- /**
- * Delete a sensor category
- *
- * @param climateServiceId
- * @return
- * @throws UnsupportedEncodingException
- */
- public static JsonNode delete(String climateServiceId) throws UnsupportedEncodingException {
- return APICall.deleteAPI(DELETE_CLIMATE_SERVICE_CALL
- + URLEncoder.encode(climateServiceId, "UTF-8"));
- }
-
- /**
- * Generate a list of climate service names
- *
- * @return a list of climate service names
- */
- public static List<String> allClimateServiceName() {
- List<ClimateService> allList = all();
- List<String> resultList = new ArrayList<String>();
- for (ClimateService element : allList) {
- String elementName = element.getClimateServiceName();
- if (elementName != null)
- resultList.add(elementName);
- }
- return resultList;
- }
-
- public void setPhoto(){
- if(url.contains("threeDimVarVertical.html")){
- photo = "/assets/images/3DVerticalProfile.jpeg";
- }else if(url.contains("twoDimZonalMean.html")){
- photo = "http://einstein.sv.cmu.edu:9002/static/twoDimZonalMean/65778f88e3e057738423aa7183f5ee54/nasa_modis_clt_200401_200412_Annual.jpeg";
- }else if(url.contains("twoDimMap.html")){
- photo = "http://einstein.sv.cmu.edu:9002/static/twoDimMap/6879a2eedd1910f4c45e6213d342e066/nasa_modis_clt_200401_200412_Annual.jpeg";
- }else if(url.contains("twoDimSlice3D.html")){
- photo = "http://einstein.sv.cmu.edu:9002/static/twoDimSlice3D/ba6b08d54048d9c8349185d2606d3638/nasa_airs_ta_200401_200412_Annual.jpeg";
- }else if(url.contains("scatterPlot2Vars.html")){
- photo = "/assets/images/ScatterPlot.png";
- }else if(url.contains("conditionalSampling.html")){
- photo = "/assets/images/ConditionalSampling1Variable.jpeg";
- }else if(url.contains("twoDimTimeSeries.html")){
- photo = "/assets/images/TimeSeriesPlot.jpeg";
- }else if(url.contains("threeDimZonalMean.html")){
- photo = "http://einstein.sv.cmu.edu:9002/static/threeDimZonalMean/e4e120045d2bb589eed371e1ca08fd99/nasa_airs_ta_200401_200412_Annual.jpeg";
- }else if(url.contains("diffPlot2Vars.html")){
- photo = "/assets/images/DifferencePlot.png";
- }else if (url.contains("regridAndDownload.html")) {
- photo = "/assets/images/regrid.jpg";
- }else if (url.contains("correlationMap.html")) {
- photo = "/assets/images/correlationMap.png";
- }else if (url.contains("conditionalSampling2Var.html")) {
- photo = "/assets/images/conditionalSampling2Variables.jpeg";
- }
- else{
- photo = "http://upload.wikimedia.org/wikipedia/commons/3/33/White_square_with_question_mark.png";
- }
- }
- public String getPhoto() {
- return photo;
- }
-
-}
-
RE: [43/49] incubator-cmda git commit: remove all
Posted by Jia Zhang <ji...@sv.cmu.edu>.
Dear Chris:
You are correct. It is the initial check-ins with the entire system. >From now on, unless major release, commits will be incremental.
Best regards,
Jia
---
Jia Zhang, Ph.D.
Associate Professor
Department of Electrical and Computer Engineering
Carnegie Mellon University – Silicon Valley
23 S. Akron Rd.
Mountain View, CA 94035
Email: jia.zhang@sv.cmu.edu
Phone: 312-718-2468
-----Original Message-----
From: Mattmann, Chris A (3980) [mailto:chris.a.mattmann@jpl.nasa.gov]
Sent: Wednesday, September 09, 2015 6:50 AM
To: dev@cmda.incubator.apache.org; jia.zhang@sv.cmu.edu
Cc: james@carmanconsulting.com
Subject: Re: [43/49] incubator-cmda git commit: remove all
Well, the short answer James, is no - we need commit notifications to exist and be sent to the commit list. I think one thing James was expressing is that many of the commits are difficult to review since there are tons of files being checked in and out. I’m assuming that’s b/c it’s the initial check-ins, and that all the commits won’t be this way. Is that correct?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Chris Mattmann, Ph.D.
Chief Architect
Instrument Software and Science Data Systems Section (398) NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 168-519, Mailstop: 168-527
Email: chris.a.mattmann@nasa.gov
WWW: http://sunset.usc.edu/~mattmann/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjunct Associate Professor, Computer Science Department University of Southern California, Los Angeles, CA 90089 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-----Original Message-----
From: Jia Zhang <ji...@sv.cmu.edu>
Organization: Carnegie Mellon University - Silicon Valley
Reply-To: "dev@cmda.incubator.apache.org" <de...@cmda.incubator.apache.org>, "jia.zhang@sv.cmu.edu" <ji...@sv.cmu.edu>
Date: Tuesday, September 8, 2015 at 9:56 PM
To: "dev@cmda.incubator.apache.org" <de...@cmda.incubator.apache.org>
Cc: "james@carmanconsulting.com" <ja...@carmanconsulting.com>
Subject: RE: [43/49] incubator-cmda git commit: remove all
>Dear James:
>
>Would you please clarify a little?
>
>Thanks a lot.
>
>Best regards,
>Jia
>
>-----Original Message-----
>From: James Carman [mailto:james@carmanconsulting.com]
>Sent: Tuesday, September 08, 2015 3:46 PM
>To: dev@cmda.incubator.apache.org
>Subject: Re: [43/49] incubator-cmda git commit: remove all
>
>Can we turn these notifications off?
>
>On Tue, Sep 8, 2015 at 6:44 PM <xi...@apache.org> wrote:
>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/a
>> p p/controllers/ClimateServiceController.java
>> ---------------------------------------------------------------------
>> - diff --git a/app/controllers/ClimateServiceController.java
>> b/app/controllers/ClimateServiceController.java
>> deleted file mode 100644
>> index 2c6aa1c..0000000
>> --- a/app/controllers/ClimateServiceController.java
>> +++ /dev/null
>> @@ -1,931 +0,0 @@
>> -/*
>> - * Licensed to the Apache Software Foundation (ASF) under one or
>>more
>> - * contributor license agreements. See the NOTICE file distributed
>>with
>> - * this work for additional information regarding copyright ownership.
>> - * The ASF licenses this file to You under the Apache License,
>>Version 2.0
>> - * (the "License"); you may not use this file except in compliance
>>with
>> - * the License. You may obtain a copy of the License at
>> - *
>> - * http://www.apache.org/licenses/LICENSE-2.0
>> - *
>> - * Unless required by applicable law or agreed to in writing,
>>software
>> - * distributed under the License is distributed on an "AS IS" BASIS,
>> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>implied.
>> - * See the License for the specific language governing permissions
>>and
>> - * limitations under the License.
>> - */
>> -
>> -package controllers;
>> -
>> -import com.fasterxml.jackson.databind.JsonNode;
>> -import com.fasterxml.jackson.databind.node.ObjectNode;
>> -import models.metadata.ClimateService; -import
>>models.metadata.DiffPlotTwoTimeAveragedVar;
>> -import models.metadata.RegridAndDownload;
>> -import models.metadata.TwoDVarZonalMean; -import
>>models.metadata.TwoDVarMap; -import models.metadata.TwoDVarTimeSeries;
>> -import models.metadata.ThreeDVarZonalMean;
>> -import models.metadata.ThreeDVar2DSlice; -import
>>models.metadata.ThreeDVarAvgVertical4Profile;
>> -import models.metadata.ScatterHistogramTwoVar;
>> -import models.metadata.ConditionalSampling;
>> -import models.metadata.ServiceLog;
>> -import models.metadata.CorrelationMap; -import
>>models.metadata.ConditionalSampling2Var;
>> -import play.Logger;
>> -import play.data.Form;
>> -import play.libs.Json;
>> -import play.mvc.Controller;
>> -import play.mvc.Result;
>> -import scala.Console;
>> -import util.APICall;
>> -import util.APICall.ResponseType;
>> -import util.Constants;
>> -import views.html.climate.*;
>> -import play.data.DynamicForm;
>> -import java.io.File;
>> -import java.io.IOException;
>> -import java.io.UnsupportedEncodingException;
>> -import java.text.DateFormat;
>> -import java.text.SimpleDateFormat;
>> -import java.util.Date;
>> -import java.util.List;
>> -import com.fasterxml.jackson.databind.ObjectMapper;
>> -
>> -public class ClimateServiceController extends Controller {
>> -
>> - final static Form<ClimateService> climateServiceForm = Form
>> - .form(ClimateService.class);
>> -
>> - public static Result home(String email, String vfile, String
>> dataset) {
>> - return ok(home.render(email, vfile, dataset));
>> - }
>> -
>> - public static Result addClimateServices() {
>> - return
>>ok(addClimateServices.render(climateServiceForm));
>> - }
>> -
>> - public static Result tutorial() {
>> - return ok(tutorial.render());
>> - }
>> -
>> - public static Result climateServices() {
>> - return ok(climateServices.render(ClimateService.all(),
>> - climateServiceForm));
>> - }
>> -
>> - public static Result mostRecentlyAddedClimateServices() {
>> - return
>>
>>ok(mostRecentlyAddedServices.render(ClimateService.getMostRecentlyAdde
>>d()
>>,
>> - climateServiceForm));
>> - }
>> -
>> - public static Result mostRecentlyUsedClimateServices() {
>> - return
>> ok(mostRecentlyUsedServices.render(ClimateService.getMostRecentlyUsed(),
>> - climateServiceForm));
>> - }
>> -
>> - public static Result mostPopularClimateServices() {
>> - return
>> ok(mostPopularServices.render(ClimateService.getMostPopular(),
>> - climateServiceForm));
>> - }
>> -
>> - public static Result newClimateService() {
>> - Form<ClimateService> dc =
>> climateServiceForm.bindFromRequest();
>> - ObjectNode jsonData = Json.newObject();
>> - try {
>> -
>> - String originalClimateServiceName =
>> dc.field("Name").value();
>> - String newClimateServiceName =
>> originalClimateServiceName.replace(' ', '-');
>> -
>> - if (newClimateServiceName != null &&
>> !newClimateServiceName.isEmpty()) {
>> - jsonData.put("name",
>> newClimateServiceName);
>> - }
>> -
>> - jsonData.put("creatorId", 1);
>> - jsonData.put("purpose",
>> dc.field("Purpose").value());
>> - jsonData.put("url", dc.field("Url").value());
>> - DateFormat dateFormat = new
>> SimpleDateFormat("yyyy/MM/dd HH:mm");
>> - Date date = new Date();
>> - jsonData.put("createTime",
>> dateFormat.format(date));
>> - jsonData.put("scenario",
>> dc.field("Scenario").value());
>> - jsonData.put("versionNo",
>> dc.field("Version").value());
>> - jsonData.put("rootServiceId",
>> dc.field("Root_Service").value());
>> - JsonNode response =
>> ClimateService.create(jsonData);
>> - Application.flashMsg(response);
>> - } catch (IllegalStateException e) {
>> - e.printStackTrace();
>> - Application.flashMsg(APICall
>> -
>> .createResponse(ResponseType.CONVERSIONERROR));
>> - } catch (Exception e) {
>> - e.printStackTrace();
>> -
>> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
>> - }
>> - return redirect("/climate/climateServices");
>> - }
>> -
>> - public static Result editClimateService() {
>> -
>> - ObjectNode jsonData = Json.newObject();
>> - try {
>> - DynamicForm df =
>> DynamicForm.form().bindFromRequest();
>> - String climateServiceName =
>>df.field("pk").value();
>> -
>> - if (climateServiceName != null &&
>> !climateServiceName.isEmpty()) {
>> - jsonData.put("name",
>>climateServiceName);
>> - }
>> - ClimateService originalService =
>> ClimateService.findServiceByName(climateServiceName);
>> -
>> - if (originalService == null) {
>> -
>> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
>> - return notFound("not found original
>> climateService " + climateServiceName);
>> - }
>> -
>> - jsonData.put("creatorId", 1);
>> - jsonData.put("purpose",
>> originalService.getPurpose());
>> - jsonData.put("url", originalService.getUrl());
>> - jsonData.put("scenario",
>> originalService.getScenario());
>> - jsonData.put("versionNo",
>> originalService.getVersion());
>> -
>> - if (originalService.getRootservice() != null)
>> -
>> - jsonData.put("rootServiceId",
>> originalService.getRootservice());
>> - String editField = df.field("name").value();
>> -
>> - if (editField != null && !editField.isEmpty()) {
>> - jsonData.put(editField,
>> df.field("value").value());
>> - }
>> -
>> - if (editField == null || editField.isEmpty()) {
>> -
>> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
>> - return notFound("not found edit field");
>> - }
>> -
>> - JsonNode response =
>> ClimateService.edit(climateServiceName, jsonData);
>> - Application.flashMsg(response);
>> -
>> - } catch (IllegalStateException e) {
>> - e.printStackTrace();
>> - Application.flashMsg(APICall
>> -
>> .createResponse(ResponseType.CONVERSIONERROR));
>> - } catch (Exception e) {
>> - e.printStackTrace();
>> -
>> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
>> - }
>> - return ok("updated");
>> -
>> - }
>> -
>> - public static Result getConfigurationByConfId() {
>> - String output = "";
>> - TwoDVarMap twoDVarMap = new TwoDVarMap();
>> - TwoDVarZonalMean twoDVarZonalMean = new
>>TwoDVarZonalMean();
>> - ScatterHistogramTwoVar scatterHistogram = new
>> ScatterHistogramTwoVar();
>> - ThreeDVarAvgVertical4Profile threeDVarAvgVertical = new
>> ThreeDVarAvgVertical4Profile();
>> - DiffPlotTwoTimeAveragedVar diffPlotTwoTimeAvg = new
>> DiffPlotTwoTimeAveragedVar();
>> - ThreeDVar2DSlice threeDVar2DSlice = new
>>ThreeDVar2DSlice();
>> - TwoDVarTimeSeries twoDVarTimeSeries = new
>> TwoDVarTimeSeries();
>> - ThreeDVarZonalMean threeDVarZonalMean = new
>> ThreeDVarZonalMean();
>> - ConditionalSampling conditionalSampling = new
>> ConditionalSampling();
>> - RegridAndDownload regridAndDownload = new
>> RegridAndDownload();
>> - CorrelationMap correlationMap = new CorrelationMap();
>> - ConditionalSampling2Var conditionalSampling2Var = new
>> ConditionalSampling2Var();
>> -
>> - try {
>> - DynamicForm df =
>> DynamicForm.form().bindFromRequest();
>> - String logId = df.field("logId").value();
>> -
>> - if (logId == null || logId.isEmpty()) {
>> -
>> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
>> - return notFound("confId is null or
>>empty");
>> - }
>> -
>> - JsonNode response =
>> APICall.callAPI(Constants.NEW_BACKEND +
>>Constants.SERVICE_EXECUTION_LOG + Constants.SERVICE_EXECUTION_LOG_GET
>>+ logId);
>> - int configurationId =
>> response.path("serviceConfiguration").path("id").asInt();
>> - JsonNode responseConfigItems =
>> APICall.callAPI(Constants.NEW_BACKEND + Constants.CONFIG_ITEM +
>>Constants.GET_CONFIG_ITEMS_BY_CONFIG + configurationId);
>> - String serviceName =
>> response.path("climateService").path("name").asText();
>> - //TODO:
>> - if
>>(serviceName.equals("2-D-Variable-Zonal-Mean"))
>> {
>> - //TODO: DO NOT USE
>> node.findPath(key)!!!!! use find(key) instead to get your immediate
>>children if you know the json structure (and we do).
>> - //TODO: (con't) findPath returns the
>>first
>> occurence of a key string, including GRANDCHILDREN
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> -
>> - if (parameterName.equals("data
>> source")) {
>> -
>> twoDVarZonalMean.setDataSource(parameterValue);
>> - } else if
>> (parameterName.equals("variable name")) {
>> -
>> twoDVarZonalMean.setVariableName(parameterValue);
>> - } else if
>> (parameterName.equals("start year-month")) {
>> -
>> twoDVarZonalMean.setStartYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("end year-month")) {
>> -
>> twoDVarZonalMean.setEndYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("select months")) {
>> - String[] months =
>> parameterValue.split(",");
>> - for (int j = 0; j <
>> months.length; j++) {
>> - if
>> (months[j].equals("1")) {
>> -
>> twoDVarZonalMean.addMonth("jan");
>> - } else if
>> (months[j].equals("2")) {
>> -
>> twoDVarZonalMean.addMonth("feb");
>> - } else if
>> (months[j].equals("3")) {
>> -
>> twoDVarZonalMean.addMonth("mar");
>> - } else if
>> (months[j].equals("4")) {
>> -
>> twoDVarZonalMean.addMonth("apr");
>> - } else if
>> (months[j].equals("5")) {
>> -
>> twoDVarZonalMean.addMonth("may");
>> - } else if
>> (months[j].equals("6")) {
>> -
>> twoDVarZonalMean.addMonth("jun");
>> - } else if
>> (months[j].equals("7")) {
>> -
>> twoDVarZonalMean.addMonth("jul");
>> - } else if
>> (months[j].equals("8")) {
>> -
>> twoDVarZonalMean.addMonth("aug");
>> - } else if
>> (months[j].equals("9")) {
>> -
>> twoDVarZonalMean.addMonth("sep");
>> - } else if
>> (months[j].equals("10")) {
>> -
>> twoDVarZonalMean.addMonth("oct");
>> - } else if
>> (months[j].equals("11")) {
>> -
>> twoDVarZonalMean.addMonth("nov");
>> - } else if
>> (months[j].equals("12")) {
>> -
>> twoDVarZonalMean.addMonth("dec");
>> - }
>> - }
>> -
>> twoDVarZonalMean.changeSelectMonths();
>> - } else if
>> (parameterName.equals("start lat (deg)")) {
>> -
>> twoDVarZonalMean.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("end lat (deg)")) {
>> -
>> twoDVarZonalMean.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("variable scale")) {
>> -
>> twoDVarZonalMean.setVariableScale(parameterValue);
>> - }
>> - }
>> -
>>
>>
>>twoDVarZonalMean.setExecutionPurpose(response.path("purpose").textValu
>> e());
>> -
>> twoDVarZonalMean.setImage(response.path("plotUrl").textValue());
>> -
>> twoDVarZonalMean.setDataURL(response.path("dataUrl").textValue());
>> - return
>> ok(views.html.climate.twoDVariableZonelMean.render(twoDVarZonalMean));
>> - }
>> - else if
>>(serviceName.equals("2-D-Variable-Map")) {
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> - if
>>(parameterName.equals("model"))
>> {
>> -
>> twoDVarMap.setDataSource(parameterValue);
>> - } else if
>> (parameterName.equals("var")) {
>> -
>> twoDVarMap.setVariableName(parameterValue);
>> - } else if
>> (parameterName.equals("startT")) {
>> -
>> twoDVarMap.setStartYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("endT")) {
>> -
>> twoDVarMap.setEndYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("months")) {
>> - String[] months =
>> parameterValue.split(",");
>> - for (int j = 0; j <
>> months.length; j++) {
>> - if
>> (months[j].equals("1")) {
>> -
>> twoDVarMap.addMonth("jan");
>> - } else if
>> (months[j].equals("2")) {
>> -
>> twoDVarMap.addMonth("feb");
>> - } else if
>> (months[j].equals("3")) {
>> -
>> twoDVarMap.addMonth("mar");
>> - } else if
>> (months[j].equals("4")) {
>> -
>> twoDVarMap.addMonth("apr");
>> - } else if
>> (months[j].equals("5")) {
>> -
>> twoDVarMap.addMonth("may");
>> - } else if
>> (months[j].equals("6")) {
>> -
>> twoDVarMap.addMonth("jun");
>> - } else if
>> (months[j].equals("7")) {
>> -
>> twoDVarMap.addMonth("jul");
>> - } else if
>> (months[j].equals("8")) {
>> -
>> twoDVarMap.addMonth("aug");
>> - } else if
>> (months[j].equals("9")) {
>> -
>> twoDVarMap.addMonth("sep");
>> - } else if
>> (months[j].equals("10")) {
>> -
>> twoDVarMap.addMonth("oct");
>> - } else if
>> (months[j].equals("11")) {
>> -
>> twoDVarMap.addMonth("nov");
>> - } else if
>> (months[j].equals("12")) {
>> -
>> twoDVarMap.addMonth("dec");
>> - }
>> - }
>> -
>> twoDVarMap.changeSelectMonths();
>> - } else if
>> (parameterName.equals("lat1")) {
>> -
>> twoDVarMap.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("lat2")) {
>> -
>> twoDVarMap.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("lon1")) {
>> -
>> twoDVarMap.setStartLon(parameterValue);
>> - } else if
>> (parameterName.equals("lon2")) {
>> -
>> twoDVarMap.setEndLon(parameterValue);
>> - } else if
>> (parameterName.equals("scale")) {
>> -
>> twoDVarMap.setVariableScale(parameterValue);
>> - }
>> - }
>> -
>>
>>twoDVarMap.setExecutionPurpose(response.path("purpose").textValue());
>> -
>> twoDVarMap.setImage(response.path("plotUrl").textValue());
>> -
>> twoDVarMap.setDataURL(response.path("dataUrl").textValue());
>> - return
>> ok(views.html.climate.twoDVariableMap.render(twoDVarMap));
>> - }
>> - else if
>> (serviceName.equals("Conditional-Sampling-with-One-Variable")){
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> - if
>> (parameterName.equals("model2")) {
>> -
>> conditionalSampling.setDataSourceE(parameterValue);
>> - } else if
>> (parameterName.equals("model1")) {
>> -
>> conditionalSampling.setDataSourceP(parameterValue);
>> - } else if
>> (parameterName.equals("var2")) {
>> -
>> conditionalSampling.setVariableNameE(parameterValue);
>> - } else if
>> (parameterName.equals("var1")) {
>> -
>> conditionalSampling.setVariableNameP(parameterValue);
>> - } else if
>> (parameterName.equals("pre1")) {
>> -
>> conditionalSampling.setPressureRangeP(parameterValue);
>> - } else if
>> (parameterName.equals("pre2")) {
>> -
>> conditionalSampling.setPressureRangeE(parameterValue);
>> - } else if
>> (parameterName.equals("startT")) {
>> -
>> conditionalSampling.setStartYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("endT")) {
>> -
>> conditionalSampling.setEndYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("lon1")) {
>> -
>> conditionalSampling.setStartLon(parameterValue);
>> - } else if
>> (parameterName.equals("lon2")) {
>> -
>> conditionalSampling.setEndLon(parameterValue);
>> - } else if
>> (parameterName.equals("lat1")) {
>> -
>> conditionalSampling.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("lat2")) {
>> -
>> conditionalSampling.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("months")) {
>> - String[] months =
>> parameterValue.split(",");
>> - for (int j = 0; j <
>> months.length; j++) {
>> - if
>> (months[j].equals("1")) {
>> -
>> conditionalSampling.addMonth("jan");
>> - } else if
>> (months[j].equals("2")) {
>> -
>> conditionalSampling.addMonth("feb");
>> - } else if
>> (months[j].equals("3")) {
>> -
>> conditionalSampling.addMonth("mar");
>> - } else if
>> (months[j].equals("4")) {
>> -
>> conditionalSampling.addMonth("apr");
>> - } else if
>> (months[j].equals("5")) {
>> -
>> conditionalSampling.addMonth("may");
>> - } else if
>> (months[j].equals("6")) {
>> -
>> conditionalSampling.addMonth("jun");
>> - } else if
>> (months[j].equals("7")) {
>> -
>> conditionalSampling.addMonth("jul");
>> - } else if
>> (months[j].equals("8")) {
>> -
>> conditionalSampling.addMonth("aug");
>> - } else if
>> (months[j].equals("9")) {
>> -
>> conditionalSampling.addMonth("sep");
>> - } else if
>> (months[j].equals("10")) {
>> -
>> conditionalSampling.addMonth("oct");
>> - } else if
>> (months[j].equals("11")) {
>> -
>> conditionalSampling.addMonth("nov");
>> - } else if
>> (months[j].equals("12")) {
>> -
>> conditionalSampling.addMonth("dec");
>> - }
>> -
>> - }
>> -
>> conditionalSampling.changeSelectMonths();
>> - } else if
>> (parameterName.equals("bin_min")) {
>> -
>> conditionalSampling.setBin_min(parameterValue);
>> - } else if
>> (parameterName.equals("bin_max")) {
>> -
>> conditionalSampling.setBin_max(parameterValue);
>> - } else if
>> (parameterName.equals("bin_n")) {
>> -
>> conditionalSampling.setBin_n(parameterValue);
>> - } else if
>> (parameterName.equals("displayOpt")) {
>> - int
>> paramBit=Integer.parseInt(parameterValue);
>> - int bitmaskX = 0x1;
>> - int bitmaskY = 0x2;
>> - int bitmaskZ = 0x4;
>> -
>> conditionalSampling.setX(Integer.toString(paramBit & bitmaskX, 2));
>> -
>> conditionalSampling.setY(Integer.toString((paramBit & bitmaskY)>>1,
>>2));
>> -
>> conditionalSampling.setZ(Integer.toString((paramBit & bitmaskZ)>>2,
>>2));
>> - }
>> - }
>> -
>>
>> conditionalSampling.setExecutionPurpose(response.path("purpose").text
>> V
>> alue());
>> -
>> conditionalSampling.setImage(response.path("plotUrl").textValue());
>> -
>> conditionalSampling.setDataURL(response.path("dataUrl").textValue());
>> - return
>> ok(views.html.climate.conditionalSampling.render(conditionalSampling));
>> - }else if
>> (serviceName.equals("2-D-Variable-Time-Series")){
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> - if
>>(parameterName.equals("model"))
>> {
>> -
>> twoDVarTimeSeries.setDataSource(parameterValue);
>> - } else if
>> (parameterName.equals("var")) {
>> -
>> twoDVarTimeSeries.setVariableName(parameterValue);
>> - } else if
>> (parameterName.equals("startT")) {
>> -
>> twoDVarTimeSeries.setStartYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("endT")) {
>> -
>> twoDVarTimeSeries.setEndYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("lat1")) {
>> -
>> twoDVarTimeSeries.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("lat2")) {
>> -
>> twoDVarTimeSeries.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("lon1")) {
>> -
>> twoDVarTimeSeries.setStartLon(parameterValue);
>> - } else if
>> (parameterName.equals("lon2")) {
>> -
>> twoDVarTimeSeries.setEndLon(parameterValue);
>> - } else if
>> (parameterName.equals("scale")) {
>> -
>> twoDVarTimeSeries.setVariableScale(parameterValue);
>> - }
>> - }
>> -
>>
>> twoDVarTimeSeries.setExecutionPurpose(response.path("purpose").textVa
>> l
>> ue());
>> -
>> twoDVarTimeSeries.setImage(response.path("plotUrl").textValue());
>> -
>> twoDVarTimeSeries.setDataURL(response.path("dataUrl").textValue());
>> - return
>> ok(views.html.climate.twoDVariableTimeSeries.render(twoDVarTimeSeries));
>> - }else if
>> (serviceName.equals("Regrid-and-Download")){
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> - if
>>(parameterName.equals("model"))
>> {
>> -
>> regridAndDownload.setDataSource(parameterValue);
>> - } else if
>> (parameterName.equals("var")) {
>> -
>> regridAndDownload.setVariableName(parameterValue);
>> - } else if
>> (parameterName.equals("startT")) {
>> -
>> regridAndDownload.setStartYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("endT")) {
>> -
>> regridAndDownload.setEndYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("lat1")) {
>> -
>> regridAndDownload.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("lat2")) {
>> -
>> regridAndDownload.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("dlat")) {
>> -
>> regridAndDownload.setDeltaLat(parameterValue);
>> - } else if
>> (parameterName.equals("dlon")) {
>> -
>> regridAndDownload.setDeltaLon(parameterValue);
>> - } else if
>> (parameterName.equals("lon1")) {
>> -
>> regridAndDownload.setStartLon(parameterValue);
>> - } else if
>> (parameterName.equals("lon2")) {
>> -
>> regridAndDownload.setEndLon(parameterValue);
>> - } else if
>> (parameterName.equals("plev")) {
>> -
>> regridAndDownload.setPressureLevel(parameterValue);
>> - }
>> - }
>> -
>>
>> regridAndDownload.setExecutionPurpose(response.path("purpose").textVa
>> l
>> ue());
>> -
>> -
>> regridAndDownload.setDataURL(response.path("dataUrl").textValue());
>> - return
>> ok(views.html.climate.regridAndDownload.render(regridAndDownload));
>> - }else if
>> (serviceName.equals("3-D-Variable-Zonal-Mean")){
>> - String press1 = "";
>> - String press2 = "";
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> - if
>>(parameterName.equals("model"))
>> {
>> -
>> threeDVarZonalMean.setDataSource(parameterValue);
>> - } else if
>> (parameterName.equals("var")) {
>> -
>> threeDVarZonalMean.setVariableName(parameterValue);
>> - } else if
>> (parameterName.equals("startT")) {
>> -
>> threeDVarZonalMean.setStartYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("endT")) {
>> -
>> threeDVarZonalMean.setEndYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("lat1")) {
>> -
>> threeDVarZonalMean.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("lat2")) {
>> -
>> threeDVarZonalMean.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("pres1")) {
>> - press1 = parameterValue;
>> - } else if
>> (parameterName.equals("pres2")) {
>> - press2 = parameterValue;
>> - } else if
>> (parameterName.equals("months")) {
>> - String[] months =
>> parameterValue.split(",");
>> - for (int j = 0; j <
>> months.length; j++) {
>> - if
>> (months[j].equals("1")) {
>> -
>> threeDVarZonalMean.addMonth("jan");
>> - } else if
>> (months[j].equals("2")) {
>> -
>> threeDVarZonalMean.addMonth("feb");
>> - } else if
>> (months[j].equals("3")) {
>> -
>> threeDVarZonalMean.addMonth("mar");
>> - } else if
>> (months[j].equals("4")) {
>> -
>> threeDVarZonalMean.addMonth("apr");
>> - } else if
>> (months[j].equals("5")) {
>> -
>> threeDVarZonalMean.addMonth("may");
>> - } else if
>> (months[j].equals("6")) {
>> -
>> threeDVarZonalMean.addMonth("jun");
>> - } else if
>> (months[j].equals("7")) {
>> -
>> threeDVarZonalMean.addMonth("jul");
>> - } else if
>> (months[j].equals("8")) {
>> -
>> threeDVarZonalMean.addMonth("aug");
>> - } else if
>> (months[j].equals("9")) {
>> -
>> threeDVarZonalMean.addMonth("sep");
>> - } else if
>> (months[j].equals("10")) {
>> -
>> threeDVarZonalMean.addMonth("oct");
>> - } else if
>> (months[j].equals("11")) {
>> -
>> threeDVarZonalMean.addMonth("nov");
>> - } else if
>> (months[j].equals("12")) {
>> -
>> threeDVarZonalMean.addMonth("dec");
>> - }
>> - }
>> - } else if
>> (parameterName.equals("scale")) {
>> - if
>> (parameterValue.equals("2")) {
>> -
>> threeDVarZonalMean.setPressureScale("2");
>> -
>> threeDVarZonalMean.setColorScale("0");
>> - } else if
>> (parameterValue.equals("0")) {
>> -
>> threeDVarZonalMean.setPressureScale("0");
>> -
>> threeDVarZonalMean.setColorScale("0");
>> - } else if
>> (parameterValue.equals("4")) {
>> -
>> threeDVarZonalMean.setPressureScale("0");
>> -
>> threeDVarZonalMean.setColorScale("4");
>> - } else if
>> (parameterValue.equals("6")) {
>> -
>> threeDVarZonalMean.setPressureScale("2");
>> -
>> threeDVarZonalMean.setColorScale("4");
>> - }
>> - }
>> - }
>> - if (!press1.isEmpty() &
>>!press2.isEmpty())
>> -
>> threeDVarZonalMean.setPressureRange("" + (Integer.parseInt(press1) /
>> 100)
>> + "," + (Integer.parseInt(press2) / 100));
>> -
>>
>> threeDVarZonalMean.setExecutionPurpose(response.path("purpose").textV
>> a
>> lue());
>> -
>> threeDVarZonalMean.setImage(response.path("plotUrl").textValue());
>> -
>> threeDVarZonalMean.setDataURL(response.path("dataUrl").textValue());
>> - return
>>
>>ok(views.html.climate.threeDVariableZonalMean.render(threeDVarZonalMea
>>n))
>>;
>> - }else if
>> (serviceName.equals("Scatter-and-Histogram-Plot-of-Two-Variables")){
>> //"19")){
>> -
>> scatterHistogram.setPressureLevel1("N/A");
>> -
>> scatterHistogram.setPressureLevel2("N/A");
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> - if
>> (parameterName.equals("model1")) {
>> -
>> scatterHistogram.setSource1(parameterValue);
>> -
>> - } else if
>> (parameterName.equals("model2")) {
>> -
>> scatterHistogram.setSource2(parameterValue);
>> -
>> - } else if
>> (parameterName.equals("var1")) {
>> -
>> scatterHistogram.setVaribaleName1(parameterValue);
>> -
>> - } else if
>> (parameterName.equals("var2")) {
>> -
>> scatterHistogram.setVaribaleName2(parameterValue);
>> - } else if
>> (parameterName.equals("startT")) {
>> -
>> scatterHistogram.setStartYear(parameterValue);
>> - } else if
>> (parameterName.equals("endT")) {
>> -
>> scatterHistogram.setEndYear(parameterValue);
>> - } else if
>> (parameterName.equals("lon1")) {
>> -
>> scatterHistogram.setStartLon(parameterValue);
>> - } else if
>> (parameterName.equals("lon2")) {
>> -
>> scatterHistogram.setEndLon(parameterValue);
>> - } else if
>> (parameterName.equals("lat1")) {
>> -
>> scatterHistogram.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("lat2")) {
>> -
>> scatterHistogram.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("nSample")) {
>> -
>> scatterHistogram.setSamples(parameterValue);
>> - }
>> - }
>> -
>>
>> scatterHistogram.setExecutionPurpose(response.path("purpose").textVal
>> u
>> e());
>> -
>> scatterHistogram.setImage(response.path("plotUrl").textValue());
>> -
>> scatterHistogram.setDataUrl(response.path("dataUrl").textValue());
>> - return
>>
>>ok(views.html.climate.scatterAndHistogramTwoVariable.render(scatterHis
>>tog
>>ram));
>> - }else if
>> (serviceName.equals("Difference-Plot-of-Two-Time-Averaged-Variables")){
>> //"20")){
>> -
>> diffPlotTwoTimeAvg.setPressureLevel1("N/A");
>> -
>> Console.println(diffPlotTwoTimeAvg.getPressureLevel1());
>> -
>> diffPlotTwoTimeAvg.setPressureLevel2("N/A");
>> - for (int i = 0; i < response
>
>
Re: [43/49] incubator-cmda git commit: remove all
Posted by "Mattmann, Chris A (3980)" <ch...@jpl.nasa.gov>.
Well, the short answer James, is no - we need commit notifications
to exist and be sent to the commit list. I think one thing James
was expressing is that many of the commits are difficult to review
since there are tons of files being checked in and out. I’m assuming
that’s b/c it’s the initial check-ins, and that all the commits won’t
be this way. Is that correct?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Chris Mattmann, Ph.D.
Chief Architect
Instrument Software and Science Data Systems Section (398)
NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 168-519, Mailstop: 168-527
Email: chris.a.mattmann@nasa.gov
WWW: http://sunset.usc.edu/~mattmann/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjunct Associate Professor, Computer Science Department
University of Southern California, Los Angeles, CA 90089 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-----Original Message-----
From: Jia Zhang <ji...@sv.cmu.edu>
Organization: Carnegie Mellon University - Silicon Valley
Reply-To: "dev@cmda.incubator.apache.org" <de...@cmda.incubator.apache.org>,
"jia.zhang@sv.cmu.edu" <ji...@sv.cmu.edu>
Date: Tuesday, September 8, 2015 at 9:56 PM
To: "dev@cmda.incubator.apache.org" <de...@cmda.incubator.apache.org>
Cc: "james@carmanconsulting.com" <ja...@carmanconsulting.com>
Subject: RE: [43/49] incubator-cmda git commit: remove all
>Dear James:
>
>Would you please clarify a little?
>
>Thanks a lot.
>
>Best regards,
>Jia
>
>-----Original Message-----
>From: James Carman [mailto:james@carmanconsulting.com]
>Sent: Tuesday, September 08, 2015 3:46 PM
>To: dev@cmda.incubator.apache.org
>Subject: Re: [43/49] incubator-cmda git commit: remove all
>
>Can we turn these notifications off?
>
>On Tue, Sep 8, 2015 at 6:44 PM <xi...@apache.org> wrote:
>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/ap
>> p/controllers/ClimateServiceController.java
>> ----------------------------------------------------------------------
>> diff --git a/app/controllers/ClimateServiceController.java
>> b/app/controllers/ClimateServiceController.java
>> deleted file mode 100644
>> index 2c6aa1c..0000000
>> --- a/app/controllers/ClimateServiceController.java
>> +++ /dev/null
>> @@ -1,931 +0,0 @@
>> -/*
>> - * Licensed to the Apache Software Foundation (ASF) under one or more
>> - * contributor license agreements. See the NOTICE file distributed
>> with
>> - * this work for additional information regarding copyright ownership.
>> - * The ASF licenses this file to You under the Apache License,
>> Version 2.0
>> - * (the "License"); you may not use this file except in compliance
>> with
>> - * the License. You may obtain a copy of the License at
>> - *
>> - * http://www.apache.org/licenses/LICENSE-2.0
>> - *
>> - * Unless required by applicable law or agreed to in writing,
>> software
>> - * distributed under the License is distributed on an "AS IS" BASIS,
>> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>> - * See the License for the specific language governing permissions
>> and
>> - * limitations under the License.
>> - */
>> -
>> -package controllers;
>> -
>> -import com.fasterxml.jackson.databind.JsonNode;
>> -import com.fasterxml.jackson.databind.node.ObjectNode;
>> -import models.metadata.ClimateService; -import
>> models.metadata.DiffPlotTwoTimeAveragedVar;
>> -import models.metadata.RegridAndDownload;
>> -import models.metadata.TwoDVarZonalMean; -import
>> models.metadata.TwoDVarMap; -import models.metadata.TwoDVarTimeSeries;
>> -import models.metadata.ThreeDVarZonalMean;
>> -import models.metadata.ThreeDVar2DSlice; -import
>> models.metadata.ThreeDVarAvgVertical4Profile;
>> -import models.metadata.ScatterHistogramTwoVar;
>> -import models.metadata.ConditionalSampling;
>> -import models.metadata.ServiceLog;
>> -import models.metadata.CorrelationMap; -import
>> models.metadata.ConditionalSampling2Var;
>> -import play.Logger;
>> -import play.data.Form;
>> -import play.libs.Json;
>> -import play.mvc.Controller;
>> -import play.mvc.Result;
>> -import scala.Console;
>> -import util.APICall;
>> -import util.APICall.ResponseType;
>> -import util.Constants;
>> -import views.html.climate.*;
>> -import play.data.DynamicForm;
>> -import java.io.File;
>> -import java.io.IOException;
>> -import java.io.UnsupportedEncodingException;
>> -import java.text.DateFormat;
>> -import java.text.SimpleDateFormat;
>> -import java.util.Date;
>> -import java.util.List;
>> -import com.fasterxml.jackson.databind.ObjectMapper;
>> -
>> -public class ClimateServiceController extends Controller {
>> -
>> - final static Form<ClimateService> climateServiceForm = Form
>> - .form(ClimateService.class);
>> -
>> - public static Result home(String email, String vfile, String
>> dataset) {
>> - return ok(home.render(email, vfile, dataset));
>> - }
>> -
>> - public static Result addClimateServices() {
>> - return
>>ok(addClimateServices.render(climateServiceForm));
>> - }
>> -
>> - public static Result tutorial() {
>> - return ok(tutorial.render());
>> - }
>> -
>> - public static Result climateServices() {
>> - return ok(climateServices.render(ClimateService.all(),
>> - climateServiceForm));
>> - }
>> -
>> - public static Result mostRecentlyAddedClimateServices() {
>> - return
>>
>>ok(mostRecentlyAddedServices.render(ClimateService.getMostRecentlyAdded()
>>,
>> - climateServiceForm));
>> - }
>> -
>> - public static Result mostRecentlyUsedClimateServices() {
>> - return
>> ok(mostRecentlyUsedServices.render(ClimateService.getMostRecentlyUsed(),
>> - climateServiceForm));
>> - }
>> -
>> - public static Result mostPopularClimateServices() {
>> - return
>> ok(mostPopularServices.render(ClimateService.getMostPopular(),
>> - climateServiceForm));
>> - }
>> -
>> - public static Result newClimateService() {
>> - Form<ClimateService> dc =
>> climateServiceForm.bindFromRequest();
>> - ObjectNode jsonData = Json.newObject();
>> - try {
>> -
>> - String originalClimateServiceName =
>> dc.field("Name").value();
>> - String newClimateServiceName =
>> originalClimateServiceName.replace(' ', '-');
>> -
>> - if (newClimateServiceName != null &&
>> !newClimateServiceName.isEmpty()) {
>> - jsonData.put("name",
>> newClimateServiceName);
>> - }
>> -
>> - jsonData.put("creatorId", 1);
>> - jsonData.put("purpose",
>> dc.field("Purpose").value());
>> - jsonData.put("url", dc.field("Url").value());
>> - DateFormat dateFormat = new
>> SimpleDateFormat("yyyy/MM/dd HH:mm");
>> - Date date = new Date();
>> - jsonData.put("createTime",
>> dateFormat.format(date));
>> - jsonData.put("scenario",
>> dc.field("Scenario").value());
>> - jsonData.put("versionNo",
>> dc.field("Version").value());
>> - jsonData.put("rootServiceId",
>> dc.field("Root_Service").value());
>> - JsonNode response =
>> ClimateService.create(jsonData);
>> - Application.flashMsg(response);
>> - } catch (IllegalStateException e) {
>> - e.printStackTrace();
>> - Application.flashMsg(APICall
>> -
>> .createResponse(ResponseType.CONVERSIONERROR));
>> - } catch (Exception e) {
>> - e.printStackTrace();
>> -
>> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
>> - }
>> - return redirect("/climate/climateServices");
>> - }
>> -
>> - public static Result editClimateService() {
>> -
>> - ObjectNode jsonData = Json.newObject();
>> - try {
>> - DynamicForm df =
>> DynamicForm.form().bindFromRequest();
>> - String climateServiceName =
>>df.field("pk").value();
>> -
>> - if (climateServiceName != null &&
>> !climateServiceName.isEmpty()) {
>> - jsonData.put("name",
>>climateServiceName);
>> - }
>> - ClimateService originalService =
>> ClimateService.findServiceByName(climateServiceName);
>> -
>> - if (originalService == null) {
>> -
>> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
>> - return notFound("not found original
>> climateService " + climateServiceName);
>> - }
>> -
>> - jsonData.put("creatorId", 1);
>> - jsonData.put("purpose",
>> originalService.getPurpose());
>> - jsonData.put("url", originalService.getUrl());
>> - jsonData.put("scenario",
>> originalService.getScenario());
>> - jsonData.put("versionNo",
>> originalService.getVersion());
>> -
>> - if (originalService.getRootservice() != null)
>> -
>> - jsonData.put("rootServiceId",
>> originalService.getRootservice());
>> - String editField = df.field("name").value();
>> -
>> - if (editField != null && !editField.isEmpty()) {
>> - jsonData.put(editField,
>> df.field("value").value());
>> - }
>> -
>> - if (editField == null || editField.isEmpty()) {
>> -
>> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
>> - return notFound("not found edit field");
>> - }
>> -
>> - JsonNode response =
>> ClimateService.edit(climateServiceName, jsonData);
>> - Application.flashMsg(response);
>> -
>> - } catch (IllegalStateException e) {
>> - e.printStackTrace();
>> - Application.flashMsg(APICall
>> -
>> .createResponse(ResponseType.CONVERSIONERROR));
>> - } catch (Exception e) {
>> - e.printStackTrace();
>> -
>> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
>> - }
>> - return ok("updated");
>> -
>> - }
>> -
>> - public static Result getConfigurationByConfId() {
>> - String output = "";
>> - TwoDVarMap twoDVarMap = new TwoDVarMap();
>> - TwoDVarZonalMean twoDVarZonalMean = new
>>TwoDVarZonalMean();
>> - ScatterHistogramTwoVar scatterHistogram = new
>> ScatterHistogramTwoVar();
>> - ThreeDVarAvgVertical4Profile threeDVarAvgVertical = new
>> ThreeDVarAvgVertical4Profile();
>> - DiffPlotTwoTimeAveragedVar diffPlotTwoTimeAvg = new
>> DiffPlotTwoTimeAveragedVar();
>> - ThreeDVar2DSlice threeDVar2DSlice = new
>>ThreeDVar2DSlice();
>> - TwoDVarTimeSeries twoDVarTimeSeries = new
>> TwoDVarTimeSeries();
>> - ThreeDVarZonalMean threeDVarZonalMean = new
>> ThreeDVarZonalMean();
>> - ConditionalSampling conditionalSampling = new
>> ConditionalSampling();
>> - RegridAndDownload regridAndDownload = new
>> RegridAndDownload();
>> - CorrelationMap correlationMap = new CorrelationMap();
>> - ConditionalSampling2Var conditionalSampling2Var = new
>> ConditionalSampling2Var();
>> -
>> - try {
>> - DynamicForm df =
>> DynamicForm.form().bindFromRequest();
>> - String logId = df.field("logId").value();
>> -
>> - if (logId == null || logId.isEmpty()) {
>> -
>> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
>> - return notFound("confId is null or
>>empty");
>> - }
>> -
>> - JsonNode response =
>> APICall.callAPI(Constants.NEW_BACKEND +
>> Constants.SERVICE_EXECUTION_LOG + Constants.SERVICE_EXECUTION_LOG_GET +
>>logId);
>> - int configurationId =
>> response.path("serviceConfiguration").path("id").asInt();
>> - JsonNode responseConfigItems =
>> APICall.callAPI(Constants.NEW_BACKEND + Constants.CONFIG_ITEM +
>> Constants.GET_CONFIG_ITEMS_BY_CONFIG + configurationId);
>> - String serviceName =
>> response.path("climateService").path("name").asText();
>> - //TODO:
>> - if
>>(serviceName.equals("2-D-Variable-Zonal-Mean"))
>> {
>> - //TODO: DO NOT USE
>> node.findPath(key)!!!!! use find(key) instead to get your immediate
>> children if you know the json structure (and we do).
>> - //TODO: (con't) findPath returns the
>>first
>> occurence of a key string, including GRANDCHILDREN
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> -
>> - if (parameterName.equals("data
>> source")) {
>> -
>> twoDVarZonalMean.setDataSource(parameterValue);
>> - } else if
>> (parameterName.equals("variable name")) {
>> -
>> twoDVarZonalMean.setVariableName(parameterValue);
>> - } else if
>> (parameterName.equals("start year-month")) {
>> -
>> twoDVarZonalMean.setStartYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("end year-month")) {
>> -
>> twoDVarZonalMean.setEndYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("select months")) {
>> - String[] months =
>> parameterValue.split(",");
>> - for (int j = 0; j <
>> months.length; j++) {
>> - if
>> (months[j].equals("1")) {
>> -
>> twoDVarZonalMean.addMonth("jan");
>> - } else if
>> (months[j].equals("2")) {
>> -
>> twoDVarZonalMean.addMonth("feb");
>> - } else if
>> (months[j].equals("3")) {
>> -
>> twoDVarZonalMean.addMonth("mar");
>> - } else if
>> (months[j].equals("4")) {
>> -
>> twoDVarZonalMean.addMonth("apr");
>> - } else if
>> (months[j].equals("5")) {
>> -
>> twoDVarZonalMean.addMonth("may");
>> - } else if
>> (months[j].equals("6")) {
>> -
>> twoDVarZonalMean.addMonth("jun");
>> - } else if
>> (months[j].equals("7")) {
>> -
>> twoDVarZonalMean.addMonth("jul");
>> - } else if
>> (months[j].equals("8")) {
>> -
>> twoDVarZonalMean.addMonth("aug");
>> - } else if
>> (months[j].equals("9")) {
>> -
>> twoDVarZonalMean.addMonth("sep");
>> - } else if
>> (months[j].equals("10")) {
>> -
>> twoDVarZonalMean.addMonth("oct");
>> - } else if
>> (months[j].equals("11")) {
>> -
>> twoDVarZonalMean.addMonth("nov");
>> - } else if
>> (months[j].equals("12")) {
>> -
>> twoDVarZonalMean.addMonth("dec");
>> - }
>> - }
>> -
>> twoDVarZonalMean.changeSelectMonths();
>> - } else if
>> (parameterName.equals("start lat (deg)")) {
>> -
>> twoDVarZonalMean.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("end lat (deg)")) {
>> -
>> twoDVarZonalMean.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("variable scale")) {
>> -
>> twoDVarZonalMean.setVariableScale(parameterValue);
>> - }
>> - }
>> -
>>
>> twoDVarZonalMean.setExecutionPurpose(response.path("purpose").textValu
>> e());
>> -
>> twoDVarZonalMean.setImage(response.path("plotUrl").textValue());
>> -
>> twoDVarZonalMean.setDataURL(response.path("dataUrl").textValue());
>> - return
>> ok(views.html.climate.twoDVariableZonelMean.render(twoDVarZonalMean));
>> - }
>> - else if
>>(serviceName.equals("2-D-Variable-Map")) {
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> - if
>>(parameterName.equals("model"))
>> {
>> -
>> twoDVarMap.setDataSource(parameterValue);
>> - } else if
>> (parameterName.equals("var")) {
>> -
>> twoDVarMap.setVariableName(parameterValue);
>> - } else if
>> (parameterName.equals("startT")) {
>> -
>> twoDVarMap.setStartYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("endT")) {
>> -
>> twoDVarMap.setEndYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("months")) {
>> - String[] months =
>> parameterValue.split(",");
>> - for (int j = 0; j <
>> months.length; j++) {
>> - if
>> (months[j].equals("1")) {
>> -
>> twoDVarMap.addMonth("jan");
>> - } else if
>> (months[j].equals("2")) {
>> -
>> twoDVarMap.addMonth("feb");
>> - } else if
>> (months[j].equals("3")) {
>> -
>> twoDVarMap.addMonth("mar");
>> - } else if
>> (months[j].equals("4")) {
>> -
>> twoDVarMap.addMonth("apr");
>> - } else if
>> (months[j].equals("5")) {
>> -
>> twoDVarMap.addMonth("may");
>> - } else if
>> (months[j].equals("6")) {
>> -
>> twoDVarMap.addMonth("jun");
>> - } else if
>> (months[j].equals("7")) {
>> -
>> twoDVarMap.addMonth("jul");
>> - } else if
>> (months[j].equals("8")) {
>> -
>> twoDVarMap.addMonth("aug");
>> - } else if
>> (months[j].equals("9")) {
>> -
>> twoDVarMap.addMonth("sep");
>> - } else if
>> (months[j].equals("10")) {
>> -
>> twoDVarMap.addMonth("oct");
>> - } else if
>> (months[j].equals("11")) {
>> -
>> twoDVarMap.addMonth("nov");
>> - } else if
>> (months[j].equals("12")) {
>> -
>> twoDVarMap.addMonth("dec");
>> - }
>> - }
>> -
>> twoDVarMap.changeSelectMonths();
>> - } else if
>> (parameterName.equals("lat1")) {
>> -
>> twoDVarMap.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("lat2")) {
>> -
>> twoDVarMap.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("lon1")) {
>> -
>> twoDVarMap.setStartLon(parameterValue);
>> - } else if
>> (parameterName.equals("lon2")) {
>> -
>> twoDVarMap.setEndLon(parameterValue);
>> - } else if
>> (parameterName.equals("scale")) {
>> -
>> twoDVarMap.setVariableScale(parameterValue);
>> - }
>> - }
>> -
>> twoDVarMap.setExecutionPurpose(response.path("purpose").textValue());
>> -
>> twoDVarMap.setImage(response.path("plotUrl").textValue());
>> -
>> twoDVarMap.setDataURL(response.path("dataUrl").textValue());
>> - return
>> ok(views.html.climate.twoDVariableMap.render(twoDVarMap));
>> - }
>> - else if
>> (serviceName.equals("Conditional-Sampling-with-One-Variable")){
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> - if
>> (parameterName.equals("model2")) {
>> -
>> conditionalSampling.setDataSourceE(parameterValue);
>> - } else if
>> (parameterName.equals("model1")) {
>> -
>> conditionalSampling.setDataSourceP(parameterValue);
>> - } else if
>> (parameterName.equals("var2")) {
>> -
>> conditionalSampling.setVariableNameE(parameterValue);
>> - } else if
>> (parameterName.equals("var1")) {
>> -
>> conditionalSampling.setVariableNameP(parameterValue);
>> - } else if
>> (parameterName.equals("pre1")) {
>> -
>> conditionalSampling.setPressureRangeP(parameterValue);
>> - } else if
>> (parameterName.equals("pre2")) {
>> -
>> conditionalSampling.setPressureRangeE(parameterValue);
>> - } else if
>> (parameterName.equals("startT")) {
>> -
>> conditionalSampling.setStartYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("endT")) {
>> -
>> conditionalSampling.setEndYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("lon1")) {
>> -
>> conditionalSampling.setStartLon(parameterValue);
>> - } else if
>> (parameterName.equals("lon2")) {
>> -
>> conditionalSampling.setEndLon(parameterValue);
>> - } else if
>> (parameterName.equals("lat1")) {
>> -
>> conditionalSampling.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("lat2")) {
>> -
>> conditionalSampling.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("months")) {
>> - String[] months =
>> parameterValue.split(",");
>> - for (int j = 0; j <
>> months.length; j++) {
>> - if
>> (months[j].equals("1")) {
>> -
>> conditionalSampling.addMonth("jan");
>> - } else if
>> (months[j].equals("2")) {
>> -
>> conditionalSampling.addMonth("feb");
>> - } else if
>> (months[j].equals("3")) {
>> -
>> conditionalSampling.addMonth("mar");
>> - } else if
>> (months[j].equals("4")) {
>> -
>> conditionalSampling.addMonth("apr");
>> - } else if
>> (months[j].equals("5")) {
>> -
>> conditionalSampling.addMonth("may");
>> - } else if
>> (months[j].equals("6")) {
>> -
>> conditionalSampling.addMonth("jun");
>> - } else if
>> (months[j].equals("7")) {
>> -
>> conditionalSampling.addMonth("jul");
>> - } else if
>> (months[j].equals("8")) {
>> -
>> conditionalSampling.addMonth("aug");
>> - } else if
>> (months[j].equals("9")) {
>> -
>> conditionalSampling.addMonth("sep");
>> - } else if
>> (months[j].equals("10")) {
>> -
>> conditionalSampling.addMonth("oct");
>> - } else if
>> (months[j].equals("11")) {
>> -
>> conditionalSampling.addMonth("nov");
>> - } else if
>> (months[j].equals("12")) {
>> -
>> conditionalSampling.addMonth("dec");
>> - }
>> -
>> - }
>> -
>> conditionalSampling.changeSelectMonths();
>> - } else if
>> (parameterName.equals("bin_min")) {
>> -
>> conditionalSampling.setBin_min(parameterValue);
>> - } else if
>> (parameterName.equals("bin_max")) {
>> -
>> conditionalSampling.setBin_max(parameterValue);
>> - } else if
>> (parameterName.equals("bin_n")) {
>> -
>> conditionalSampling.setBin_n(parameterValue);
>> - } else if
>> (parameterName.equals("displayOpt")) {
>> - int
>> paramBit=Integer.parseInt(parameterValue);
>> - int bitmaskX = 0x1;
>> - int bitmaskY = 0x2;
>> - int bitmaskZ = 0x4;
>> -
>> conditionalSampling.setX(Integer.toString(paramBit & bitmaskX, 2));
>> -
>> conditionalSampling.setY(Integer.toString((paramBit & bitmaskY)>>1,
>> 2));
>> -
>> conditionalSampling.setZ(Integer.toString((paramBit & bitmaskZ)>>2,
>>2));
>> - }
>> - }
>> -
>>
>> conditionalSampling.setExecutionPurpose(response.path("purpose").textV
>> alue());
>> -
>> conditionalSampling.setImage(response.path("plotUrl").textValue());
>> -
>> conditionalSampling.setDataURL(response.path("dataUrl").textValue());
>> - return
>> ok(views.html.climate.conditionalSampling.render(conditionalSampling));
>> - }else if
>> (serviceName.equals("2-D-Variable-Time-Series")){
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> - if
>>(parameterName.equals("model"))
>> {
>> -
>> twoDVarTimeSeries.setDataSource(parameterValue);
>> - } else if
>> (parameterName.equals("var")) {
>> -
>> twoDVarTimeSeries.setVariableName(parameterValue);
>> - } else if
>> (parameterName.equals("startT")) {
>> -
>> twoDVarTimeSeries.setStartYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("endT")) {
>> -
>> twoDVarTimeSeries.setEndYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("lat1")) {
>> -
>> twoDVarTimeSeries.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("lat2")) {
>> -
>> twoDVarTimeSeries.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("lon1")) {
>> -
>> twoDVarTimeSeries.setStartLon(parameterValue);
>> - } else if
>> (parameterName.equals("lon2")) {
>> -
>> twoDVarTimeSeries.setEndLon(parameterValue);
>> - } else if
>> (parameterName.equals("scale")) {
>> -
>> twoDVarTimeSeries.setVariableScale(parameterValue);
>> - }
>> - }
>> -
>>
>> twoDVarTimeSeries.setExecutionPurpose(response.path("purpose").textVal
>> ue());
>> -
>> twoDVarTimeSeries.setImage(response.path("plotUrl").textValue());
>> -
>> twoDVarTimeSeries.setDataURL(response.path("dataUrl").textValue());
>> - return
>> ok(views.html.climate.twoDVariableTimeSeries.render(twoDVarTimeSeries));
>> - }else if
>> (serviceName.equals("Regrid-and-Download")){
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> - if
>>(parameterName.equals("model"))
>> {
>> -
>> regridAndDownload.setDataSource(parameterValue);
>> - } else if
>> (parameterName.equals("var")) {
>> -
>> regridAndDownload.setVariableName(parameterValue);
>> - } else if
>> (parameterName.equals("startT")) {
>> -
>> regridAndDownload.setStartYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("endT")) {
>> -
>> regridAndDownload.setEndYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("lat1")) {
>> -
>> regridAndDownload.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("lat2")) {
>> -
>> regridAndDownload.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("dlat")) {
>> -
>> regridAndDownload.setDeltaLat(parameterValue);
>> - } else if
>> (parameterName.equals("dlon")) {
>> -
>> regridAndDownload.setDeltaLon(parameterValue);
>> - } else if
>> (parameterName.equals("lon1")) {
>> -
>> regridAndDownload.setStartLon(parameterValue);
>> - } else if
>> (parameterName.equals("lon2")) {
>> -
>> regridAndDownload.setEndLon(parameterValue);
>> - } else if
>> (parameterName.equals("plev")) {
>> -
>> regridAndDownload.setPressureLevel(parameterValue);
>> - }
>> - }
>> -
>>
>> regridAndDownload.setExecutionPurpose(response.path("purpose").textVal
>> ue());
>> -
>> -
>> regridAndDownload.setDataURL(response.path("dataUrl").textValue());
>> - return
>> ok(views.html.climate.regridAndDownload.render(regridAndDownload));
>> - }else if
>> (serviceName.equals("3-D-Variable-Zonal-Mean")){
>> - String press1 = "";
>> - String press2 = "";
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> - if
>>(parameterName.equals("model"))
>> {
>> -
>> threeDVarZonalMean.setDataSource(parameterValue);
>> - } else if
>> (parameterName.equals("var")) {
>> -
>> threeDVarZonalMean.setVariableName(parameterValue);
>> - } else if
>> (parameterName.equals("startT")) {
>> -
>> threeDVarZonalMean.setStartYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("endT")) {
>> -
>> threeDVarZonalMean.setEndYearMonth(parameterValue);
>> - } else if
>> (parameterName.equals("lat1")) {
>> -
>> threeDVarZonalMean.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("lat2")) {
>> -
>> threeDVarZonalMean.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("pres1")) {
>> - press1 = parameterValue;
>> - } else if
>> (parameterName.equals("pres2")) {
>> - press2 = parameterValue;
>> - } else if
>> (parameterName.equals("months")) {
>> - String[] months =
>> parameterValue.split(",");
>> - for (int j = 0; j <
>> months.length; j++) {
>> - if
>> (months[j].equals("1")) {
>> -
>> threeDVarZonalMean.addMonth("jan");
>> - } else if
>> (months[j].equals("2")) {
>> -
>> threeDVarZonalMean.addMonth("feb");
>> - } else if
>> (months[j].equals("3")) {
>> -
>> threeDVarZonalMean.addMonth("mar");
>> - } else if
>> (months[j].equals("4")) {
>> -
>> threeDVarZonalMean.addMonth("apr");
>> - } else if
>> (months[j].equals("5")) {
>> -
>> threeDVarZonalMean.addMonth("may");
>> - } else if
>> (months[j].equals("6")) {
>> -
>> threeDVarZonalMean.addMonth("jun");
>> - } else if
>> (months[j].equals("7")) {
>> -
>> threeDVarZonalMean.addMonth("jul");
>> - } else if
>> (months[j].equals("8")) {
>> -
>> threeDVarZonalMean.addMonth("aug");
>> - } else if
>> (months[j].equals("9")) {
>> -
>> threeDVarZonalMean.addMonth("sep");
>> - } else if
>> (months[j].equals("10")) {
>> -
>> threeDVarZonalMean.addMonth("oct");
>> - } else if
>> (months[j].equals("11")) {
>> -
>> threeDVarZonalMean.addMonth("nov");
>> - } else if
>> (months[j].equals("12")) {
>> -
>> threeDVarZonalMean.addMonth("dec");
>> - }
>> - }
>> - } else if
>> (parameterName.equals("scale")) {
>> - if
>> (parameterValue.equals("2")) {
>> -
>> threeDVarZonalMean.setPressureScale("2");
>> -
>> threeDVarZonalMean.setColorScale("0");
>> - } else if
>> (parameterValue.equals("0")) {
>> -
>> threeDVarZonalMean.setPressureScale("0");
>> -
>> threeDVarZonalMean.setColorScale("0");
>> - } else if
>> (parameterValue.equals("4")) {
>> -
>> threeDVarZonalMean.setPressureScale("0");
>> -
>> threeDVarZonalMean.setColorScale("4");
>> - } else if
>> (parameterValue.equals("6")) {
>> -
>> threeDVarZonalMean.setPressureScale("2");
>> -
>> threeDVarZonalMean.setColorScale("4");
>> - }
>> - }
>> - }
>> - if (!press1.isEmpty() &
>>!press2.isEmpty())
>> -
>> threeDVarZonalMean.setPressureRange("" + (Integer.parseInt(press1) /
>> 100)
>> + "," + (Integer.parseInt(press2) / 100));
>> -
>>
>> threeDVarZonalMean.setExecutionPurpose(response.path("purpose").textVa
>> lue());
>> -
>> threeDVarZonalMean.setImage(response.path("plotUrl").textValue());
>> -
>> threeDVarZonalMean.setDataURL(response.path("dataUrl").textValue());
>> - return
>>
>>ok(views.html.climate.threeDVariableZonalMean.render(threeDVarZonalMean))
>>;
>> - }else if
>> (serviceName.equals("Scatter-and-Histogram-Plot-of-Two-Variables")){
>> //"19")){
>> -
>> scatterHistogram.setPressureLevel1("N/A");
>> -
>> scatterHistogram.setPressureLevel2("N/A");
>> - for (int i = 0; i <
>> responseConfigItems.size(); i++) {
>> - String parameterName =
>>
>>responseConfigItems.get(i).path("parameter").path("purpose").textValue();
>> - String parameterValue =
>> responseConfigItems.get(i).path("value").textValue();
>> - if
>> (parameterName.equals("model1")) {
>> -
>> scatterHistogram.setSource1(parameterValue);
>> -
>> - } else if
>> (parameterName.equals("model2")) {
>> -
>> scatterHistogram.setSource2(parameterValue);
>> -
>> - } else if
>> (parameterName.equals("var1")) {
>> -
>> scatterHistogram.setVaribaleName1(parameterValue);
>> -
>> - } else if
>> (parameterName.equals("var2")) {
>> -
>> scatterHistogram.setVaribaleName2(parameterValue);
>> - } else if
>> (parameterName.equals("startT")) {
>> -
>> scatterHistogram.setStartYear(parameterValue);
>> - } else if
>> (parameterName.equals("endT")) {
>> -
>> scatterHistogram.setEndYear(parameterValue);
>> - } else if
>> (parameterName.equals("lon1")) {
>> -
>> scatterHistogram.setStartLon(parameterValue);
>> - } else if
>> (parameterName.equals("lon2")) {
>> -
>> scatterHistogram.setEndLon(parameterValue);
>> - } else if
>> (parameterName.equals("lat1")) {
>> -
>> scatterHistogram.setStartLat(parameterValue);
>> - } else if
>> (parameterName.equals("lat2")) {
>> -
>> scatterHistogram.setEndLat(parameterValue);
>> - } else if
>> (parameterName.equals("nSample")) {
>> -
>> scatterHistogram.setSamples(parameterValue);
>> - }
>> - }
>> -
>>
>> scatterHistogram.setExecutionPurpose(response.path("purpose").textValu
>> e());
>> -
>> scatterHistogram.setImage(response.path("plotUrl").textValue());
>> -
>> scatterHistogram.setDataUrl(response.path("dataUrl").textValue());
>> - return
>>
>>ok(views.html.climate.scatterAndHistogramTwoVariable.render(scatterHistog
>>ram));
>> - }else if
>> (serviceName.equals("Difference-Plot-of-Two-Time-Averaged-Variables")){
>> //"20")){
>> -
>> diffPlotTwoTimeAvg.setPressureLevel1("N/A");
>> -
>> Console.println(diffPlotTwoTimeAvg.getPressureLevel1());
>> -
>> diffPlotTwoTimeAvg.setPressureLevel2("N/A");
>> - for (int i = 0; i < response
>
>
RE: [43/49] incubator-cmda git commit: remove all
Posted by Jia Zhang <ji...@sv.cmu.edu>.
Dear James:
Would you please clarify a little?
Thanks a lot.
Best regards,
Jia
-----Original Message-----
From: James Carman [mailto:james@carmanconsulting.com]
Sent: Tuesday, September 08, 2015 3:46 PM
To: dev@cmda.incubator.apache.org
Subject: Re: [43/49] incubator-cmda git commit: remove all
Can we turn these notifications off?
On Tue, Sep 8, 2015 at 6:44 PM <xi...@apache.org> wrote:
>
> http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/ap
> p/controllers/ClimateServiceController.java
> ----------------------------------------------------------------------
> diff --git a/app/controllers/ClimateServiceController.java
> b/app/controllers/ClimateServiceController.java
> deleted file mode 100644
> index 2c6aa1c..0000000
> --- a/app/controllers/ClimateServiceController.java
> +++ /dev/null
> @@ -1,931 +0,0 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one or more
> - * contributor license agreements. See the NOTICE file distributed
> with
> - * this work for additional information regarding copyright ownership.
> - * The ASF licenses this file to You under the Apache License,
> Version 2.0
> - * (the "License"); you may not use this file except in compliance
> with
> - * the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> software
> - * distributed under the License is distributed on an "AS IS" BASIS,
> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> - * See the License for the specific language governing permissions
> and
> - * limitations under the License.
> - */
> -
> -package controllers;
> -
> -import com.fasterxml.jackson.databind.JsonNode;
> -import com.fasterxml.jackson.databind.node.ObjectNode;
> -import models.metadata.ClimateService; -import
> models.metadata.DiffPlotTwoTimeAveragedVar;
> -import models.metadata.RegridAndDownload;
> -import models.metadata.TwoDVarZonalMean; -import
> models.metadata.TwoDVarMap; -import models.metadata.TwoDVarTimeSeries;
> -import models.metadata.ThreeDVarZonalMean;
> -import models.metadata.ThreeDVar2DSlice; -import
> models.metadata.ThreeDVarAvgVertical4Profile;
> -import models.metadata.ScatterHistogramTwoVar;
> -import models.metadata.ConditionalSampling;
> -import models.metadata.ServiceLog;
> -import models.metadata.CorrelationMap; -import
> models.metadata.ConditionalSampling2Var;
> -import play.Logger;
> -import play.data.Form;
> -import play.libs.Json;
> -import play.mvc.Controller;
> -import play.mvc.Result;
> -import scala.Console;
> -import util.APICall;
> -import util.APICall.ResponseType;
> -import util.Constants;
> -import views.html.climate.*;
> -import play.data.DynamicForm;
> -import java.io.File;
> -import java.io.IOException;
> -import java.io.UnsupportedEncodingException;
> -import java.text.DateFormat;
> -import java.text.SimpleDateFormat;
> -import java.util.Date;
> -import java.util.List;
> -import com.fasterxml.jackson.databind.ObjectMapper;
> -
> -public class ClimateServiceController extends Controller {
> -
> - final static Form<ClimateService> climateServiceForm = Form
> - .form(ClimateService.class);
> -
> - public static Result home(String email, String vfile, String
> dataset) {
> - return ok(home.render(email, vfile, dataset));
> - }
> -
> - public static Result addClimateServices() {
> - return ok(addClimateServices.render(climateServiceForm));
> - }
> -
> - public static Result tutorial() {
> - return ok(tutorial.render());
> - }
> -
> - public static Result climateServices() {
> - return ok(climateServices.render(ClimateService.all(),
> - climateServiceForm));
> - }
> -
> - public static Result mostRecentlyAddedClimateServices() {
> - return
> ok(mostRecentlyAddedServices.render(ClimateService.getMostRecentlyAdded(),
> - climateServiceForm));
> - }
> -
> - public static Result mostRecentlyUsedClimateServices() {
> - return
> ok(mostRecentlyUsedServices.render(ClimateService.getMostRecentlyUsed(),
> - climateServiceForm));
> - }
> -
> - public static Result mostPopularClimateServices() {
> - return
> ok(mostPopularServices.render(ClimateService.getMostPopular(),
> - climateServiceForm));
> - }
> -
> - public static Result newClimateService() {
> - Form<ClimateService> dc =
> climateServiceForm.bindFromRequest();
> - ObjectNode jsonData = Json.newObject();
> - try {
> -
> - String originalClimateServiceName =
> dc.field("Name").value();
> - String newClimateServiceName =
> originalClimateServiceName.replace(' ', '-');
> -
> - if (newClimateServiceName != null &&
> !newClimateServiceName.isEmpty()) {
> - jsonData.put("name",
> newClimateServiceName);
> - }
> -
> - jsonData.put("creatorId", 1);
> - jsonData.put("purpose",
> dc.field("Purpose").value());
> - jsonData.put("url", dc.field("Url").value());
> - DateFormat dateFormat = new
> SimpleDateFormat("yyyy/MM/dd HH:mm");
> - Date date = new Date();
> - jsonData.put("createTime",
> dateFormat.format(date));
> - jsonData.put("scenario",
> dc.field("Scenario").value());
> - jsonData.put("versionNo",
> dc.field("Version").value());
> - jsonData.put("rootServiceId",
> dc.field("Root_Service").value());
> - JsonNode response =
> ClimateService.create(jsonData);
> - Application.flashMsg(response);
> - } catch (IllegalStateException e) {
> - e.printStackTrace();
> - Application.flashMsg(APICall
> -
> .createResponse(ResponseType.CONVERSIONERROR));
> - } catch (Exception e) {
> - e.printStackTrace();
> -
> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
> - }
> - return redirect("/climate/climateServices");
> - }
> -
> - public static Result editClimateService() {
> -
> - ObjectNode jsonData = Json.newObject();
> - try {
> - DynamicForm df =
> DynamicForm.form().bindFromRequest();
> - String climateServiceName = df.field("pk").value();
> -
> - if (climateServiceName != null &&
> !climateServiceName.isEmpty()) {
> - jsonData.put("name", climateServiceName);
> - }
> - ClimateService originalService =
> ClimateService.findServiceByName(climateServiceName);
> -
> - if (originalService == null) {
> -
> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
> - return notFound("not found original
> climateService " + climateServiceName);
> - }
> -
> - jsonData.put("creatorId", 1);
> - jsonData.put("purpose",
> originalService.getPurpose());
> - jsonData.put("url", originalService.getUrl());
> - jsonData.put("scenario",
> originalService.getScenario());
> - jsonData.put("versionNo",
> originalService.getVersion());
> -
> - if (originalService.getRootservice() != null)
> -
> - jsonData.put("rootServiceId",
> originalService.getRootservice());
> - String editField = df.field("name").value();
> -
> - if (editField != null && !editField.isEmpty()) {
> - jsonData.put(editField,
> df.field("value").value());
> - }
> -
> - if (editField == null || editField.isEmpty()) {
> -
> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
> - return notFound("not found edit field");
> - }
> -
> - JsonNode response =
> ClimateService.edit(climateServiceName, jsonData);
> - Application.flashMsg(response);
> -
> - } catch (IllegalStateException e) {
> - e.printStackTrace();
> - Application.flashMsg(APICall
> -
> .createResponse(ResponseType.CONVERSIONERROR));
> - } catch (Exception e) {
> - e.printStackTrace();
> -
> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
> - }
> - return ok("updated");
> -
> - }
> -
> - public static Result getConfigurationByConfId() {
> - String output = "";
> - TwoDVarMap twoDVarMap = new TwoDVarMap();
> - TwoDVarZonalMean twoDVarZonalMean = new TwoDVarZonalMean();
> - ScatterHistogramTwoVar scatterHistogram = new
> ScatterHistogramTwoVar();
> - ThreeDVarAvgVertical4Profile threeDVarAvgVertical = new
> ThreeDVarAvgVertical4Profile();
> - DiffPlotTwoTimeAveragedVar diffPlotTwoTimeAvg = new
> DiffPlotTwoTimeAveragedVar();
> - ThreeDVar2DSlice threeDVar2DSlice = new ThreeDVar2DSlice();
> - TwoDVarTimeSeries twoDVarTimeSeries = new
> TwoDVarTimeSeries();
> - ThreeDVarZonalMean threeDVarZonalMean = new
> ThreeDVarZonalMean();
> - ConditionalSampling conditionalSampling = new
> ConditionalSampling();
> - RegridAndDownload regridAndDownload = new
> RegridAndDownload();
> - CorrelationMap correlationMap = new CorrelationMap();
> - ConditionalSampling2Var conditionalSampling2Var = new
> ConditionalSampling2Var();
> -
> - try {
> - DynamicForm df =
> DynamicForm.form().bindFromRequest();
> - String logId = df.field("logId").value();
> -
> - if (logId == null || logId.isEmpty()) {
> -
> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
> - return notFound("confId is null or empty");
> - }
> -
> - JsonNode response =
> APICall.callAPI(Constants.NEW_BACKEND +
> Constants.SERVICE_EXECUTION_LOG + Constants.SERVICE_EXECUTION_LOG_GET + logId);
> - int configurationId =
> response.path("serviceConfiguration").path("id").asInt();
> - JsonNode responseConfigItems =
> APICall.callAPI(Constants.NEW_BACKEND + Constants.CONFIG_ITEM +
> Constants.GET_CONFIG_ITEMS_BY_CONFIG + configurationId);
> - String serviceName =
> response.path("climateService").path("name").asText();
> - //TODO:
> - if (serviceName.equals("2-D-Variable-Zonal-Mean"))
> {
> - //TODO: DO NOT USE
> node.findPath(key)!!!!! use find(key) instead to get your immediate
> children if you know the json structure (and we do).
> - //TODO: (con't) findPath returns the first
> occurence of a key string, including GRANDCHILDREN
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> -
> - if (parameterName.equals("data
> source")) {
> -
> twoDVarZonalMean.setDataSource(parameterValue);
> - } else if
> (parameterName.equals("variable name")) {
> -
> twoDVarZonalMean.setVariableName(parameterValue);
> - } else if
> (parameterName.equals("start year-month")) {
> -
> twoDVarZonalMean.setStartYearMonth(parameterValue);
> - } else if
> (parameterName.equals("end year-month")) {
> -
> twoDVarZonalMean.setEndYearMonth(parameterValue);
> - } else if
> (parameterName.equals("select months")) {
> - String[] months =
> parameterValue.split(",");
> - for (int j = 0; j <
> months.length; j++) {
> - if
> (months[j].equals("1")) {
> -
> twoDVarZonalMean.addMonth("jan");
> - } else if
> (months[j].equals("2")) {
> -
> twoDVarZonalMean.addMonth("feb");
> - } else if
> (months[j].equals("3")) {
> -
> twoDVarZonalMean.addMonth("mar");
> - } else if
> (months[j].equals("4")) {
> -
> twoDVarZonalMean.addMonth("apr");
> - } else if
> (months[j].equals("5")) {
> -
> twoDVarZonalMean.addMonth("may");
> - } else if
> (months[j].equals("6")) {
> -
> twoDVarZonalMean.addMonth("jun");
> - } else if
> (months[j].equals("7")) {
> -
> twoDVarZonalMean.addMonth("jul");
> - } else if
> (months[j].equals("8")) {
> -
> twoDVarZonalMean.addMonth("aug");
> - } else if
> (months[j].equals("9")) {
> -
> twoDVarZonalMean.addMonth("sep");
> - } else if
> (months[j].equals("10")) {
> -
> twoDVarZonalMean.addMonth("oct");
> - } else if
> (months[j].equals("11")) {
> -
> twoDVarZonalMean.addMonth("nov");
> - } else if
> (months[j].equals("12")) {
> -
> twoDVarZonalMean.addMonth("dec");
> - }
> - }
> -
> twoDVarZonalMean.changeSelectMonths();
> - } else if
> (parameterName.equals("start lat (deg)")) {
> -
> twoDVarZonalMean.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("end lat (deg)")) {
> -
> twoDVarZonalMean.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("variable scale")) {
> -
> twoDVarZonalMean.setVariableScale(parameterValue);
> - }
> - }
> -
>
> twoDVarZonalMean.setExecutionPurpose(response.path("purpose").textValu
> e());
> -
> twoDVarZonalMean.setImage(response.path("plotUrl").textValue());
> -
> twoDVarZonalMean.setDataURL(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.twoDVariableZonelMean.render(twoDVarZonalMean));
> - }
> - else if (serviceName.equals("2-D-Variable-Map")) {
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> - if (parameterName.equals("model"))
> {
> -
> twoDVarMap.setDataSource(parameterValue);
> - } else if
> (parameterName.equals("var")) {
> -
> twoDVarMap.setVariableName(parameterValue);
> - } else if
> (parameterName.equals("startT")) {
> -
> twoDVarMap.setStartYearMonth(parameterValue);
> - } else if
> (parameterName.equals("endT")) {
> -
> twoDVarMap.setEndYearMonth(parameterValue);
> - } else if
> (parameterName.equals("months")) {
> - String[] months =
> parameterValue.split(",");
> - for (int j = 0; j <
> months.length; j++) {
> - if
> (months[j].equals("1")) {
> -
> twoDVarMap.addMonth("jan");
> - } else if
> (months[j].equals("2")) {
> -
> twoDVarMap.addMonth("feb");
> - } else if
> (months[j].equals("3")) {
> -
> twoDVarMap.addMonth("mar");
> - } else if
> (months[j].equals("4")) {
> -
> twoDVarMap.addMonth("apr");
> - } else if
> (months[j].equals("5")) {
> -
> twoDVarMap.addMonth("may");
> - } else if
> (months[j].equals("6")) {
> -
> twoDVarMap.addMonth("jun");
> - } else if
> (months[j].equals("7")) {
> -
> twoDVarMap.addMonth("jul");
> - } else if
> (months[j].equals("8")) {
> -
> twoDVarMap.addMonth("aug");
> - } else if
> (months[j].equals("9")) {
> -
> twoDVarMap.addMonth("sep");
> - } else if
> (months[j].equals("10")) {
> -
> twoDVarMap.addMonth("oct");
> - } else if
> (months[j].equals("11")) {
> -
> twoDVarMap.addMonth("nov");
> - } else if
> (months[j].equals("12")) {
> -
> twoDVarMap.addMonth("dec");
> - }
> - }
> -
> twoDVarMap.changeSelectMonths();
> - } else if
> (parameterName.equals("lat1")) {
> -
> twoDVarMap.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("lat2")) {
> -
> twoDVarMap.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("lon1")) {
> -
> twoDVarMap.setStartLon(parameterValue);
> - } else if
> (parameterName.equals("lon2")) {
> -
> twoDVarMap.setEndLon(parameterValue);
> - } else if
> (parameterName.equals("scale")) {
> -
> twoDVarMap.setVariableScale(parameterValue);
> - }
> - }
> -
> twoDVarMap.setExecutionPurpose(response.path("purpose").textValue());
> -
> twoDVarMap.setImage(response.path("plotUrl").textValue());
> -
> twoDVarMap.setDataURL(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.twoDVariableMap.render(twoDVarMap));
> - }
> - else if
> (serviceName.equals("Conditional-Sampling-with-One-Variable")){
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> - if
> (parameterName.equals("model2")) {
> -
> conditionalSampling.setDataSourceE(parameterValue);
> - } else if
> (parameterName.equals("model1")) {
> -
> conditionalSampling.setDataSourceP(parameterValue);
> - } else if
> (parameterName.equals("var2")) {
> -
> conditionalSampling.setVariableNameE(parameterValue);
> - } else if
> (parameterName.equals("var1")) {
> -
> conditionalSampling.setVariableNameP(parameterValue);
> - } else if
> (parameterName.equals("pre1")) {
> -
> conditionalSampling.setPressureRangeP(parameterValue);
> - } else if
> (parameterName.equals("pre2")) {
> -
> conditionalSampling.setPressureRangeE(parameterValue);
> - } else if
> (parameterName.equals("startT")) {
> -
> conditionalSampling.setStartYearMonth(parameterValue);
> - } else if
> (parameterName.equals("endT")) {
> -
> conditionalSampling.setEndYearMonth(parameterValue);
> - } else if
> (parameterName.equals("lon1")) {
> -
> conditionalSampling.setStartLon(parameterValue);
> - } else if
> (parameterName.equals("lon2")) {
> -
> conditionalSampling.setEndLon(parameterValue);
> - } else if
> (parameterName.equals("lat1")) {
> -
> conditionalSampling.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("lat2")) {
> -
> conditionalSampling.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("months")) {
> - String[] months =
> parameterValue.split(",");
> - for (int j = 0; j <
> months.length; j++) {
> - if
> (months[j].equals("1")) {
> -
> conditionalSampling.addMonth("jan");
> - } else if
> (months[j].equals("2")) {
> -
> conditionalSampling.addMonth("feb");
> - } else if
> (months[j].equals("3")) {
> -
> conditionalSampling.addMonth("mar");
> - } else if
> (months[j].equals("4")) {
> -
> conditionalSampling.addMonth("apr");
> - } else if
> (months[j].equals("5")) {
> -
> conditionalSampling.addMonth("may");
> - } else if
> (months[j].equals("6")) {
> -
> conditionalSampling.addMonth("jun");
> - } else if
> (months[j].equals("7")) {
> -
> conditionalSampling.addMonth("jul");
> - } else if
> (months[j].equals("8")) {
> -
> conditionalSampling.addMonth("aug");
> - } else if
> (months[j].equals("9")) {
> -
> conditionalSampling.addMonth("sep");
> - } else if
> (months[j].equals("10")) {
> -
> conditionalSampling.addMonth("oct");
> - } else if
> (months[j].equals("11")) {
> -
> conditionalSampling.addMonth("nov");
> - } else if
> (months[j].equals("12")) {
> -
> conditionalSampling.addMonth("dec");
> - }
> -
> - }
> -
> conditionalSampling.changeSelectMonths();
> - } else if
> (parameterName.equals("bin_min")) {
> -
> conditionalSampling.setBin_min(parameterValue);
> - } else if
> (parameterName.equals("bin_max")) {
> -
> conditionalSampling.setBin_max(parameterValue);
> - } else if
> (parameterName.equals("bin_n")) {
> -
> conditionalSampling.setBin_n(parameterValue);
> - } else if
> (parameterName.equals("displayOpt")) {
> - int
> paramBit=Integer.parseInt(parameterValue);
> - int bitmaskX = 0x1;
> - int bitmaskY = 0x2;
> - int bitmaskZ = 0x4;
> -
> conditionalSampling.setX(Integer.toString(paramBit & bitmaskX, 2));
> -
> conditionalSampling.setY(Integer.toString((paramBit & bitmaskY)>>1,
> 2));
> -
> conditionalSampling.setZ(Integer.toString((paramBit & bitmaskZ)>>2, 2));
> - }
> - }
> -
>
> conditionalSampling.setExecutionPurpose(response.path("purpose").textV
> alue());
> -
> conditionalSampling.setImage(response.path("plotUrl").textValue());
> -
> conditionalSampling.setDataURL(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.conditionalSampling.render(conditionalSampling));
> - }else if
> (serviceName.equals("2-D-Variable-Time-Series")){
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> - if (parameterName.equals("model"))
> {
> -
> twoDVarTimeSeries.setDataSource(parameterValue);
> - } else if
> (parameterName.equals("var")) {
> -
> twoDVarTimeSeries.setVariableName(parameterValue);
> - } else if
> (parameterName.equals("startT")) {
> -
> twoDVarTimeSeries.setStartYearMonth(parameterValue);
> - } else if
> (parameterName.equals("endT")) {
> -
> twoDVarTimeSeries.setEndYearMonth(parameterValue);
> - } else if
> (parameterName.equals("lat1")) {
> -
> twoDVarTimeSeries.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("lat2")) {
> -
> twoDVarTimeSeries.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("lon1")) {
> -
> twoDVarTimeSeries.setStartLon(parameterValue);
> - } else if
> (parameterName.equals("lon2")) {
> -
> twoDVarTimeSeries.setEndLon(parameterValue);
> - } else if
> (parameterName.equals("scale")) {
> -
> twoDVarTimeSeries.setVariableScale(parameterValue);
> - }
> - }
> -
>
> twoDVarTimeSeries.setExecutionPurpose(response.path("purpose").textVal
> ue());
> -
> twoDVarTimeSeries.setImage(response.path("plotUrl").textValue());
> -
> twoDVarTimeSeries.setDataURL(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.twoDVariableTimeSeries.render(twoDVarTimeSeries));
> - }else if
> (serviceName.equals("Regrid-and-Download")){
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> - if (parameterName.equals("model"))
> {
> -
> regridAndDownload.setDataSource(parameterValue);
> - } else if
> (parameterName.equals("var")) {
> -
> regridAndDownload.setVariableName(parameterValue);
> - } else if
> (parameterName.equals("startT")) {
> -
> regridAndDownload.setStartYearMonth(parameterValue);
> - } else if
> (parameterName.equals("endT")) {
> -
> regridAndDownload.setEndYearMonth(parameterValue);
> - } else if
> (parameterName.equals("lat1")) {
> -
> regridAndDownload.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("lat2")) {
> -
> regridAndDownload.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("dlat")) {
> -
> regridAndDownload.setDeltaLat(parameterValue);
> - } else if
> (parameterName.equals("dlon")) {
> -
> regridAndDownload.setDeltaLon(parameterValue);
> - } else if
> (parameterName.equals("lon1")) {
> -
> regridAndDownload.setStartLon(parameterValue);
> - } else if
> (parameterName.equals("lon2")) {
> -
> regridAndDownload.setEndLon(parameterValue);
> - } else if
> (parameterName.equals("plev")) {
> -
> regridAndDownload.setPressureLevel(parameterValue);
> - }
> - }
> -
>
> regridAndDownload.setExecutionPurpose(response.path("purpose").textVal
> ue());
> -
> -
> regridAndDownload.setDataURL(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.regridAndDownload.render(regridAndDownload));
> - }else if
> (serviceName.equals("3-D-Variable-Zonal-Mean")){
> - String press1 = "";
> - String press2 = "";
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> - if (parameterName.equals("model"))
> {
> -
> threeDVarZonalMean.setDataSource(parameterValue);
> - } else if
> (parameterName.equals("var")) {
> -
> threeDVarZonalMean.setVariableName(parameterValue);
> - } else if
> (parameterName.equals("startT")) {
> -
> threeDVarZonalMean.setStartYearMonth(parameterValue);
> - } else if
> (parameterName.equals("endT")) {
> -
> threeDVarZonalMean.setEndYearMonth(parameterValue);
> - } else if
> (parameterName.equals("lat1")) {
> -
> threeDVarZonalMean.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("lat2")) {
> -
> threeDVarZonalMean.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("pres1")) {
> - press1 = parameterValue;
> - } else if
> (parameterName.equals("pres2")) {
> - press2 = parameterValue;
> - } else if
> (parameterName.equals("months")) {
> - String[] months =
> parameterValue.split(",");
> - for (int j = 0; j <
> months.length; j++) {
> - if
> (months[j].equals("1")) {
> -
> threeDVarZonalMean.addMonth("jan");
> - } else if
> (months[j].equals("2")) {
> -
> threeDVarZonalMean.addMonth("feb");
> - } else if
> (months[j].equals("3")) {
> -
> threeDVarZonalMean.addMonth("mar");
> - } else if
> (months[j].equals("4")) {
> -
> threeDVarZonalMean.addMonth("apr");
> - } else if
> (months[j].equals("5")) {
> -
> threeDVarZonalMean.addMonth("may");
> - } else if
> (months[j].equals("6")) {
> -
> threeDVarZonalMean.addMonth("jun");
> - } else if
> (months[j].equals("7")) {
> -
> threeDVarZonalMean.addMonth("jul");
> - } else if
> (months[j].equals("8")) {
> -
> threeDVarZonalMean.addMonth("aug");
> - } else if
> (months[j].equals("9")) {
> -
> threeDVarZonalMean.addMonth("sep");
> - } else if
> (months[j].equals("10")) {
> -
> threeDVarZonalMean.addMonth("oct");
> - } else if
> (months[j].equals("11")) {
> -
> threeDVarZonalMean.addMonth("nov");
> - } else if
> (months[j].equals("12")) {
> -
> threeDVarZonalMean.addMonth("dec");
> - }
> - }
> - } else if
> (parameterName.equals("scale")) {
> - if
> (parameterValue.equals("2")) {
> -
> threeDVarZonalMean.setPressureScale("2");
> -
> threeDVarZonalMean.setColorScale("0");
> - } else if
> (parameterValue.equals("0")) {
> -
> threeDVarZonalMean.setPressureScale("0");
> -
> threeDVarZonalMean.setColorScale("0");
> - } else if
> (parameterValue.equals("4")) {
> -
> threeDVarZonalMean.setPressureScale("0");
> -
> threeDVarZonalMean.setColorScale("4");
> - } else if
> (parameterValue.equals("6")) {
> -
> threeDVarZonalMean.setPressureScale("2");
> -
> threeDVarZonalMean.setColorScale("4");
> - }
> - }
> - }
> - if (!press1.isEmpty() & !press2.isEmpty())
> -
> threeDVarZonalMean.setPressureRange("" + (Integer.parseInt(press1) /
> 100)
> + "," + (Integer.parseInt(press2) / 100));
> -
>
> threeDVarZonalMean.setExecutionPurpose(response.path("purpose").textVa
> lue());
> -
> threeDVarZonalMean.setImage(response.path("plotUrl").textValue());
> -
> threeDVarZonalMean.setDataURL(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.threeDVariableZonalMean.render(threeDVarZonalMean));
> - }else if
> (serviceName.equals("Scatter-and-Histogram-Plot-of-Two-Variables")){
> //"19")){
> -
> scatterHistogram.setPressureLevel1("N/A");
> -
> scatterHistogram.setPressureLevel2("N/A");
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> - if
> (parameterName.equals("model1")) {
> -
> scatterHistogram.setSource1(parameterValue);
> -
> - } else if
> (parameterName.equals("model2")) {
> -
> scatterHistogram.setSource2(parameterValue);
> -
> - } else if
> (parameterName.equals("var1")) {
> -
> scatterHistogram.setVaribaleName1(parameterValue);
> -
> - } else if
> (parameterName.equals("var2")) {
> -
> scatterHistogram.setVaribaleName2(parameterValue);
> - } else if
> (parameterName.equals("startT")) {
> -
> scatterHistogram.setStartYear(parameterValue);
> - } else if
> (parameterName.equals("endT")) {
> -
> scatterHistogram.setEndYear(parameterValue);
> - } else if
> (parameterName.equals("lon1")) {
> -
> scatterHistogram.setStartLon(parameterValue);
> - } else if
> (parameterName.equals("lon2")) {
> -
> scatterHistogram.setEndLon(parameterValue);
> - } else if
> (parameterName.equals("lat1")) {
> -
> scatterHistogram.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("lat2")) {
> -
> scatterHistogram.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("nSample")) {
> -
> scatterHistogram.setSamples(parameterValue);
> - }
> - }
> -
>
> scatterHistogram.setExecutionPurpose(response.path("purpose").textValu
> e());
> -
> scatterHistogram.setImage(response.path("plotUrl").textValue());
> -
> scatterHistogram.setDataUrl(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.scatterAndHistogramTwoVariable.render(scatterHistogram));
> - }else if
> (serviceName.equals("Difference-Plot-of-Two-Time-Averaged-Variables")){
> //"20")){
> -
> diffPlotTwoTimeAvg.setPressureLevel1("N/A");
> -
> Console.println(diffPlotTwoTimeAvg.getPressureLevel1());
> -
> diffPlotTwoTimeAvg.setPressureLevel2("N/A");
> - for (int i = 0; i < response
Re: [43/49] incubator-cmda git commit: remove all
Posted by James Carman <ja...@carmanconsulting.com>.
Can we turn these notifications off?
On Tue, Sep 8, 2015 at 6:44 PM <xi...@apache.org> wrote:
>
> http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/controllers/ClimateServiceController.java
> ----------------------------------------------------------------------
> diff --git a/app/controllers/ClimateServiceController.java
> b/app/controllers/ClimateServiceController.java
> deleted file mode 100644
> index 2c6aa1c..0000000
> --- a/app/controllers/ClimateServiceController.java
> +++ /dev/null
> @@ -1,931 +0,0 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one or more
> - * contributor license agreements. See the NOTICE file distributed with
> - * this work for additional information regarding copyright ownership.
> - * The ASF licenses this file to You under the Apache License, Version 2.0
> - * (the "License"); you may not use this file except in compliance with
> - * the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing, software
> - * distributed under the License is distributed on an "AS IS" BASIS,
> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> - * See the License for the specific language governing permissions and
> - * limitations under the License.
> - */
> -
> -package controllers;
> -
> -import com.fasterxml.jackson.databind.JsonNode;
> -import com.fasterxml.jackson.databind.node.ObjectNode;
> -import models.metadata.ClimateService;
> -import models.metadata.DiffPlotTwoTimeAveragedVar;
> -import models.metadata.RegridAndDownload;
> -import models.metadata.TwoDVarZonalMean;
> -import models.metadata.TwoDVarMap;
> -import models.metadata.TwoDVarTimeSeries;
> -import models.metadata.ThreeDVarZonalMean;
> -import models.metadata.ThreeDVar2DSlice;
> -import models.metadata.ThreeDVarAvgVertical4Profile;
> -import models.metadata.ScatterHistogramTwoVar;
> -import models.metadata.ConditionalSampling;
> -import models.metadata.ServiceLog;
> -import models.metadata.CorrelationMap;
> -import models.metadata.ConditionalSampling2Var;
> -import play.Logger;
> -import play.data.Form;
> -import play.libs.Json;
> -import play.mvc.Controller;
> -import play.mvc.Result;
> -import scala.Console;
> -import util.APICall;
> -import util.APICall.ResponseType;
> -import util.Constants;
> -import views.html.climate.*;
> -import play.data.DynamicForm;
> -import java.io.File;
> -import java.io.IOException;
> -import java.io.UnsupportedEncodingException;
> -import java.text.DateFormat;
> -import java.text.SimpleDateFormat;
> -import java.util.Date;
> -import java.util.List;
> -import com.fasterxml.jackson.databind.ObjectMapper;
> -
> -public class ClimateServiceController extends Controller {
> -
> - final static Form<ClimateService> climateServiceForm = Form
> - .form(ClimateService.class);
> -
> - public static Result home(String email, String vfile, String
> dataset) {
> - return ok(home.render(email, vfile, dataset));
> - }
> -
> - public static Result addClimateServices() {
> - return ok(addClimateServices.render(climateServiceForm));
> - }
> -
> - public static Result tutorial() {
> - return ok(tutorial.render());
> - }
> -
> - public static Result climateServices() {
> - return ok(climateServices.render(ClimateService.all(),
> - climateServiceForm));
> - }
> -
> - public static Result mostRecentlyAddedClimateServices() {
> - return
> ok(mostRecentlyAddedServices.render(ClimateService.getMostRecentlyAdded(),
> - climateServiceForm));
> - }
> -
> - public static Result mostRecentlyUsedClimateServices() {
> - return
> ok(mostRecentlyUsedServices.render(ClimateService.getMostRecentlyUsed(),
> - climateServiceForm));
> - }
> -
> - public static Result mostPopularClimateServices() {
> - return
> ok(mostPopularServices.render(ClimateService.getMostPopular(),
> - climateServiceForm));
> - }
> -
> - public static Result newClimateService() {
> - Form<ClimateService> dc =
> climateServiceForm.bindFromRequest();
> - ObjectNode jsonData = Json.newObject();
> - try {
> -
> - String originalClimateServiceName =
> dc.field("Name").value();
> - String newClimateServiceName =
> originalClimateServiceName.replace(' ', '-');
> -
> - if (newClimateServiceName != null &&
> !newClimateServiceName.isEmpty()) {
> - jsonData.put("name",
> newClimateServiceName);
> - }
> -
> - jsonData.put("creatorId", 1);
> - jsonData.put("purpose",
> dc.field("Purpose").value());
> - jsonData.put("url", dc.field("Url").value());
> - DateFormat dateFormat = new
> SimpleDateFormat("yyyy/MM/dd HH:mm");
> - Date date = new Date();
> - jsonData.put("createTime",
> dateFormat.format(date));
> - jsonData.put("scenario",
> dc.field("Scenario").value());
> - jsonData.put("versionNo",
> dc.field("Version").value());
> - jsonData.put("rootServiceId",
> dc.field("Root_Service").value());
> - JsonNode response =
> ClimateService.create(jsonData);
> - Application.flashMsg(response);
> - } catch (IllegalStateException e) {
> - e.printStackTrace();
> - Application.flashMsg(APICall
> -
> .createResponse(ResponseType.CONVERSIONERROR));
> - } catch (Exception e) {
> - e.printStackTrace();
> -
> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
> - }
> - return redirect("/climate/climateServices");
> - }
> -
> - public static Result editClimateService() {
> -
> - ObjectNode jsonData = Json.newObject();
> - try {
> - DynamicForm df =
> DynamicForm.form().bindFromRequest();
> - String climateServiceName = df.field("pk").value();
> -
> - if (climateServiceName != null &&
> !climateServiceName.isEmpty()) {
> - jsonData.put("name", climateServiceName);
> - }
> - ClimateService originalService =
> ClimateService.findServiceByName(climateServiceName);
> -
> - if (originalService == null) {
> -
> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
> - return notFound("not found original
> climateService " + climateServiceName);
> - }
> -
> - jsonData.put("creatorId", 1);
> - jsonData.put("purpose",
> originalService.getPurpose());
> - jsonData.put("url", originalService.getUrl());
> - jsonData.put("scenario",
> originalService.getScenario());
> - jsonData.put("versionNo",
> originalService.getVersion());
> -
> - if (originalService.getRootservice() != null)
> -
> - jsonData.put("rootServiceId",
> originalService.getRootservice());
> - String editField = df.field("name").value();
> -
> - if (editField != null && !editField.isEmpty()) {
> - jsonData.put(editField,
> df.field("value").value());
> - }
> -
> - if (editField == null || editField.isEmpty()) {
> -
> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
> - return notFound("not found edit field");
> - }
> -
> - JsonNode response =
> ClimateService.edit(climateServiceName, jsonData);
> - Application.flashMsg(response);
> -
> - } catch (IllegalStateException e) {
> - e.printStackTrace();
> - Application.flashMsg(APICall
> -
> .createResponse(ResponseType.CONVERSIONERROR));
> - } catch (Exception e) {
> - e.printStackTrace();
> -
> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
> - }
> - return ok("updated");
> -
> - }
> -
> - public static Result getConfigurationByConfId() {
> - String output = "";
> - TwoDVarMap twoDVarMap = new TwoDVarMap();
> - TwoDVarZonalMean twoDVarZonalMean = new TwoDVarZonalMean();
> - ScatterHistogramTwoVar scatterHistogram = new
> ScatterHistogramTwoVar();
> - ThreeDVarAvgVertical4Profile threeDVarAvgVertical = new
> ThreeDVarAvgVertical4Profile();
> - DiffPlotTwoTimeAveragedVar diffPlotTwoTimeAvg = new
> DiffPlotTwoTimeAveragedVar();
> - ThreeDVar2DSlice threeDVar2DSlice = new ThreeDVar2DSlice();
> - TwoDVarTimeSeries twoDVarTimeSeries = new
> TwoDVarTimeSeries();
> - ThreeDVarZonalMean threeDVarZonalMean = new
> ThreeDVarZonalMean();
> - ConditionalSampling conditionalSampling = new
> ConditionalSampling();
> - RegridAndDownload regridAndDownload = new
> RegridAndDownload();
> - CorrelationMap correlationMap = new CorrelationMap();
> - ConditionalSampling2Var conditionalSampling2Var = new
> ConditionalSampling2Var();
> -
> - try {
> - DynamicForm df =
> DynamicForm.form().bindFromRequest();
> - String logId = df.field("logId").value();
> -
> - if (logId == null || logId.isEmpty()) {
> -
> Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN));
> - return notFound("confId is null or empty");
> - }
> -
> - JsonNode response =
> APICall.callAPI(Constants.NEW_BACKEND + Constants.SERVICE_EXECUTION_LOG +
> Constants.SERVICE_EXECUTION_LOG_GET + logId);
> - int configurationId =
> response.path("serviceConfiguration").path("id").asInt();
> - JsonNode responseConfigItems =
> APICall.callAPI(Constants.NEW_BACKEND + Constants.CONFIG_ITEM +
> Constants.GET_CONFIG_ITEMS_BY_CONFIG + configurationId);
> - String serviceName =
> response.path("climateService").path("name").asText();
> - //TODO:
> - if (serviceName.equals("2-D-Variable-Zonal-Mean"))
> {
> - //TODO: DO NOT USE
> node.findPath(key)!!!!! use find(key) instead to get your immediate
> children if you know the json structure (and we do).
> - //TODO: (con't) findPath returns the first
> occurence of a key string, including GRANDCHILDREN
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> -
> - if (parameterName.equals("data
> source")) {
> -
> twoDVarZonalMean.setDataSource(parameterValue);
> - } else if
> (parameterName.equals("variable name")) {
> -
> twoDVarZonalMean.setVariableName(parameterValue);
> - } else if
> (parameterName.equals("start year-month")) {
> -
> twoDVarZonalMean.setStartYearMonth(parameterValue);
> - } else if
> (parameterName.equals("end year-month")) {
> -
> twoDVarZonalMean.setEndYearMonth(parameterValue);
> - } else if
> (parameterName.equals("select months")) {
> - String[] months =
> parameterValue.split(",");
> - for (int j = 0; j <
> months.length; j++) {
> - if
> (months[j].equals("1")) {
> -
> twoDVarZonalMean.addMonth("jan");
> - } else if
> (months[j].equals("2")) {
> -
> twoDVarZonalMean.addMonth("feb");
> - } else if
> (months[j].equals("3")) {
> -
> twoDVarZonalMean.addMonth("mar");
> - } else if
> (months[j].equals("4")) {
> -
> twoDVarZonalMean.addMonth("apr");
> - } else if
> (months[j].equals("5")) {
> -
> twoDVarZonalMean.addMonth("may");
> - } else if
> (months[j].equals("6")) {
> -
> twoDVarZonalMean.addMonth("jun");
> - } else if
> (months[j].equals("7")) {
> -
> twoDVarZonalMean.addMonth("jul");
> - } else if
> (months[j].equals("8")) {
> -
> twoDVarZonalMean.addMonth("aug");
> - } else if
> (months[j].equals("9")) {
> -
> twoDVarZonalMean.addMonth("sep");
> - } else if
> (months[j].equals("10")) {
> -
> twoDVarZonalMean.addMonth("oct");
> - } else if
> (months[j].equals("11")) {
> -
> twoDVarZonalMean.addMonth("nov");
> - } else if
> (months[j].equals("12")) {
> -
> twoDVarZonalMean.addMonth("dec");
> - }
> - }
> -
> twoDVarZonalMean.changeSelectMonths();
> - } else if
> (parameterName.equals("start lat (deg)")) {
> -
> twoDVarZonalMean.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("end lat (deg)")) {
> -
> twoDVarZonalMean.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("variable scale")) {
> -
> twoDVarZonalMean.setVariableScale(parameterValue);
> - }
> - }
> -
> twoDVarZonalMean.setExecutionPurpose(response.path("purpose").textValue());
> -
> twoDVarZonalMean.setImage(response.path("plotUrl").textValue());
> -
> twoDVarZonalMean.setDataURL(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.twoDVariableZonelMean.render(twoDVarZonalMean));
> - }
> - else if (serviceName.equals("2-D-Variable-Map")) {
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> - if (parameterName.equals("model"))
> {
> -
> twoDVarMap.setDataSource(parameterValue);
> - } else if
> (parameterName.equals("var")) {
> -
> twoDVarMap.setVariableName(parameterValue);
> - } else if
> (parameterName.equals("startT")) {
> -
> twoDVarMap.setStartYearMonth(parameterValue);
> - } else if
> (parameterName.equals("endT")) {
> -
> twoDVarMap.setEndYearMonth(parameterValue);
> - } else if
> (parameterName.equals("months")) {
> - String[] months =
> parameterValue.split(",");
> - for (int j = 0; j <
> months.length; j++) {
> - if
> (months[j].equals("1")) {
> -
> twoDVarMap.addMonth("jan");
> - } else if
> (months[j].equals("2")) {
> -
> twoDVarMap.addMonth("feb");
> - } else if
> (months[j].equals("3")) {
> -
> twoDVarMap.addMonth("mar");
> - } else if
> (months[j].equals("4")) {
> -
> twoDVarMap.addMonth("apr");
> - } else if
> (months[j].equals("5")) {
> -
> twoDVarMap.addMonth("may");
> - } else if
> (months[j].equals("6")) {
> -
> twoDVarMap.addMonth("jun");
> - } else if
> (months[j].equals("7")) {
> -
> twoDVarMap.addMonth("jul");
> - } else if
> (months[j].equals("8")) {
> -
> twoDVarMap.addMonth("aug");
> - } else if
> (months[j].equals("9")) {
> -
> twoDVarMap.addMonth("sep");
> - } else if
> (months[j].equals("10")) {
> -
> twoDVarMap.addMonth("oct");
> - } else if
> (months[j].equals("11")) {
> -
> twoDVarMap.addMonth("nov");
> - } else if
> (months[j].equals("12")) {
> -
> twoDVarMap.addMonth("dec");
> - }
> - }
> -
> twoDVarMap.changeSelectMonths();
> - } else if
> (parameterName.equals("lat1")) {
> -
> twoDVarMap.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("lat2")) {
> -
> twoDVarMap.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("lon1")) {
> -
> twoDVarMap.setStartLon(parameterValue);
> - } else if
> (parameterName.equals("lon2")) {
> -
> twoDVarMap.setEndLon(parameterValue);
> - } else if
> (parameterName.equals("scale")) {
> -
> twoDVarMap.setVariableScale(parameterValue);
> - }
> - }
> -
> twoDVarMap.setExecutionPurpose(response.path("purpose").textValue());
> -
> twoDVarMap.setImage(response.path("plotUrl").textValue());
> -
> twoDVarMap.setDataURL(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.twoDVariableMap.render(twoDVarMap));
> - }
> - else if
> (serviceName.equals("Conditional-Sampling-with-One-Variable")){
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> - if
> (parameterName.equals("model2")) {
> -
> conditionalSampling.setDataSourceE(parameterValue);
> - } else if
> (parameterName.equals("model1")) {
> -
> conditionalSampling.setDataSourceP(parameterValue);
> - } else if
> (parameterName.equals("var2")) {
> -
> conditionalSampling.setVariableNameE(parameterValue);
> - } else if
> (parameterName.equals("var1")) {
> -
> conditionalSampling.setVariableNameP(parameterValue);
> - } else if
> (parameterName.equals("pre1")) {
> -
> conditionalSampling.setPressureRangeP(parameterValue);
> - } else if
> (parameterName.equals("pre2")) {
> -
> conditionalSampling.setPressureRangeE(parameterValue);
> - } else if
> (parameterName.equals("startT")) {
> -
> conditionalSampling.setStartYearMonth(parameterValue);
> - } else if
> (parameterName.equals("endT")) {
> -
> conditionalSampling.setEndYearMonth(parameterValue);
> - } else if
> (parameterName.equals("lon1")) {
> -
> conditionalSampling.setStartLon(parameterValue);
> - } else if
> (parameterName.equals("lon2")) {
> -
> conditionalSampling.setEndLon(parameterValue);
> - } else if
> (parameterName.equals("lat1")) {
> -
> conditionalSampling.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("lat2")) {
> -
> conditionalSampling.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("months")) {
> - String[] months =
> parameterValue.split(",");
> - for (int j = 0; j <
> months.length; j++) {
> - if
> (months[j].equals("1")) {
> -
> conditionalSampling.addMonth("jan");
> - } else if
> (months[j].equals("2")) {
> -
> conditionalSampling.addMonth("feb");
> - } else if
> (months[j].equals("3")) {
> -
> conditionalSampling.addMonth("mar");
> - } else if
> (months[j].equals("4")) {
> -
> conditionalSampling.addMonth("apr");
> - } else if
> (months[j].equals("5")) {
> -
> conditionalSampling.addMonth("may");
> - } else if
> (months[j].equals("6")) {
> -
> conditionalSampling.addMonth("jun");
> - } else if
> (months[j].equals("7")) {
> -
> conditionalSampling.addMonth("jul");
> - } else if
> (months[j].equals("8")) {
> -
> conditionalSampling.addMonth("aug");
> - } else if
> (months[j].equals("9")) {
> -
> conditionalSampling.addMonth("sep");
> - } else if
> (months[j].equals("10")) {
> -
> conditionalSampling.addMonth("oct");
> - } else if
> (months[j].equals("11")) {
> -
> conditionalSampling.addMonth("nov");
> - } else if
> (months[j].equals("12")) {
> -
> conditionalSampling.addMonth("dec");
> - }
> -
> - }
> -
> conditionalSampling.changeSelectMonths();
> - } else if
> (parameterName.equals("bin_min")) {
> -
> conditionalSampling.setBin_min(parameterValue);
> - } else if
> (parameterName.equals("bin_max")) {
> -
> conditionalSampling.setBin_max(parameterValue);
> - } else if
> (parameterName.equals("bin_n")) {
> -
> conditionalSampling.setBin_n(parameterValue);
> - } else if
> (parameterName.equals("displayOpt")) {
> - int
> paramBit=Integer.parseInt(parameterValue);
> - int bitmaskX = 0x1;
> - int bitmaskY = 0x2;
> - int bitmaskZ = 0x4;
> -
> conditionalSampling.setX(Integer.toString(paramBit & bitmaskX, 2));
> -
> conditionalSampling.setY(Integer.toString((paramBit & bitmaskY)>>1, 2));
> -
> conditionalSampling.setZ(Integer.toString((paramBit & bitmaskZ)>>2, 2));
> - }
> - }
> -
> conditionalSampling.setExecutionPurpose(response.path("purpose").textValue());
> -
> conditionalSampling.setImage(response.path("plotUrl").textValue());
> -
> conditionalSampling.setDataURL(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.conditionalSampling.render(conditionalSampling));
> - }else if
> (serviceName.equals("2-D-Variable-Time-Series")){
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> - if (parameterName.equals("model"))
> {
> -
> twoDVarTimeSeries.setDataSource(parameterValue);
> - } else if
> (parameterName.equals("var")) {
> -
> twoDVarTimeSeries.setVariableName(parameterValue);
> - } else if
> (parameterName.equals("startT")) {
> -
> twoDVarTimeSeries.setStartYearMonth(parameterValue);
> - } else if
> (parameterName.equals("endT")) {
> -
> twoDVarTimeSeries.setEndYearMonth(parameterValue);
> - } else if
> (parameterName.equals("lat1")) {
> -
> twoDVarTimeSeries.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("lat2")) {
> -
> twoDVarTimeSeries.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("lon1")) {
> -
> twoDVarTimeSeries.setStartLon(parameterValue);
> - } else if
> (parameterName.equals("lon2")) {
> -
> twoDVarTimeSeries.setEndLon(parameterValue);
> - } else if
> (parameterName.equals("scale")) {
> -
> twoDVarTimeSeries.setVariableScale(parameterValue);
> - }
> - }
> -
> twoDVarTimeSeries.setExecutionPurpose(response.path("purpose").textValue());
> -
> twoDVarTimeSeries.setImage(response.path("plotUrl").textValue());
> -
> twoDVarTimeSeries.setDataURL(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.twoDVariableTimeSeries.render(twoDVarTimeSeries));
> - }else if
> (serviceName.equals("Regrid-and-Download")){
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> - if (parameterName.equals("model"))
> {
> -
> regridAndDownload.setDataSource(parameterValue);
> - } else if
> (parameterName.equals("var")) {
> -
> regridAndDownload.setVariableName(parameterValue);
> - } else if
> (parameterName.equals("startT")) {
> -
> regridAndDownload.setStartYearMonth(parameterValue);
> - } else if
> (parameterName.equals("endT")) {
> -
> regridAndDownload.setEndYearMonth(parameterValue);
> - } else if
> (parameterName.equals("lat1")) {
> -
> regridAndDownload.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("lat2")) {
> -
> regridAndDownload.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("dlat")) {
> -
> regridAndDownload.setDeltaLat(parameterValue);
> - } else if
> (parameterName.equals("dlon")) {
> -
> regridAndDownload.setDeltaLon(parameterValue);
> - } else if
> (parameterName.equals("lon1")) {
> -
> regridAndDownload.setStartLon(parameterValue);
> - } else if
> (parameterName.equals("lon2")) {
> -
> regridAndDownload.setEndLon(parameterValue);
> - } else if
> (parameterName.equals("plev")) {
> -
> regridAndDownload.setPressureLevel(parameterValue);
> - }
> - }
> -
> regridAndDownload.setExecutionPurpose(response.path("purpose").textValue());
> -
> -
> regridAndDownload.setDataURL(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.regridAndDownload.render(regridAndDownload));
> - }else if
> (serviceName.equals("3-D-Variable-Zonal-Mean")){
> - String press1 = "";
> - String press2 = "";
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> - if (parameterName.equals("model"))
> {
> -
> threeDVarZonalMean.setDataSource(parameterValue);
> - } else if
> (parameterName.equals("var")) {
> -
> threeDVarZonalMean.setVariableName(parameterValue);
> - } else if
> (parameterName.equals("startT")) {
> -
> threeDVarZonalMean.setStartYearMonth(parameterValue);
> - } else if
> (parameterName.equals("endT")) {
> -
> threeDVarZonalMean.setEndYearMonth(parameterValue);
> - } else if
> (parameterName.equals("lat1")) {
> -
> threeDVarZonalMean.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("lat2")) {
> -
> threeDVarZonalMean.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("pres1")) {
> - press1 = parameterValue;
> - } else if
> (parameterName.equals("pres2")) {
> - press2 = parameterValue;
> - } else if
> (parameterName.equals("months")) {
> - String[] months =
> parameterValue.split(",");
> - for (int j = 0; j <
> months.length; j++) {
> - if
> (months[j].equals("1")) {
> -
> threeDVarZonalMean.addMonth("jan");
> - } else if
> (months[j].equals("2")) {
> -
> threeDVarZonalMean.addMonth("feb");
> - } else if
> (months[j].equals("3")) {
> -
> threeDVarZonalMean.addMonth("mar");
> - } else if
> (months[j].equals("4")) {
> -
> threeDVarZonalMean.addMonth("apr");
> - } else if
> (months[j].equals("5")) {
> -
> threeDVarZonalMean.addMonth("may");
> - } else if
> (months[j].equals("6")) {
> -
> threeDVarZonalMean.addMonth("jun");
> - } else if
> (months[j].equals("7")) {
> -
> threeDVarZonalMean.addMonth("jul");
> - } else if
> (months[j].equals("8")) {
> -
> threeDVarZonalMean.addMonth("aug");
> - } else if
> (months[j].equals("9")) {
> -
> threeDVarZonalMean.addMonth("sep");
> - } else if
> (months[j].equals("10")) {
> -
> threeDVarZonalMean.addMonth("oct");
> - } else if
> (months[j].equals("11")) {
> -
> threeDVarZonalMean.addMonth("nov");
> - } else if
> (months[j].equals("12")) {
> -
> threeDVarZonalMean.addMonth("dec");
> - }
> - }
> - } else if
> (parameterName.equals("scale")) {
> - if
> (parameterValue.equals("2")) {
> -
> threeDVarZonalMean.setPressureScale("2");
> -
> threeDVarZonalMean.setColorScale("0");
> - } else if
> (parameterValue.equals("0")) {
> -
> threeDVarZonalMean.setPressureScale("0");
> -
> threeDVarZonalMean.setColorScale("0");
> - } else if
> (parameterValue.equals("4")) {
> -
> threeDVarZonalMean.setPressureScale("0");
> -
> threeDVarZonalMean.setColorScale("4");
> - } else if
> (parameterValue.equals("6")) {
> -
> threeDVarZonalMean.setPressureScale("2");
> -
> threeDVarZonalMean.setColorScale("4");
> - }
> - }
> - }
> - if (!press1.isEmpty() & !press2.isEmpty())
> -
> threeDVarZonalMean.setPressureRange("" + (Integer.parseInt(press1) / 100)
> + "," + (Integer.parseInt(press2) / 100));
> -
> threeDVarZonalMean.setExecutionPurpose(response.path("purpose").textValue());
> -
> threeDVarZonalMean.setImage(response.path("plotUrl").textValue());
> -
> threeDVarZonalMean.setDataURL(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.threeDVariableZonalMean.render(threeDVarZonalMean));
> - }else if
> (serviceName.equals("Scatter-and-Histogram-Plot-of-Two-Variables")){
> //"19")){
> -
> scatterHistogram.setPressureLevel1("N/A");
> -
> scatterHistogram.setPressureLevel2("N/A");
> - for (int i = 0; i <
> responseConfigItems.size(); i++) {
> - String parameterName =
> responseConfigItems.get(i).path("parameter").path("purpose").textValue();
> - String parameterValue =
> responseConfigItems.get(i).path("value").textValue();
> - if
> (parameterName.equals("model1")) {
> -
> scatterHistogram.setSource1(parameterValue);
> -
> - } else if
> (parameterName.equals("model2")) {
> -
> scatterHistogram.setSource2(parameterValue);
> -
> - } else if
> (parameterName.equals("var1")) {
> -
> scatterHistogram.setVaribaleName1(parameterValue);
> -
> - } else if
> (parameterName.equals("var2")) {
> -
> scatterHistogram.setVaribaleName2(parameterValue);
> - } else if
> (parameterName.equals("startT")) {
> -
> scatterHistogram.setStartYear(parameterValue);
> - } else if
> (parameterName.equals("endT")) {
> -
> scatterHistogram.setEndYear(parameterValue);
> - } else if
> (parameterName.equals("lon1")) {
> -
> scatterHistogram.setStartLon(parameterValue);
> - } else if
> (parameterName.equals("lon2")) {
> -
> scatterHistogram.setEndLon(parameterValue);
> - } else if
> (parameterName.equals("lat1")) {
> -
> scatterHistogram.setStartLat(parameterValue);
> - } else if
> (parameterName.equals("lat2")) {
> -
> scatterHistogram.setEndLat(parameterValue);
> - } else if
> (parameterName.equals("nSample")) {
> -
> scatterHistogram.setSamples(parameterValue);
> - }
> - }
> -
> scatterHistogram.setExecutionPurpose(response.path("purpose").textValue());
> -
> scatterHistogram.setImage(response.path("plotUrl").textValue());
> -
> scatterHistogram.setDataUrl(response.path("dataUrl").textValue());
> - return
> ok(views.html.climate.scatterAndHistogramTwoVariable.render(scatterHistogram));
> - }else if
> (serviceName.equals("Difference-Plot-of-Two-Time-Averaged-Variables")){
> //"20")){
> -
> diffPlotTwoTimeAvg.setPressureLevel1("N/A");
> -
> Console.println(diffPlotTwoTimeAvg.getPressureLevel1());
> -
> diffPlotTwoTimeAvg.setPressureLevel2("N/A");
> - for (int i = 0; i < response