From 0ff5383447c82166b40cc6793b1aa61aeaad321d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EB=B0=B1=ED=96=89?= Date: Wed, 23 Jul 2025 19:53:17 +0900 Subject: [PATCH 01/32] =?UTF-8?q?=EC=9D=B4=ED=81=B4=EB=A6=BD=EC=8A=A4=20>?= =?UTF-8?q?=20Source=20>=20Format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- egovframework.dev.imp.templates/pom.xml | 26 +++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/egovframework.dev.imp.templates/pom.xml b/egovframework.dev.imp.templates/pom.xml index 86604c29..aaf9838c 100644 --- a/egovframework.dev.imp.templates/pom.xml +++ b/egovframework.dev.imp.templates/pom.xml @@ -1,13 +1,15 @@ - - 4.0.0 - egovframework.dev.imp - templates - 0.0.1-SNAPSHOT - - - org.apache.velocity - velocity - 1.6.2 - - + + 4.0.0 + egovframework.dev.imp + templates + 0.0.1-SNAPSHOT + + + org.apache.velocity + velocity + 1.6.2 + + \ No newline at end of file From 986d09f6ff8dca69bb5fef44d7f76645d4bb7c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EB=B0=B1=ED=96=89?= Date: Wed, 23 Jul 2025 19:54:08 +0900 Subject: [PATCH 02/32] =?UTF-8?q?java-diff-1.1.0.jar=20=EB=A9=94=EC=9D=B4?= =?UTF-8?q?=EB=B8=90=20dependency=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- egovframework.dev.imp.templates/pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/egovframework.dev.imp.templates/pom.xml b/egovframework.dev.imp.templates/pom.xml index aaf9838c..6647f075 100644 --- a/egovframework.dev.imp.templates/pom.xml +++ b/egovframework.dev.imp.templates/pom.xml @@ -11,5 +11,14 @@ velocity 1.6.2 + + + + org.incava + java-diff + 1.1 + test + + \ No newline at end of file From 0f265268c4e3fc0c4aa787831bfced9b8a9dbfc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EB=B0=B1=ED=96=89?= Date: Thu, 24 Jul 2025 07:34:51 +0900 Subject: [PATCH 03/32] https://ant.apache.org/manual/using.html#example --- egovframework.dev.imp.templates/ant/build.xml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 egovframework.dev.imp.templates/ant/build.xml diff --git a/egovframework.dev.imp.templates/ant/build.xml b/egovframework.dev.imp.templates/ant/build.xml new file mode 100644 index 00000000..52a1eb05 --- /dev/null +++ b/egovframework.dev.imp.templates/ant/build.xml @@ -0,0 +1,38 @@ + + + simple example build file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 951439774a473f3c838faca15f731de827c7011e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EB=B0=B1=ED=96=89?= Date: Thu, 24 Jul 2025 07:35:16 +0900 Subject: [PATCH 04/32] =?UTF-8?q?=EC=9D=B4=ED=81=B4=EB=A6=BD=EC=8A=A4=20>?= =?UTF-8?q?=20Source=20>=20Format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- egovframework.dev.imp.templates/ant/build.xml | 55 +++++++++---------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/egovframework.dev.imp.templates/ant/build.xml b/egovframework.dev.imp.templates/ant/build.xml index 52a1eb05..3248929b 100644 --- a/egovframework.dev.imp.templates/ant/build.xml +++ b/egovframework.dev.imp.templates/ant/build.xml @@ -1,38 +1,35 @@ - + simple example build file - - - - + + + + - - - - - - + + + + + + - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + \ No newline at end of file From ab31ba8f69200d750cbd2c13b21b562abc03eca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EB=B0=B1=ED=96=89?= Date: Thu, 24 Jul 2025 08:25:47 +0900 Subject: [PATCH 05/32] =?UTF-8?q?=EC=9D=B4=ED=81=B4=EB=A6=BD=EC=8A=A4=20>?= =?UTF-8?q?=20Source=20>=20Format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/operation/CrudCodeGen.java | 61 ++--- .../src/test/java/test/CrudCodeGenTest.java | 247 +++++++++--------- 2 files changed, 146 insertions(+), 162 deletions(-) diff --git a/egovframework.dev.imp.templates/src/main/java/operation/CrudCodeGen.java b/egovframework.dev.imp.templates/src/main/java/operation/CrudCodeGen.java index ae69c70c..a8741ddd 100644 --- a/egovframework.dev.imp.templates/src/main/java/operation/CrudCodeGen.java +++ b/egovframework.dev.imp.templates/src/main/java/operation/CrudCodeGen.java @@ -4,8 +4,6 @@ import java.io.Writer; import java.util.Properties; -import model.DataModelContext; - import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; @@ -13,27 +11,30 @@ import org.apache.velocity.exception.ParseErrorException; import org.apache.velocity.exception.ResourceNotFoundException; +import model.DataModelContext; + public class CrudCodeGen { - public String generate(DataModelContext dataModel, String templateFile) throws Exception{ + public String generate(DataModelContext dataModel, String templateFile) throws Exception { StringWriter sw = new StringWriter(); generate(dataModel, templateFile, sw); - + System.out.println(sw.toString()); - - return sw.toString(); + + return sw.toString(); } - - private void generate(DataModelContext dataModel, String templateFile, Writer writer) throws Exception{ + + private void generate(DataModelContext dataModel, String templateFile, Writer writer) throws Exception { String templateEncoding = "UTF-8"; - - Properties p = new Properties() ; - p.setProperty("resource.loader", "class"); - p.setProperty("class.resource.loader.class","org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); - - p.setProperty("file.resource.loader.cache", "false"); - p.setProperty("file.resource.loader.modificationCheckInterval", "0"); - Velocity.init(p); + Properties p = new Properties(); + p.setProperty("resource.loader", "class"); + p.setProperty("class.resource.loader.class", + "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + + p.setProperty("file.resource.loader.cache", "false"); + p.setProperty("file.resource.loader.modificationCheckInterval", "0"); + + Velocity.init(p); VelocityContext context = new VelocityContext(); @@ -43,33 +44,23 @@ private void generate(DataModelContext dataModel, String templateFile, Writer wr context.put("primaryKeys", dataModel.getPrimaryKeys()); context.put("createDate", dataModel.getCreateDate()); context.put("author", dataModel.getAuthor()); - - + Template template = null; - try - { + try { template = Velocity.getTemplate(templateFile, templateEncoding); - } - catch( ResourceNotFoundException rnfe ) - { + } catch (ResourceNotFoundException rnfe) { rnfe.printStackTrace(); - } - catch( ParseErrorException pee ) - { + } catch (ParseErrorException pee) { // syntax error: problem parsing the template - } - catch( MethodInvocationException mie ) - { + } catch (MethodInvocationException mie) { // something invoked in the template // threw an exception + } catch (Exception e) { } - catch( Exception e ) - {} - template.merge( context, writer ); - - + template.merge(context, writer); + } - + } diff --git a/egovframework.dev.imp.templates/src/test/java/test/CrudCodeGenTest.java b/egovframework.dev.imp.templates/src/test/java/test/CrudCodeGenTest.java index 38472b0f..97cefb3d 100644 --- a/egovframework.dev.imp.templates/src/test/java/test/CrudCodeGenTest.java +++ b/egovframework.dev.imp.templates/src/test/java/test/CrudCodeGenTest.java @@ -9,135 +9,138 @@ import java.util.ArrayList; import java.util.List; -import model.Attribute; -import model.DataModelContext; -import model.Entity; -import operation.CrudCodeGen; - import org.incava.util.diff.Diff; import org.incava.util.diff.Difference; import org.junit.Before; import org.junit.Test; +import model.Attribute; +import model.DataModelContext; +import model.Entity; +import operation.CrudCodeGen; + public class CrudCodeGenTest { private CrudCodeGen crudCodeGen; private DataModelContext dataModel; + @Before public void setUp() throws Exception { crudCodeGen = new CrudCodeGen(); - + dataModel = new DataModelContext(); - + dataModel.setPackageName("pkg"); dataModel.setAuthor("홍길동"); dataModel.setTeam("실행환경 개발팀"); dataModel.setCreateDate("2009.02.01"); - + Entity entity = new Entity("SAMPLE2"); - + dataModel.setEntity(entity); - + List attributes = new ArrayList(); List primaryKeys = new ArrayList(); - + Attribute attr = new Attribute("ID"); attr.setJavaType("String"); attributes.add(attr); primaryKeys.add(attr); - + attr = new Attribute("NAME"); attr.setJavaType("String"); attributes.add(attr); // primaryKeys.add(attr); - + attr = new Attribute("DESCRIPTION"); attr.setJavaType("String"); attributes.add(attr); - + attr = new Attribute("USE_YN"); attr.setJavaType("String"); attributes.add(attr); - + attr = new Attribute("REG_USER"); attr.setJavaType("String"); attributes.add(attr); dataModel.setAttributes(attributes); dataModel.setPrimaryKeys(primaryKeys); - + } - + private void genAndDiff(String templateFile, String targetFile) throws Exception { String result = crudCodeGen.generate(dataModel, templateFile); String[] targetLines = readResource(targetFile); String[] sourceLines = readString(result); - - List diffs = (new Diff(sourceLines, targetLines)).diff(); - - - for (Difference diff : diffs) { - int delStart = diff.getDeletedStart(); - int delEnd = diff.getDeletedEnd(); - int addStart = diff.getAddedStart(); - int addEnd = diff.getAddedEnd(); - String from = toString(delStart, delEnd); - String to = toString(addStart, addEnd); - String type = delEnd != Difference.NONE && addEnd != Difference.NONE ? "c" : (delEnd == Difference.NONE ? "a" : "d"); - - System.out.println(from + type + to); - - if (delEnd != Difference.NONE) { - printLines(delStart, delEnd, "<", sourceLines); - if (addEnd != Difference.NONE) { - System.out.println("---"); - } - } - if (addEnd != Difference.NONE) { - printLines(addStart, addEnd, ">", targetLines); - } - } - - assertEquals(diffs.size(), 0); + + List diffs = (new Diff(sourceLines, targetLines)).diff(); + + for (Difference diff : diffs) { + int delStart = diff.getDeletedStart(); + int delEnd = diff.getDeletedEnd(); + int addStart = diff.getAddedStart(); + int addEnd = diff.getAddedEnd(); + String from = toString(delStart, delEnd); + String to = toString(addStart, addEnd); + String type = delEnd != Difference.NONE && addEnd != Difference.NONE ? "c" + : (delEnd == Difference.NONE ? "a" : "d"); + + System.out.println(from + type + to); + + if (delEnd != Difference.NONE) { + printLines(delStart, delEnd, "<", sourceLines); + if (addEnd != Difference.NONE) { + System.out.println("---"); + } + } + if (addEnd != Difference.NONE) { + printLines(addStart, addEnd, ">", targetLines); + } + } + + assertEquals(diffs.size(), 0); } @Test public void testSQLMap() throws Exception { String templateFile = "templates/crud/src/main/resources/pkg/EgovSample_Sample2_SQL.vm"; String targetFile = "templates/crud/src/main/resources/pkg/EgovSample_Sample2_SQL.xml"; - + genAndDiff(templateFile, targetFile); - } - - + } + @Test public void testService() throws Exception { String templateFile = "templates/crud/src/main/java/pkg/service/EgovSample2Service.vm"; - String targetFile = "templates/crud/src/main/java/pkg/service/EgovSample2Service.jav"; - + String targetFile = "templates/crud/src/main/java/pkg/service/EgovSample2Service.jav"; + genAndDiff(templateFile, targetFile); - } + } + @Test public void testVO() throws Exception { String templateFile = "templates/crud/src/main/java/pkg/service/Sample2VO.vm"; String targetFile = "templates/crud/src/main/java/pkg/service/Sample2VO.jav"; - + genAndDiff(templateFile, targetFile); - } + } + @Test public void testServiceImpl() throws Exception { String templateFile = "templates/crud/src/main/java/pkg/service/impl/EgovSample2ServiceImpl.vm"; String targetFile = "templates/crud/src/main/java/pkg/service/impl/EgovSample2ServiceImpl.jav"; - + genAndDiff(templateFile, targetFile); - } + } + @Test public void testDAO() throws Exception { String templateFile = "templates/crud/src/main/java/pkg/service/impl/Sample2DAO.vm"; String targetFile = "templates/crud/src/main/java/pkg/service/impl/Sample2DAO.jav"; - + genAndDiff(templateFile, targetFile); - } - + } + @Test public void testController() throws Exception { String templateFile = "templates/crud/src/main/java/pkg/web/EgovSample2Controller.vm"; @@ -145,7 +148,7 @@ public void testController() throws Exception { genAndDiff(templateFile, targetFile); } - + @Test public void testListView() throws Exception { String templateFile = "templates/crud/src/webapp/WEB-INF/jsp/pkg/egovSample2List.vm"; @@ -153,77 +156,67 @@ public void testListView() throws Exception { genAndDiff(templateFile, targetFile); } - - + @Test public void testRegisterView() throws Exception { String templateFile = "templates/crud/src/webapp/WEB-INF/jsp/pkg/egovSample2Register.vm"; String targetFile = "templates/crud/src/webapp/WEB-INF/jsp/pkg/egovSample2Register.jsp"; - + genAndDiff(templateFile, targetFile); - } - - - - - - protected void printLines(int start, int end, String ind, String[] lines) - { - for (int lnum = start; lnum <= end; ++lnum) { - System.out.println(ind + " " + lines[lnum]); - } - } - - protected String toString(int start, int end) - { - // adjusted, because file lines are one-indexed, not zero. - - StringBuffer buf = new StringBuffer(); - - // match the line numbering from diff(1): - buf.append(end == Difference.NONE ? start : (1 + start)); - - if (end != Difference.NONE && start != end) { - buf.append(",").append(1 + end); - } - return buf.toString(); - } - - protected String[] readResource(String fileName) - { - try { - InputStream is = getClass().getClassLoader().getResourceAsStream(fileName); - InputStreamReader sr = new InputStreamReader(is); - BufferedReader br = new BufferedReader(sr); - List contents = new ArrayList(); - String in; - while ((in = br.readLine()) != null) { - contents.add(in); - } - return (String[])contents.toArray(new String[] {}); - } - catch (Exception e) { - System.err.println("error reading " + fileName + ": " + e); - System.exit(1); - return null; - } - } - protected String[] readString(String data) - { - try { - StringReader sr = new StringReader(data); - BufferedReader br = new BufferedReader(sr); - List contents = new ArrayList(); - String in; - while ((in = br.readLine()) != null) { - contents.add(in); - } - return (String[])contents.toArray(new String[] {}); - } - catch (Exception e) { - System.err.println("error reading " + e); - System.exit(1); - return null; - } - } + } + + protected void printLines(int start, int end, String ind, String[] lines) { + for (int lnum = start; lnum <= end; ++lnum) { + System.out.println(ind + " " + lines[lnum]); + } + } + + protected String toString(int start, int end) { + // adjusted, because file lines are one-indexed, not zero. + + StringBuffer buf = new StringBuffer(); + + // match the line numbering from diff(1): + buf.append(end == Difference.NONE ? start : (1 + start)); + + if (end != Difference.NONE && start != end) { + buf.append(",").append(1 + end); + } + return buf.toString(); + } + + protected String[] readResource(String fileName) { + try { + InputStream is = getClass().getClassLoader().getResourceAsStream(fileName); + InputStreamReader sr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(sr); + List contents = new ArrayList(); + String in; + while ((in = br.readLine()) != null) { + contents.add(in); + } + return contents.toArray(new String[] {}); + } catch (Exception e) { + System.err.println("error reading " + fileName + ": " + e); + System.exit(1); + return null; + } + } + + protected String[] readString(String data) { + try { + StringReader sr = new StringReader(data); + BufferedReader br = new BufferedReader(sr); + List contents = new ArrayList(); + String in; + while ((in = br.readLine()) != null) { + contents.add(in); + } + return contents.toArray(new String[] {}); + } catch (Exception e) { + System.err.println("error reading " + e); + System.exit(1); + return null; + } + } } From 614cf6783b8b496cfb1640e103961e89906dba09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EB=B0=B1=ED=96=89?= Date: Thu, 24 Jul 2025 08:43:27 +0900 Subject: [PATCH 06/32] CrudCodeGenTest --- egovframework.dev.imp.templates/ant/build.xml | 75 ++++- .../imp/codegen/template/model/Attribute.java | 113 +++++++ .../template/model/DataModelContext.java | 135 ++++++++ .../template/model/DbModelElement.java | 156 +++++++++ .../imp/codegen/template/model/Entity.java | 49 +++ .../codegen/template/util/NamingUtils.java | 89 +++++ .../src/main/java/model/Attribute.java | 52 +-- .../src/main/java/model/DataModelContext.java | 114 +++---- .../src/main/java/model/Entity.java | 18 +- .../src/main/java/model/NameCasing.java | 104 +++--- .../src/main/java/operation/CrudCodeGen.java | 33 +- .../cache/ehcacheConfigForSpring-java.vm | 34 ++ .../cache/ehcacheConfigForSpring.vm | 22 +- .../cache/ehcacheConfigForSpring.xml | 29 +- .../crud/java/pkg/service/Sample2DefaultVO.vm | 2 +- .../service/impl/EgovSample2ServiceImpl.vm | 26 +- .../crud/java/pkg/service/impl/Sample2DAO.vm | 30 +- .../java/pkg/service/impl/Sample2DAO_OLD.vm | 113 +++++++ .../java/pkg/service/impl/Sample2Mapper.vm | 100 ++++++ .../java/pkg/web/EgovSample2Controller.vm | 14 +- .../crud/jsp/pkg/egovSample2List.vm | 66 ++-- .../crud/jsp/pkg/egovSample2Register.vm | 41 ++- .../resource/pkg/EgovSample_Sample2_MAPPER.vm | 317 ++++++++++++++++++ ...2_SQL.vm => EgovSample_Sample2_SQL_OLD.vm} | 96 +++--- .../eGovFrameTemplates/crud/wizard.xml | 22 +- .../datasource/c3p0-java.vm | 52 +++ .../eGovFrameTemplates/datasource/c3p0.vm | 23 +- .../datasource/datasource.xml | 51 ++- .../datasource/dbcp-java.vm | 47 +++ .../eGovFrameTemplates/datasource/dbcp.vm | 29 +- .../datasource/jdbc-java.vm | 67 ++++ .../eGovFrameTemplates/datasource/jdbc.vm | 46 ++- .../eGovFrameTemplates/datasource/jeus.vm | 16 - .../datasource/jndiDatasource-java.vm | 29 ++ .../datasource/jndiDatasource.vm | 25 +- .../datasource/jndiDatasource.xml | 39 +-- .../eGovFrameTemplates/datasource/weblogic.vm | 14 - .../idGeneration/sequenceId-java.vm | 22 ++ .../idGeneration/sequenceId.vm | 11 +- .../idGeneration/sequenceId.xml | 26 +- .../idGeneration/tableId-java.vm | 36 ++ .../idGeneration/tableId.vm | 33 +- .../idGeneration/tableId.xml | 50 +-- .../idGeneration/uuId-java.vm | 25 ++ .../eGovFrameTemplates/idGeneration/uuId.vm | 16 +- .../eGovFrameTemplates/idGeneration/uuId.xml | 29 +- .../logging/console-properties.vm | 28 ++ .../logging/console-yaml.vm | 29 ++ .../eGovFrameTemplates/logging/console.vm | 44 +-- .../eGovFrameTemplates/logging/console.xml | 33 +- .../logging/dailyRollingFile.vm | 24 -- .../logging/dailyRollingFile.xml | 39 --- .../eGovFrameTemplates/logging/egovDb.vm | 28 -- .../eGovFrameTemplates/logging/egovDb.xml | 38 --- .../eGovFrameTemplates/logging/egovJdbc.vm | 34 -- .../eGovFrameTemplates/logging/egovJdbc.xml | 28 -- .../logging/file-properties.vm | 27 ++ .../eGovFrameTemplates/logging/file-yaml.vm | 30 ++ .../eGovFrameTemplates/logging/file.vm | 46 +-- .../eGovFrameTemplates/logging/file.xml | 36 +- .../eGovFrameTemplates/logging/jdbc-yaml.vm | 60 ++++ .../eGovFrameTemplates/logging/jdbc.vm | 75 +++-- .../eGovFrameTemplates/logging/jdbc.xml | 49 ++- .../logging/rollingFile-properties.vm | 32 ++ .../logging/rollingFile-yaml.vm | 35 ++ .../eGovFrameTemplates/logging/rollingFile.vm | 55 ++- .../logging/rollingFile.xml | 43 ++- .../timeBasedRollingFile-properties.vm | 34 ++ .../logging/timeBasedRollingFile-yaml.vm | 35 ++ .../logging/timeBasedRollingFile.vm | 26 ++ .../logging/timeBasedRollingFile.xml | 52 +++ .../property/property-java.vm | 47 +++ .../eGovFrameTemplates/property/property.vm | 6 +- .../eGovFrameTemplates/property/property.xml | 30 +- .../scheduling/beanJob-java.vm | 30 ++ .../eGovFrameTemplates/scheduling/beanJob.vm | 7 +- .../eGovFrameTemplates/scheduling/beanJob.xml | 38 ++- .../scheduling/cronTrigger-java.vm | 23 ++ .../scheduling/cronTrigger.vm | 6 +- .../scheduling/cronTrigger.xml | 40 ++- .../scheduling/methodJob-java.vm | 21 ++ .../scheduling/methodJob.vm | 4 +- .../scheduling/methodJob.xml | 42 ++- .../scheduling/scheduler-java.vm | 21 ++ .../scheduling/scheduler.vm | 4 +- .../scheduling/scheduler.xml | 36 +- .../scheduling/simpleTrigger-java.vm | 22 ++ .../scheduling/simpleTrigger.vm | 8 +- .../scheduling/simpleTrigger.xml | 42 ++- .../transaction/jpa-java.vm | 115 +++++++ .../eGovFrameTemplates/transaction/jpa.vm | 59 +++- .../eGovFrameTemplates/transaction/jpa.xml | 129 ++++++- .../transaction/jta-java.vm | 115 +++++++ .../eGovFrameTemplates/transaction/jta.vm | 57 +++- .../eGovFrameTemplates/transaction/jta.xml | 99 ++++-- .../transaction/transaction-java.vm | 101 ++++++ .../{datasource.vm => transaction.vm} | 30 +- .../{datasource.xml => transaction.xml} | 67 ++-- .../resources/eGovFrameTemplates/wizards.xml | 57 ++++ .../pkg/EgovSample_Sample2_MAPPER.xml | 99 ++++++ .../pkg/EgovSample_Sample2_SQL_OLD.xml | 96 ++++++ .../src/test/java/test/CrudCodeGenTest.java | 48 +-- 102 files changed, 4011 insertions(+), 984 deletions(-) create mode 100644 egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/Attribute.java create mode 100644 egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/DataModelContext.java create mode 100644 egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/DbModelElement.java create mode 100644 egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/Entity.java create mode 100644 egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/util/NamingUtils.java create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/cache/ehcacheConfigForSpring-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/crud/java/pkg/service/impl/Sample2DAO_OLD.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/crud/java/pkg/service/impl/Sample2Mapper.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/crud/resource/pkg/EgovSample_Sample2_MAPPER.vm rename egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/crud/resource/pkg/{EgovSample_Sample2_SQL.vm => EgovSample_Sample2_SQL_OLD.vm} (82%) create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/datasource/c3p0-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/datasource/dbcp-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/datasource/jdbc-java.vm delete mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/datasource/jeus.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/datasource/jndiDatasource-java.vm delete mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/datasource/weblogic.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/idGeneration/sequenceId-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/idGeneration/tableId-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/idGeneration/uuId-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/console-properties.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/console-yaml.vm delete mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/dailyRollingFile.vm delete mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/dailyRollingFile.xml delete mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/egovDb.vm delete mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/egovDb.xml delete mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/egovJdbc.vm delete mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/egovJdbc.xml create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/file-properties.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/file-yaml.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/jdbc-yaml.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/rollingFile-properties.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/rollingFile-yaml.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/timeBasedRollingFile-properties.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/timeBasedRollingFile-yaml.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/timeBasedRollingFile.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/logging/timeBasedRollingFile.xml create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/property/property-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/scheduling/beanJob-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/scheduling/cronTrigger-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/scheduling/methodJob-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/scheduling/scheduler-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/scheduling/simpleTrigger-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/transaction/jpa-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/transaction/jta-java.vm create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/transaction/transaction-java.vm rename egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/transaction/{datasource.vm => transaction.vm} (74%) rename egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/transaction/{datasource.xml => transaction.xml} (57%) create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/wizards.xml create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplatesResult/crud/resource/pkg/EgovSample_Sample2_MAPPER.xml create mode 100644 egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplatesResult/crud/resource/pkg/EgovSample_Sample2_SQL_OLD.xml diff --git a/egovframework.dev.imp.templates/ant/build.xml b/egovframework.dev.imp.templates/ant/build.xml index 3248929b..67a2e5d4 100644 --- a/egovframework.dev.imp.templates/ant/build.xml +++ b/egovframework.dev.imp.templates/ant/build.xml @@ -3,33 +3,90 @@ simple example build file - - - + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + - + + - + + + model=${model} + src.model=${src.model} + build.model=${build.model} + + util=${util} + src.util=${src.util} + build.util=${build.util} + + eGovFrameTemplates=${eGovFrameTemplates} + src.eGovFrameTemplates=${src.eGovFrameTemplates} + build.eGovFrameTemplates=${build.eGovFrameTemplates} + + + DSTAMP=${DSTAMP} + - - + + + + + + \ No newline at end of file diff --git a/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/Attribute.java b/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/Attribute.java new file mode 100644 index 00000000..cfb79e1f --- /dev/null +++ b/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/Attribute.java @@ -0,0 +1,113 @@ +/* + * Copyright 2008-2009 MOSPA(Ministry of Security and Public Administration). + * + * Licensed 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 egovframework.dev.imp.codegen.template.model; + +/** + * + * 어트리뷰트 정보 클래스 + *

