]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Modifications done to respect PMD rules.
authorrkv <rkv@opencascade.com>
Wed, 7 Nov 2012 07:58:45 +0000 (07:58 +0000)
committerrkv <rkv@opencascade.com>
Wed, 7 Nov 2012 07:58:45 +0000 (07:58 +0000)
Workspace/DaoGenerator/src/org/siman/generator/DaoGenerator.java
Workspace/DaoGenerator/src/templates/DAO.java.vm
Workspace/DaoGenerator/src/templates/DAOImpl.java.vm

index ab60ec5c9afdd1a9b40b6990289e8f456242360e..fa690690c2a43569d07864e8ecd4676b082ee9af 100644 (file)
@@ -9,16 +9,13 @@
 
 package org.siman.generator;
 
-import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.util.ResourceBundle;
-
-import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Properties;
+import java.util.ResourceBundle;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -59,7 +56,7 @@ public class DaoGenerator {
         * @throws IOException
         * @throws SAXException
         */
-       public static void main(String[] args) throws ParserConfigurationException,
+       public static void main(final String[] args) throws ParserConfigurationException,
                        SAXException, IOException {
                ResourceBundle bundle = ResourceBundle.getBundle("config");
                String srcCtx = bundle.getString(SRC_CTX);
@@ -124,9 +121,9 @@ public class DaoGenerator {
         * @throws IOException
         * @throws SAXException
         */
-       private static void processMappingResource(List<Properties> daos,
-                       DocumentBuilderFactory dfactory, String resourceName,
-                       String srcPath, String outPath)
+       private static void processMappingResource(final List<Properties> daos,
+                       final DocumentBuilderFactory dfactory, final String resourceName,
+                       final String srcPath, final String outPath)
                        throws ParserConfigurationException, SAXException, IOException {
                // dfactory.setValidating(false);
                // dfactory.setFeature("http://xml.org/sax/features/namespaces", false);
@@ -154,8 +151,8 @@ public class DaoGenerator {
         * @param string
         * @param outPath
         */
-       private static void processClasses(List<Properties> daos, Document resDoc,
-                       String elementName, String outPath) {
+       private static void processClasses(final List<Properties> daos, final Document resDoc,
+                       final String elementName, final String outPath) {
                NodeList classes = resDoc.getElementsByTagName(elementName);
                Element classElem;
                for (int i = 0; i < classes.getLength(); i++) {
@@ -199,8 +196,8 @@ public class DaoGenerator {
         * @param string
         * @param outPath
         */
-       private static void generateClass(String entityName, String className,
-                       String templatePath, String outPath) {
+       private static void generateClass(final String entityName, final String className,
+                       final String templatePath, final String outPath) {
                String resultPath = outPath + className.replace(".", "/") + ".java";
                System.out.println("Generating file: " + resultPath);
                VelocityContext context = new VelocityContext();
@@ -220,7 +217,7 @@ public class DaoGenerator {
         * @param string
         * @param outPath
         */
-       private static void generateDaoContext(List<Properties> daos, String outPath) {
+       private static void generateDaoContext(final List<Properties> daos, final String outPath) {
                String resultPath = outPath + "spring/daoContext.xml";
                String templatePath = "templates/daoContext.xml.vm";
                System.out.println("Generating file: " + resultPath);
@@ -236,8 +233,8 @@ public class DaoGenerator {
         * @param templatePath
         * @param resultPath
         */
-       private static void generateFile(VelocityContext context,
-                       String templatePath, String resultPath) {
+       private static void generateFile(final VelocityContext context,
+                       final String templatePath, final String resultPath) {
                Template template = null;
                context.put("date", new Date());
 
index 80720c0a9c200e1b0615ad78537078f357683297..779a298d5b15c271f42c4aea865a8f56a27a7089 100644 (file)
@@ -11,7 +11,9 @@
 package ${DAOPackage}; 
 
 import ${EntityPackage}.${EntityClass};
+#if(${DAOPackage} != "org.splat.dal.dao.kernel")
 import org.splat.dal.dao.kernel.GenericDAO;
+#end
 
 /**
  * ${EntityClass} DAO class implementation.
index 20715320c28d2107e7511106f46ca6b42a81f783..7977aa0114eb4d3ebd2750312e7f6cd32421e8a5 100644 (file)
@@ -11,7 +11,9 @@
 package ${DAOPackage};
 
 import ${EntityPackage}.${EntityClass};
-import org.splat.dal.dao.kernel.GenericDAOImpl;
+#if(${DAOPackage} != "org.splat.dal.dao.kernel")
+import org.splat.dal.dao.kernel.AbstractGenericDAOImpl;
+#end
 
 /**
  * ${EntityClass} DAO.
@@ -19,11 +21,11 @@ import org.splat.dal.dao.kernel.GenericDAOImpl;
  * 
  */
 public class ${EntityClass}DAOImpl extends
-               GenericDAOImpl<${EntityClass}, Long> implements ${EntityClass}DAO {
+               AbstractGenericDAOImpl<${EntityClass}, Long> implements ${EntityClass}DAO {
 
        /** 
         * {@inheritDoc}
-        * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType()
+        * @see org.splat.dal.dao.kernel.AbstractGenericDAOImpl#getType()
         */
        @Override
        protected Class<${EntityClass}> getType() {