OSDN Git Service

20170503
[rapideact/rapideact.git] / com / rapide_act / CmnUtils.java
index 35b5cf2..75ba796 100644 (file)
@@ -60,6 +60,31 @@ public class CmnUtils{
                }
        }
 
+       protected static void writeSeparator(String _file, int _columnCount, ArrayList<String> _alData, String _sprtr) throws Exception{
+               PrintWriter pw = null;
+               try {
+                       debugPrint("Start write Separator," + "columnCount=" + _columnCount);
+                       pw = new PrintWriter(new BufferedWriter(new FileWriter(new File(_file))));
+                       for(int i=0;i<_alData.size();i++){
+                               pw.print(_alData.get(i).replaceAll("\n","\r\n"));
+                               if (_columnCount == 1){
+                                       pw.println("");
+                               } else {
+                                       if ((i+1) % _columnCount == 0 && i > 0){
+                                               pw.println("");
+                                       } else {
+                                               pw.print(_sprtr);
+                                       }
+                               }
+                       }
+                       pw.close();
+                       debugPrint("End write Separator");
+               }
+               catch (Exception e){
+                       throw e;
+               }
+       }
+
        protected static void printConsole(int _columnCount, ArrayList<String> _alData) throws Exception{
                try {
                        debugPrint("Start console print");
@@ -290,6 +315,44 @@ public class CmnUtils{
                }
        }
 
+       protected static boolean isColLength(String _colType, String _colLen) throws Exception{
+               if(
+                       !_colLen.equals("") &&
+                       !_colType.toUpperCase().equals("NUMBER") &&
+                       !_colType.toUpperCase().equals("BLOB") &&
+                       !_colType.toUpperCase().equals("CLOB") &&
+                       !_colType.toUpperCase().equals("NCLOB") &&
+                       !_colType.toUpperCase().equals("TIMESTAMP") &&
+                       !_colType.toUpperCase().equals("DATE") &&
+                       !_colType.toUpperCase().equals("LONG") &&
+                       !_colType.toUpperCase().equals("ROWID") &&
+                       !_colType.toUpperCase().equals("LONG RAW") &&
+                       !_colType.toUpperCase().equals("AQ$_SUBSCRIBERS")){
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+
+       protected static boolean isColPrec(String _colType, String _colPrec) throws Exception{
+               if(
+                       !_colPrec.equals("") && !_colType.equals("TIMESTAMP")){
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+
+       protected static int getColLength(String _colType, String _colLen) throws Exception{
+               if(
+                       _colType.toUpperCase().equals("NCHAR") ||
+                       _colType.toUpperCase().equals("NVARCHAR2")){
+                               return Integer.parseInt(_colLen)/2;
+               } else {
+                       return Integer.parseInt(_colLen);
+               }
+       }
+
        protected static boolean isColString(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("LONG") ||