NOTE: 어트리뷰트(데이터베이스 특정 테이블의 컬럼) 정보를 담기위한 모델 클래스 + * + * @author 개발환경 개발팀 이흥주 + * @since 2009.08.03 + * @version 1.0 + * @see + * + *

+ *  == 개정이력(Modification Information) ==
+ *   
+ *   수정일      수정자           수정내용
+ *  -------    --------    ---------------------------
+ *   2009.08.03  이흥주          최초 생성
+ *
+ * 
+ */ +public class Attribute extends DbModelElement { + + /** + * + * 생성자 + * + * @param name + */ + public Attribute(String name) { + super(name); + } + + /** 데이터 타입 */ + private String type; + + /** 자바 타입 */ + private String javaType; + + /** 프라이머리 키 여부 */ + private boolean isPrimaryKey; + + /** + * 필수 키 여부 가져오기 + * @return + */ + public boolean getIsPrimaryKey() { + return isPrimaryKey; + } + + /** + * 필수 키 여부 가져오기 + * @return + */ + public boolean isPrimaryKey() { + return isPrimaryKey; + } + + /** + * 필수키 여부 세팅하기 + * @param isPrimaryKey + */ + public void setPrimaryKey(boolean isPrimaryKey) { + this.isPrimaryKey = isPrimaryKey; + } + + /** + * 자바 타입 가져오기 + * @return + */ + public String getJavaType() { + return javaType; + } + + /** + * 자바 타입 세팅하기 + * @param javaType + */ + public void setJavaType(String javaType) { + this.javaType = javaType; + } + + /** + * 타입 가져오기 + * @return + */ + public String getType() { + return type; + } + + /** + * 타입 세팅하기 + * @param type + */ + public void setType(String type) { + this.type = type; + } +} diff --git a/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/DataModelContext.java b/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/DataModelContext.java new file mode 100644 index 00000000..2171a12f --- /dev/null +++ b/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/DataModelContext.java @@ -0,0 +1,135 @@ +/* + * Copyright 2008-2009 MOSPA(Ministry of Security and Public Administration). + * + * Licensed 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 egovframework.dev.imp.codegen.template.model; + +import java.util.List; +/** + * + * 데이터베이스 Context 클래스 + *

NOTE: 데이터베이스 정보 및 테이블, 컬럼 정보를 담기위한 클래스 + * + * @author 개발환경 개발팀 이흥주 + * @since 2009.08.03 + * @version 1.0 + * @see + * + *

+ *  == 개정이력(Modification Information) ==
+ *   
+ *   수정일      수정자           수정내용
+ *  -------    --------    ---------------------------
+ *   2009.08.03  이흥주          최초 생성
+ *
+ * 
+ */ +public class DataModelContext { + + /** 데이터베이스 벤더 */ + private String vender; + /** 데이터베이스 제품 명 */ + private String databaseProductName; + /** 엔티티(테이블) 정보 */ + private Entity entity; + /** 어트리뷰트(컬럼) 정보 */ + private List attributes; + /** 기본키 컬럼 정보 */ + private List primaryKeys; + + /** + * 데이타베이스 제품명 + * @return + */ + public String getDatabaseProductName() { + return databaseProductName; + } + + /** + * 데이타베이스 제품명 세팅하기 + * @param databaseProductName + */ + public void setDatabaseProductName(String databaseProductName) { + this.databaseProductName = databaseProductName; + } + + /** + * 벤더 정보 가져오기 + * @return + */ + public String getVender() { + return vender; + } + + /** + * 벤더 정보 세팅하기 + * @param vender + */ + public void setVender(String vender) { + this.vender = vender; + } + + + /** + * 기본키 목록 가져오기 + * + * @return + */ + public List getPrimaryKeys() { + return primaryKeys; + } + + /** + * 기본키 목록 세팅하기 + * @param primaryKeys + */ + public void setPrimaryKeys(List primaryKeys) { + this.primaryKeys = primaryKeys; + } + + /** + * 엔티티 가져오기 + * @return + */ + public Entity getEntity() { + return entity; + } + + /** + * 엔티티 세팅하기 + * + * @param entity + */ + public void setEntity(Entity entity) { + this.entity = entity; + } + + /** + * 속성 목록 가져오기 + * + * @return + */ + public List getAttributes() { + return attributes; + } + + /** + * 속성 목록 세팅하기 + * + * @param attributes + */ + public void setAttributes(List attributes) { + this.attributes = attributes; + } +} diff --git a/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/DbModelElement.java b/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/DbModelElement.java new file mode 100644 index 00000000..6c78538e --- /dev/null +++ b/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/DbModelElement.java @@ -0,0 +1,156 @@ +/* + * Copyright 2008-2009 MOSPA(Ministry of Security and Public Administration). + * + * Licensed 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 egovframework.dev.imp.codegen.template.model; + +import egovframework.dev.imp.codegen.template.util.NamingUtils; + +/** + * + * 데이터베이스 모델 요소의 상위 클래스 + *

NOTE: 데이터베이스 모델 요소(테이블, 컬럼)의 최상위 클래스로서 + * DB명을 세팅하면 Java 코드젠에서 사용되어지는 여러 케이싱 명칭을 반환할 수 있다. + * + * @author 개발환경 개발팀 이흥주 + * @since 2009.08.03 + * @version 1.0 + * @see + * + *

+ *  == 개정이력(Modification Information) ==
+ *   
+ *   수정일      수정자           수정내용
+ *  -------    --------    ---------------------------
+ *   2009.08.03  이흥주          최초 생성
+ *
+ * 
+ */ +public class DbModelElement { + /** 이름 */ + private String name; + /** Upper Case 명 */ + private String ucName; + /** Lower Case 명 */ + private String lcName; + /** Camel Case 명 */ + private String ccName; + /** Pascal Case 명 */ + private String pcName; + + /** + * + * 생성자 + * + * @param name 이름 + */ + public DbModelElement(String name){ + setName(name); + } + + /** + * 이름 가져오기 + * + * @return + */ + public String getName() { + return name; + } + + /** + * 이름 세팅하기 + * + * @param name + */ + public void setName(String name) { + this.name = name; + setUcName(name.toUpperCase()); + setLcName(name.toLowerCase()); + setCcName(NamingUtils.convertUnderscoreNameToCamelcase(name)); + setPcName(NamingUtils.convertCamelcaseToPascalcase(getCcName())); + } + + /** + * 대문자 이름 반환 + * + * @return + */ + public String getUcName() { + return ucName; + } + + + /** + * 대문자 이름 세팅 + * + * @param uppercaseName + */ + public void setUcName(String uppercaseName) { + this.ucName = uppercaseName; + } + + /** + * 소문자 이름 반환 + * + * @return + */ + public String getLcName() { + return lcName; + } + + /** + * 소문자 이름 세팅 + * + * @param lowercaseName + */ + public void setLcName(String lowercaseName) { + this.lcName = lowercaseName; + } + + /** + * 카멜 케이스 이름 반환 + * + * @return + */ + public String getCcName() { + return ccName; + } + + /** + * 카멜 케이스 이름 세팅 + * + * @param camelcaseName + */ + public void setCcName(String camelcaseName) { + this.ccName = camelcaseName; + } + + /** + * 파스칼 케이스 이름 반환 + * @return + */ + public String getPcName() { + return pcName; + } + + /** + * 파스칼 케이스 이름 세팅 + * @param pascalcaseName + */ + public void setPcName(String pascalcaseName) { + this.pcName = pascalcaseName; + } + + +} diff --git a/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/Entity.java b/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/Entity.java new file mode 100644 index 00000000..06585eda --- /dev/null +++ b/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/model/Entity.java @@ -0,0 +1,49 @@ +/* + * Copyright 2008-2009 MOSPA(Ministry of Security and Public Administration). + * + * Licensed 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 egovframework.dev.imp.codegen.template.model; + +/** + * + * 엔티티 정보 클래스 + *

NOTE: 어트리뷰트(데이터베이스 테이블) 정보를 담기위한 모델 클래스 + * + * @author 개발환경 개발팀 이흥주 + * @since 2009.08.03 + * @version 1.0 + * @see + * + *

+ *  == 개정이력(Modification Information) ==
+ *   
+ *   수정일      수정자           수정내용
+ *  -------    --------    ---------------------------
+ *   2009.08.03  이흥주          최초 생성
+ *
+ * 
+ */ +public class Entity extends DbModelElement { + + /** + * + * 생성자 + * + * @param name 이름 + */ + public Entity(String name) { + super(name); + } + +} diff --git a/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/util/NamingUtils.java b/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/util/NamingUtils.java new file mode 100644 index 00000000..a6191758 --- /dev/null +++ b/egovframework.dev.imp.templates/src/main/java/egovframework/dev/imp/codegen/template/util/NamingUtils.java @@ -0,0 +1,89 @@ +/* + * Copyright 2008-2009 MOSPA(Ministry of Security and Public Administration). + * + * Licensed 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 egovframework.dev.imp.codegen.template.util; + +/** + * + * 네이밍 변환 유틸리티 클래스 + *

NOTE: 언더스코어 네이밍을 카멜, 파스칼 케이싱으로 변환하기 위한 유틸리티 + * + * @author 개발환경 개발팀 이흥주 + * @since 2009.08.03 + * @version 1.0 + * @see + * + *

+ *  == 개정이력(Modification Information) ==
+ *   
+ *   수정일      수정자           수정내용
+ *  -------    --------    ---------------------------
+ *   2009.08.03  이흥주          최초 생성
+ *
+ * 
+ */ +public class NamingUtils { + + /** + * + * 언더스코어 명칭을 카멜케이싱 명칭으로 변환 + * + * @param name + * @return + */ + public static String convertUnderscoreNameToCamelcase(String name){ + StringBuffer result = new StringBuffer(); + boolean nextIsUpper = false; + if (name != null && name.length() > 0) { + if (name.length() > 1 && name.substring(1,2).equals("_")) { + result.append(name.substring(0, 1).toUpperCase()); + } + else { + result.append(name.substring(0, 1).toLowerCase()); + } + String s = null; + for (int i = 1; i < name.length(); i++) { + s = name.substring(i, i + 1); + if (s.equals("_")) { + nextIsUpper = true; + } + else { + if (nextIsUpper) { + result.append(s.toUpperCase()); + nextIsUpper = false; + } + else { + result.append(s.toLowerCase()); + } + } + } + } + return result.toString(); + } + + /** + * + * 카멜케이싱 명칭을 파스칼케이싱 명칭으로 변환 + * + * @param name + * @return + */ + public static String convertCamelcaseToPascalcase(String name){ + StringBuffer result = new StringBuffer(); + result.append(name.substring(0, 1).toUpperCase()); + result.append(name.substring(1)); + return result.toString(); + } +} diff --git a/egovframework.dev.imp.templates/src/main/java/model/Attribute.java b/egovframework.dev.imp.templates/src/main/java/model/Attribute.java index 75dedc4c..a5d0cd57 100644 --- a/egovframework.dev.imp.templates/src/main/java/model/Attribute.java +++ b/egovframework.dev.imp.templates/src/main/java/model/Attribute.java @@ -1,26 +1,26 @@ -package model; - -public class Attribute extends NameCasing { - public Attribute(String name) { - super(name); - } - - private String type; - private String javaType; - - public String getJavaType() { - return javaType; - } - - public void setJavaType(String javaType) { - this.javaType = javaType; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } -} +//package model; +// +//public class Attribute extends NameCasing { +// public Attribute(String name) { +// super(name); +// } +// +// private String type; +// private String javaType; +// +// public String getJavaType() { +// return javaType; +// } +// +// public void setJavaType(String javaType) { +// this.javaType = javaType; +// } +// +// public String getType() { +// return type; +// } +// +// public void setType(String type) { +// this.type = type; +// } +//} diff --git a/egovframework.dev.imp.templates/src/main/java/model/DataModelContext.java b/egovframework.dev.imp.templates/src/main/java/model/DataModelContext.java index 74b3cb2a..a3c323b4 100644 --- a/egovframework.dev.imp.templates/src/main/java/model/DataModelContext.java +++ b/egovframework.dev.imp.templates/src/main/java/model/DataModelContext.java @@ -1,57 +1,57 @@ -package model; - -import java.util.List; - -public class DataModelContext { - private String author; - private String createDate; - private String team; - - public String getAuthor() { - return author; - } - public String getTeam() { - return team; - } - public void setTeam(String team) { - this.team = team; - } - public void setAuthor(String author) { - this.author = author; - } - public String getCreateDate() { - return createDate; - } - public void setCreateDate(String createDate) { - this.createDate = createDate; - } - private String packageName; - public String getPackageName() { - return packageName; - } - public void setPackageName(String packageName) { - this.packageName = packageName; - } - private Entity entity; - private List attributes; - private List primaryKeys; - - public List getPrimaryKeys() { - return primaryKeys; - } - public void setPrimaryKeys(List primaryKeys) { - this.primaryKeys = primaryKeys; - } - public Entity getEntity() { - return entity; - } - public void setEntity(Entity entity) { - this.entity = entity; - } - public List getAttributes() { - return attributes; - } - public void setAttributes(List attributes) { - this.attributes = attributes; - } -} +//package model; +// +//import java.util.List; +// +//public class DataModelContext { +// private String author; +// private String createDate; +// private String team; +// +// public String getAuthor() { +// return author; +// } +// public String getTeam() { +// return team; +// } +// public void setTeam(String team) { +// this.team = team; +// } +// public void setAuthor(String author) { +// this.author = author; +// } +// public String getCreateDate() { +// return createDate; +// } +// public void setCreateDate(String createDate) { +// this.createDate = createDate; +// } +// private String packageName; +// public String getPackageName() { +// return packageName; +// } +// public void setPackageName(String packageName) { +// this.packageName = packageName; +// } +// private Entity entity; +// private List attributes; +// private List primaryKeys; +// +// public List getPrimaryKeys() { +// return primaryKeys; +// } +// public void setPrimaryKeys(List primaryKeys) { +// this.primaryKeys = primaryKeys; +// } +// public Entity getEntity() { +// return entity; +// } +// public void setEntity(Entity entity) { +// this.entity = entity; +// } +// public List getAttributes() { +// return attributes; +// } +// public void setAttributes(List attributes) { +// this.attributes = attributes; +// } +//} diff --git a/egovframework.dev.imp.templates/src/main/java/model/Entity.java b/egovframework.dev.imp.templates/src/main/java/model/Entity.java index 0be5287d..cd3d12d2 100644 --- a/egovframework.dev.imp.templates/src/main/java/model/Entity.java +++ b/egovframework.dev.imp.templates/src/main/java/model/Entity.java @@ -1,9 +1,9 @@ -package model; - -public class Entity extends NameCasing { - - public Entity(String name) { - super(name); - } - -} +//package model; +// +//public class Entity extends NameCasing { +// +// public Entity(String name) { +// super(name); +// } +// +//} diff --git a/egovframework.dev.imp.templates/src/main/java/model/NameCasing.java b/egovframework.dev.imp.templates/src/main/java/model/NameCasing.java index a5ec5a25..cbc9841e 100644 --- a/egovframework.dev.imp.templates/src/main/java/model/NameCasing.java +++ b/egovframework.dev.imp.templates/src/main/java/model/NameCasing.java @@ -1,52 +1,52 @@ -package model; - -import utils.NamingUtils; - -public class NameCasing { - private String name; - private String ucName; - private String lcName; - private String ccName; - private String pcName; - - public NameCasing(String name){ - setName(name); - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - setUcName(name.toUpperCase()); - setLcName(name.toLowerCase()); - setCcName(NamingUtils.convertUnderscoreNameToCamelcase(name)); - setPcName(NamingUtils.convertCamelcaseToPascalcase(getCcName())); - } - public String getUcName() { - return ucName; - } - public void setUcName(String uppercaseName) { - this.ucName = uppercaseName; - } - public String getLcName() { - return lcName; - } - public void setLcName(String lowercaseName) { - this.lcName = lowercaseName; - } - public String getCcName() { - return ccName; - } - public void setCcName(String camelcaseName) { - this.ccName = camelcaseName; - } - public String getPcName() { - return pcName; - } - public void setPcName(String pascalcaseName) { - this.pcName = pascalcaseName; - } - - -} +//package model; +// +//import utils.NamingUtils; +// +//public class NameCasing { +// private String name; +// private String ucName; +// private String lcName; +// private String ccName; +// private String pcName; +// +// public NameCasing(String name){ +// setName(name); +// } +// +// public String getName() { +// return name; +// } +// public void setName(String name) { +// this.name = name; +// setUcName(name.toUpperCase()); +// setLcName(name.toLowerCase()); +// setCcName(NamingUtils.convertUnderscoreNameToCamelcase(name)); +// setPcName(NamingUtils.convertCamelcaseToPascalcase(getCcName())); +// } +// public String getUcName() { +// return ucName; +// } +// public void setUcName(String uppercaseName) { +// this.ucName = uppercaseName; +// } +// public String getLcName() { +// return lcName; +// } +// public void setLcName(String lowercaseName) { +// this.lcName = lowercaseName; +// } +// public String getCcName() { +// return ccName; +// } +// public void setCcName(String camelcaseName) { +// this.ccName = camelcaseName; +// } +// public String getPcName() { +// return pcName; +// } +// public void setPcName(String pascalcaseName) { +// this.pcName = pascalcaseName; +// } +// +// +//} diff --git a/egovframework.dev.imp.templates/src/main/java/operation/CrudCodeGen.java b/egovframework.dev.imp.templates/src/main/java/operation/CrudCodeGen.java index a8741ddd..3284dc36 100644 --- a/egovframework.dev.imp.templates/src/main/java/operation/CrudCodeGen.java +++ b/egovframework.dev.imp.templates/src/main/java/operation/CrudCodeGen.java @@ -1,5 +1,6 @@ package operation; +import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.util.Properties; @@ -11,10 +12,10 @@ import org.apache.velocity.exception.ParseErrorException; import org.apache.velocity.exception.ResourceNotFoundException; -import model.DataModelContext; +import egovframework.dev.imp.codegen.template.model.DataModelContext; public class CrudCodeGen { - public String generate(DataModelContext dataModel, String templateFile) throws Exception { + public String generate(DataModelContext dataModel, String templateFile) { StringWriter sw = new StringWriter(); generate(dataModel, templateFile, sw); @@ -23,7 +24,7 @@ public String generate(DataModelContext dataModel, String templateFile) throws E return sw.toString(); } - private void generate(DataModelContext dataModel, String templateFile, Writer writer) throws Exception { + private void generate(DataModelContext dataModel, String templateFile, Writer writer) { String templateEncoding = "UTF-8"; Properties p = new Properties(); @@ -34,16 +35,22 @@ private void generate(DataModelContext dataModel, String templateFile, Writer wr p.setProperty("file.resource.loader.cache", "false"); p.setProperty("file.resource.loader.modificationCheckInterval", "0"); - Velocity.init(p); + try { + Velocity.init(p); + } catch (Exception e) { + throw new IllegalArgumentException(e); + } VelocityContext context = new VelocityContext(); - context.put("package", dataModel.getPackageName()); - context.put("entity", dataModel.getEntity()); - context.put("attributes", dataModel.getAttributes()); - context.put("primaryKeys", dataModel.getPrimaryKeys()); - context.put("createDate", dataModel.getCreateDate()); - context.put("author", dataModel.getAuthor()); +// context.put("package", dataModel.getPackageName()); +// context.put("entity", dataModel.getEntity()); +// context.put("attributes", dataModel.getAttributes()); +// context.put("primaryKeys", dataModel.getPrimaryKeys()); +// context.put("createDate", dataModel.getCreateDate()); +// context.put("author", dataModel.getAuthor()); + + context.put("model", dataModel); Template template = null; @@ -59,7 +66,11 @@ private void generate(DataModelContext dataModel, String templateFile, Writer wr } catch (Exception e) { } - template.merge(context, writer); + try { + template.merge(context, writer); + } catch (ResourceNotFoundException | ParseErrorException | MethodInvocationException | IOException e) { + throw new IllegalArgumentException(e); + } } diff --git a/egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/cache/ehcacheConfigForSpring-java.vm b/egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/cache/ehcacheConfigForSpring-java.vm new file mode 100644 index 00000000..315b045e --- /dev/null +++ b/egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/cache/ehcacheConfigForSpring-java.vm @@ -0,0 +1,34 @@ +package ${txtConfigPackage}; + +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.ehcache.EhCacheCacheManager; +import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; + +@Configuration +@EnableCaching +public class ${templateUtil.substringAfterLast(${txtClassName}, ".")} { + + @Bean + public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() { + EhCacheManagerFactoryBean factoryBean = new EhCacheManagerFactoryBean(); + factoryBean.setConfigLocation(new ClassPathResource("${templateUtil.removeSourcePath(${txtConfigLocation})}")); + factoryBean.setShared(true); + return factoryBean; + } + + @Bean + public EhCacheCacheManager cacheManager(EhCacheManagerFactoryBean ehCacheManagerFactoryBean) { + return new EhCacheCacheManager(ehCacheManagerFactoryBean.getObject()); + } + + /* pom.xml에 다음 라이브러리 추가 필요 + + net.sf.ehcache + ehcache + 2.10.9.2 + + */ +} \ No newline at end of file diff --git a/egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/cache/ehcacheConfigForSpring.vm b/egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/cache/ehcacheConfigForSpring.vm index 112f4a9f..a52475e4 100644 --- a/egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/cache/ehcacheConfigForSpring.vm +++ b/egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/cache/ehcacheConfigForSpring.vm @@ -1,14 +1,26 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:cache="http://www.springframework.org/schema/cache" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd + http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd"> - + + + - + - +
+ + \ No newline at end of file diff --git a/egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/cache/ehcacheConfigForSpring.xml b/egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/cache/ehcacheConfigForSpring.xml index 89b5e6fe..ef858ea7 100644 --- a/egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/cache/ehcacheConfigForSpring.xml +++ b/egovframework.dev.imp.templates/src/main/resources/eGovFrameTemplates/cache/ehcacheConfigForSpring.xml @@ -5,19 +5,34 @@ - Select config file. + Select config package or path. - - - - - + + + + + + + + + + + + + -