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/05 02:20:49 UTC

[45/50] [abbrv] incubator-cmda git commit: Change DatasetController name

Change DatasetController name

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

Branch: refs/heads/master
Commit: f6aa0322711640d9e1e6b78dd828a26e863790fa
Parents: a4768f3
Author: mingqi830 <mq...@andrew.cmu.edu>
Authored: Fri Sep 4 16:32:45 2015 -0700
Committer: mingqi830 <mq...@andrew.cmu.edu>
Committed: Fri Sep 4 16:32:45 2015 -0700

----------------------------------------------------------------------
 app/controllers/DatasetController.java     | 111 ++++++++++++++++++++++++
 app/controllers/dataSetController.java     | 111 ------------------------
 app/views/climate/header.scala.html        |   4 +-
 app/views/climate/searchDataSet.scala.html |   2 +-
 conf/routes                                |   6 +-
 5 files changed, 117 insertions(+), 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/f6aa0322/app/controllers/DatasetController.java
----------------------------------------------------------------------
diff --git a/app/controllers/DatasetController.java b/app/controllers/DatasetController.java
new file mode 100644
index 0000000..0a226b6
--- /dev/null
+++ b/app/controllers/DatasetController.java
@@ -0,0 +1,111 @@
+/*
+ * 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/f6aa0322/app/controllers/dataSetController.java
----------------------------------------------------------------------
diff --git a/app/controllers/dataSetController.java b/app/controllers/dataSetController.java
deleted file mode 100644
index 2289ab9..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/f6aa0322/app/views/climate/header.scala.html
----------------------------------------------------------------------
diff --git a/app/views/climate/header.scala.html b/app/views/climate/header.scala.html
index d51a38d..0cae470 100644
--- a/app/views/climate/header.scala.html
+++ b/app/views/climate/header.scala.html
@@ -47,8 +47,8 @@
 							class="caret"></b></a>
 						<ul class="dropdown-menu">
 						
-						<li><a href="@routes.dataSetController.datasetList()">Dataset List</a></li>
-						<li><a href="@routes.dataSetController.searchDataset()">Search dataset</a></li>
+						<li><a href="@routes.DatasetController.datasetList()">Dataset List</a></li>
+						<li><a href="@routes.DatasetController.searchDataset()">Search dataset</a></li>
 						</ul>
 					</li>
 					<li class="dropdown"><a href="#"

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/f6aa0322/app/views/climate/searchDataSet.scala.html
----------------------------------------------------------------------
diff --git a/app/views/climate/searchDataSet.scala.html b/app/views/climate/searchDataSet.scala.html
index 8fb042d..68f260a 100644
--- a/app/views/climate/searchDataSet.scala.html
+++ b/app/views/climate/searchDataSet.scala.html
@@ -508,7 +508,7 @@
 	@flash_message()   
 	 
     <h1 style="margin-left:490px">Search Dataset</h1>
-    @helper.form(routes.dataSetController.getSearchResult()) {
+    @helper.form(routes.DatasetController.getSearchResult()) {
     	<div class="ui-widget col-sm-offset-3 col-sm-7">
     	<div class = "form-group">
     		@inputText(dataSetForm("Dataset Name"), 'class -> "form-control", 'id -> "dataSetName", '_label -> Messages("Dataset Name"), 'placeholder -> "ARGO Ocean Temperature", 'size->70) 

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/f6aa0322/conf/routes
----------------------------------------------------------------------
diff --git a/conf/routes b/conf/routes
index 4d5da4f..f554cae 100644
--- a/conf/routes
+++ b/conf/routes
@@ -48,9 +48,9 @@ POST    	/climate/delete/serviceLog   						controllers.ClimateServiceController
 GET			/climate/oneService									controllers.ClimateServiceController.oneService(url ?= null)
 
 #Keyword search
-GET 		/climate/dataSets									controllers.dataSetController.datasetList()
-GET			/climate/searchDataSet 					 			controllers.dataSetController.searchDataset()
-GET 		/climate/getSearchResult				 			controllers.dataSetController.getSearchResult()
+GET 		/climate/datasets									controllers.DatasetController.datasetList()
+GET			/climate/searchDataSet 					 			controllers.DatasetController.searchDataset()
+GET 		/climate/getSearchResult				 			controllers.DatasetController.getSearchResult()
 
 #Map static resources from the /public folder to the /assets URL path
 GET     	/assets/*file               						controllers.Assets.at(path="/public", file)