Source Code Cross Referenced for DomlDesignReader.java in  » Database-JDBC-Connection-Pool » octopus » org » webdocwf » util » loader » generator » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » octopus » org.webdocwf.util.loader.generator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
003:
004:
005:         Copyright (C) 2003  Together
006:
007:         This library is free software; you can redistribute it and/or
008:         modify it under the terms of the GNU Lesser General Public
009:         License as published by the Free Software Foundation; either
010:         version 2.1 of the License, or (at your option) any later version.
011:
012:         This library is distributed in the hope that it will be useful,
013:         but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         Lesser General Public License for more details.
016:
017:         You should have received a copy of the GNU Lesser General Public
018:         License along with this library; if not, write to the Free Software
019:         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
020:         */
021:
022:        package org.webdocwf.util.loader.generator;
023:
024:        import java.io.File;
025:        import java.util.ArrayList;
026:        import java.util.Arrays;
027:        import java.util.List;
028:        import java.util.StringTokenizer;
029:
030:        import javax.xml.parsers.DocumentBuilder;
031:        import javax.xml.parsers.DocumentBuilderFactory;
032:
033:        import org.enhydra.xml.ElementImpl;
034:        import org.w3c.dom.Document;
035:        import org.w3c.dom.Element;
036:        import org.w3c.dom.NodeList;
037:        import org.webdocwf.util.loader.LoaderException;
038:        import org.webdocwf.util.loader.logging.Logger;
039:        import org.webdocwf.util.loader.logging.StandardLogger;
040:
041:        /**
042:         * DomlDesignReader class retrieves the input data from doml file, and placed them in to
043:         * ImportDefinition class.
044:         * @author Radoslav Dutina
045:         * @version 1.0
046:         */
047:        public class DomlDesignReader {
048:
049:            private ElementImpl searchDocument;
050:            private Document documentXml;
051:            private String databaseType = null;
052:
053:            private String tableName = null;
054:
055:            private String notUsingOid = null;
056:            private String columnName = null;
057:            private String isConstant = null;
058:            private String isPrimaryKey = null;
059:
060:            private String size = null;
061:            private String canBeNull = null;
062:            private String dbType = null;
063:
064:            private String indexId = null;
065:            private String indexUnique = null;
066:            private String indexColumnId = null;
067:
068:            private String constraint = null;
069:            private String foreignKeyColumn = null;
070:            private String reference = null;
071:            private String foreignTable = null;
072:
073:            private static List listColumnNames = null;
074:            private static List listTargetTableNames = null;
075:            private static List listTargetTableID = null;
076:            private static List listColumnType = null;
077:            private static List listColumnLenght = null;
078:            private static List listAllowNulls = null;
079:
080:            private static List listPrimaryKeys = null;
081:            private static List listIndexVariables = null;
082:            private static List listForeignVariables = null;
083:
084:            private ImportDefinitionAttributes importDefinitionAttributes = new ImportDefinitionAttributes();
085:            private RelationshipsAttributes relationshipsAttributes = new RelationshipsAttributes();
086:            private MappingTypeData mappingTypeData = null;
087:
088:            private StringTokenizer st;
089:            private String oidDbType = null;
090:            private String oidDbSize = null;
091:
092:            private Logger logger;
093:
094:            /**
095:             * Construct object DomlDesignReader with associated parameters.
096:             * @param generatorParameters represents the references to InputParameter object.
097:             * @param document is the object of Document class.
098:             * @param root is the object of Element class.
099:             * @throws LoaderException
100:             */
101:
102:            public DomlDesignReader(Document document, Element root,
103:                    InputParameters generatorParameters) throws LoaderException {
104:                setLogger();
105:                this .logger.write("normal", "DomlDesignReader is started.");
106:                DocumentBuilderFactory factoryXml = DocumentBuilderFactory
107:                        .newInstance();
108:                try {
109:                    File file = new File(generatorParameters.getDomlPath());
110:                    DocumentBuilder builderXml = factoryXml
111:                            .newDocumentBuilder();
112:                    try {
113:                        this .documentXml = builderXml.parse(file);
114:                    } catch (Exception e) {
115:                        String msg = "Exception in class DomlDesignReader: Error has occurred when trying to parse file!";
116:                        LoaderException le = new LoaderException(msg + "\n"
117:                                + e.getMessage() + "\n", (Throwable) e);
118:                        this .logger
119:                                .write(
120:                                        "full",
121:                                        "Exception in class DomlDesignReader: Error has occurred when trying to parse file!"
122:                                                + "\n"
123:                                                + le.getStackTraceAsString());
124:                        throw le;
125:                    }
126:                    this .searchDocument = (ElementImpl) ElementImpl
127:                            .newInstance(documentXml);
128:
129:                    NodeList databaseName = searchDocument
130:                            .getElementsByTagName("database");
131:                    if (databaseName.getLength() != 0) {
132:                        databaseType = databaseName.item(0).getAttributes()
133:                                .item(0).getNodeValue();
134:                        //28.08.2003
135:                        //        generatorParameters.setSourceType(databaseType.toString());
136:
137:                        NodeList tableList = searchDocument
138:                                .getElementsByTagName("table");
139:                        int countOid = 0;
140:                        int counterConstraint = 0;
141:                        if (tableList.getLength() != 0) {
142:                            for (int i = 0; i < tableList.getLength(); i++) {
143:                                String maxConstraintLength = generatorParameters
144:                                        .getMaxConstraintLength();
145:                                int maxConstraintInt = 0;
146:                                if (!maxConstraintLength.equalsIgnoreCase("")
147:                                        && !maxConstraintLength
148:                                                .equalsIgnoreCase("-1")) {
149:                                    maxConstraintInt = Integer
150:                                            .parseInt(maxConstraintLength);
151:                                }
152:                                listColumnNames = new ArrayList();
153:                                listTargetTableNames = new ArrayList();
154:                                listTargetTableID = new ArrayList();
155:                                listColumnType = new ArrayList();
156:                                listColumnLenght = new ArrayList();
157:                                listAllowNulls = new ArrayList();
158:
159:                                listPrimaryKeys = new ArrayList();
160:                                listIndexVariables = new ArrayList();
161:                                listForeignVariables = new ArrayList();
162:
163:                                //            MappingOidAndVersion mappingOidAndVersion=new MappingOidAndVersion(generatorParameters);
164:
165:                                st = new StringTokenizer(generatorParameters
166:                                        .getOidColumnType());
167:                                int countOidToken = 0;
168:                                //e.g. oidDb=decimal (19,0)
169:                                while (st.hasMoreTokens()) {
170:                                    if (countOidToken == 0)
171:                                        oidDbType = st.nextToken();
172:                                    else
173:                                        oidDbSize = (st.nextToken()).substring(
174:                                                1, 5);
175:                                    countOidToken++;
176:                                }
177:
178:                                tableName = ((ElementImpl) tableList.item(i))
179:                                        .getAttribute("dbTableName");
180:                                notUsingOid = ((ElementImpl) tableList.item(i))
181:                                        .getAttribute("notUsingOid");
182:                                //System.out.println("Working...."+tableName);
183:                                this .logger.write("normal", "Working...."
184:                                        + tableName);
185:                                //BufferOctopusClass.getInstance().writeToBuffer("Working...."+tableName);
186:                                //if notUsingOid is false, we must add columns oid and version
187:                                boolean addOid = false;
188:                                if (notUsingOid.equalsIgnoreCase("")
189:                                        || notUsingOid
190:                                                .equalsIgnoreCase("false"))
191:                                    addOid = true;
192:
193:                                importDefinitionAttributes.setName(tableName);
194:                                importDefinitionAttributes
195:                                        .setTableName(tableName);
196:
197:                                NodeList indexList = ((ElementImpl) tableList
198:                                        .item(i)).getElementsByTagName("index");
199:                                if (indexList.getLength() != 0) {
200:                                    for (int l = 0; l < indexList.getLength(); l++) {
201:                                        indexId = ((ElementImpl) indexList
202:                                                .item(l)).getAttribute("id");
203:                                        indexUnique = ((ElementImpl) indexList
204:                                                .item(l))
205:                                                .getAttribute("unique");
206:
207:                                        NodeList indexColumn = ((ElementImpl) indexList
208:                                                .item(l))
209:                                                .getElementsByTagName("indexColumn");
210:                                        indexColumnId = "";
211:                                        for (int j = 0; j < indexColumn
212:                                                .getLength(); j++) {
213:                                            indexColumnId += ((ElementImpl) indexColumn
214:                                                    .item(j))
215:                                                    .getAttribute("id")
216:                                                    + ",";
217:                                        }
218:                                        indexColumnId = indexColumnId
219:                                                .substring(0, indexColumnId
220:                                                        .length() - 1);
221:
222:                                        if (indexUnique
223:                                                .equalsIgnoreCase("false")
224:                                                || indexUnique
225:                                                        .equalsIgnoreCase("")) {
226:                                            listIndexVariables.add("1");
227:                                        } else {
228:                                            listIndexVariables.add("0");
229:                                        }
230:                                        //index lenght restrictions
231:                                        String indexName = indexId + "_"
232:                                                + tableName;
233:                                        if (maxConstraintInt > 0
234:                                                && indexName.length() > maxConstraintInt) {
235:                                            String newIndexName = indexName
236:                                                    .substring(
237:                                                            0,
238:                                                            maxConstraintInt
239:                                                                    - String
240:                                                                            .valueOf(
241:                                                                                    counterConstraint)
242:                                                                            .length());
243:                                            indexName = newIndexName
244:                                                    + String
245:                                                            .valueOf(counterConstraint);
246:                                            counterConstraint++;
247:                                        }
248:                                        listIndexVariables.add(indexName);
249:                                        listIndexVariables.add(indexColumnId);
250:                                    }
251:                                }
252:
253:                                NodeList columnList = ((ElementImpl) tableList
254:                                        .item(i))
255:                                        .getElementsByTagName("column");
256:                                if (columnList.getLength() != 0) {
257:                                    for (int j = 0; j < columnList.getLength(); j++) {
258:                                        columnName = ((ElementImpl) columnList
259:                                                .item(j)).getAttribute("id");
260:
261:                                        listColumnNames.add(columnName);
262:                                        listTargetTableNames.add(tableName);
263:                                        listTargetTableID.add("0");
264:
265:                                        isConstant = ((ElementImpl) columnList
266:                                                .item(j))
267:                                                .getAttribute("isConstant");
268:                                        isPrimaryKey = ((ElementImpl) columnList
269:                                                .item(j))
270:                                                .getAttribute("isPrimaryKey");
271:                                        //primary key restrictions
272:                                        if (isPrimaryKey
273:                                                .equalsIgnoreCase("true")) {
274:                                            String primaryKeyName = tableName
275:                                                    + "_" + columnName;
276:                                            if (maxConstraintInt > 0
277:                                                    && primaryKeyName.length() > maxConstraintInt) {
278:                                                String newPrimaryName = primaryKeyName
279:                                                        .substring(
280:                                                                0,
281:                                                                maxConstraintInt
282:                                                                        - String
283:                                                                                .valueOf(
284:                                                                                        counterConstraint)
285:                                                                                .length());
286:                                                primaryKeyName = newPrimaryName
287:                                                        + String
288:                                                                .valueOf(counterConstraint);
289:                                                counterConstraint++;
290:                                            }
291:                                            listPrimaryKeys.add(primaryKeyName);
292:                                            listPrimaryKeys.add(columnName);
293:                                        }
294:
295:                                        NodeList typeConstraint = ((ElementImpl) columnList
296:                                                .item(j))
297:                                                .getElementsByTagName("referenceObject");
298:                                        if (typeConstraint.getLength() != 0) {
299:                                            for (int m = 0; m < typeConstraint
300:                                                    .getLength(); m++) {
301:                                                constraint = ((ElementImpl) typeConstraint
302:                                                        .item(m))
303:                                                        .getAttribute("constraint");
304:                                                foreignKeyColumn = ((ElementImpl) typeConstraint
305:                                                        .item(m))
306:                                                        .getAttribute("foreignKeyColumn");
307:                                                reference = ((ElementImpl) typeConstraint
308:                                                        .item(m))
309:                                                        .getAttribute("reference");
310:
311:                                                NodeList allTable = searchDocument
312:                                                        .getElementsByTagName("table");
313:                                                for (int n = 0; n < allTable
314:                                                        .getLength(); n++) {
315:                                                    String ID = ((ElementImpl) allTable
316:                                                            .item(n))
317:                                                            .getAttribute("id");
318:                                                    if (ID
319:                                                            .equalsIgnoreCase(reference)) {
320:                                                        foreignTable = ((ElementImpl) allTable
321:                                                                .item(n))
322:                                                                .getAttribute("dbTableName");
323:                                                        break;
324:                                                    }
325:                                                }
326:                                                //foreign key restrictions (lenght)
327:                                                String foreignKeyName = tableName
328:                                                        + "_" + columnName;
329:                                                if (maxConstraintInt > 0
330:                                                        && foreignKeyName
331:                                                                .length() > maxConstraintInt) {
332:                                                    String newFKName = foreignKeyName
333:                                                            .substring(
334:                                                                    0,
335:                                                                    maxConstraintInt
336:                                                                            - String
337:                                                                                    .valueOf(
338:                                                                                            counterConstraint)
339:                                                                                    .length());
340:                                                    foreignKeyName = newFKName
341:                                                            + String
342:                                                                    .valueOf(counterConstraint);
343:                                                    counterConstraint++;
344:                                                }
345:
346:                                                if (foreignKeyColumn
347:                                                        .equalsIgnoreCase("true")) {
348:                                                    listForeignVariables
349:                                                            .add(tableName);
350:                                                    //                      listForeignVariables.add(tableName+"_"+columnName);
351:                                                    listForeignVariables
352:                                                            .add(foreignKeyName);
353:                                                    listForeignVariables
354:                                                            .add(columnName);
355:                                                    listForeignVariables
356:                                                            .add(foreignTable);
357:                                                    listForeignVariables
358:                                                            .add(foreignKeyColumn);
359:                                                } else {
360:                                                    //oid column
361:                                                    listForeignVariables
362:                                                            .add(tableName);
363:                                                    //                      listForeignVariables.add(tableName+"_"+columnName);
364:                                                    listForeignVariables
365:                                                            .add(foreignKeyName);
366:                                                    listForeignVariables
367:                                                            .add(columnName);
368:                                                    listForeignVariables
369:                                                            .add(foreignTable);
370:                                                    listForeignVariables
371:                                                            .add(generatorParameters
372:                                                                    .getOidColumnName());
373:
374:                                                }
375:                                                NodeList typeList = ((ElementImpl) columnList
376:                                                        .item(j))
377:                                                        .getElementsByTagName("type");
378:                                                if (typeList.getLength() != 0) {
379:                                                    for (int k = 0; k < typeList
380:                                                            .getLength(); k++) {
381:                                                        size = ((ElementImpl) typeList
382:                                                                .item(k))
383:                                                                .getAttribute("size");
384:                                                        canBeNull = ((ElementImpl) typeList
385:                                                                .item(k))
386:                                                                .getAttribute("canBeNull");
387:                                                        dbType = ((ElementImpl) typeList
388:                                                                .item(k))
389:                                                                .getAttribute("dbType");
390:
391:                                                        if (canBeNull
392:                                                                .equalsIgnoreCase("true")) {
393:                                                            listAllowNulls
394:                                                                    .add("");
395:                                                        } else {
396:                                                            listAllowNulls
397:                                                                    .add(" NOT NULL");
398:                                                        }
399:                                                        //if parameter dbType=null, then the primary key is oid column from referenced
400:                                                        //table
401:                                                        if (dbType
402:                                                                .equalsIgnoreCase("none")) {
403:                                                            //                          mappingTypeData=new MappingTypeData(oidDbType, generatorParameters);
404:                                                            //                          listColumnType.add(mappingTypeData.getSQLType());
405:                                                            listColumnType
406:                                                                    .add(oidDbType);
407:                                                            if (size
408:                                                                    .equalsIgnoreCase("")
409:                                                                    || size == null
410:                                                                    &&
411:
412:                                                                    (generatorParameters
413:                                                                            .getIsDecimal(mappingTypeData
414:                                                                                    .getSQLType())
415:                                                                            .equalsIgnoreCase("true"))) {
416:                                                                listColumnLenght
417:                                                                        .add(" (19,0) ");
418:                                                            } else if (!size
419:                                                                    .equalsIgnoreCase("")) {
420:                                                                listColumnLenght
421:                                                                        .add(" ("
422:                                                                                + size
423:                                                                                + ") ");
424:
425:                                                            } else
426:                                                                listColumnLenght
427:                                                                        .add(size);
428:                                                        }
429:                                                    }
430:                                                }
431:                                            }
432:                                        } else {
433:                                            NodeList typeList = ((ElementImpl) columnList
434:                                                    .item(j))
435:                                                    .getElementsByTagName("type");
436:                                            if (typeList.getLength() != 0) {
437:                                                for (int k = 0; k < typeList
438:                                                        .getLength(); k++) {
439:                                                    size = ((ElementImpl) typeList
440:                                                            .item(k))
441:                                                            .getAttribute("size");
442:                                                    canBeNull = ((ElementImpl) typeList
443:                                                            .item(k))
444:                                                            .getAttribute("canBeNull");
445:                                                    dbType = ((ElementImpl) typeList
446:                                                            .item(k))
447:                                                            .getAttribute("dbType");
448:
449:                                                    if (canBeNull
450:                                                            .equalsIgnoreCase("true")) {
451:                                                        listAllowNulls.add("");
452:                                                    } else {
453:                                                        listAllowNulls
454:                                                                .add(" NOT NULL ");
455:                                                    }
456:                                                    //Mapp the type of the parameter
457:                                                    mappingTypeData = new MappingTypeData(
458:                                                            dbType,
459:                                                            generatorParameters);
460:                                                    listColumnType
461:                                                            .add(mappingTypeData
462:                                                                    .getSQLType());
463:                                                    //ZK change this 6.5.2004
464:                                                    //                      if((size.equalsIgnoreCase("")||size==null)&&
465:                                                    //                         (mappingTypeData.getSQLType().equalsIgnoreCase("varchar")||
466:                                                    //                         mappingTypeData.getSQLType().equalsIgnoreCase("nvarchar")||
467:                                                    //                         mappingTypeData.getSQLType().equalsIgnoreCase("longvarchar"))){
468:                                                    //                      listColumnLenght.add("32");
469:                                                    if ((size
470:                                                            .equalsIgnoreCase("") || size == null)
471:                                                            && (generatorParameters
472:                                                                    .getHasSize(mappingTypeData
473:                                                                            .getSQLType())
474:                                                                    .equalsIgnoreCase("true"))) {
475:                                                        listColumnLenght
476:                                                                .add("32");
477:                                                    } else if (!size
478:                                                            .equalsIgnoreCase("")) {
479:                                                        listColumnLenght
480:                                                                .add(" ("
481:                                                                        + size
482:                                                                        + ") ");
483:                                                    } else {
484:                                                        listColumnLenght
485:                                                                .add(size);
486:                                                    }
487:                                                }
488:                                            }
489:                                        }
490:                                    }
491:                                }
492:                                //add column names for columns oid and version
493:                                if (addOid == true
494:                                        && countOid < tableList.getLength()) {
495:                                    listColumnNames.add(generatorParameters
496:                                            .getOidColumnName());
497:                                    listTargetTableNames.add(tableName);
498:                                    listTargetTableID.add("0");
499:                                    listAllowNulls.add(" NOT NULL ");
500:                                    listColumnLenght.add(" (" + oidDbSize
501:                                            + ") ");
502:                                    listColumnType.add(oidDbType);
503:
504:                                    listColumnNames.add(generatorParameters
505:                                            .getVersionColumnName());
506:                                    listTargetTableNames.add(tableName);
507:                                    listTargetTableID.add("0");
508:                                    listAllowNulls.add(" NOT NULL ");
509:                                    listColumnLenght.add("");
510:                                    listColumnType.add(generatorParameters
511:                                            .getVersionColumnType());
512:
513:                                    String primaryKeyNameOid = tableName
514:                                            + "_"
515:                                            + generatorParameters
516:                                                    .getOidColumnName();
517:                                    if (maxConstraintInt > 0
518:                                            && primaryKeyNameOid.length() > maxConstraintInt) {
519:                                        String newPrimaryName = primaryKeyNameOid
520:                                                .substring(
521:                                                        0,
522:                                                        maxConstraintInt
523:                                                                - String
524:                                                                        .valueOf(
525:                                                                                counterConstraint)
526:                                                                        .length());
527:                                        primaryKeyNameOid = newPrimaryName
528:                                                + String
529:                                                        .valueOf(counterConstraint);
530:                                        counterConstraint++;
531:                                    }
532:                                    listPrimaryKeys.add(primaryKeyNameOid);
533:                                    listPrimaryKeys.add(generatorParameters
534:                                            .getOidColumnName());
535:                                }
536:
537:                                importDefinitionAttributes
538:                                        .setTagSourceColumnName(getColumnNames());
539:                                importDefinitionAttributes
540:                                        .setTagTargetColumnName(getColumnNames());
541:                                importDefinitionAttributes
542:                                        .setTagTargetTableName(getTargetTableNames());
543:                                importDefinitionAttributes
544:                                        .setTagTargetTableID(getTargetTableID());
545:                                importDefinitionAttributes
546:                                        .setTagColumnType(getColumnType());
547:                                importDefinitionAttributes
548:                                        .setTagAllowNulls(getAllowNulls());
549:                                importDefinitionAttributes
550:                                        .setTagColumnLenght(getColumnLenght());
551:
552:                                relationshipsAttributes.setTableName(tableName);
553:                                relationshipsAttributes
554:                                        .setPrimaryKeys(getPrimaryKeys());
555:                                relationshipsAttributes
556:                                        .setIndexVariables(getIndexVariables());
557:                                relationshipsAttributes
558:                                        .setForeignVariables(getForeignVariables());
559:
560:                                WriteSqlFiles writeSql = new WriteSqlFiles(
561:                                        tableName, countOid,
562:                                        getImportDefinition(),
563:                                        getRelationshipsAttributes(),
564:                                        generatorParameters);
565:
566:                                WriteImportDefinition writeImportDefinition = new WriteImportDefinition(
567:                                        document, root, getImportDefinition(),
568:                                        generatorParameters);
569:                                countOid++;
570:                            }
571:                            //System.out.println("\ndone....");
572:                            //BufferOctopusClass.getInstance().writeToBuffer("\ndone....");
573:                            this .logger.write("normal", "\ndone....");
574:                        }
575:                    } else {
576:                        String msg = "Your file don't have database tag!";
577:                        LoaderException le = new LoaderException("Exception:",
578:                                (Throwable) new Exception(msg));
579:                        this .logger.write("full",
580:                                "Exception in class DomlDesignReader:"
581:                                        + le.getStackTraceAsString());
582:                        throw le;
583:                    }
584:                } catch (Exception e) {
585:                    String msg = "Exception in class DomlDesignReader: Error has occurred when trying to set parameters!"
586:                            + "\n";
587:
588:                    LoaderException le = new LoaderException(msg
589:                            + e.getMessage(), (Throwable) e);
590:                    this .logger
591:                            .write(
592:                                    "full",
593:                                    "Exception in class DomlDesignReader: Error has occurred when trying to set parameters!"
594:                                            + "\n" + le.getStackTraceAsString());
595:                    throw le;
596:                }
597:                this .logger.write("normal", "DomlDesignReader is finished.");
598:            }
599:
600:            /**
601:             * This method read value of importDefinitionAttributes parameters.
602:             * @return references to ImportDefinitionAttributes objects.
603:             */
604:            public ImportDefinitionAttributes getImportDefinition() {
605:                return importDefinitionAttributes;
606:            }
607:
608:            /**
609:             * This method read value of relationshipsAttributes parameters.
610:             * @return references to RelationshipsAttributes objects.
611:             */
612:            public RelationshipsAttributes getRelationshipsAttributes() {
613:                return relationshipsAttributes;
614:            }
615:
616:            /**
617:             * This method sets value of listColumnNames parameters.
618:             * @param list_ColumnNames is value of parameters.
619:             */
620:            public static void setColumnNames(String[] list_ColumnNames) {
621:                listColumnNames = Arrays.asList(list_ColumnNames);
622:            }
623:
624:            /**
625:             * This method read value of listColumnNames parameters.
626:             * @return value of parameters.
627:             */
628:            public static String[] getColumnNames() {
629:                String[] ret = new String[listColumnNames.size()];
630:                listColumnNames.toArray(ret);
631:                return ret;
632:            }
633:
634:            /**
635:             * This method sets value of listTargetTableNames parameters.
636:             * @param list_TargetTableNames is value of parameters.
637:             */
638:            public static void setTargetTableNames(
639:                    String[] list_TargetTableNames) {
640:                listTargetTableNames = Arrays.asList(list_TargetTableNames);
641:            }
642:
643:            /**
644:             * This method read value of listTargetTableNames parameters.
645:             * @return value of parameters.
646:             */
647:            public static String[] getTargetTableNames() {
648:                String[] ret = new String[listTargetTableNames.size()];
649:                listTargetTableNames.toArray(ret);
650:                return ret;
651:            }
652:
653:            /**
654:             * This method sets value of listTargetTableID parameters.
655:             * @param list_TargetTableID is value of parameter.
656:             */
657:            public static void setTargetTableID(String[] list_TargetTableID) {
658:                listTargetTableID = Arrays.asList(list_TargetTableID);
659:            }
660:
661:            /**
662:             * This method read value of listTargetTableID parameters.
663:             * @return value of parameters.
664:             */
665:            public static String[] getTargetTableID() {
666:                String[] ret = new String[listTargetTableID.size()];
667:                listTargetTableID.toArray(ret);
668:                return ret;
669:            }
670:
671:            /**
672:             * This method sets value of listColumnType parameters.
673:             * @param list_ColumnType is value of parameters.
674:             */
675:            public static void setColumnType(String[] list_ColumnType) {
676:                listColumnType = Arrays.asList(list_ColumnType);
677:            }
678:
679:            /**
680:             * This method read value of listColumnType parameters.
681:             * @return value of parameters.
682:             */
683:            public static String[] getColumnType() {
684:                String[] ret = new String[listColumnType.size()];
685:                listColumnType.toArray(ret);
686:                return ret;
687:            }
688:
689:            /**
690:             * This method sets value of listColumnLenght parameters.
691:             * @param list_ColumnLenght is value of parameter.
692:             */
693:            public static void setColumnLenght(String[] list_ColumnLenght) {
694:                listColumnLenght = Arrays.asList(list_ColumnLenght);
695:            }
696:
697:            /**
698:             * This method read value of listColumnLenght parameters.
699:             * @return value of parameters.
700:             */
701:            public static String[] getColumnLenght() {
702:                String[] ret = new String[listColumnLenght.size()];
703:                listColumnLenght.toArray(ret);
704:                return ret;
705:            }
706:
707:            /**
708:             * This method sets value of listAllowNulls parameters.
709:             * @param list_AllowNulls is value of parameters.
710:             */
711:            public static void setAllowNulls(String[] list_AllowNulls) {
712:                listAllowNulls = Arrays.asList(list_AllowNulls);
713:            }
714:
715:            /**
716:             * This method read value of listAllowNulls parameters.
717:             * @return value of parameters.
718:             */
719:            public static String[] getAllowNulls() {
720:                String[] ret = new String[listAllowNulls.size()];
721:                listAllowNulls.toArray(ret);
722:                return ret;
723:            }
724:
725:            /**
726:             * This method sets the value of listPrimaryKeys parameters.
727:             * @param primary_Keys is value of parameter.
728:             */
729:            public static void setPrimaryKeys(String[] primary_Keys) {
730:                listPrimaryKeys = Arrays.asList(primary_Keys);
731:            }
732:
733:            /**
734:             * This method read the value of listPrimaryKeys parameters.
735:             * @return value of parameter.
736:             */
737:            public static String[] getPrimaryKeys() {
738:                String[] ret = new String[listPrimaryKeys.size()];
739:                listPrimaryKeys.toArray(ret);
740:                return ret;
741:            }
742:
743:            /**
744:             * This method sets the value of listIndexVariables parameters.
745:             * @param index_Variables is value of parameter.
746:             */
747:            public static void setIndexVariables(String[] index_Variables) {
748:                listIndexVariables = Arrays.asList(index_Variables);
749:            }
750:
751:            /**
752:             * This method read the value of listIndexVariables parameters.
753:             * @return value of parameter.
754:             */
755:            public static String[] getIndexVariables() {
756:                String[] ret = new String[listIndexVariables.size()];
757:                listIndexVariables.toArray(ret);
758:                return ret;
759:            }
760:
761:            /**
762:             * This method sets the value of listForeignVariables parameters.
763:             * @param foreign_Variables is the value of parameter.
764:             */
765:            public static void setForeignVariables(String[] foreign_Variables) {
766:                listForeignVariables = Arrays.asList(foreign_Variables);
767:            }
768:
769:            /**
770:             * This method read the value of listForeignVariables parameters.
771:             * @return value of parameter.
772:             */
773:            public static String[] getForeignVariables() {
774:                String[] ret = new String[listForeignVariables.size()];
775:                listForeignVariables.toArray(ret);
776:                return ret;
777:            }
778:
779:            /**
780:             * This method will set logger object
781:             * @param logger
782:             */
783:            private void setLogger() {
784:                this.logger = StandardLogger.getCentralLogger();
785:            }
786:
787:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.