Skip to content

Commit

Permalink
Merge pull request #12 from OpenGDSMobile/publicData
Browse files Browse the repository at this point in the history
Public data
  • Loading branch information
engintruder committed Jul 24, 2015
2 parents 7e52842 + 98f5ddd commit 1ff33cf
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.ListIterator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
Expand All @@ -24,6 +25,13 @@ public class AttributeTableServiceImp extends EgovAbstractServiceImpl implements
@Override
public List<LinkedHashMap<String, Object>> createAttr(HashMap<String, Object> tableName) {
List<LinkedHashMap<String, Object>> resultData = at.selectAttr(tableName);
ListIterator<LinkedHashMap<String, Object>> listItr = resultData.listIterator();
while(listItr.hasNext()){
LinkedHashMap<String, Object> tmp = listItr.next();
tmp.remove("geom");
}

System.out.println(resultData);
return resultData;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@

import org.springframework.stereotype.Repository;

import egovframework.rte.psl.dataaccess.EgovAbstractMapper;


@Repository("geodao")
public class GeoServerManagerDAO{

static String RESTURL = "http://127.0.0.1/geoserver";
static String RESTUSER = "root";
static String RESTUSER = "admin";
static String RESTPW = "geoserver";

GeoServerRESTPublisher publisher;
Expand All @@ -25,6 +23,7 @@ public class GeoServerManagerDAO{
super();
publisher = new GeoServerRESTPublisher(RESTURL, RESTUSER, RESTPW);
reader= new GeoServerRESTReader(RESTURL, RESTUSER, RESTPW);
System.out.println(reader.existGeoserver());
}

public boolean geoserverCreateWorkspace(String name) {
Expand All @@ -34,8 +33,7 @@ public boolean geoserverCreateWorkspace(String name) {

public List<String> getGeoserverLayerNames(String workspace) {
// TODO Auto-generated method stub
System.out.println(reader.getLayers().getNames());
return reader.getLayers().getNames();
return reader.getDatastores(workspace).getNames();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public JSONObject processXmlbyPublicData(Document src, String[] keys){
}
}
result.put("row", list);

log.info(result);
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public String requestPublicData(JSONObject data) {
serviceName = String.valueOf(data.get(tmp));
}
}
if(serviceName.equals("TimeAverageAirQuality")
|| serviceName.equals("RealtimeRoadsideStation")){
if(serviceName.equals("TimeAverageAirQuality") || serviceName.equals("RealtimeRoadsideStation")){
String baseURL = "http://openapi.seoul.go.kr:8088/";
String[] urlOrder =
new String []{"serviceKey", "returnType", "serviceName", "amount", "dateTimeValue"};
Expand Down Expand Up @@ -74,20 +73,19 @@ public String processServiceURL(JSONObject data, String[] urlOrder,String baseUR
@SuppressWarnings("unchecked")
public JSONObject processJSONbySeoulData(JSONObject data, String[] keys){
JSONObject source = (JSONObject) data.get(serviceName);
log.info(source);
source = (JSONObject) source.get("row");
JSONArray rowList = (JSONArray) source.get("row");
JSONObject result = new JSONObject();
JSONArray list = new JSONArray();

for(int i=0; i<source.size(); i++){
JSONObject contents = (JSONObject) source.get(i);
for(int i=0; i<rowList.size(); i++){
JSONObject contents = (JSONObject) rowList.get(i);
JSONObject obj = new JSONObject();
for(int j=0; j<keys.length; j++){
obj.put(keys[j], contents.get(keys[j]));
}
list.add(obj);
}
result.put("row", list);
log.info(source);
log.info(result);
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class GeoServerManagerController {
@RequestMapping(value="/getLayerNames.do")
public @ResponseBody Map<String, Object> getLayerNames(@RequestBody String data){
Map<String, Object> message = new HashMap<String, Object>();
try {
try {
Map<String,Object> Mapdata = Util.convertJsonToObject(data);
message.put("result", "OK");
message.put("message", null);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/webmapping/db/pgqlCreateDBSQL.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ CREATE DATABASE OPENGDSMOBILE_DB
LC_CTYPE = 'en_US.UTF-8'
CONNECTION LIMIT = -1;

CREATE EXTENSTION postgis;
CREATE EXTENSION postgis;
4 changes: 2 additions & 2 deletions src/main/webapp/WEB-INF/config/webmapping/context-servlet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<context:annotation-config/>
<mvc:annotation-driven/>

<context:component-scan base-package="com.openGDSMobileApplicationServer">
<context:component-scan base-package="com.openGDSMobileApplicationServer"><!--
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
<context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
<context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/>
<context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/> -->
</context:component-scan>

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/geoBasedData/DONG.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/main/webapp/geoBasedData/GU.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/main/webapp/geoBasedData/SIDO.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<script type="text/javascript" src="./js/egovframework/mbl/cmm/EgovMobile-1.3.2.js"></script> <!-- eGov Mobile -->

<script>
var serverAddr = "http://113.198.80.60:8081/mobile/SeoulOpenData.do";
var serverAddr = "http://localhost:8080/mobile/SeoulOpenData.do";
var obj = null;

function dataPortal() {
Expand Down Expand Up @@ -106,7 +106,7 @@
paramData['serviceName'] = "TimeAverageAirQuality";
paramData['amount'] = "1/100";
paramData['dateTimeValue'] = '201501011100';
paramData['envType'] = "pm10";
paramData['envType'] = "PM10";
console.log(paramData);
$.ajax({
type : 'POST',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.openGDSMobileApplicaionServer.service.impl;
package com.openGDSMobileApplicaionServer.service.impl.test;

import static org.junit.Assert.*;

Expand Down

0 comments on commit 1ff33cf

Please sign in to comment.