github에서 보안이슈로 권고한 jackson json library 버전 수정 및 잡다한 내용 수정
This commit is contained in:
50
pom.xml
50
pom.xml
@@ -11,22 +11,22 @@
|
|||||||
<java-version>1.8</java-version>
|
<java-version>1.8</java-version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
|
||||||
<!-- Web -->
|
<!-- Web -->
|
||||||
<jsp.version>2.2</jsp.version>
|
<jsp.version>2.2</jsp.version>
|
||||||
<jstl.version>1.2</jstl.version>
|
<jstl.version>1.2</jstl.version>
|
||||||
<servlet.version>2.5</servlet.version>
|
<servlet.version>2.5</servlet.version>
|
||||||
|
|
||||||
<!-- Spring -->
|
<!-- Spring -->
|
||||||
<spring-framework.version>4.3.18.RELEASE</spring-framework.version>
|
<spring-framework.version>4.3.18.RELEASE</spring-framework.version>
|
||||||
|
|
||||||
<!-- AspectJ -->
|
<!-- AspectJ -->
|
||||||
<aspectj.version>1.8.13</aspectj.version>
|
<aspectj.version>1.8.13</aspectj.version>
|
||||||
|
|
||||||
<!-- 데이터베이스 버전 -->
|
<!-- 데이터베이스 버전 -->
|
||||||
<h2db.version>1.4.197</h2db.version>
|
<h2db.version>1.4.197</h2db.version>
|
||||||
<oracle.version>11.2.0</oracle.version>
|
<oracle.version>11.2.0</oracle.version>
|
||||||
|
|
||||||
<!-- Mybatis -->
|
<!-- Mybatis -->
|
||||||
<mybatis.version>3.4.6</mybatis.version>
|
<mybatis.version>3.4.6</mybatis.version>
|
||||||
<mybatis-spring.version>1.3.2</mybatis-spring.version>
|
<mybatis-spring.version>1.3.2</mybatis-spring.version>
|
||||||
@@ -35,9 +35,9 @@
|
|||||||
<logback.version>1.2.3</logback.version>
|
<logback.version>1.2.3</logback.version>
|
||||||
<slf4j.version>1.7.25</slf4j.version>
|
<slf4j.version>1.7.25</slf4j.version>
|
||||||
<log4jdbc.version>1.16</log4jdbc.version>
|
<log4jdbc.version>1.16</log4jdbc.version>
|
||||||
|
|
||||||
<!-- Jackson Json Version -->
|
<!-- Jackson Json Version -->
|
||||||
<jackson.version>2.5.1</jackson.version>
|
<jackson.version>2.9.7</jackson.version>
|
||||||
<!-- jackson.version>1.9.13</jackson.version -->
|
<!-- jackson.version>1.9.13</jackson.version -->
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -54,28 +54,28 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring Transactions -->
|
<!-- Spring Transactions -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-jdbc</artifactId>
|
<artifactId>spring-jdbc</artifactId>
|
||||||
<version>${spring-framework.version}</version>
|
<version>${spring-framework.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring Transactions -->
|
<!-- Spring Transactions -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-tx</artifactId>
|
<artifactId>spring-tx</artifactId>
|
||||||
<version>${spring-framework.version}</version>
|
<version>${spring-framework.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring MVC -->
|
<!-- Spring MVC -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-webmvc</artifactId>
|
<artifactId>spring-webmvc</artifactId>
|
||||||
<version>${spring-framework.version}</version>
|
<version>${spring-framework.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- AspectJ -->
|
<!-- AspectJ -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.aspectj</groupId>
|
<groupId>org.aspectj</groupId>
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
<artifactId>aspectjweaver</artifactId>
|
<artifactId>aspectjweaver</artifactId>
|
||||||
<version>${aspectj.version}</version>
|
<version>${aspectj.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Logging with SLF4J & LogBack -->
|
<!-- Logging with SLF4J & LogBack -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
<version>${logback.version}</version>
|
<version>${logback.version}</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Servlet -->
|
<!-- Servlet -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
@@ -120,21 +120,21 @@
|
|||||||
<artifactId>jstl</artifactId>
|
<artifactId>jstl</artifactId>
|
||||||
<version>${jstl.version}</version>
|
<version>${jstl.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.2</version>
|
<version>1.18.2</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
<version>${h2db.version}</version>
|
<version>${h2db.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Mybatis -->
|
<!-- Mybatis -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis</groupId>
|
<groupId>org.mybatis</groupId>
|
||||||
@@ -147,13 +147,13 @@
|
|||||||
<artifactId>mybatis-spring</artifactId>
|
<artifactId>mybatis-spring</artifactId>
|
||||||
<version>${mybatis-spring.version}</version>
|
<version>${mybatis-spring.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||||
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
|
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
|
||||||
<version>${log4jdbc.version}</version>
|
<version>${log4jdbc.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- jackson json -->
|
<!-- jackson json -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
@@ -166,25 +166,25 @@
|
|||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>${jackson.version}</version>
|
<version>${jackson.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
<version>${jackson.version}</version>
|
<version>${jackson.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.validation</groupId>
|
<groupId>javax.validation</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>validation-api</artifactId>
|
||||||
<version>2.0.1.Final</version>
|
<version>2.0.1.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hibernate.validator</groupId>
|
<groupId>org.hibernate.validator</groupId>
|
||||||
<artifactId>hibernate-validator</artifactId>
|
<artifactId>hibernate-validator</artifactId>
|
||||||
<version>6.0.12.Final</version>
|
<version>6.0.12.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tobesoft</groupId>
|
<groupId>com.tobesoft</groupId>
|
||||||
<artifactId>xplatform</artifactId>
|
<artifactId>xplatform</artifactId>
|
||||||
@@ -192,7 +192,7 @@
|
|||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/xplatform-xapi-1.0.jar</systemPath>
|
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/xplatform-xapi-1.0.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tobesoft</groupId>
|
<groupId>com.tobesoft</groupId>
|
||||||
<artifactId>miplatform</artifactId>
|
<artifactId>miplatform</artifactId>
|
||||||
@@ -200,8 +200,8 @@
|
|||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/miplatform-3.2.jar</systemPath>
|
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/miplatform-3.2.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ public class XplatformReflectionUtils {
|
|||||||
* @param columnValue
|
* @param columnValue
|
||||||
*/
|
*/
|
||||||
public static void setField(Field field, ColumnHeader columnHeader, Object obj, String columnValue) {
|
public static void setField(Field field, ColumnHeader columnHeader, Object obj, String columnValue) {
|
||||||
|
|
||||||
ReflectionUtils.makeAccessible(field); //Field가 private 등의 접근할 수 없는 상황일때도 접근할 수 있게 한다
|
ReflectionUtils.makeAccessible(field); //Field가 private 등의 접근할 수 없는 상황일때도 접근할 수 있게 한다
|
||||||
|
|
||||||
Class<?> fieldType = field.getType();
|
Class<?> fieldType = field.getType();
|
||||||
|
|
||||||
if(fieldType == String.class) {
|
if(fieldType == String.class) {
|
||||||
ReflectionUtils.setField(field, obj, columnValue);
|
ReflectionUtils.setField(field, obj, columnValue);
|
||||||
} else if(fieldType == char.class || fieldType == Character.class) {
|
} else if(fieldType == char.class || fieldType == Character.class) {
|
||||||
@@ -60,56 +60,63 @@ public class XplatformReflectionUtils {
|
|||||||
String year = columnValue.substring(0, 4);
|
String year = columnValue.substring(0, 4);
|
||||||
String month = columnValue.substring(4, 6);
|
String month = columnValue.substring(4, 6);
|
||||||
String day = columnValue.substring(6, 8);
|
String day = columnValue.substring(6, 8);
|
||||||
|
|
||||||
calendar.set(Calendar.YEAR, Integer.parseInt(year, 10));
|
calendar.set(Calendar.YEAR, Integer.parseInt(year, 10));
|
||||||
calendar.set(Calendar.MONTH, Integer.parseInt(month, 10) - 1);
|
calendar.set(Calendar.MONTH, Integer.parseInt(month, 10) - 1);
|
||||||
calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(day, 10));
|
calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(day, 10));
|
||||||
|
|
||||||
} else { // DataTypes.DATE 타입에 8자리 숫자가 들어와야 하는데 그러지 않은 것이므로 예외처리 대상이다
|
} else { // DataTypes.DATE 타입에 8자리 숫자가 들어와야 하는데 그러지 않은 것이므로 예외처리 대상이다
|
||||||
|
throw new IllegalArgumentException("dataType must be 8 characters in Xplatform DATE type");
|
||||||
}
|
}
|
||||||
} else if(dataType == DataTypes.TIME) {
|
} else if(dataType == DataTypes.TIME) {
|
||||||
if(columnValue.length() > 6) {
|
if(columnValue.length() >= 6) {
|
||||||
String hour = columnValue.substring(0, 2);
|
String hour = columnValue.substring(0, 2);
|
||||||
String minute = columnValue.substring(2, 4);
|
String minute = columnValue.substring(2, 4);
|
||||||
String second = columnValue.substring(4, 6);
|
String second = columnValue.substring(4, 6);
|
||||||
String milisecond = columnValue.substring(6, 9);
|
|
||||||
|
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour, 10));
|
calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour, 10));
|
||||||
calendar.set(Calendar.MINUTE, Integer.parseInt(minute, 10));
|
calendar.set(Calendar.MINUTE, Integer.parseInt(minute, 10));
|
||||||
calendar.set(Calendar.SECOND, Integer.parseInt(second, 10));
|
calendar.set(Calendar.SECOND, Integer.parseInt(second, 10));
|
||||||
calendar.set(Calendar.MILLISECOND, Integer.parseInt(milisecond, 10));
|
|
||||||
|
if(columnValue.length() > 6) {
|
||||||
|
String milisecond = columnValue.substring(6);
|
||||||
|
calendar.set(Calendar.MILLISECOND, Integer.parseInt(milisecond, 10));
|
||||||
|
}
|
||||||
|
|
||||||
} else { // DataTypes.DATE 타입에 6자리 이상의 숫자가 들어와야 하는데 그러지 않은 것이므로 예외처리 대상이다
|
} else { // DataTypes.DATE 타입에 6자리 이상의 숫자가 들어와야 하는데 그러지 않은 것이므로 예외처리 대상이다
|
||||||
|
throw new IllegalArgumentException("dataType must be 6 characters in Xplatform TIME type");
|
||||||
}
|
}
|
||||||
} else if(dataType == DataTypes.DATE_TIME) {
|
} else if(dataType == DataTypes.DATE_TIME) {
|
||||||
if(columnValue.length() == 17) {
|
if(columnValue.length() >= 14) {
|
||||||
String year = columnValue.substring(0, 4);
|
String year = columnValue.substring(0, 4);
|
||||||
String month = columnValue.substring(4, 6);
|
String month = columnValue.substring(4, 6);
|
||||||
String day = columnValue.substring(6, 8);
|
String day = columnValue.substring(6, 8);
|
||||||
String hour = columnValue.substring(8, 10);
|
String hour = columnValue.substring(8, 10);
|
||||||
String minute = columnValue.substring(10, 12);
|
String minute = columnValue.substring(10, 12);
|
||||||
String second = columnValue.substring(12, 14);
|
String second = columnValue.substring(12, 14);
|
||||||
String milisecond = columnValue.substring(14);
|
|
||||||
|
|
||||||
calendar.set(Calendar.YEAR, Integer.parseInt(year, 10));
|
calendar.set(Calendar.YEAR, Integer.parseInt(year, 10));
|
||||||
calendar.set(Calendar.MONTH, Integer.parseInt(month, 10) - 1);
|
calendar.set(Calendar.MONTH, Integer.parseInt(month, 10) - 1);
|
||||||
calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(day, 10));
|
calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(day, 10));
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour, 10));
|
calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour, 10));
|
||||||
calendar.set(Calendar.MINUTE, Integer.parseInt(minute, 10));
|
calendar.set(Calendar.MINUTE, Integer.parseInt(minute, 10));
|
||||||
calendar.set(Calendar.SECOND, Integer.parseInt(second, 10));
|
calendar.set(Calendar.SECOND, Integer.parseInt(second, 10));
|
||||||
calendar.set(Calendar.MILLISECOND, Integer.parseInt(milisecond, 10));
|
|
||||||
|
if(columnValue.length() > 14) {
|
||||||
|
String milisecond = columnValue.substring(14);
|
||||||
|
calendar.set(Calendar.MILLISECOND, Integer.parseInt(milisecond, 10));
|
||||||
|
}
|
||||||
|
|
||||||
} else { // DataTypes.DATE 타입에 14자리 이상의 숫자가 들어와야 하는데 그러지 않은 것이므로 예외처리 대상이다
|
} else { // DataTypes.DATE 타입에 14자리 이상의 숫자가 들어와야 하는데 그러지 않은 것이므로 예외처리 대상이다
|
||||||
|
throw new IllegalArgumentException("dataType must be 14 charactersin Xplatform DATE_TIME type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReflectionUtils.setField(field, obj, calendar.getTime());
|
ReflectionUtils.setField(field, obj, calendar.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public static <T> Collection<T> getCollection(Class clazz) {
|
public static <T> Collection<T> getCollection(Class clazz) {
|
||||||
Collection<T> result = null;
|
Collection<T> result = null;
|
||||||
@@ -118,11 +125,11 @@ public class XplatformReflectionUtils {
|
|||||||
} else if(clazz == HashSet.class) {
|
} else if(clazz == HashSet.class) {
|
||||||
result = new HashSet<T>();
|
result = new HashSet<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Java Reflection에서 Field 객체를 가져올때 해당 객체의 Super 클래스들에 대한 Field를 같이 가져오는 것이 없어서 별도로 제작했다
|
* Java Reflection에서 Field 객체를 가져올때 해당 객체의 Super 클래스들에 대한 Field를 같이 가져오는 것이 없어서 별도로 제작했다
|
||||||
* @param t
|
* @param t
|
||||||
@@ -135,9 +142,9 @@ public class XplatformReflectionUtils {
|
|||||||
fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
|
fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
|
||||||
clazz = clazz.getSuperclass();
|
clazz = clazz.getSuperclass();
|
||||||
}
|
}
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DataSet 클래스 객체를 Collection 인터페이스 계열의 클래스 객체로 변환하는 메소드
|
* DataSet 클래스 객체를 Collection 인터페이스 계열의 클래스 객체로 변환하는 메소드
|
||||||
* @param dataSet 변환대상이 되는 DataSet
|
* @param dataSet 변환대상이 되는 DataSet
|
||||||
@@ -152,11 +159,11 @@ public class XplatformReflectionUtils {
|
|||||||
int insertUpdateRowCount = dataSet.getRowCount();
|
int insertUpdateRowCount = dataSet.getRowCount();
|
||||||
int removeRowCount = dataSet.getRemovedRowCount();
|
int removeRowCount = dataSet.getRemovedRowCount();
|
||||||
int columnCount = dataSet.getColumnCount(); // 데이터셋에서 삭제된 데이터행(DataRow)는 별도 공간에 저장되기 때문에 이에 대한 처리를 위해 별도 변수를 잡고 이에 대한 작업을 진행한다
|
int columnCount = dataSet.getColumnCount(); // 데이터셋에서 삭제된 데이터행(DataRow)는 별도 공간에 저장되기 때문에 이에 대한 처리를 위해 별도 변수를 잡고 이에 대한 작업을 진행한다
|
||||||
|
|
||||||
if(collectionType.isInterface()) { // Colleciton 계열 인터페이스로 선언한 경우
|
if(collectionType.isInterface()) { // Colleciton 계열 인터페이스로 선언한 경우
|
||||||
if(collectionType.equals(List.class)) { // List 타입으로 받을 경우(ArrayList를 생성해서 return 해준다)
|
if(collectionType.equals(List.class)) { // List 타입으로 받을 경우(ArrayList를 생성해서 return 해준다)
|
||||||
List<Object> listResult = new ArrayList<Object>();
|
List<Object> listResult = new ArrayList<Object>();
|
||||||
|
|
||||||
// 저장(insert, update)되어야 할 DataSet의 row들에 대한 처리
|
// 저장(insert, update)되어야 할 DataSet의 row들에 대한 처리
|
||||||
for(int i=0; i < insertUpdateRowCount; i++) {
|
for(int i=0; i < insertUpdateRowCount; i++) {
|
||||||
if(Map.class.isAssignableFrom(genericClass)) {
|
if(Map.class.isAssignableFrom(genericClass)) {
|
||||||
@@ -167,7 +174,7 @@ public class XplatformReflectionUtils {
|
|||||||
listResult.add(obj);
|
listResult.add(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 삭제(delete)되어야 할 DataSet의 row들에 대한 처리
|
// 삭제(delete)되어야 할 DataSet의 row들에 대한 처리
|
||||||
for(int i = 0; i < removeRowCount; i++) {
|
for(int i = 0; i < removeRowCount; i++) {
|
||||||
if(Map.class.isAssignableFrom(genericClass)) {
|
if(Map.class.isAssignableFrom(genericClass)) {
|
||||||
@@ -178,11 +185,11 @@ public class XplatformReflectionUtils {
|
|||||||
listResult.add(obj);
|
listResult.add(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = listResult;
|
result = listResult;
|
||||||
} else if(collectionType.equals(Set.class)) { // Set 타입으로 받을 경우(HashSet을 생성해서 return 해준다)
|
} else if(collectionType.equals(Set.class)) { // Set 타입으로 받을 경우(HashSet을 생성해서 return 해준다)
|
||||||
Set<Object> setResult = new HashSet<Object>();
|
Set<Object> setResult = new HashSet<Object>();
|
||||||
|
|
||||||
// 저장(insert, update)되어야 할 DataSet의 row들에 대한 처리
|
// 저장(insert, update)되어야 할 DataSet의 row들에 대한 처리
|
||||||
for(int i=0; i < insertUpdateRowCount; i++) {
|
for(int i=0; i < insertUpdateRowCount; i++) {
|
||||||
if(Map.class.isAssignableFrom(genericClass)) {
|
if(Map.class.isAssignableFrom(genericClass)) {
|
||||||
@@ -193,7 +200,7 @@ public class XplatformReflectionUtils {
|
|||||||
setResult.add(obj);
|
setResult.add(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 삭제(delete)되어야 할 DataSet의 row들에 대한 처리
|
// 삭제(delete)되어야 할 DataSet의 row들에 대한 처리
|
||||||
for(int i = 0; i < removeRowCount; i++) {
|
for(int i = 0; i < removeRowCount; i++) {
|
||||||
if(Map.class.isAssignableFrom(genericClass)) {
|
if(Map.class.isAssignableFrom(genericClass)) {
|
||||||
@@ -204,7 +211,7 @@ public class XplatformReflectionUtils {
|
|||||||
setResult.add(obj);
|
setResult.add(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = setResult;
|
result = setResult;
|
||||||
}
|
}
|
||||||
} else { // List, Set 같은 인터페이스가 아니라 ArrayList, HashSet 같은 Collection 인터페이스 구현 클래스로 받은 경우
|
} else { // List, Set 같은 인터페이스가 아니라 ArrayList, HashSet 같은 Collection 인터페이스 구현 클래스로 받은 경우
|
||||||
@@ -222,7 +229,7 @@ public class XplatformReflectionUtils {
|
|||||||
((Collection)(checkObject)).add(obj);
|
((Collection)(checkObject)).add(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 삭제(delete)되어야 할 DataSet의 row들에 대한 처리
|
// 삭제(delete)되어야 할 DataSet의 row들에 대한 처리
|
||||||
for(int i = 0; i < removeRowCount; i++) {
|
for(int i = 0; i < removeRowCount; i++) {
|
||||||
if(Map.class.isAssignableFrom(genericClass)) {
|
if(Map.class.isAssignableFrom(genericClass)) {
|
||||||
@@ -234,15 +241,15 @@ public class XplatformReflectionUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = checkObject;
|
result = checkObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DataSet 객체에서 특정 row에 해당되는 객체를 Map<String, Object> 형태로 변환한다
|
* DataSet 객체에서 특정 row에 해당되는 객체를 Map<String, Object> 형태로 변환한다
|
||||||
* 변환된 Map에서 key는 해당 DataSet의 column 이름이다.
|
* 변환된 Map에서 key는 해당 DataSet의 column 이름이다.
|
||||||
@@ -250,8 +257,8 @@ public class XplatformReflectionUtils {
|
|||||||
* @param colCount DataSet 객체의 컬럼 갯수
|
* @param colCount DataSet 객체의 컬럼 갯수
|
||||||
* @param rowIdx DataSet 객체에서 읽고자 하는 row의 인덱스
|
* @param rowIdx DataSet 객체에서 읽고자 하는 row의 인덱스
|
||||||
* @return
|
* @return
|
||||||
* @throws IllegalAccessException
|
* @throws IllegalAccessException
|
||||||
* @throws InstantiationException
|
* @throws InstantiationException
|
||||||
*/
|
*/
|
||||||
private static Map<String, Object> makeDataAsMap(Class<?> mapType, DataSet dataSet, int colCount, int rowIdx) throws InstantiationException, IllegalAccessException {
|
private static Map<String, Object> makeDataAsMap(Class<?> mapType, DataSet dataSet, int colCount, int rowIdx) throws InstantiationException, IllegalAccessException {
|
||||||
Map<String, Object> result = null;
|
Map<String, Object> result = null;
|
||||||
@@ -260,20 +267,20 @@ public class XplatformReflectionUtils {
|
|||||||
} else {
|
} else {
|
||||||
result = (Map<String, Object>) mapType.newInstance();
|
result = (Map<String, Object>) mapType.newInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
result.put("rowType", dataSet.getRowType(rowIdx));
|
result.put("rowType", dataSet.getRowType(rowIdx));
|
||||||
result.put("storeDataChanges", dataSet.isStoreDataChanges());
|
result.put("storeDataChanges", dataSet.isStoreDataChanges());
|
||||||
for(int j=0; j < colCount; j++) {
|
for(int j=0; j < colCount; j++) {
|
||||||
Object columnValue = dataSet.getObject(rowIdx, j); // 데이터셋에서 해당 row에 대한 column 값을 Object로 가져온다
|
Object columnValue = dataSet.getObject(rowIdx, j); // 데이터셋에서 해당 row에 대한 column 값을 Object로 가져온다
|
||||||
|
|
||||||
ColumnHeader columnHeader = dataSet.getColumn(j);
|
ColumnHeader columnHeader = dataSet.getColumn(j);
|
||||||
String columnName = columnHeader.getName();
|
String columnName = columnHeader.getName();
|
||||||
result.put(columnName, columnValue);
|
result.put(columnName, columnValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DataSet 객체에 저장되어 있는 삭제된 데이터에서 특정 row에 해당되는 객체를 Map<String, Object> 형태로 변환한다
|
* DataSet 객체에 저장되어 있는 삭제된 데이터에서 특정 row에 해당되는 객체를 Map<String, Object> 형태로 변환한다
|
||||||
* 변환된 Map에서 key는 해당 DataSet의 column 이름이다.
|
* 변환된 Map에서 key는 해당 DataSet의 column 이름이다.
|
||||||
@@ -281,8 +288,8 @@ public class XplatformReflectionUtils {
|
|||||||
* @param colCount DataSet 객체의 컬럼 갯수
|
* @param colCount DataSet 객체의 컬럼 갯수
|
||||||
* @param rowIdx DataSet 객체에서 읽고자 하는 row의 인덱스
|
* @param rowIdx DataSet 객체에서 읽고자 하는 row의 인덱스
|
||||||
* @return
|
* @return
|
||||||
* @throws IllegalAccessException
|
* @throws IllegalAccessException
|
||||||
* @throws InstantiationException
|
* @throws InstantiationException
|
||||||
*/
|
*/
|
||||||
private static Map<String, Object> makeRemovedDataAsMap(Class<?> mapType, DataSet dataSet, int colCount, int rowIdx) throws InstantiationException, IllegalAccessException {
|
private static Map<String, Object> makeRemovedDataAsMap(Class<?> mapType, DataSet dataSet, int colCount, int rowIdx) throws InstantiationException, IllegalAccessException {
|
||||||
Map<String, Object> result = null;
|
Map<String, Object> result = null;
|
||||||
@@ -291,20 +298,20 @@ public class XplatformReflectionUtils {
|
|||||||
} else {
|
} else {
|
||||||
result = (Map<String, Object>) mapType.newInstance();
|
result = (Map<String, Object>) mapType.newInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
result.put("rowType", DataSet.ROW_TYPE_DELETED);
|
result.put("rowType", DataSet.ROW_TYPE_DELETED);
|
||||||
result.put("storeDataChanges", dataSet.isStoreDataChanges());
|
result.put("storeDataChanges", dataSet.isStoreDataChanges());
|
||||||
for(int j=0; j < colCount; j++) {
|
for(int j=0; j < colCount; j++) {
|
||||||
Object columnValue = dataSet.getRemovedData(rowIdx, j); // 데이터셋에서 해당 row에 대한 column 값을 Object로 가져온다
|
Object columnValue = dataSet.getRemovedData(rowIdx, j); // 데이터셋에서 해당 row에 대한 column 값을 Object로 가져온다
|
||||||
|
|
||||||
ColumnHeader columnHeader = dataSet.getColumn(j);
|
ColumnHeader columnHeader = dataSet.getColumn(j);
|
||||||
String columnName = columnHeader.getName();
|
String columnName = columnHeader.getName();
|
||||||
result.put(columnName, columnValue);
|
result.put(columnName, columnValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DataSet 객체에서 특정 row에 해당되는 객체를 특정 클래스의 객체로 변환한다
|
* DataSet 객체에서 특정 row에 해당되는 객체를 특정 클래스의 객체로 변환한다
|
||||||
* @param innerClass 특정 클래스타입
|
* @param innerClass 특정 클래스타입
|
||||||
@@ -324,22 +331,22 @@ public class XplatformReflectionUtils {
|
|||||||
ReflectionUtils.makeAccessible(storeDataChangesField);
|
ReflectionUtils.makeAccessible(storeDataChangesField);
|
||||||
rowTypeField.setInt(obj, dataSet.getRowType(rowIdx));
|
rowTypeField.setInt(obj, dataSet.getRowType(rowIdx));
|
||||||
storeDataChangesField.setBoolean(obj, dataSet.isStoreDataChanges());
|
storeDataChangesField.setBoolean(obj, dataSet.isStoreDataChanges());
|
||||||
|
|
||||||
for(int j=0; j < colCount; j++) {
|
for(int j=0; j < colCount; j++) {
|
||||||
String columnValue = dataSet.getString(rowIdx, j); // 데이터셋에서 해당 row에 대한 column 값을 String으로 가져온다
|
String columnValue = dataSet.getString(rowIdx, j); // 데이터셋에서 해당 row에 대한 column 값을 String으로 가져온다
|
||||||
|
|
||||||
ColumnHeader columnHeader = dataSet.getColumn(j);
|
ColumnHeader columnHeader = dataSet.getColumn(j);
|
||||||
String columnName = columnHeader.getName();
|
String columnName = columnHeader.getName();
|
||||||
|
|
||||||
Field field = ReflectionUtils.findField(innerClass, columnName);
|
Field field = ReflectionUtils.findField(innerClass, columnName);
|
||||||
|
|
||||||
if(field == null) { // 컬럼이름으로 된 멤버변수를 찾지 못한 경우
|
if(field == null) { // 컬럼이름으로 된 멤버변수를 찾지 못한 경우
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
XplatformReflectionUtils.setField(field, columnHeader, obj, columnValue);
|
XplatformReflectionUtils.setField(field, columnHeader, obj, columnValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,27 +367,27 @@ public class XplatformReflectionUtils {
|
|||||||
Field storeDataChangesField = ReflectionUtils.findField(innerClass, "storeDataChanges");
|
Field storeDataChangesField = ReflectionUtils.findField(innerClass, "storeDataChanges");
|
||||||
ReflectionUtils.makeAccessible(rowTypeField);
|
ReflectionUtils.makeAccessible(rowTypeField);
|
||||||
ReflectionUtils.makeAccessible(storeDataChangesField);
|
ReflectionUtils.makeAccessible(storeDataChangesField);
|
||||||
|
|
||||||
// 삭제된 행의 rowType을 읽어오는 메소드는 없기 때문에(DataSet 클래스의 getRowType 메소드는 저장이나 변경된 데이터셋에 대한 rowType 을 읽어오는 것이지 삭제된 행에 대한 rowType을 읽는 것이 아니다)
|
// 삭제된 행의 rowType을 읽어오는 메소드는 없기 때문에(DataSet 클래스의 getRowType 메소드는 저장이나 변경된 데이터셋에 대한 rowType 을 읽어오는 것이지 삭제된 행에 대한 rowType을 읽는 것이 아니다)
|
||||||
// 이렇게 된 원인은 삭제된 행을 별도로 저장하는 상황때문에 그리 된거지만 어차피 삭제된 행은 rowType이 DataSet.ROW_TYPE_DELETED로 설정되기 때문에 이것으로 강제 설정을 해준다
|
// 이렇게 된 원인은 삭제된 행을 별도로 저장하는 상황때문에 그리 된거지만 어차피 삭제된 행은 rowType이 DataSet.ROW_TYPE_DELETED로 설정되기 때문에 이것으로 강제 설정을 해준다
|
||||||
rowTypeField.setInt(obj, DataSet.ROW_TYPE_DELETED);
|
rowTypeField.setInt(obj, DataSet.ROW_TYPE_DELETED);
|
||||||
storeDataChangesField.setBoolean(obj, dataSet.isStoreDataChanges());
|
storeDataChangesField.setBoolean(obj, dataSet.isStoreDataChanges());
|
||||||
|
|
||||||
for(int j=0; j < colCount; j++) {
|
for(int j=0; j < colCount; j++) {
|
||||||
String columnValue = dataSet.getRemovedStringData(rowIdx, j); // 삭제된 데이터의 해당 row에 대한 column 값을 String으로 가져온다
|
String columnValue = dataSet.getRemovedStringData(rowIdx, j); // 삭제된 데이터의 해당 row에 대한 column 값을 String으로 가져온다
|
||||||
|
|
||||||
ColumnHeader columnHeader = dataSet.getColumn(j);
|
ColumnHeader columnHeader = dataSet.getColumn(j);
|
||||||
String columnName = columnHeader.getName();
|
String columnName = columnHeader.getName();
|
||||||
|
|
||||||
Field field = ReflectionUtils.findField(innerClass, columnName);
|
Field field = ReflectionUtils.findField(innerClass, columnName);
|
||||||
|
|
||||||
if(field == null) { // 컬럼이름으로 된 멤버변수를 찾지 못한 경우
|
if(field == null) { // 컬럼이름으로 된 멤버변수를 찾지 못한 경우
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
XplatformReflectionUtils.setField(field, columnHeader, obj, columnValue);
|
XplatformReflectionUtils.setField(field, columnHeader, obj, columnValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,9 +82,7 @@ public class XplatformArgumentResolver implements HandlerMethodArgumentResolver
|
|||||||
|
|
||||||
Class<?> type = parameter.getParameterType();
|
Class<?> type = parameter.getParameterType();
|
||||||
Annotation[] annotations = parameter.getParameterAnnotations();
|
Annotation[] annotations = parameter.getParameterAnnotations();
|
||||||
HttpServletRequest request = (HttpServletRequest)webRequest.getNativeRequest();
|
HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
|
||||||
// HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
|
|
||||||
// PlatformRequest platformRequest = new HttpPlatformRequest(request, "utf-8");
|
|
||||||
|
|
||||||
DataSetList dataSetList = null;
|
DataSetList dataSetList = null;
|
||||||
VariableList variableList = null;
|
VariableList variableList = null;
|
||||||
@@ -112,16 +110,16 @@ public class XplatformArgumentResolver implements HandlerMethodArgumentResolver
|
|||||||
for(Annotation annotation : annotations){
|
for(Annotation annotation : annotations){
|
||||||
Class<? extends Annotation> annotationClass = annotation.annotationType();
|
Class<? extends Annotation> annotationClass = annotation.annotationType();
|
||||||
|
|
||||||
if(annotationClass.equals(RequestDataSetList.class)){ // @RequestDataSetList 어노테이션에 대한 처리(이 어노테이션은 DataSetList 클래스객체만 파라미터 타입으로 받을 수 있다)
|
if(annotationClass.equals(RequestDataSetList.class)) { // @RequestDataSetList 어노테이션에 대한 처리(이 어노테이션은 DataSetList 클래스객체만 파라미터 타입으로 받을 수 있다)
|
||||||
if(type.equals(DataSetList.class)) {
|
if(type.equals(DataSetList.class)) {
|
||||||
result = dataSetList;
|
result = dataSetList;
|
||||||
}else{
|
}else{
|
||||||
result = WebArgumentResolver.UNRESOLVED;
|
result = WebArgumentResolver.UNRESOLVED;
|
||||||
}
|
}
|
||||||
} else if(annotationClass.equals(RequestDataSet.class)){ // @RequestDataSet 어노테이션에 대한 처리
|
} else if(annotationClass.equals(RequestDataSet.class)) { // @RequestDataSet 어노테이션에 대한 처리
|
||||||
RequestDataSet requestDataSet = (RequestDataSet)annotation;
|
RequestDataSet requestDataSet = (RequestDataSet)annotation;
|
||||||
String dataSetName = requestDataSet.name();
|
String dataSetName = requestDataSet.name();
|
||||||
if(!StringUtils.hasText(dataSetName)) { // DataSet 이름이 빠진것이므로 이거는 예외처리 진행하자
|
if(!StringUtils.hasText(dataSetName)) { // DataSet 이름이 빠진경우
|
||||||
result = WebArgumentResolver.UNRESOLVED;
|
result = WebArgumentResolver.UNRESOLVED;
|
||||||
} else {
|
} else {
|
||||||
DataSet dataSet = dataSetList.get(dataSetName);
|
DataSet dataSet = dataSetList.get(dataSetName);
|
||||||
@@ -180,7 +178,7 @@ public class XplatformArgumentResolver implements HandlerMethodArgumentResolver
|
|||||||
} else {
|
} else {
|
||||||
result = variable.getObject();
|
result = variable.getObject();
|
||||||
}
|
}
|
||||||
} else { // 특정 변수 이름이 없으면 VO로 매핑하는 것이기 때문에 오히려 이런 경우 자바의 데이터타입과는 매핑을 할 수 없다
|
} else { // 특정 변수 이름이 없으면 List, Set, Map 또는 VO로 매핑하는 것이기 때문에 오히려 이런 경우 자바의 데이터타입과는 매핑을 할 수 없다
|
||||||
List<String> keyList = variableList.keyList();
|
List<String> keyList = variableList.keyList();
|
||||||
|
|
||||||
if(Collection.class.isAssignableFrom(type)) {
|
if(Collection.class.isAssignableFrom(type)) {
|
||||||
@@ -221,6 +219,7 @@ public class XplatformArgumentResolver implements HandlerMethodArgumentResolver
|
|||||||
|
|
||||||
for(String key : keyList) {
|
for(String key : keyList) {
|
||||||
Field keyField = ReflectionUtils.findField(type, key);
|
Field keyField = ReflectionUtils.findField(type, key);
|
||||||
|
if(keyField == null) continue;
|
||||||
ReflectionUtils.makeAccessible(keyField);
|
ReflectionUtils.makeAccessible(keyField);
|
||||||
|
|
||||||
Class<?> keyFieldType = keyField.getType();
|
Class<?> keyFieldType = keyField.getType();
|
||||||
|
|||||||
@@ -17,7 +17,5 @@ public class XplatformViewResolver extends AbstractTemplateViewResolver {
|
|||||||
XplatformView view = (XplatformView)super.buildView(viewName);
|
XplatformView view = (XplatformView)super.buildView(viewName);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
<targetPlatform>Windows,CE,Linux</targetPlatform>
|
<targetPlatform>Windows,CE,Linux</targetPlatform>
|
||||||
</customer>
|
</customer>
|
||||||
<date>
|
<date>
|
||||||
<activation>2018-08-01</activation>
|
<activation>2018-10-01</activation>
|
||||||
<term unit="month">2</term>
|
<term unit="month">2</term>
|
||||||
</date>
|
</date>
|
||||||
<key>RDUTZJQZYZVS42PMV7NP4WGXE53J4VWM9</key>
|
<key>X9SNZZ4F8D2WSUDUCFFWVYPQCBYA4NXH7</key>
|
||||||
</license>
|
</license>
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
|
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
||||||
|
|
||||||
<context:component-scan base-package="com.terry.xplatform">
|
<context:component-scan base-package="com.terry.xplatform">
|
||||||
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
|
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
|
||||||
<context:exclude-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice" />
|
<context:exclude-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice" />
|
||||||
</context:component-scan>
|
</context:component-scan>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|||||||
Reference in New Issue
Block a user