cmda-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xingwei...@apache.org
Subject [47/50] [abbrv] incubator-cmda git commit: modify model package
Date Sat, 05 Sep 2015 00:20:51 GMT
modify model package


Project: http://git-wip-us.apache.org/repos/asf/incubator-cmda/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cmda/commit/25673e4c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cmda/tree/25673e4c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cmda/diff/25673e4c

Branch: refs/heads/master
Commit: 25673e4c3109ea169b4899ac61f2b91452d202e9
Parents: f6aa032
Author: cat1021 <longma1021@gmail.com>
Authored: Fri Sep 4 16:49:39 2015 -0700
Committer: cat1021 <longma1021@gmail.com>
Committed: Fri Sep 4 16:49:39 2015 -0700

----------------------------------------------------------------------
 app/models/BugReport.java                       | 37 ++--------
 app/models/DataSet.java                         | 74 ++------------------
 app/models/metadata/ClimateService.java         | 15 ----
 app/models/metadata/ConditionalSampling.java    |  4 +-
 .../metadata/ConditionalSampling2Var.java       |  3 -
 app/models/metadata/ServiceLog.java             | 66 +++--------------
 app/models/metadata/ThreeDVar2DSlice.java       |  5 +-
 .../metadata/ThreeDVarAvgVertical4Profile.java  |  4 +-
 app/models/metadata/ThreeDVarZonalMean.java     |  4 +-
 app/models/metadata/TwoDVarMap.java             |  4 +-
 app/util/APICall.java                           | 14 ++--
 11 files changed, 34 insertions(+), 196 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/25673e4c/app/models/BugReport.java
----------------------------------------------------------------------
diff --git a/app/models/BugReport.java b/app/models/BugReport.java
index 7c15d0d..9842e09 100644
--- a/app/models/BugReport.java
+++ b/app/models/BugReport.java
@@ -18,15 +18,11 @@
 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.*;
 
