diff --git a/pom.xml b/pom.xml
index 8b6be07..8d529d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,193 +1,193 @@
-
- 4.0.0
- com.nexacro.spring
- 1.0.0
- nexacro-core
- jar
- nexacro-core
- http://maven.apache.org
-
- nexacro-core Dev Group
-
- Description of nexacro-core
-
-
- com.nexacro
- nexacro-pom-parent
- 1.0.0
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- org.apache.maven.plugins
- maven-source-plugin
-
-
- org.maven.ide.eclipse
- lifecycle-mapping
- 0.9.9-SNAPSHOT
-
- generic
-
-
-
-
-
-
-
-
-
-
- com.nexacro
- nexacro-xapi
- 1.0
- compile
-
-
-
-
-
- org.springframework
- spring-core
-
-
- org.springframework
- spring-beans
-
-
- org.springframework
- spring-context
-
-
- org.springframework
- spring-web
-
-
- org.springframework
- spring-webmvc
-
-
- org.springframework
- spring-aop
-
-
-
- org.springframework
- spring-test
- ${spring.maven.artifact.version}
- test
-
-
-
- org.springmodules
- spring-modules-jakarta-commons
- 0.8a
-
-
- javax.servlet
- servlet-api
-
-
-
-
-
- commons-configuration
- commons-configuration
- 1.6
-
-
-
-
- javax.servlet
- javax.servlet-api
- 3.0.1
- provided
-
-
-
- javax.servlet.jsp
- javax.servlet.jsp-api
- 2.2.1
- provided
-
-
-
-
- org.apache.logging.log4j
- log4j-slf4j-impl
- 2.1
-
-
- org.apache.logging.log4j
- log4j-core
- 2.1
-
-
-
- org.slf4j
- jcl-over-slf4j
- ${org.slf4j-version}
- runtime
-
-
-
-
-
-
- junit
- junit
- 4.8.1
- test
-
-
-
- commons-io
- commons-io
- 2.4
- test
-
-
-
- xmlunit
- xmlunit
- 1.2
- test
-
-
-
-
-
- 1.7.5
-
-
+
+ 4.0.0
+ com.nexacro.spring
+ 1.0.1
+ nexacro-core
+ jar
+ nexacro-core
+ http://maven.apache.org
+
+ nexacro-core Dev Group
+
+ Description of nexacro-core
+
+
+ com.nexacro
+ nexacro-pom-parent
+ 1.0.0
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ org.maven.ide.eclipse
+ lifecycle-mapping
+ 0.9.9-SNAPSHOT
+
+ generic
+
+
+
+
+
+
+
+
+
+
+ com.nexacro
+ nexacro-xapi
+ 1.0
+ compile
+
+
+
+
+
+ org.springframework
+ spring-core
+
+
+ org.springframework
+ spring-beans
+
+
+ org.springframework
+ spring-context
+
+
+ org.springframework
+ spring-web
+
+
+ org.springframework
+ spring-webmvc
+
+
+ org.springframework
+ spring-aop
+
+
+
+ org.springframework
+ spring-test
+ ${spring.maven.artifact.version}
+ test
+
+
+
+ org.springmodules
+ spring-modules-jakarta-commons
+ 0.8a
+
+
+ javax.servlet
+ servlet-api
+
+
+
+
+
+ commons-configuration
+ commons-configuration
+ 1.6
+
+
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.0.1
+ provided
+
+
+
+ javax.servlet.jsp
+ javax.servlet.jsp-api
+ 2.2.1
+ provided
+
+
+
+
+ org.apache.logging.log4j
+ log4j-slf4j-impl
+ 2.1
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.1
+
+
+
+ org.slf4j
+ jcl-over-slf4j
+ ${org.slf4j-version}
+ runtime
+
+
+
+
+
+
+ junit
+ junit
+ 4.8.1
+ test
+
+
+
+ commons-io
+ commons-io
+ 2.4
+ test
+
+
+
+ xmlunit
+ xmlunit
+ 1.2
+ test
+
+
+
+
+
+ 1.7.5
+
+
diff --git a/src/main/java/com/nexacro/spring/data/convert/ConvertDefinition.java b/src/main/java/com/nexacro/spring/data/convert/ConvertDefinition.java
index b05d2b2..a5fcab2 100644
--- a/src/main/java/com/nexacro/spring/data/convert/ConvertDefinition.java
+++ b/src/main/java/com/nexacro/spring/data/convert/ConvertDefinition.java
@@ -1,71 +1,108 @@
-package com.nexacro.spring.data.convert;
-
-
-/**
- *
데이터 변환에 대한 정보를 저장한다.
- *
DataSet 혹은 Variable의 명칭을 가지며, List 형식의 데이터 변환시 Generic Type 정보를 가진다.
- *
- * @author Park SeongMin
- * @since 07.28.2015
- * @version 1.0
- * @see
- */
-
-public class ConvertDefinition {
-
- private String name;
- private Class genericType; // for generic
- private boolean isIgnoreException = false;
-
- public ConvertDefinition(String name) {
- setName(name);
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- * the name to set
- */
- public void setName(String name) {
- if(name == null || name.length() == 0) {
- throw new IllegalArgumentException("converted name must be not null");
- }
- this.name = name;
- }
-
- /**
- * @return the isIgnoreException
- */
- public boolean isIgnoreException() {
- return isIgnoreException;
- }
-
- /**
- * @param isIgnoreException
- * the isIgnoreException to set
- */
- public void setIgnoreException(boolean isIgnoreException) {
- this.isIgnoreException = isIgnoreException;
- }
-
- /**
- * @return the genericType
- */
- public Class getGenericType() {
- return genericType;
- }
-
- /**
- * @param genericType the genericType to set
- */
- public void setGenericType(Class genericType) {
- this.genericType = genericType;
- }
-
-}
+package com.nexacro.spring.data.convert;
+
+import com.nexacro.xapi.data.DataSet;
+
+
+/**
+ *
데이터 변환에 대한 정보를 저장한다.
+ *
DataSet 혹은 Variable의 명칭을 가지며, List 형식의 데이터 변환시 Generic Type 정보를 가진다.
+ *
+ * @author Park SeongMin
+ * @since 07.28.2015
+ * @version 1.0
+ * @see
+ */
+
+public class ConvertDefinition {
+
+ private String name;
+ private Class genericType; // for generic
+ private boolean isIgnoreException = false;
+
+ private DataSet schemaDataSet;
+ private boolean disallowChangeStructure; // (v1.0.0에서 허용 하게 되어 있음)
+
+ public ConvertDefinition(String name) {
+ setName(name);
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name
+ * the name to set
+ */
+ public void setName(String name) {
+ if(name == null || name.length() == 0) {
+ throw new IllegalArgumentException("converted name must be not null");
+ }
+ this.name = name;
+ }
+
+ /**
+ * @return the isIgnoreException
+ */
+ public boolean isIgnoreException() {
+ return isIgnoreException;
+ }
+
+ /**
+ * @param isIgnoreException
+ * the isIgnoreException to set
+ */
+ public void setIgnoreException(boolean isIgnoreException) {
+ this.isIgnoreException = isIgnoreException;
+ }
+
+ /**
+ * @return the genericType
+ */
+ public Class getGenericType() {
+ return genericType;
+ }
+
+ /**
+ * @param genericType the genericType to set
+ */
+ public void setGenericType(Class genericType) {
+ this.genericType = genericType;
+ }
+
+ /**
+ *
+ * @return disallow structure change
+ */
+ public boolean isDisallowChangeStructure() {
+ return disallowChangeStructure;
+ }
+
+ /**
+ *
+ * @param disallow structure change
+ */
+ public void setDisallowChangeStructure(boolean disallowChangeStructure) {
+ this.disallowChangeStructure = disallowChangeStructure;
+ }
+
+ /**
+ *
+ * @return the schema dataSet
+ */
+ public DataSet getSchemaDataSet() {
+ return schemaDataSet;
+ }
+
+ /**
+ *
+ * @param schemaDataSet
+ */
+ public void setSchemaDataSet(DataSet schemaDataSet) {
+ this.schemaDataSet = schemaDataSet;
+ }
+
+}
diff --git a/src/main/java/com/nexacro/spring/data/support/AbstractDataSetConverter.java b/src/main/java/com/nexacro/spring/data/support/AbstractDataSetConverter.java
index 9b19448..886b928 100644
--- a/src/main/java/com/nexacro/spring/data/support/AbstractDataSetConverter.java
+++ b/src/main/java/com/nexacro/spring/data/support/AbstractDataSetConverter.java
@@ -37,7 +37,7 @@ public class AbstractDataSetConverter extends AbstractListenerHandler {
* @param map
* @throws NexacroConvertException
*/
- protected void addRowIntoDataSet(DataSet ds, Map map) throws NexacroConvertException {
+ protected void addRowIntoDataSet(DataSet ds, Map map, boolean disallowChangeStructure) throws NexacroConvertException {
// ignore null data.
if(map == null) {
return;
@@ -62,11 +62,15 @@ public class AbstractDataSetConverter extends AbstractListenerHandler {
int columnIndex = ds.indexOfColumn(columnName);
if(columnIndex < 0) {
- // flexible map data. 'null' data should be ignored
- ds.setChangeStructureWithData(true);
-
- if(!addColumnByMap(ds, columnName, value)) {
- continue;
+ if(disallowChangeStructure) {
+ // ignore
+ continue;
+ } else {
+ // flexible map data. 'null' data should be ignored
+ ds.setChangeStructureWithData(true);
+ if(!addColumnByMap(ds, columnName, value)) {
+ continue;
+ }
}
}
// fire event
@@ -108,7 +112,13 @@ public class AbstractDataSetConverter extends AbstractListenerHandler {
// Byte[] 변환
Object object = NexacroConverterHelper.toObject(propertyValue);
+ // 컬럼은 무조건 존재한다.
int columnIndex = ds.indexOfColumn(propertyName);
+ if(columnIndex < 0) {
+ // Map과 달리 이미 구조 변경에 대한 처리가 되었기 때문에 컬럼이 존재하지 않을 경우 무시하도록 한다.
+ continue;
+ }
+
// fire event
object = fireDataSetConvertedValue(ds, object, newRow, columnIndex, false, false);
@@ -127,6 +137,9 @@ public class AbstractDataSetConverter extends AbstractListenerHandler {
* @throws NexacroConvertException
*/
protected void addColumnIntoDataSet(DataSet ds, Map map) throws NexacroConvertException {
+
+ ds.setChangeStructureWithData(true);
+
Iterator iterator = map.keySet().iterator();
while(iterator.hasNext()) {
Object key = iterator.next();
@@ -149,6 +162,8 @@ public class AbstractDataSetConverter extends AbstractListenerHandler {
*/
protected void addColumnIntoDataSet(DataSet ds, Object availableFirstData) {
+ ds.setChangeStructureWithData(true);
+
NexacroBeanWrapper beanWrapper = NexacroBeanWrapper.createBeanWrapper(availableFirstData);
NexacroBeanProperty[] beanProperties = beanWrapper.getProperties();
diff --git a/src/main/java/com/nexacro/spring/data/support/ListToDataSetConverter.java b/src/main/java/com/nexacro/spring/data/support/ListToDataSetConverter.java
index 189a18b..a91f5c4 100644
--- a/src/main/java/com/nexacro/spring/data/support/ListToDataSetConverter.java
+++ b/src/main/java/com/nexacro/spring/data/support/ListToDataSetConverter.java
@@ -1,126 +1,142 @@
-package com.nexacro.spring.data.support;
-
-import java.util.List;
-import java.util.Map;
-
-import com.nexacro.spring.data.convert.ConvertDefinition;
-import com.nexacro.spring.data.convert.NexacroConvertException;
-import com.nexacro.spring.data.convert.NexacroConverter;
-import com.nexacro.spring.data.metadata.NexacroMetaData;
-import com.nexacro.xapi.data.DataSet;
-
-/**
- *
List에서 DataSet으로 데이터로 변환을 수행한다.
- *
- * @author Park SeongMin
- * @since 07.28.2015
- * @version 1.0
- * @see
- */
-public class ListToDataSetConverter extends AbstractDataSetConverter implements NexacroConverter {
-
- private static final int CHECK_INDEX = 0;
-
- @Override
- public boolean canConvert(Class source, Class target) {
-
- if(source == null || target == null) {
- return false;
- }
-
- // support list sub class
- if(List.class.isAssignableFrom(source) && DataSet.class.equals(target)) {
- return true;
- }
-
- return false;
- }
-
- /*
- * @see com.nexacro.spring.data.NexacroConverter#convert(java.lang.Object)
- */
- @Override
- public DataSet convert(List source, ConvertDefinition definition) throws NexacroConvertException {
-
- if(definition ==null) {
- throw new IllegalArgumentException(ConvertDefinition.class.getSimpleName()+" must not be null.");
- }
- if(source == null) {
- return new DataSet(definition.getName());
- }
-
- // check first value
- Object availableFirstData = checkAvailable(source);
- if(availableFirstData == null) {
- return new DataSet(definition.getName());
- }
-
- // DataSet SavedType은 처리 하지 않는다. (UI 처리 불필요)
- DataSet ds = null;
- if(availableFirstData instanceof Map) {
- ds = convertListMapToDataSet(source, definition, (Map) availableFirstData);
- } else {
- ds = convertListBeanToDataSet(source, definition, availableFirstData);
- }
-
- return ds;
- }
-
- private Object checkAvailable(List source) {
-
- // for ibatis empty data
- if(source instanceof NexacroMetaData) {
- NexacroMetaData metaData = (NexacroMetaData) source;
- return metaData.getMetaData();
- }
-
- if(source.size() == 0) {
- return null;
- }
- for(Object obj: source) {
- if(obj != null) {
- return obj;
- }
- }
-
- return null;
- }
-
- private DataSet convertListMapToDataSet(List source, ConvertDefinition definition, Map availableFirstData) throws NexacroConvertException {
-
- DataSet ds = new DataSet(definition.getName());
-
- // dynamic하게 변경 된 데이터는 처리 하지 않는다.
- addColumnIntoDataSet(ds, availableFirstData);
-
- for(Object obj: source) {
-
- if(!(obj instanceof Map)) {
- throw new NexacroConvertException("list should use the generic type. target="+ds.getName());
- }
-
- addRowIntoDataSet(ds, (Map) obj);
- }
-
- return ds;
- }
-
- private DataSet convertListBeanToDataSet(List source, ConvertDefinition definition, Object availableFirstData) throws NexacroConvertException {
-
- // 지원하는 형식인지 확인 한다.
- if(!NexacroConverterHelper.isSupportedBean(availableFirstData.getClass())) {
- throw new NexacroConvertException("unsupported generic type. type="+availableFirstData.getClass());
- }
-
- DataSet ds = new DataSet(definition.getName());
-
- addColumnIntoDataSet(ds, availableFirstData);
-
- for(Object obj: source) {
- addRowIntoDataSet(ds, obj);
- }
-
- return ds;
- }
-
-}
+package com.nexacro.spring.data.support;
+
+import java.util.List;
+import java.util.Map;
+
+import com.nexacro.spring.data.convert.ConvertDefinition;
+import com.nexacro.spring.data.convert.NexacroConvertException;
+import com.nexacro.spring.data.convert.NexacroConverter;
+import com.nexacro.spring.data.metadata.NexacroMetaData;
+import com.nexacro.xapi.data.DataSet;
+
+/**
+ * List에서 DataSet으로 데이터로 변환을 수행한다.
+ *
+ * @author Park SeongMin
+ * @since 07.28.2015
+ * @version 1.0
+ * @see
+ */
+public class ListToDataSetConverter extends AbstractDataSetConverter implements NexacroConverter {
+
+ private static final int CHECK_INDEX = 0;
+
+ @Override
+ public boolean canConvert(Class source, Class target) {
+
+ if(source == null || target == null) {
+ return false;
+ }
+
+ // support list sub class
+ if(List.class.isAssignableFrom(source) && DataSet.class.equals(target)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /*
+ * @see com.nexacro.spring.data.NexacroConverter#convert(java.lang.Object)
+ */
+ @Override
+ public DataSet convert(List source, ConvertDefinition definition) throws NexacroConvertException {
+
+ if(definition ==null) {
+ throw new IllegalArgumentException(ConvertDefinition.class.getSimpleName()+" must not be null.");
+ }
+ if(source == null) {
+ return new DataSet(definition.getName());
+ }
+
+ // check first value
+ Object availableFirstData = checkAvailable(source);
+ if(availableFirstData == null) {
+ return new DataSet(definition.getName());
+ }
+
+ // DataSet SavedType은 처리 하지 않는다. (UI 처리 불필요)
+ DataSet ds = null;
+ if(availableFirstData instanceof Map) {
+ ds = convertListMapToDataSet(source, definition, (Map) availableFirstData);
+ } else {
+ ds = convertListBeanToDataSet(source, definition, availableFirstData);
+ }
+
+ return ds;
+ }
+
+ private Object checkAvailable(List source) {
+
+ // for ibatis empty data
+ if(source instanceof NexacroMetaData) {
+ NexacroMetaData metaData = (NexacroMetaData) source;
+ return metaData.getMetaData();
+ }
+
+ if(source.size() == 0) {
+ return null;
+ }
+ for(Object obj: source) {
+ if(obj != null) {
+ return obj;
+ }
+ }
+
+ return null;
+ }
+
+ private DataSet convertListMapToDataSet(List source, ConvertDefinition definition, Map availableFirstData) throws NexacroConvertException {
+
+ DataSet ds = null;
+
+ if(definition.getSchemaDataSet() != null) {
+ // set schema dataSet
+ ds = definition.getSchemaDataSet();
+ } else {
+ ds = new DataSet(definition.getName());
+ addColumnIntoDataSet(ds, availableFirstData);
+ }
+
+ for(Object obj: source) {
+
+ if(!(obj instanceof Map)) {
+ throw new NexacroConvertException("list should use the generic type. target="+ds.getName());
+ }
+
+ addRowIntoDataSet(ds, (Map) obj, definition.isDisallowChangeStructure());
+ }
+
+ return ds;
+ }
+
+ private DataSet convertListBeanToDataSet(List source, ConvertDefinition definition, Object availableFirstData) throws NexacroConvertException {
+
+ // 지원하는 형식인지 확인 한다.
+ if(!NexacroConverterHelper.isSupportedBean(availableFirstData.getClass())) {
+ throw new NexacroConvertException("unsupported generic type. type="+availableFirstData.getClass());
+ }
+
+ DataSet ds = null;
+ if(definition.getSchemaDataSet() != null) {
+ // set schema dataSet
+ ds = definition.getSchemaDataSet();
+
+ // map과 달리 bean은 이미 정의가 되어 있기 때문에 row를 추가할때 컬럼을 추가하지 않고, 미리 설정한다.
+ if(!definition.isDisallowChangeStructure()) {
+ addColumnIntoDataSet(ds, availableFirstData);
+ }
+
+ } else {
+ ds = new DataSet(definition.getName());
+ addColumnIntoDataSet(ds, availableFirstData);
+ }
+
+ for(Object obj: source) {
+ addRowIntoDataSet(ds, obj);
+ }
+
+ return ds;
+ }
+
+}
diff --git a/src/main/java/com/nexacro/spring/data/support/ObjectToDataSetConverter.java b/src/main/java/com/nexacro/spring/data/support/ObjectToDataSetConverter.java
index 961b4e0..17d7c0b 100644
--- a/src/main/java/com/nexacro/spring/data/support/ObjectToDataSetConverter.java
+++ b/src/main/java/com/nexacro/spring/data/support/ObjectToDataSetConverter.java
@@ -1,98 +1,118 @@
-package com.nexacro.spring.data.support;
-
-import java.util.List;
-import java.util.Map;
-
-import com.nexacro.spring.data.convert.ConvertDefinition;
-import com.nexacro.spring.data.convert.NexacroConvertException;
-import com.nexacro.spring.data.convert.NexacroConverter;
-import com.nexacro.xapi.data.DataSet;
-
-/**
- * Object에서 DataSet으로 데이터로 변환을 수행한다.
- *
- * @author Park SeongMin
- * @since 08.17.2015
- * @version 1.0
- * @see
- */
-public class ObjectToDataSetConverter extends AbstractDataSetConverter implements NexacroConverter