@@ -72,14 +68,10 @@ public class BugReport {
 	@Formats.DateTime(pattern = "MM/dd/yy")
 	public java.sql.Date updateDate;
 
-	// @ManyToOne
-	// public User owner;
 	@play.db.jpa.Transactional
 	public static List getAll() {
 		Connection connection = DB.getConnection();
-		// This should clearly not be here, but for the moment i'll leave it
-		// we need to learn how H2 works, it's an in-memory db so i think
-		// there's two instances running
+
 		try {
 			Query query = JPA.em().createNativeQuery(
 					"CREATE TABLE BUG_REPORT (id INT auto_increment, "
@@ -93,8 +85,7 @@ public class BugReport {
 			System.out.println("created bug report table");
 		} catch (Exception e) {
 			System.out.println("Didn't create table");
-		}
-		finally {
+		} finally {
 			if (connection != null) {
 				try {
 					connection.close();
@@ -104,24 +95,17 @@ public class BugReport {
 			}
 		}
 
-		// org.hibernate.dialect.Dialect does not have boolean type registered
 		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();
-		// "INSERT INTO BUG_REPORT VALUES ("Name")";
-		// Query query =
-		// JPA.em().createNativeQuery("INSERT INTO BUG_REPORT VALUES (" +
-		// this.title + ")" );
-		// query.executeUpdate();
+
 		try {
-			// organization_name VARCHAR(255), email VARCHAR(255), description
-			// VARCHAR(255), CREATED_AT TIMESTAMP
+			
 			Statement statement = connection.createStatement();
 			String queryText = "INSERT INTO BUG_REPORT (title, name, email, organization, description,
solved) VALUES ('"
 					+ this.title.replaceAll("\'", "\'\'")
@@ -153,14 +137,9 @@ public class BugReport {
 	@play.db.jpa.Transactional
 	public static boolean delete(int id) {
 		Connection connection = DB.getConnection();
-		// "INSERT INTO BUG_REPORT VALUES ("Name")";
-		// Query query =
-		// JPA.em().createNativeQuery("INSERT INTO BUG_REPORT VALUES (" +
-		// this.title + ")" );
-		// query.executeUpdate();
+
 		try {
-			// organization_name VARCHAR(255), email VARCHAR(255), description
-			// VARCHAR(255), CREATED_AT TIMESTAMP
+
 			Statement statement = connection.createStatement();
 			String deleteText = "DELETE FROM BUG_REPORT WHERE ID = " + id;
 			statement.executeUpdate(deleteText);
@@ -184,8 +163,7 @@ public class BugReport {
 	public static boolean solve(int id) {
 		Connection connection = DB.getConnection();
 		try {
-			// organization_name VARCHAR(255), email VARCHAR(255), description
-			// VARCHAR(255), CREATED_AT TIMESTAMP
+
 			Statement statement = connection.createStatement();
 			String solveText = "UPDATE BUG_REPORT SET SOLVED = 1 WHERE ID = " + id;
 			statement.executeUpdate(solveText);
@@ -264,5 +242,4 @@ public class BugReport {
 	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/25673e4c/app/models/DataSet.java
----------------------------------------------------------------------
diff --git a/app/models/DataSet.java b/app/models/DataSet.java
index 91200eb..929dce7 100644
--- a/app/models/DataSet.java
+++ b/app/models/DataSet.java
@@ -22,14 +22,8 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.Map;
-
-import scala.Console;
-import models.metadata.ClimateService;
-import models.metadata.ServiceLog;
 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;
@@ -177,13 +171,11 @@ public class DataSet {
 
 		JsonNode dataSetNode = APICall.callAPI(GET_ALL_DATASET);
 
-		// if no value is returned or error or is not json array
 		if (dataSetNode == null || dataSetNode.has("error")
 				|| !dataSetNode.isArray()) {
 			return dataSets;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < dataSetNode.size(); i++) {
 			JsonNode json = dataSetNode.path(i);
 			DataSet dataset = new DataSet();
@@ -198,31 +190,14 @@ public class DataSet {
 			dataset.setSource(json.get("source").asText());
 			dataset.setStatus(json.get("status").asText());
 			dataset.setResponsiblePerson(json.get("responsiblePerson").asText());
-//			dataset.setComments(json.get(""));
 			dataset.setDataSourceName(json.get("dataSourceNameinWebInterface").asText());
-//			Console.print("aaa"+dataset.getDataSourceName());
 			dataset.setVariableName(json.get("variableNameInWebInterface").asText());
 			dataset.setDataSourceInput(json.get("dataSourceInputParameterToCallScienceApplicationCode").asText());
 			dataset.setVariableNameInput(json.get("variableNameInputParameterToCallScienceApplicationCode").asText());
-			
-//!!!!!!fake start/end time value
-			
-//			if (json.get("endTime") != null) {
-//				dataset.setEndTime(json.get("endTime").asText());
-//			} else {
-//				dataset.setEndTime(null);
-//			}
-//			if (json.get("startTime") != null) {
-//				dataset.setStartTime(json.get("startTime").asText());
-//			} else {
-//				dataset.setEndTime(null);
-//			}
-			
-			
 			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);
 				
@@ -230,7 +205,7 @@ public class DataSet {
 					dataset.setStartTime(new SimpleDateFormat("YYYYMM").format(tmpTime));
 				}
 		    } catch (ParseException e){	    
-//		    	e.printStackTrace();
+
 		    }
 			
 			try {
@@ -240,13 +215,8 @@ public class DataSet {
 					dataset.setEndTime(new SimpleDateFormat("YYYYMM").format(tmpTime));
 				}
 		    } catch (ParseException e){	    
-//		    	e.printStackTrace();
+
 		    }
-			
-			
-//			dataset.setEndTime("201508");
-//			dataset.setStartTime("201507");
-			
 			dataSets.add(dataset);
 		}
 		return dataSets;
@@ -262,36 +232,21 @@ public static List<DataSet> queryDataSet(String dataSetName, String
agency, Stri
 		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());
 		}
-		
-//		if (dataSetName != null && !dataSetName.isEmpty()) {
-//			queryJson.put("name", dataSetName);
-//		}
-//		if (agency != null && !agency.isEmpty()) {
-//			queryJson.put("agencyId", agency);
-//		}
-//		if (instrument != null && !instrument.isEmpty()) {
-//			queryJson.put("instrument", instrument);
-//		}
-//		if (physicalVariable != null && !physicalVariable.isEmpty()) {
-//			queryJson.put("physicalVariable", physicalVariable);
-//		}
-//		if (gridDimension != null && !gridDimension.isEmpty()) {
-//			queryJson.put("gridDimension", gridDimension);
-//		}
-		
 		JsonNode dataSetNode = APICall.postAPI(DATASET_QUERY, queryJson);
+		
 		if (dataSetNode == null || dataSetNode.has("error")
 				|| !dataSetNode.isArray()) {
 			return dataset;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < dataSetNode.size(); i++) {
 			JsonNode json = dataSetNode.path(i);
 			DataSet newDataSet = deserializeJsonToDataSet(json);
@@ -302,14 +257,6 @@ public static List<DataSet> queryDataSet(String dataSetName, String
agency, Stri
 
 	private static DataSet deserializeJsonToDataSet(JsonNode json) {
 		DataSet newDataSet = new DataSet();
-//		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.setGridDimension(json.get("gridDimension").asText());
-		
 		newDataSet.setId(json.get("id").asText());
 		newDataSet.setDataSetName(json.get("name").asText());
 		newDataSet.setAgencyId(json.get("agencyId").asText());
@@ -321,9 +268,7 @@ public static List<DataSet> queryDataSet(String dataSetName, String
agency, Stri
 		newDataSet.setSource(json.get("source").asText());
 		newDataSet.setStatus(json.get("status").asText());
 		newDataSet.setResponsiblePerson(json.get("responsiblePerson").asText());
-//		dataset.setComments(json.get(""));
 		newDataSet.setDataSourceName(json.get("dataSourceNameinWebInterface").asText());
-//		Console.print("aaa"+dataset.getDataSourceName());
 		newDataSet.setVariableName(json.get("variableNameInWebInterface").asText());
 		newDataSet.setDataSourceInput(json.get("dataSourceInputParameterToCallScienceApplicationCode").asText());
 		newDataSet.setVariableNameInput(json.get("variableNameInputParameterToCallScienceApplicationCode").asText());
@@ -349,13 +294,6 @@ public static List<DataSet> queryDataSet(String dataSetName, String
agency, Stri
 	    } catch (ParseException e){	    
 	    	
 	    }
-
-		
-//!!!!!!fake start/end time value		
-//		newDataSet.setEndTime(json.get("dataSetEndTime").asText());
-//		newDataSet.setStartTime(json.get("dataSetStartTime").asText());
-		
-	
 		return newDataSet;
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/25673e4c/app/models/metadata/ClimateService.java
----------------------------------------------------------------------
diff --git a/app/models/metadata/ClimateService.java b/app/models/metadata/ClimateService.java
index 96a40e0..63711e6 100644
--- a/app/models/metadata/ClimateService.java
+++ b/app/models/metadata/ClimateService.java
@@ -20,9 +20,7 @@ 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;
 
@@ -146,13 +144,11 @@ public class ClimateService {
 		JsonNode climateServicesNode = APICall
 				.callAPI(GET_CLIMATE_SERVICES_CALL);
 
-		// if no value is returned or error or is not json array
 		if (climateServicesNode == null || climateServicesNode.has("error")
 				|| !climateServicesNode.isArray()) {
 			return climateServices;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < climateServicesNode.size(); i++) {
 			JsonNode json = climateServicesNode.path(i);
 			ClimateService newService = new ClimateService();
@@ -176,14 +172,11 @@ public class ClimateService {
 
 		JsonNode climateServicesNode = APICall
 				.callAPI(GET_MOST_RECENTLY_ADDED_CLIMATE_SERVICES_CALL);
-		//System.out.print(GET_MOST_RECENTLY_ADDED_CLIMATE_SERVICES_CALL);
-		// if no value is returned or error or is not json array
 		if (climateServicesNode == null || climateServicesNode.has("error")
 				|| !climateServicesNode.isArray()) {
 			return climateServices;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < climateServicesNode.size(); i++) {
 			JsonNode json = climateServicesNode.path(i);
 			ClimateService newService = new ClimateService();
@@ -192,7 +185,6 @@ public class ClimateService {
 					"name").asText());
 			newService.setPurpose(json.findPath("purpose").asText());
 			newService.setUrl(json.findPath("url").asText());
-			//newService.setCreateTime(json.findPath("createTime").asText());
 			newService.setScenario(json.findPath("scenario").asText());
 			newService.setVersion(json.findPath("versionNo").asText());
 			newService.setRootservice(json.findPath("rootServiceId").asText());
@@ -208,13 +200,11 @@ public class ClimateService {
 		JsonNode climateServicesNode = APICall
 				.callAPI(GET_MOST_RECENTLY_USED_CLIMATE_SERVICES_CALL);
 
-		// if no value is returned or error or is not json array
 		if (climateServicesNode == null || climateServicesNode.has("error")
 				|| !climateServicesNode.isArray()) {
 			return climateServices;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < climateServicesNode.size(); i++) {
 			JsonNode json = climateServicesNode.path(i);
 			ClimateService newService = new ClimateService();
@@ -223,7 +213,6 @@ public class ClimateService {
 					"name").asText());
 			newService.setPurpose(json.findPath("purpose").asText());
 			newService.setUrl(json.findPath("url").asText());
-			//newService.setCreateTime(json.findPath("createTime").asText());
 			newService.setScenario(json.findPath("scenario").asText());
 			newService.setVersion(json.findPath("versionNo").asText());
 			newService.setRootservice(json.findPath("rootServiceId").asText());
@@ -239,13 +228,11 @@ public class ClimateService {
 		JsonNode climateServicesNode = APICall
 				.callAPI(GET_MOST_POPULAR_CLIMATE_SERVICES_CALL);
 
-		// if no value is returned or error or is not json array
 		if (climateServicesNode == null || climateServicesNode.has("error")
 				|| !climateServicesNode.isArray()) {
 			return climateServices;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < climateServicesNode.size(); i++) {
 			JsonNode json = climateServicesNode.path(i);
 			ClimateService newService = new ClimateService();
@@ -254,7 +241,6 @@ public class ClimateService {
 					"name").asText());
 			newService.setPurpose(json.findPath("purpose").asText());
 			newService.setUrl(json.findPath("url").asText());
-			//newService.setCreateTime(json.findPath("createTime").asText());
 			newService.setScenario(json.findPath("scenario").asText());
 			newService.setVersion(json.findPath("versionNo").asText());
 			newService.setRootservice(json.findPath("rootServiceId").asText());
@@ -339,7 +325,6 @@ public class ClimateService {
 			photo = "/assets/images/conditionalSampling2Variables.jpeg";
 		}
 		else{
-			//photo = "http://i1-mac.softpedia-static.com/screenshots/Climate-Data-Analysis-Tools_1.png";
 			photo = "http://upload.wikimedia.org/wikipedia/commons/3/33/White_square_with_question_mark.png";
 		}
 	}

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/25673e4c/app/models/metadata/ConditionalSampling.java
----------------------------------------------------------------------
diff --git a/app/models/metadata/ConditionalSampling.java b/app/models/metadata/ConditionalSampling.java
index dbe1332..d8ef86c 100644
--- a/app/models/metadata/ConditionalSampling.java
+++ b/app/models/metadata/ConditionalSampling.java
@@ -155,9 +155,7 @@ public class ConditionalSampling {
 		this.selectMonths = selectMonths;
 	}
 	public void changeSelectMonths(){
-//		if(month.isEmpty()){
-//			this.selectMonths = "select none";
-//		}
+
 		if(month.contains("1")&&month.contains("2")&&month.contains("3")&&month.contains("4")&&month.contains("5")&&month.contains("6")&&month.contains("7")&&month.contains("8")&&month.contains("9")&&month.contains("10")&&month.contains("11")&&month.contains("12")){
 			this.selectMonths = "select all";
 		}

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/25673e4c/app/models/metadata/ConditionalSampling2Var.java
----------------------------------------------------------------------
diff --git a/app/models/metadata/ConditionalSampling2Var.java b/app/models/metadata/ConditionalSampling2Var.java
index 6c69796..30a9e24 100644
--- a/app/models/metadata/ConditionalSampling2Var.java
+++ b/app/models/metadata/ConditionalSampling2Var.java
@@ -60,9 +60,6 @@ public class ConditionalSampling2Var {
 	private String image = "";
 	private String dataURL = "";
 	private String serviceResponseText = "";
-
-	//env_var_plev1
-	
 	
 	public String getDataSourceP() {
 		return dataSourceP;

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/25673e4c/app/models/metadata/ServiceLog.java
----------------------------------------------------------------------
diff --git a/app/models/metadata/ServiceLog.java b/app/models/metadata/ServiceLog.java
index 9cb9a39..830362e 100644
--- a/app/models/metadata/ServiceLog.java
+++ b/app/models/metadata/ServiceLog.java
@@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import play.Logger;
 import util.APICall;
 import util.Constants;
-
 import java.io.UnsupportedEncodingException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -155,13 +154,11 @@ public class ServiceLog {
 		JsonNode serviceLogNode = APICall
 				.callAPI(GET_ALL_SERVICE_LOG);
 
-		// if no value is returned or error or is not json array
 		if (serviceLogNode == null || serviceLogNode.has("error")
 				|| !serviceLogNode.isArray()) {
 			return serviceLog;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < serviceLogNode.size(); i++) {
 			JsonNode json = serviceLogNode.path(i);
 
@@ -181,18 +178,12 @@ public class ServiceLog {
 		newServiceLog.setPurpose(json.get("purpose").asText());
 		newServiceLog.setUserId(json.get("user").get("firstName").asText()+" "+json.get("user").get("lastName").asText());
 		newServiceLog.setServiceConfigurationId(json.get("serviceConfiguration").get("id").asText());
-//		newServiceLog.setExecutionStartTime(json.findPath("executionStartTime").asText());
-//		newServiceLog.setExecutionEndTime(json.findPath("executionEndTime").asText());
-//		newServiceLog.setDataSetStartTime(json.findPath("datasetStudyStartTime").asText());
-//		newServiceLog.setDataSetEndTime(json.findPath("datasetStudyEndTime").asText());
-		
 		String executionStartTime = json.findPath("executionStartTime").asText();
-		String executionEndTime = json.findPath("executionEndTime").asText();
-		
+		String executionEndTime = json.findPath("executionEndTime").asText();	
 		String datasetStudyStartTime = json.findPath("datasetStudyStartTime").asText();
 		String datasetStudyEndTime = json.findPath("datasetStudyEndTime").asText();
-		
 		Date tmpTime = null;
+		
 		try {
 			tmpTime = (new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a")).parse(executionStartTime);
	
 			if (tmpTime != null) {
@@ -216,7 +207,7 @@ public class ServiceLog {
 				newServiceLog.setDataSetStartTime(new SimpleDateFormat("YYYYMM").format(tmpTime));
 			}
 	    } catch (ParseException e){	    
-//	    	e.printStackTrace();
+
 	    }
 		
 		try {
@@ -226,19 +217,10 @@ public class ServiceLog {
 				newServiceLog.setDataSetEndTime(new SimpleDateFormat("YYYYMM").format(tmpTime));
 			}
 	    } catch (ParseException e){	    
-//	    	e.printStackTrace();
+
 	    }
-		
-		
-//		tmptime = null;
-//		try {
-//			tmptime = (new SimpleDateFormat("YYYY-MM-DD HH:MM:SS")).parse(json.findPath("datasetStudyEndTime").asText());
-//	    } catch (ParseException e){	    
-//	    	e.printStackTrace();
-//	    }
-//		newServiceLog.setDataSetEndTime(new SimpleDateFormat("YYYYMM").format(tmptime));
-		
-		newServiceLog.setDatasetLogId(json.findPath("datasetLogId").asText());	//Not used variavle,
use original code for now to set this to an empyy string
+
+		newServiceLog.setDatasetLogId(json.findPath("datasetLogId").asText());
 
 		return newServiceLog;
 	}
@@ -259,15 +241,11 @@ public class ServiceLog {
 
 		JsonNode serviceLogNode = APICall
 				.callAPI("http://localhost:9008/searchServiceLogsWithParameter/model/"+dataSource+"/json");
-		//Logger.debug(GET_A_SERVICE_LOG + userId+ "/" +startTime + "" + "/" +endTime + "" + "/"
+ util.Constants.FORMAT);
-		// if no value is returned or error or is not json array
-		//Logger.info(serviceLogNode.toString());
 		if (serviceLogNode == null || serviceLogNode.has("error")
 				|| !serviceLogNode.isArray()) {
 			return serviceLog;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < serviceLogNode.size(); i++) {
 			JsonNode json = serviceLogNode.path(i);
 			ServiceLog newServiceLog = deserializeJsonToServiceLog(json);
@@ -281,15 +259,13 @@ public class ServiceLog {
 
 		JsonNode serviceLogNode = APICall
 				.callAPI("http://localhost:9008/searchServiceLogsWithParameter/var/"+variableName+"/json");
-		//Logger.debug(GET_A_SERVICE_LOG + userId+ "/" +startTime + "" + "/" +endTime + "" + "/"
+ util.Constants.FORMAT);
-		// if no value is returned or error or is not json array
+
 		Logger.info(serviceLogNode.toString());
 		if (serviceLogNode == null || serviceLogNode.has("error")
 				|| !serviceLogNode.isArray()) {
 			return serviceLog;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < serviceLogNode.size(); i++) {
 			JsonNode json = serviceLogNode.path(i);
 			ServiceLog newServiceLog = deserializeJsonToServiceLog(json);
@@ -303,15 +279,12 @@ public class ServiceLog {
 
 		JsonNode serviceLogNode = APICall
 				.callAPIParameter("http://localhost:9008/getExecutionLogByPurpose", "purpose", purpose);
-		//Logger.debug(GET_A_SERVICE_LOG + userId+ "/" +startTime + "" + "/" +endTime + "" + "/"
+ util.Constants.FORMAT);
-		// if no value is returned or error or is not json array
+
 		Logger.info(serviceLogNode.toString());
 		if (serviceLogNode == null || serviceLogNode.has("error")
 				|| !serviceLogNode.isArray()) {
 			return serviceLog;
 		}
-
-		// parse the json string into object
 		
 		for (int i = 0; i < serviceLogNode.size(); i++) {
 			JsonNode json = serviceLogNode.path(i);
@@ -326,15 +299,12 @@ public class ServiceLog {
 
 		JsonNode serviceLogNode = APICall
 				.callAPI("http://localhost:9008/searchServiceLogsWithParameter/" + userId + "/json");
-		//Logger.debug(GET_A_SERVICE_LOG + userId+ "/" +startTime + "" + "/" +endTime + "" + "/"
+ util.Constants.FORMAT);
-		// if no value is returned or error or is not json array
 		Logger.info(serviceLogNode.toString());
 		if (serviceLogNode == null || serviceLogNode.has("error")
 				|| !serviceLogNode.isArray()) {
 			return serviceLog;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < serviceLogNode.size(); i++) {
 			JsonNode json = serviceLogNode.path(i);
 			ServiceLog newServiceLog = deserializeJsonToServiceLog(json);
@@ -348,15 +318,12 @@ public class ServiceLog {
 
 		JsonNode serviceLogNode = APICall
 				.callAPI("http://localhost:9008/searchServiceLogsWithParameterRange/startT/"+start+"/endT/"+end+"/json");
-		//Logger.debug(GET_A_SERVICE_LOG + userId+ "/" +startTime + "" + "/" +endTime + "" + "/"
+ util.Constants.FORMAT);
-		// if no value is returned or error or is not json array
 		Logger.info(serviceLogNode.toString());
 		if (serviceLogNode == null || serviceLogNode.has("error")
 				|| !serviceLogNode.isArray()) {
 			return serviceLog;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < serviceLogNode.size(); i++) {
 			JsonNode json = serviceLogNode.path(i);
 			ServiceLog newServiceLog = deserializeJsonToServiceLog(json);
@@ -370,15 +337,13 @@ public class ServiceLog {
 
 		JsonNode serviceLogNode = APICall
 				.callAPI("http://localhost:9008/searchServiceLogsWithParameterRange/start%20lat%20(deg)/"
+ start + "/end%20lat%20(deg)/" + end + "/json");
-		//Logger.debug(GET_A_SERVICE_LOG + userId+ "/" +startTime + "" + "/" +endTime + "" + "/"
+ util.Constants.FORMAT);
-		// if no value is returned or error or is not json array
+
 		Logger.info(serviceLogNode.toString());
 		if (serviceLogNode == null || serviceLogNode.has("error")
 				|| !serviceLogNode.isArray()) {
 			return serviceLog;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < serviceLogNode.size(); i++) {
 			JsonNode json = serviceLogNode.path(i);
 			ServiceLog newServiceLog = deserializeJsonToServiceLog(json);
@@ -410,15 +375,13 @@ public class ServiceLog {
 		}
 		JsonNode serviceLogNode = APICall
 				.callAPI("http://localhost:9008/searchServiceLogsWithMultipleParameter/userid/" + userId
+ "/datasource/" + dataSource + "/variablename/" + variableName + "/startyearmonth/" + startTime
+ "/endyearmonth/" + endTime + "/executionpurpose/" + executionPurpose + "/json");
-		//Logger.debug(GET_A_SERVICE_LOG + userId+ "/" +startTime + "" + "/" +endTime + "" + "/"
+ util.Constants.FORMAT);
-		// if no value is returned or error or is not json array
+
 		Logger.info(serviceLogNode.toString());
 		if (serviceLogNode == null || serviceLogNode.has("error")
 				|| !serviceLogNode.isArray()) {
 			return serviceLog;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < serviceLogNode.size(); i++) {
 			JsonNode json = serviceLogNode.path(i);
 			ServiceLog newServiceLog = deserializeJsonToServiceLog(json);
@@ -427,7 +390,6 @@ public class ServiceLog {
 		return serviceLog;
 	}
 
-	//simple search function on top of the table of service execution log
 	public static List<ServiceLog> search(String userId, long startTime, long endTime)
{
 
 		List<ServiceLog> serviceLog = new ArrayList<ServiceLog>();
@@ -437,16 +399,12 @@ public class ServiceLog {
 
 		JsonNode serviceLogNode = APICall
 				.callAPI(GET_A_SERVICE_LOG + userId + "/" + startTime + "" + "/" + endTime + "" + "/"
+ util.Constants.FORMAT);
-//		JsonNode serviceLogNode = APICall
-//				.callAPI("http://localhost:9008/getServiceExecutionLogs/123/1415904302/1415904357/json");
-		//Logger.debug(GET_A_SERVICE_LOG + userId+ "/" +startTime + "" + "/" +endTime + "" + "/"
+ util.Constants.FORMAT);
-		// if no value is returned or error or is not json array
+
 		if (serviceLogNode == null || serviceLogNode.has("error")
 				|| !serviceLogNode.isArray()) {
 			return serviceLog;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < serviceLogNode.size(); i++) {
 			JsonNode json = serviceLogNode.path(i);
 			ServiceLog newServiceLog = deserializeJsonToServiceLog(json);
@@ -529,14 +487,12 @@ public class ServiceLog {
 			}
 		}
 
-		//System.out.println(queryJson);
 		JsonNode serviceLogNode = APICall.postAPI(EXECUTION_LOG_QUERY, queryJson);
 		if (serviceLogNode == null || serviceLogNode.has("error")
 				|| !serviceLogNode.isArray()) {
 			return serviceLog;
 		}
 
-		// parse the json string into object
 		for (int i = 0; i < serviceLogNode.size(); i++) {
 			JsonNode json = serviceLogNode.path(i);
 			ServiceLog newServiceLog = deserializeJsonToServiceLog(json);

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/25673e4c/app/models/metadata/ThreeDVar2DSlice.java
----------------------------------------------------------------------
diff --git a/app/models/metadata/ThreeDVar2DSlice.java b/app/models/metadata/ThreeDVar2DSlice.java
index 0d31acc..66d24ab 100644
--- a/app/models/metadata/ThreeDVar2DSlice.java
+++ b/app/models/metadata/ThreeDVar2DSlice.java
@@ -92,9 +92,7 @@ public class ThreeDVar2DSlice {
 		this.selectMonths = selectMonths;
 	}
 	public void changeSelectMonths(){
-//		if(month.isEmpty()){
-//			this.selectMonths = "select none";
-//		}
+
 		if(month.contains("1")&&month.contains("2")&&month.contains("3")&&month.contains("4")&&month.contains("5")&&month.contains("6")&&month.contains("7")&&month.contains("8")&&month.contains("9")&&month.contains("10")&&month.contains("11")&&month.contains("12")){
 			this.selectMonths = "select all";
 		}
@@ -136,7 +134,6 @@ public class ThreeDVar2DSlice {
 	public void setEndLat(String endLat) {
 		this.endLat = endLat;
 	}
-	
 	public String getExecutionPurpose() {
 		return executionPurpose;
 	}

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/25673e4c/app/models/metadata/ThreeDVarAvgVertical4Profile.java
----------------------------------------------------------------------
diff --git a/app/models/metadata/ThreeDVarAvgVertical4Profile.java b/app/models/metadata/ThreeDVarAvgVertical4Profile.java
index 5161722..c3b6ecf 100644
--- a/app/models/metadata/ThreeDVarAvgVertical4Profile.java
+++ b/app/models/metadata/ThreeDVarAvgVertical4Profile.java
@@ -88,9 +88,7 @@ public class ThreeDVarAvgVertical4Profile {
 		this.selectMonths = selectMonths;
 	}
 	public void changeSelectMonths(){
-//		if(month.isEmpty()){
-//			this.selectMonths = "select none";
-//		}
+
 		if(month.contains("1")&&month.contains("2")&&month.contains("3")&&month.contains("4")&&month.contains("5")&&month.contains("6")&&month.contains("7")&&month.contains("8")&&month.contains("9")&&month.contains("10")&&month.contains("11")&&month.contains("12")){
 			this.selectMonths = "select all";
 		}

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/25673e4c/app/models/metadata/ThreeDVarZonalMean.java
----------------------------------------------------------------------
diff --git a/app/models/metadata/ThreeDVarZonalMean.java b/app/models/metadata/ThreeDVarZonalMean.java
index c16d1f4..98eb959 100644
--- a/app/models/metadata/ThreeDVarZonalMean.java
+++ b/app/models/metadata/ThreeDVarZonalMean.java
@@ -86,9 +86,7 @@ public class ThreeDVarZonalMean {
 		this.selectMonths = selectMonths;
 	}
 	public void changeSelectMonths(){
-//		if(month.isEmpty()){
-//			this.selectMonths = "select none";
-//		}
+
 		if(month.contains("1")&&month.contains("2")&&month.contains("3")&&month.contains("4")&&month.contains("5")&&month.contains("6")&&month.contains("7")&&month.contains("8")&&month.contains("9")&&month.contains("10")&&month.contains("11")&&month.contains("12")){
 			this.selectMonths = "select all";
 		}

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/25673e4c/app/models/metadata/TwoDVarMap.java
----------------------------------------------------------------------
diff --git a/app/models/metadata/TwoDVarMap.java b/app/models/metadata/TwoDVarMap.java
index 539e8db..4fc0803 100644
--- a/app/models/metadata/TwoDVarMap.java
+++ b/app/models/metadata/TwoDVarMap.java
@@ -80,9 +80,7 @@ public class TwoDVarMap {
 		this.selectMonths = selectMonths;
 	}
 	public void changeSelectMonths(){
-//		if(month.isEmpty()){
-//			this.selectMonths = "select none";
-//		}
+
 		if(month.contains("1")&&month.contains("2")&&month.contains("3")&&month.contains("4")&&month.contains("5")&&month.contains("6")&&month.contains("7")&&month.contains("8")&&month.contains("9")&&month.contains("10")&&month.contains("11")&&month.contains("12")){
 			this.selectMonths = "select all";
 		}

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/25673e4c/app/util/APICall.java
----------------------------------------------------------------------
diff --git a/app/util/APICall.java b/app/util/APICall.java
index 2c147d5..4b182c1 100644
--- a/app/util/APICall.java
+++ b/app/util/APICall.java
@@ -23,7 +23,6 @@ import play.libs.WS;
 import play.libs.F.Function;
 import play.libs.F.Promise;
 import scala.Console;
-
 import com.fasterxml.jackson.databind.*;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 
@@ -44,7 +43,7 @@ public class APICall {
 						if (response.getStatus() == 200
 								|| response.getStatus() == 201) {
 							return response.asJson();
-						} else { // no response from the server
+						} else {
 							Logger.info(""+response.getStatus());
 							return createResponse(ResponseType.GETERROR);
 						}
@@ -63,7 +62,6 @@ public class APICall {
 		Promise<WS.Response> responsePromise = WS
 				.url(apiString).setQueryParameter(paraName, para).get();
 		Console.print(responsePromise.get());
-//		System.out.println(responsePromise.toString());
 		final Promise<JsonNode> bodyPromise = responsePromise
 				.map(new Function<WS.Response, JsonNode>() {
 					@Override
@@ -72,7 +70,7 @@ public class APICall {
 						if (response.getStatus() == 200
 								|| response.getStatus() == 201) {
 							return response.asJson();
-						} else { // no response from the server
+						} else {
 							Logger.info(""+response.getStatus());
 							return createResponse(ResponseType.GETERROR);
 						}
@@ -100,10 +98,9 @@ public class APICall {
 								return response.asJson();
 							}
 							catch (Exception e){
-								//If response is in Json format, return as json, otherwise just plain success
 								return createResponse(ResponseType.SUCCESS);
 							}
-						} else { // other response status from the server
+						} else {
 							return createResponse(ResponseType.SAVEERROR);
 						}
 					}
@@ -115,7 +112,6 @@ public class APICall {
 		}
 	}
 
-	/* Right now, only deviceType and device use PUT HTTP request*/
 	public static JsonNode putAPI(String apiString, JsonNode jsonData) {
 		Promise<WS.Response> responsePromise = WS.url(apiString).put(jsonData);
 		final Promise<JsonNode> bodyPromise = responsePromise
@@ -127,7 +123,7 @@ public class APICall {
 								.getStatus() == 200)
 								&& !response.getBody().contains("not")) {
 							return createResponse(ResponseType.SUCCESS);
-						} else { // other response status from the server
+						} else { 
 							return createResponse(ResponseType.SAVEERROR);
 						}
 					}
@@ -150,7 +146,7 @@ public class APICall {
 								.getStatus() == 201)
 								&& !response.getBody().contains("not")) {
 							return createResponse(ResponseType.SUCCESS);
-						} else { // no response from the server
+						} else {
 							return createResponse(ResponseType.DELETEERROR);
 						}
 					}


Mime
View raw message