Source Code Cross Referenced for DODSApplicationMappingAdmin.java in  » Workflow-Engines » shark » org » enhydra » shark » appmappersistence » 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 » Workflow Engines » shark » org.enhydra.shark.appmappersistence 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        package org.enhydra.shark.appmappersistence;
0002:
0003:        import java.math.BigDecimal;
0004:        import java.util.ArrayList;
0005:        import java.util.List;
0006:
0007:        import org.enhydra.dods.DODS;
0008:        import org.enhydra.shark.api.admin.ApplicationMappingManagerAdmin;
0009:        import org.enhydra.shark.api.client.wfmc.wapi.WMSessionHandle;
0010:        import org.enhydra.shark.api.internal.appmappersistence.ApplicationMap;
0011:        import org.enhydra.shark.api.internal.working.CallbackUtilities;
0012:        import org.enhydra.shark.appmappersistence.data.PackLevelXPDLAppDO;
0013:        import org.enhydra.shark.appmappersistence.data.PackLevelXPDLAppQuery;
0014:        import org.enhydra.shark.appmappersistence.data.PackLevelXPDLAppTAAppDetailDO;
0015:        import org.enhydra.shark.appmappersistence.data.PackLevelXPDLAppTAAppDetailQuery;
0016:        import org.enhydra.shark.appmappersistence.data.PackLevelXPDLAppTAAppDetailUsrDO;
0017:        import org.enhydra.shark.appmappersistence.data.PackLevelXPDLAppTAAppDetailUsrQuery;
0018:        import org.enhydra.shark.appmappersistence.data.PackLevelXPDLAppTAAppUserDO;
0019:        import org.enhydra.shark.appmappersistence.data.PackLevelXPDLAppTAAppUserQuery;
0020:        import org.enhydra.shark.appmappersistence.data.PackLevelXPDLAppToolAgentAppDO;
0021:        import org.enhydra.shark.appmappersistence.data.PackLevelXPDLAppToolAgentAppQuery;
0022:        import org.enhydra.shark.appmappersistence.data.ProcLevelXPDLAppDO;
0023:        import org.enhydra.shark.appmappersistence.data.ProcLevelXPDLAppQuery;
0024:        import org.enhydra.shark.appmappersistence.data.ProcLevelXPDLAppTAAppDetailDO;
0025:        import org.enhydra.shark.appmappersistence.data.ProcLevelXPDLAppTAAppDetailQuery;
0026:        import org.enhydra.shark.appmappersistence.data.ProcLevelXPDLAppTAAppDetailUsrDO;
0027:        import org.enhydra.shark.appmappersistence.data.ProcLevelXPDLAppTAAppDetailUsrQuery;
0028:        import org.enhydra.shark.appmappersistence.data.ProcLevelXPDLAppTAAppUserDO;
0029:        import org.enhydra.shark.appmappersistence.data.ProcLevelXPDLAppTAAppUserQuery;
0030:        import org.enhydra.shark.appmappersistence.data.ProcLevelXPDLAppToolAgentAppDO;
0031:        import org.enhydra.shark.appmappersistence.data.ProcLevelXPDLAppToolAgentAppQuery;
0032:        import org.enhydra.shark.appmappersistence.data.ToolAgentAppDO;
0033:        import org.enhydra.shark.appmappersistence.data.ToolAgentAppDetailDO;
0034:        import org.enhydra.shark.appmappersistence.data.ToolAgentAppDetailQuery;
0035:        import org.enhydra.shark.appmappersistence.data.ToolAgentAppDetailUserDO;
0036:        import org.enhydra.shark.appmappersistence.data.ToolAgentAppDetailUserQuery;
0037:        import org.enhydra.shark.appmappersistence.data.ToolAgentAppQuery;
0038:        import org.enhydra.shark.appmappersistence.data.ToolAgentAppUserDO;
0039:        import org.enhydra.shark.appmappersistence.data.ToolAgentAppUserQuery;
0040:        import org.enhydra.shark.appmappersistence.data.ToolAgentUserDO;
0041:        import org.enhydra.shark.appmappersistence.data.ToolAgentUserQuery;
0042:        import org.enhydra.shark.appmappersistence.data.XPDLApplicationPackageDO;
0043:        import org.enhydra.shark.appmappersistence.data.XPDLApplicationPackageQuery;
0044:        import org.enhydra.shark.appmappersistence.data.XPDLApplicationProcessDO;
0045:        import org.enhydra.shark.appmappersistence.data.XPDLApplicationProcessQuery;
0046:        import org.enhydra.shark.utilities.dods.DODSUtilities;
0047:
0048:        import com.lutris.appserver.server.sql.DBTransaction;
0049:        import com.lutris.appserver.server.sql.DatabaseManagerException;
0050:        import com.lutris.appserver.server.sql.LogicalDatabase;
0051:
0052:        /**
0053:         * Implementation of ApplicationMappingsManager interface
0054:         * 
0055:         * @author Zoran Milakovic
0056:         * @author Tanja Jovanovic
0057:         */
0058:        public class DODSApplicationMappingAdmin implements 
0059:                ApplicationMappingManagerAdmin {
0060:
0061:            public static final String LDB_PARAM_NAME = "DODSApplicationMappingAdmin.DatabaseName";
0062:
0063:            protected static LogicalDatabase db;
0064:
0065:            public void configure(CallbackUtilities cus) throws Exception {
0066:                if (null == cus) {
0067:                    throw new Exception(
0068:                            "Cannot configure without call back impl.");
0069:                }
0070:                DODSUtilities.init(cus.getProperties());
0071:
0072:                String dbName = cus.getProperty(LDB_PARAM_NAME, DODS
0073:                        .getDatabaseManager().getDefaultDB());
0074:                try {
0075:                    db = DODS.getDatabaseManager().findLogicalDatabase(dbName);
0076:
0077:                } catch (Exception e) {
0078:                    cus.error(null, "Couldn't find logical database " + dbName,
0079:                            e);
0080:                    throw e;
0081:                }
0082:
0083:                setLDBName();
0084:            }
0085:
0086:            /**
0087:             * Method saveApplicationMapping save new application mapping in database.
0088:             * 
0089:             * @param am an ApplicationMap
0090:             * @return a boolean
0091:             * @exception Exception
0092:             */
0093:            public boolean saveApplicationMapping(ApplicationMap am)
0094:                    throws Exception {
0095:                boolean retVal = true;
0096:                if (!checkValidity(am)) {
0097:                    throw new Exception("Application mapping is not valid");
0098:                }
0099:                DBTransaction dbt = getDBTransaction();
0100:                if (am.getProcessDefinitionId() != null) {
0101:                    if (am.getApplicationMode() != null) {
0102:                        if (am.getUsername() != null) {
0103:                            ProcLevelXPDLAppDO procLevelXPDLAppDO = this 
0104:                                    .checkProcLevelXPDLApp(am);
0105:                            ToolAgentAppDetailUserDO toolAgentAppDetailUserDO = this 
0106:                                    .checkToolAgentAppDetailUser(am);
0107:                            ProcLevelXPDLAppTAAppDetailUsrDO saveDO = ProcLevelXPDLAppTAAppDetailUsrDO
0108:                                    .createVirgin(dbt);
0109:                            saveDO.setXPDL_APPOID(procLevelXPDLAppDO);
0110:                            saveDO.setTOOLAGENTOID(toolAgentAppDetailUserDO);
0111:                            saveDO.save();
0112:                        } else { // if(am.getUsername() != null)
0113:                            ProcLevelXPDLAppDO procLevelXPDLAppDO = this 
0114:                                    .checkProcLevelXPDLApp(am);
0115:                            ToolAgentAppDetailDO toolAgentAppDetailDO = this 
0116:                                    .checkToolAgentAppDetail(am);
0117:                            ProcLevelXPDLAppTAAppDetailDO saveDO = ProcLevelXPDLAppTAAppDetailDO
0118:                                    .createVirgin(dbt);
0119:                            saveDO.setXPDL_APPOID(procLevelXPDLAppDO);
0120:                            saveDO.setTOOLAGENTOID(toolAgentAppDetailDO);
0121:                            saveDO.save();
0122:                        }
0123:                    } else { // if (am.getApplicationMode() != null)
0124:                        if (am.getUsername() != null) {
0125:                            ProcLevelXPDLAppDO procLevelXPDLAppDO = this 
0126:                                    .checkProcLevelXPDLApp(am);
0127:                            ToolAgentAppUserDO toolAgentAppUserDO = this 
0128:                                    .checkToolAgentAppUser(am);
0129:                            ProcLevelXPDLAppTAAppUserDO saveDO = ProcLevelXPDLAppTAAppUserDO
0130:                                    .createVirgin(dbt);
0131:                            saveDO.setXPDL_APPOID(procLevelXPDLAppDO);
0132:                            saveDO.setTOOLAGENTOID(toolAgentAppUserDO);
0133:                            saveDO.save();
0134:                        } else { // if(am.getUsername() != null)
0135:                            ProcLevelXPDLAppDO procLevelXPDLAppDO = this 
0136:                                    .checkProcLevelXPDLApp(am);
0137:                            ToolAgentAppDO toolAgentAppDO = this 
0138:                                    .checkToolAgentApp(am);
0139:                            ProcLevelXPDLAppToolAgentAppDO saveDO = ProcLevelXPDLAppToolAgentAppDO
0140:                                    .createVirgin(dbt);
0141:                            saveDO.setXPDL_APPOID(procLevelXPDLAppDO);
0142:                            saveDO.setTOOLAGENTOID(toolAgentAppDO);
0143:                            saveDO.save();
0144:                        }
0145:                    }
0146:
0147:                } else { // if (am.getProcessDefinitionId())
0148:                    if (am.getApplicationMode() != null) {
0149:                        if (am.getUsername() != null) {
0150:                            PackLevelXPDLAppDO packLevelXPDLAppDO = this 
0151:                                    .checkPackLevelXPDLApp(am);
0152:                            ToolAgentAppDetailUserDO toolAgentAppDetailUserDO = this 
0153:                                    .checkToolAgentAppDetailUser(am);
0154:                            PackLevelXPDLAppTAAppDetailUsrDO saveDO = PackLevelXPDLAppTAAppDetailUsrDO
0155:                                    .createVirgin(dbt);
0156:                            saveDO.setXPDL_APPOID(packLevelXPDLAppDO);
0157:                            saveDO.setTOOLAGENTOID(toolAgentAppDetailUserDO);
0158:                            saveDO.save();
0159:                        } else { // if(am.getUsername() != null)
0160:                            PackLevelXPDLAppDO packLevelXPDLAppDO = this 
0161:                                    .checkPackLevelXPDLApp(am);
0162:                            ToolAgentAppDetailDO toolAgentAppDetailDO = this 
0163:                                    .checkToolAgentAppDetail(am);
0164:                            PackLevelXPDLAppTAAppDetailDO saveDO = PackLevelXPDLAppTAAppDetailDO
0165:                                    .createVirgin(dbt);
0166:                            saveDO.setXPDL_APPOID(packLevelXPDLAppDO);
0167:                            saveDO.setTOOLAGENTOID(toolAgentAppDetailDO);
0168:                            saveDO.save();
0169:                        }
0170:                    } else { // if (am.getApplicationMode() != null)
0171:                        if (am.getUsername() != null) {
0172:                            PackLevelXPDLAppDO packLevelXPDLAppDO = this 
0173:                                    .checkPackLevelXPDLApp(am);
0174:                            ToolAgentAppUserDO toolAgentAppUserDO = this 
0175:                                    .checkToolAgentAppUser(am);
0176:                            PackLevelXPDLAppTAAppUserDO saveDO = PackLevelXPDLAppTAAppUserDO
0177:                                    .createVirgin(dbt);
0178:                            saveDO.setXPDL_APPOID(packLevelXPDLAppDO);
0179:                            saveDO.setTOOLAGENTOID(toolAgentAppUserDO);
0180:                            saveDO.save();
0181:                        } else { // if(am.getUsername() != null)
0182:                            PackLevelXPDLAppDO packLevelXPDLAppDO = this 
0183:                                    .checkPackLevelXPDLApp(am);
0184:                            ToolAgentAppDO toolAgentAppDO = this 
0185:                                    .checkToolAgentApp(am);
0186:                            PackLevelXPDLAppToolAgentAppDO saveDO = PackLevelXPDLAppToolAgentAppDO
0187:                                    .createVirgin(dbt);
0188:                            saveDO.setXPDL_APPOID(packLevelXPDLAppDO);
0189:                            saveDO.setTOOLAGENTOID(toolAgentAppDO);
0190:                            saveDO.save();
0191:                        }
0192:                    }
0193:                }
0194:
0195:                return retVal;
0196:            }
0197:
0198:            public ApplicationMap[] getAllApplicationMappings()
0199:                    throws Exception {
0200:                List list = new ArrayList();
0201:                DBTransaction dbt = getDBTransaction();
0202:                // package level, mode, username and password not defined
0203:                PackLevelXPDLAppToolAgentAppQuery packLevelXPDLAppToolAgentAppQuery = new PackLevelXPDLAppToolAgentAppQuery(
0204:                        dbt);
0205:                PackLevelXPDLAppToolAgentAppDO[] packLevelXPDLAppToolAgentAppDOArray = packLevelXPDLAppToolAgentAppQuery
0206:                        .getDOArray();
0207:                for (int i = 0; i < packLevelXPDLAppToolAgentAppDOArray.length; i++) {
0208:                    ApplicationMap am = this .createApplicationMap();
0209:                    am
0210:                            .setApplicationDefinitionId(packLevelXPDLAppToolAgentAppDOArray[i]
0211:                                    .getXPDL_APPOID().getAPPLICATION_ID());
0212:                    am.setPackageId(packLevelXPDLAppToolAgentAppDOArray[i]
0213:                            .getXPDL_APPOID().getPACKAGEOID().getPACKAGE_ID());
0214:                    am.setProcessDefinitionId(null);
0215:                    am
0216:                            .setToolAgentClassName(packLevelXPDLAppToolAgentAppDOArray[i]
0217:                                    .getTOOLAGENTOID().getTOOL_AGENT_NAME());
0218:                    am
0219:                            .setApplicationName(packLevelXPDLAppToolAgentAppDOArray[i]
0220:                                    .getTOOLAGENTOID().getAPP_NAME());
0221:                    am.setApplicationMode(null);
0222:                    am.setUsername(null);
0223:                    am.setPassword(null);
0224:                    list.add(am);
0225:                }
0226:
0227:                // package level, mode defined, username and password not
0228:                // defined
0229:                PackLevelXPDLAppTAAppDetailQuery packLevelXPDLAppToolAgentAppDetailQuery = new PackLevelXPDLAppTAAppDetailQuery(
0230:                        dbt);
0231:                PackLevelXPDLAppTAAppDetailDO[] packLevelXPDLAppToolAgentAppDetailDOArray = packLevelXPDLAppToolAgentAppDetailQuery
0232:                        .getDOArray();
0233:                for (int i = 0; i < packLevelXPDLAppToolAgentAppDetailDOArray.length; i++) {
0234:                    ApplicationMap am = this .createApplicationMap();
0235:                    am
0236:                            .setApplicationDefinitionId(packLevelXPDLAppToolAgentAppDetailDOArray[i]
0237:                                    .getXPDL_APPOID().getAPPLICATION_ID());
0238:                    am
0239:                            .setPackageId(packLevelXPDLAppToolAgentAppDetailDOArray[i]
0240:                                    .getXPDL_APPOID().getPACKAGEOID()
0241:                                    .getPACKAGE_ID());
0242:                    am.setProcessDefinitionId(null);
0243:                    am
0244:                            .setToolAgentClassName(packLevelXPDLAppToolAgentAppDetailDOArray[i]
0245:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0246:                                    .getTOOL_AGENT_NAME());
0247:                    am
0248:                            .setApplicationName(packLevelXPDLAppToolAgentAppDetailDOArray[i]
0249:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0250:                                    .getAPP_NAME());
0251:                    am
0252:                            .setApplicationMode(new Integer(
0253:                                    packLevelXPDLAppToolAgentAppDetailDOArray[i]
0254:                                            .getTOOLAGENTOID().getAPP_MODE()
0255:                                            .intValue()));
0256:                    am.setUsername(null);
0257:                    am.setPassword(null);
0258:                    list.add(am);
0259:                }
0260:
0261:                // package level, mode not defined, username and password
0262:                // defined
0263:                PackLevelXPDLAppTAAppUserQuery packLevelXPDLAppToolAgentAppUserQuery = new PackLevelXPDLAppTAAppUserQuery(
0264:                        dbt);
0265:                PackLevelXPDLAppTAAppUserDO[] packLevelXPDLAppToolAgentAppUserDOArray = packLevelXPDLAppToolAgentAppUserQuery
0266:                        .getDOArray();
0267:                for (int i = 0; i < packLevelXPDLAppToolAgentAppUserDOArray.length; i++) {
0268:                    ApplicationMap am = this .createApplicationMap();
0269:                    am
0270:                            .setApplicationDefinitionId(packLevelXPDLAppToolAgentAppUserDOArray[i]
0271:                                    .getXPDL_APPOID().getAPPLICATION_ID());
0272:                    am.setPackageId(packLevelXPDLAppToolAgentAppUserDOArray[i]
0273:                            .getXPDL_APPOID().getPACKAGEOID().getPACKAGE_ID());
0274:                    am.setProcessDefinitionId(null);
0275:                    am
0276:                            .setToolAgentClassName(packLevelXPDLAppToolAgentAppUserDOArray[i]
0277:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0278:                                    .getTOOL_AGENT_NAME());
0279:                    am
0280:                            .setApplicationName(packLevelXPDLAppToolAgentAppUserDOArray[i]
0281:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0282:                                    .getAPP_NAME());
0283:                    am.setApplicationMode(null);
0284:                    am.setUsername(packLevelXPDLAppToolAgentAppUserDOArray[i]
0285:                            .getTOOLAGENTOID().getUSEROID().getUSERNAME());
0286:                    am.setPassword(packLevelXPDLAppToolAgentAppUserDOArray[i]
0287:                            .getTOOLAGENTOID().getUSEROID().getPWD());
0288:                    list.add(am);
0289:                }
0290:
0291:                // package level, mode, username and password defined
0292:                PackLevelXPDLAppTAAppDetailUsrQuery packLevelXPDLAppToolAgentAppDetailUserQuery = new PackLevelXPDLAppTAAppDetailUsrQuery(
0293:                        dbt);
0294:                PackLevelXPDLAppTAAppDetailUsrDO[] packLevelXPDLAppToolAgentAppDetailUserDOArray = packLevelXPDLAppToolAgentAppDetailUserQuery
0295:                        .getDOArray();
0296:                for (int i = 0; i < packLevelXPDLAppToolAgentAppDetailUserDOArray.length; i++) {
0297:                    ApplicationMap am = this .createApplicationMap();
0298:                    am
0299:                            .setApplicationDefinitionId(packLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0300:                                    .getXPDL_APPOID().getAPPLICATION_ID());
0301:                    am
0302:                            .setPackageId(packLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0303:                                    .getXPDL_APPOID().getPACKAGEOID()
0304:                                    .getPACKAGE_ID());
0305:                    am.setProcessDefinitionId(null);
0306:                    am
0307:                            .setToolAgentClassName(packLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0308:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0309:                                    .getTOOLAGENT_APPOID().getTOOL_AGENT_NAME());
0310:                    am
0311:                            .setApplicationName(packLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0312:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0313:                                    .getTOOLAGENT_APPOID().getAPP_NAME());
0314:                    am.setApplicationMode(new Integer(
0315:                            packLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0316:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0317:                                    .getAPP_MODE().intValue()));
0318:                    am
0319:                            .setUsername(packLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0320:                                    .getTOOLAGENTOID().getUSEROID()
0321:                                    .getUSERNAME());
0322:                    am
0323:                            .setPassword(packLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0324:                                    .getTOOLAGENTOID().getUSEROID().getPWD());
0325:                    list.add(am);
0326:                }
0327:
0328:                // process level, mode, username and password not defined
0329:                ProcLevelXPDLAppToolAgentAppQuery procLevelXPDLAppToolAgentAppQuery = new ProcLevelXPDLAppToolAgentAppQuery(
0330:                        dbt);
0331:                ProcLevelXPDLAppToolAgentAppDO[] procLevelXPDLAppToolAgentAppDOArray = procLevelXPDLAppToolAgentAppQuery
0332:                        .getDOArray();
0333:                for (int i = 0; i < procLevelXPDLAppToolAgentAppDOArray.length; i++) {
0334:                    ApplicationMap am = this .createApplicationMap();
0335:                    am
0336:                            .setApplicationDefinitionId(procLevelXPDLAppToolAgentAppDOArray[i]
0337:                                    .getXPDL_APPOID().getAPPLICATION_ID());
0338:                    am.setPackageId(procLevelXPDLAppToolAgentAppDOArray[i]
0339:                            .getXPDL_APPOID().getPROCESSOID().getPACKAGEOID()
0340:                            .getPACKAGE_ID());
0341:                    am
0342:                            .setProcessDefinitionId(procLevelXPDLAppToolAgentAppDOArray[i]
0343:                                    .getXPDL_APPOID().getPROCESSOID()
0344:                                    .getPROCESS_ID());
0345:                    am
0346:                            .setToolAgentClassName(procLevelXPDLAppToolAgentAppDOArray[i]
0347:                                    .getTOOLAGENTOID().getTOOL_AGENT_NAME());
0348:                    am
0349:                            .setApplicationName(procLevelXPDLAppToolAgentAppDOArray[i]
0350:                                    .getTOOLAGENTOID().getAPP_NAME());
0351:                    am.setApplicationMode(null);
0352:                    am.setUsername(null);
0353:                    am.setPassword(null);
0354:                    list.add(am);
0355:                }
0356:
0357:                // process level, mode defined, username and password not
0358:                // defined
0359:                ProcLevelXPDLAppTAAppDetailQuery procLevelXPDLAppToolAgentAppDetailQuery = new ProcLevelXPDLAppTAAppDetailQuery(
0360:                        dbt);
0361:                ProcLevelXPDLAppTAAppDetailDO[] procLevelXPDLAppToolAgentAppDetailDOArray = procLevelXPDLAppToolAgentAppDetailQuery
0362:                        .getDOArray();
0363:                for (int i = 0; i < procLevelXPDLAppToolAgentAppDetailDOArray.length; i++) {
0364:                    ApplicationMap am = this .createApplicationMap();
0365:                    am
0366:                            .setApplicationDefinitionId(procLevelXPDLAppToolAgentAppDetailDOArray[i]
0367:                                    .getXPDL_APPOID().getAPPLICATION_ID());
0368:                    am
0369:                            .setPackageId(procLevelXPDLAppToolAgentAppDetailDOArray[i]
0370:                                    .getXPDL_APPOID().getPROCESSOID()
0371:                                    .getPACKAGEOID().getPACKAGE_ID());
0372:                    am
0373:                            .setProcessDefinitionId(procLevelXPDLAppToolAgentAppDetailDOArray[i]
0374:                                    .getXPDL_APPOID().getPROCESSOID()
0375:                                    .getPROCESS_ID());
0376:                    am
0377:                            .setToolAgentClassName(procLevelXPDLAppToolAgentAppDetailDOArray[i]
0378:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0379:                                    .getTOOL_AGENT_NAME());
0380:                    am
0381:                            .setApplicationName(procLevelXPDLAppToolAgentAppDetailDOArray[i]
0382:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0383:                                    .getAPP_NAME());
0384:                    am
0385:                            .setApplicationMode(new Integer(
0386:                                    procLevelXPDLAppToolAgentAppDetailDOArray[i]
0387:                                            .getTOOLAGENTOID().getAPP_MODE()
0388:                                            .intValue()));
0389:                    am.setUsername(null);
0390:                    am.setPassword(null);
0391:                    list.add(am);
0392:                }
0393:
0394:                // process level, mode not defined, username and password
0395:                // defined
0396:                ProcLevelXPDLAppTAAppUserQuery procLevelXPDLAppToolAgentAppUserQuery = new ProcLevelXPDLAppTAAppUserQuery(
0397:                        dbt);
0398:                ProcLevelXPDLAppTAAppUserDO[] procLevelXPDLAppToolAgentAppUserDOArray = procLevelXPDLAppToolAgentAppUserQuery
0399:                        .getDOArray();
0400:                for (int i = 0; i < procLevelXPDLAppToolAgentAppUserDOArray.length; i++) {
0401:                    ApplicationMap am = this .createApplicationMap();
0402:                    am
0403:                            .setApplicationDefinitionId(procLevelXPDLAppToolAgentAppUserDOArray[i]
0404:                                    .getXPDL_APPOID().getAPPLICATION_ID());
0405:                    am.setPackageId(procLevelXPDLAppToolAgentAppUserDOArray[i]
0406:                            .getXPDL_APPOID().getPROCESSOID().getPACKAGEOID()
0407:                            .getPACKAGE_ID());
0408:                    am
0409:                            .setProcessDefinitionId(procLevelXPDLAppToolAgentAppUserDOArray[i]
0410:                                    .getXPDL_APPOID().getPROCESSOID()
0411:                                    .getPROCESS_ID());
0412:                    am
0413:                            .setToolAgentClassName(procLevelXPDLAppToolAgentAppUserDOArray[i]
0414:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0415:                                    .getTOOL_AGENT_NAME());
0416:                    am
0417:                            .setApplicationName(procLevelXPDLAppToolAgentAppUserDOArray[i]
0418:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0419:                                    .getAPP_NAME());
0420:                    am.setApplicationMode(null);
0421:                    am.setUsername(procLevelXPDLAppToolAgentAppUserDOArray[i]
0422:                            .getTOOLAGENTOID().getUSEROID().getUSERNAME());
0423:                    am.setPassword(procLevelXPDLAppToolAgentAppUserDOArray[i]
0424:                            .getTOOLAGENTOID().getUSEROID().getPWD());
0425:                    list.add(am);
0426:                }
0427:
0428:                // process level, mode, username and password defined
0429:                ProcLevelXPDLAppTAAppDetailUsrQuery procLevelXPDLAppToolAgentAppDetailUserQuery = new ProcLevelXPDLAppTAAppDetailUsrQuery(
0430:                        dbt);
0431:                ProcLevelXPDLAppTAAppDetailUsrDO[] procLevelXPDLAppToolAgentAppDetailUserDOArray = procLevelXPDLAppToolAgentAppDetailUserQuery
0432:                        .getDOArray();
0433:                for (int i = 0; i < procLevelXPDLAppToolAgentAppDetailUserDOArray.length; i++) {
0434:                    ApplicationMap am = this .createApplicationMap();
0435:                    am
0436:                            .setApplicationDefinitionId(procLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0437:                                    .getXPDL_APPOID().getAPPLICATION_ID());
0438:                    am
0439:                            .setPackageId(procLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0440:                                    .getXPDL_APPOID().getPROCESSOID()
0441:                                    .getPACKAGEOID().getPACKAGE_ID());
0442:                    am
0443:                            .setProcessDefinitionId(procLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0444:                                    .getXPDL_APPOID().getPROCESSOID()
0445:                                    .getPROCESS_ID());
0446:                    am
0447:                            .setToolAgentClassName(procLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0448:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0449:                                    .getTOOLAGENT_APPOID().getTOOL_AGENT_NAME());
0450:                    am
0451:                            .setApplicationName(procLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0452:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0453:                                    .getTOOLAGENT_APPOID().getAPP_NAME());
0454:                    am.setApplicationMode(new Integer(
0455:                            procLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0456:                                    .getTOOLAGENTOID().getTOOLAGENT_APPOID()
0457:                                    .getAPP_MODE().intValue()));
0458:                    am
0459:                            .setUsername(procLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0460:                                    .getTOOLAGENTOID().getUSEROID()
0461:                                    .getUSERNAME());
0462:                    am
0463:                            .setPassword(procLevelXPDLAppToolAgentAppDetailUserDOArray[i]
0464:                                    .getTOOLAGENTOID().getUSEROID().getPWD());
0465:                    list.add(am);
0466:                }
0467:
0468:                // return list with all application mappings
0469:                ApplicationMap[] ret = new ApplicationMap[list.size()];
0470:                list.toArray(ret);
0471:                return ret;
0472:            }
0473:
0474:            public ApplicationMap createApplicationMap() {
0475:                return new ApplicationMap();
0476:            }
0477:
0478:            /**
0479:             * Method deleteApplicationMapping delete specified application mapping from database.
0480:             * 
0481:             * @param am an ApplicationMap
0482:             * @return a boolean
0483:             * @exception Exception
0484:             */
0485:            public boolean deleteApplicationMappingByMap(ApplicationMap am)
0486:                    throws Exception {
0487:                boolean retVal = true;
0488:                String processId = am.getProcessDefinitionId();
0489:                Integer appModeInt = am.getApplicationMode();
0490:                String username = am.getUsername();
0491:
0492:                if (processId != null) {
0493:                    if (appModeInt != null) {
0494:                        if (username != null) {
0495:                            this 
0496:                                    .deleteProcLevelXPDLAppToolAgentAppDetailUser(am);
0497:                        } else { // if(username != null)
0498:                            this .deleteProcLevelXPDLAppToolAgentAppDetail(am);
0499:                        }
0500:                    } else { // if appModeInt != nul)
0501:                        if (username != null) {
0502:                            this .deleteProcLevelXPDLAppToolAgentAppUser(am);
0503:                        } else { // if(username != null)
0504:                            this .deleteProcLevelXPDLAppToolAgentApp(am);
0505:                        }
0506:                    }
0507:                } else { // if (processId != null)
0508:                    if (appModeInt != null) {
0509:                        if (username != null) {
0510:                            this 
0511:                                    .deletePackLevelXPDLAppToolAgentAppDetailUser(am);
0512:                        } else { // if(username() != null)
0513:                            this .deletePackLevelXPDLAppToolAgentAppDetail(am);
0514:                        }
0515:                    } else { // if (appModeInt != null)
0516:                        if (username != null) {
0517:                            this .deletePackLevelXPDLAppToolAgentAppUser(am);
0518:                        } else { // if(username() != null)
0519:                            this .deletePackLevelXPDLAppToolAgentApp(am);
0520:                        }
0521:                    }
0522:                }
0523:
0524:                return retVal;
0525:            }
0526:
0527:            public boolean deleteApplicationMapping(String packageId,
0528:                    String packageVersion, String processDefinitionId,
0529:                    String applicationId) throws Exception {
0530:
0531:                boolean retVal = true;
0532:                DBTransaction dbt = getDBTransaction();
0533:                // empty string is same as null
0534:                if (processDefinitionId != null
0535:                        && processDefinitionId.trim().equals(""))
0536:                    processDefinitionId = null;
0537:                ApplicationMap am = this .createApplicationMap();
0538:                am.setPackageId(packageId);
0539:                am.setProcessDefinitionId(processDefinitionId);
0540:                am.setApplicationDefinitionId(applicationId);
0541:
0542:                // appMode, username and password not defined
0543:                ToolAgentAppQuery toolAgentAppQuery = new ToolAgentAppQuery(dbt);
0544:                ToolAgentAppDO[] toolAgentAppDOArr = toolAgentAppQuery
0545:                        .getDOArray();
0546:                for (int i = 0; i < toolAgentAppDOArr.length; i++) {
0547:                    am.setToolAgentClassName(toolAgentAppDOArr[i]
0548:                            .getTOOL_AGENT_NAME());
0549:                    am.setApplicationName(toolAgentAppDOArr[i].getAPP_NAME());
0550:                    am.setApplicationMode(null);
0551:                    am.setUsername(null);
0552:                    am.setPassword(null);
0553:                    if (processDefinitionId != null) {
0554:                        this .deleteProcLevelXPDLAppToolAgentApp(am);
0555:                    } else {
0556:                        this .deletePackLevelXPDLAppToolAgentApp(am);
0557:                    }
0558:                }
0559:
0560:                // appMode defined, username and password not defined
0561:                ToolAgentAppDetailQuery toolAgentAppDetailQuery = new ToolAgentAppDetailQuery(
0562:                        dbt);
0563:                ToolAgentAppDetailDO[] toolAgentAppDetailDOArr = toolAgentAppDetailQuery
0564:                        .getDOArray();
0565:                for (int i = 0; i < toolAgentAppDetailDOArr.length; i++) {
0566:                    am
0567:                            .setApplicationMode(new Integer(
0568:                                    toolAgentAppDetailDOArr[i].getAPP_MODE()
0569:                                            .intValue()));
0570:                    am.setToolAgentClassName(toolAgentAppDetailDOArr[i]
0571:                            .getTOOLAGENT_APPOID().getTOOL_AGENT_NAME());
0572:                    am.setApplicationName(toolAgentAppDetailDOArr[i]
0573:                            .getTOOLAGENT_APPOID().getAPP_NAME());
0574:                    am.setUsername(null);
0575:                    am.setPassword(null);
0576:                    if (processDefinitionId != null) {
0577:                        this .deleteProcLevelXPDLAppToolAgentAppDetail(am);
0578:                    } else {
0579:                        this .deletePackLevelXPDLAppToolAgentAppDetail(am);
0580:                    }
0581:                }
0582:
0583:                // appMode not defined, username and password defined
0584:                ToolAgentAppUserQuery toolAgentAppUserQuery = new ToolAgentAppUserQuery(
0585:                        dbt);
0586:                ToolAgentAppUserDO[] toolAgentAppUserDOArr = toolAgentAppUserQuery
0587:                        .getDOArray();
0588:                for (int i = 0; i < toolAgentAppUserDOArr.length; i++) {
0589:                    am.setUsername(toolAgentAppUserDOArr[i].getUSEROID()
0590:                            .getUSERNAME());
0591:                    am.setPassword(toolAgentAppUserDOArr[i].getUSEROID()
0592:                            .getPWD());
0593:                    am.setToolAgentClassName(toolAgentAppUserDOArr[i]
0594:                            .getTOOLAGENT_APPOID().getTOOL_AGENT_NAME());
0595:                    am.setApplicationName(toolAgentAppUserDOArr[i]
0596:                            .getTOOLAGENT_APPOID().getAPP_NAME());
0597:                    am.setApplicationMode(null);
0598:                    if (processDefinitionId != null) {
0599:                        this .deleteProcLevelXPDLAppToolAgentAppUser(am);
0600:                    } else {
0601:                        this .deletePackLevelXPDLAppToolAgentAppUser(am);
0602:                    }
0603:                }
0604:
0605:                // appMode, username and password defined
0606:                ToolAgentAppDetailUserQuery toolAgentAppDetailUserQuery = new ToolAgentAppDetailUserQuery(
0607:                        dbt);
0608:                ToolAgentAppDetailUserDO[] toolAgentAppDetailUserDOArr = toolAgentAppDetailUserQuery
0609:                        .getDOArray();
0610:                for (int i = 0; i < toolAgentAppDetailUserDOArr.length; i++) {
0611:                    am.setApplicationMode(new Integer(
0612:                            toolAgentAppDetailUserDOArr[i]
0613:                                    .getTOOLAGENT_APPOID().getAPP_MODE()
0614:                                    .intValue()));
0615:                    am.setUsername(toolAgentAppDetailUserDOArr[i].getUSEROID()
0616:                            .getUSERNAME());
0617:                    am.setPassword(toolAgentAppDetailUserDOArr[i].getUSEROID()
0618:                            .getPWD());
0619:                    am.setToolAgentClassName(toolAgentAppDetailUserDOArr[i]
0620:                            .getTOOLAGENT_APPOID().getTOOLAGENT_APPOID()
0621:                            .getTOOL_AGENT_NAME());
0622:                    am.setApplicationName(toolAgentAppDetailUserDOArr[i]
0623:                            .getTOOLAGENT_APPOID().getTOOLAGENT_APPOID()
0624:                            .getAPP_NAME());
0625:                    if (processDefinitionId != null) {
0626:                        this .deleteProcLevelXPDLAppToolAgentAppDetailUser(am);
0627:                    } else {
0628:                        this .deletePackLevelXPDLAppToolAgentAppDetailUser(am);
0629:                    }
0630:                }
0631:                return retVal;
0632:                /*
0633:                 * ApplicationMap am = this.createApplicationMap(); am.setPackageId(packageId);
0634:                 * am.setProcessDefinitionId(processDefinitionId);
0635:                 * am.setApplicationDefinitionId(applicationId); return
0636:                 * this.deleteApplicationMapping(trans, am);
0637:                 */
0638:            }
0639:
0640:            public ApplicationMap getApplicationMap(WMSessionHandle shandle,
0641:                    String packageId, String pkgVer,
0642:                    String processDefinitionId, String applicationDefinitionId)
0643:                    throws Exception {
0644:                ApplicationMap am = null;
0645:
0646:                DBTransaction dbt = getDBTransaction();
0647:                // empty string is same as null
0648:                if (processDefinitionId != null
0649:                        && processDefinitionId.trim().equals(""))
0650:                    processDefinitionId = null;
0651:
0652:                if (processDefinitionId == null) {
0653:
0654:                    XPDLApplicationPackageQuery packageQuery = new XPDLApplicationPackageQuery(
0655:                            dbt);
0656:                    packageQuery.setQueryPACKAGE_ID(packageId);
0657:                    packageQuery.requireUniqueInstance();
0658:                    XPDLApplicationPackageDO packageDO = packageQuery
0659:                            .getNextDO();
0660:
0661:                    PackLevelXPDLAppQuery packLevelXPDLAppQuery = new PackLevelXPDLAppQuery(
0662:                            dbt);
0663:                    packLevelXPDLAppQuery
0664:                            .setQueryAPPLICATION_ID(applicationDefinitionId);
0665:                    packLevelXPDLAppQuery.setQueryPACKAGEOID(packageDO);
0666:                    packLevelXPDLAppQuery.requireUniqueInstance();
0667:                    PackLevelXPDLAppDO packLevelXPDLAppDO = packLevelXPDLAppQuery
0668:                            .getNextDO();
0669:
0670:                    // package level, mode, username and password not defined
0671:                    PackLevelXPDLAppToolAgentAppQuery packLevelXPDLAppToolAgentAppQuery = new PackLevelXPDLAppToolAgentAppQuery(
0672:                            dbt);
0673:                    packLevelXPDLAppToolAgentAppQuery
0674:                            .setQueryXPDL_APPOID(packLevelXPDLAppDO);
0675:                    packLevelXPDLAppToolAgentAppQuery.requireUniqueInstance();
0676:                    PackLevelXPDLAppToolAgentAppDO packLevelXPDLAppToolAgentAppDO = packLevelXPDLAppToolAgentAppQuery
0677:                            .getNextDO();
0678:
0679:                    if (packLevelXPDLAppToolAgentAppDO != null) {
0680:                        am = this .createApplicationMap();
0681:                        am
0682:                                .setApplicationDefinitionId(packLevelXPDLAppToolAgentAppDO
0683:                                        .getXPDL_APPOID().getAPPLICATION_ID());
0684:                        am.setPackageId(packLevelXPDLAppToolAgentAppDO
0685:                                .getXPDL_APPOID().getPACKAGEOID()
0686:                                .getPACKAGE_ID());
0687:                        am.setProcessDefinitionId(null);
0688:                        am.setToolAgentClassName(packLevelXPDLAppToolAgentAppDO
0689:                                .getTOOLAGENTOID().getTOOL_AGENT_NAME());
0690:                        am.setApplicationName(packLevelXPDLAppToolAgentAppDO
0691:                                .getTOOLAGENTOID().getAPP_NAME());
0692:                        am.setApplicationMode(null);
0693:                        am.setUsername(null);
0694:                        am.setPassword(null);
0695:                        return am;
0696:                    }
0697:
0698:                    // package level, mode defined, username and password not
0699:                    // defined
0700:                    PackLevelXPDLAppTAAppDetailQuery packLevelXPDLAppToolAgentAppDetailQuery = new PackLevelXPDLAppTAAppDetailQuery(
0701:                            dbt);
0702:                    packLevelXPDLAppToolAgentAppDetailQuery
0703:                            .setQueryXPDL_APPOID(packLevelXPDLAppDO);
0704:                    packLevelXPDLAppToolAgentAppDetailQuery
0705:                            .requireUniqueInstance();
0706:                    PackLevelXPDLAppTAAppDetailDO packLevelXPDLAppToolAgentAppDetailDO = packLevelXPDLAppToolAgentAppDetailQuery
0707:                            .getNextDO();
0708:
0709:                    if (packLevelXPDLAppToolAgentAppDetailDO != null) {
0710:                        am = this .createApplicationMap();
0711:                        am
0712:                                .setApplicationDefinitionId(packLevelXPDLAppToolAgentAppDetailDO
0713:                                        .getXPDL_APPOID().getAPPLICATION_ID());
0714:                        am.setPackageId(packLevelXPDLAppToolAgentAppDetailDO
0715:                                .getXPDL_APPOID().getPACKAGEOID()
0716:                                .getPACKAGE_ID());
0717:                        am.setProcessDefinitionId(null);
0718:                        am
0719:                                .setToolAgentClassName(packLevelXPDLAppToolAgentAppDetailDO
0720:                                        .getTOOLAGENTOID()
0721:                                        .getTOOLAGENT_APPOID()
0722:                                        .getTOOL_AGENT_NAME());
0723:                        am
0724:                                .setApplicationName(packLevelXPDLAppToolAgentAppDetailDO
0725:                                        .getTOOLAGENTOID()
0726:                                        .getTOOLAGENT_APPOID().getAPP_NAME());
0727:                        am.setApplicationMode(new Integer(
0728:                                packLevelXPDLAppToolAgentAppDetailDO
0729:                                        .getTOOLAGENTOID().getAPP_MODE()
0730:                                        .intValue()));
0731:                        am.setUsername(null);
0732:                        am.setPassword(null);
0733:                        return am;
0734:                    }
0735:
0736:                    // package level, mode not defined, username and password
0737:                    // defined
0738:
0739:                    PackLevelXPDLAppTAAppUserQuery packLevelXPDLAppToolAgentAppUserQuery = new PackLevelXPDLAppTAAppUserQuery(
0740:                            dbt);
0741:                    packLevelXPDLAppToolAgentAppUserQuery
0742:                            .setQueryXPDL_APPOID(packLevelXPDLAppDO);
0743:                    packLevelXPDLAppToolAgentAppUserQuery
0744:                            .requireUniqueInstance();
0745:                    PackLevelXPDLAppTAAppUserDO packLevelXPDLAppToolAgentAppUserDO = packLevelXPDLAppToolAgentAppUserQuery
0746:                            .getNextDO();
0747:
0748:                    if (packLevelXPDLAppToolAgentAppUserDO != null) {
0749:                        am = this .createApplicationMap();
0750:                        am
0751:                                .setApplicationDefinitionId(packLevelXPDLAppToolAgentAppUserDO
0752:                                        .getXPDL_APPOID().getAPPLICATION_ID());
0753:                        am.setPackageId(packLevelXPDLAppToolAgentAppUserDO
0754:                                .getXPDL_APPOID().getPACKAGEOID()
0755:                                .getPACKAGE_ID());
0756:                        am.setProcessDefinitionId(null);
0757:                        am
0758:                                .setToolAgentClassName(packLevelXPDLAppToolAgentAppUserDO
0759:                                        .getTOOLAGENTOID()
0760:                                        .getTOOLAGENT_APPOID()
0761:                                        .getTOOL_AGENT_NAME());
0762:                        am
0763:                                .setApplicationName(packLevelXPDLAppToolAgentAppUserDO
0764:                                        .getTOOLAGENTOID()
0765:                                        .getTOOLAGENT_APPOID().getAPP_NAME());
0766:                        am.setApplicationMode(null);
0767:                        am.setUsername(packLevelXPDLAppToolAgentAppUserDO
0768:                                .getTOOLAGENTOID().getUSEROID().getUSERNAME());
0769:                        am.setPassword(packLevelXPDLAppToolAgentAppUserDO
0770:                                .getTOOLAGENTOID().getUSEROID().getPWD());
0771:                        return am;
0772:                    }
0773:
0774:                    // package level, mode, username and password defined
0775:                    PackLevelXPDLAppTAAppDetailUsrQuery packLevelXPDLAppToolAgentAppDetailUserQuery = new PackLevelXPDLAppTAAppDetailUsrQuery(
0776:                            dbt);
0777:                    packLevelXPDLAppToolAgentAppDetailUserQuery
0778:                            .setQueryXPDL_APPOID(packLevelXPDLAppDO);
0779:                    packLevelXPDLAppToolAgentAppDetailUserQuery
0780:                            .requireUniqueInstance();
0781:                    PackLevelXPDLAppTAAppDetailUsrDO packLevelXPDLAppToolAgentAppDetailUserDO = packLevelXPDLAppToolAgentAppDetailUserQuery
0782:                            .getNextDO();
0783:
0784:                    if (packLevelXPDLAppToolAgentAppDetailUserDO != null) {
0785:                        am = this .createApplicationMap();
0786:                        am
0787:                                .setApplicationDefinitionId(packLevelXPDLAppToolAgentAppDetailUserDO
0788:                                        .getXPDL_APPOID().getAPPLICATION_ID());
0789:                        am
0790:                                .setPackageId(packLevelXPDLAppToolAgentAppDetailUserDO
0791:                                        .getXPDL_APPOID().getPACKAGEOID()
0792:                                        .getPACKAGE_ID());
0793:                        am.setProcessDefinitionId(null);
0794:                        am
0795:                                .setToolAgentClassName(packLevelXPDLAppToolAgentAppDetailUserDO
0796:                                        .getTOOLAGENTOID()
0797:                                        .getTOOLAGENT_APPOID()
0798:                                        .getTOOLAGENT_APPOID()
0799:                                        .getTOOL_AGENT_NAME());
0800:                        am
0801:                                .setApplicationName(packLevelXPDLAppToolAgentAppDetailUserDO
0802:                                        .getTOOLAGENTOID()
0803:                                        .getTOOLAGENT_APPOID()
0804:                                        .getTOOLAGENT_APPOID().getAPP_NAME());
0805:                        am.setApplicationMode(new Integer(
0806:                                packLevelXPDLAppToolAgentAppDetailUserDO
0807:                                        .getTOOLAGENTOID()
0808:                                        .getTOOLAGENT_APPOID().getAPP_MODE()
0809:                                        .intValue()));
0810:                        am.setUsername(packLevelXPDLAppToolAgentAppDetailUserDO
0811:                                .getTOOLAGENTOID().getUSEROID().getUSERNAME());
0812:                        am.setPassword(packLevelXPDLAppToolAgentAppDetailUserDO
0813:                                .getTOOLAGENTOID().getUSEROID().getPWD());
0814:                        return am;
0815:                    }
0816:
0817:                } else {
0818:
0819:                    XPDLApplicationPackageQuery packageQuery = new XPDLApplicationPackageQuery(
0820:                            dbt);
0821:                    packageQuery.setQueryPACKAGE_ID(packageId);
0822:                    packageQuery.requireUniqueInstance();
0823:                    XPDLApplicationPackageDO packageDO = packageQuery
0824:                            .getNextDO();
0825:
0826:                    XPDLApplicationProcessQuery processQuery = new XPDLApplicationProcessQuery(
0827:                            dbt);
0828:                    processQuery.setQueryPROCESS_ID(processDefinitionId);
0829:                    processQuery.setQueryPACKAGEOID(packageDO);
0830:                    processQuery.requireUniqueInstance();
0831:                    XPDLApplicationProcessDO processDO = processQuery
0832:                            .getNextDO();
0833:
0834:                    ProcLevelXPDLAppQuery procLevelXPDLAppQuery = new ProcLevelXPDLAppQuery(
0835:                            dbt);
0836:                    procLevelXPDLAppQuery
0837:                            .setQueryAPPLICATION_ID(applicationDefinitionId);
0838:                    procLevelXPDLAppQuery.setQueryPROCESSOID(processDO);
0839:                    procLevelXPDLAppQuery.requireUniqueInstance();
0840:                    ProcLevelXPDLAppDO procLevelXPDLAppDO = procLevelXPDLAppQuery
0841:                            .getNextDO();
0842:
0843:                    // process level, mode, username and password not defined
0844:                    ProcLevelXPDLAppToolAgentAppQuery procLevelXPDLAppToolAgentAppQuery = new ProcLevelXPDLAppToolAgentAppQuery(
0845:                            dbt);
0846:                    procLevelXPDLAppToolAgentAppQuery
0847:                            .setQueryXPDL_APPOID(procLevelXPDLAppDO);
0848:                    procLevelXPDLAppToolAgentAppQuery.requireUniqueInstance();
0849:                    ProcLevelXPDLAppToolAgentAppDO procLevelXPDLAppToolAgentAppDO = procLevelXPDLAppToolAgentAppQuery
0850:                            .getNextDO();
0851:
0852:                    if (procLevelXPDLAppToolAgentAppDO != null) {
0853:                        am = this .createApplicationMap();
0854:                        am
0855:                                .setApplicationDefinitionId(procLevelXPDLAppToolAgentAppDO
0856:                                        .getXPDL_APPOID().getAPPLICATION_ID());
0857:                        am.setPackageId(procLevelXPDLAppToolAgentAppDO
0858:                                .getXPDL_APPOID().getPROCESSOID()
0859:                                .getPACKAGEOID().getPACKAGE_ID());
0860:                        am
0861:                                .setProcessDefinitionId(procLevelXPDLAppToolAgentAppDO
0862:                                        .getXPDL_APPOID().getPROCESSOID()
0863:                                        .getPROCESS_ID());
0864:                        am.setToolAgentClassName(procLevelXPDLAppToolAgentAppDO
0865:                                .getTOOLAGENTOID().getTOOL_AGENT_NAME());
0866:                        am.setApplicationName(procLevelXPDLAppToolAgentAppDO
0867:                                .getTOOLAGENTOID().getAPP_NAME());
0868:                        am.setApplicationMode(null);
0869:                        am.setUsername(null);
0870:                        am.setPassword(null);
0871:                        return am;
0872:                    }
0873:
0874:                    // process level, mode defined, username and password not
0875:                    // defined
0876:                    ProcLevelXPDLAppTAAppDetailQuery procLevelXPDLAppToolAgentAppDetailQuery = new ProcLevelXPDLAppTAAppDetailQuery(
0877:                            dbt);
0878:                    procLevelXPDLAppToolAgentAppDetailQuery
0879:                            .setQueryXPDL_APPOID(procLevelXPDLAppDO);
0880:                    procLevelXPDLAppToolAgentAppDetailQuery
0881:                            .requireUniqueInstance();
0882:                    ProcLevelXPDLAppTAAppDetailDO procLevelXPDLAppToolAgentAppDetailDO = procLevelXPDLAppToolAgentAppDetailQuery
0883:                            .getNextDO();
0884:
0885:                    if (procLevelXPDLAppToolAgentAppDetailDO != null) {
0886:                        am = this .createApplicationMap();
0887:                        am
0888:                                .setApplicationDefinitionId(procLevelXPDLAppToolAgentAppDetailDO
0889:                                        .getXPDL_APPOID().getAPPLICATION_ID());
0890:                        am.setPackageId(procLevelXPDLAppToolAgentAppDetailDO
0891:                                .getXPDL_APPOID().getPROCESSOID()
0892:                                .getPACKAGEOID().getPACKAGE_ID());
0893:                        am
0894:                                .setProcessDefinitionId(procLevelXPDLAppToolAgentAppDetailDO
0895:                                        .getXPDL_APPOID().getPROCESSOID()
0896:                                        .getPROCESS_ID());
0897:                        am
0898:                                .setToolAgentClassName(procLevelXPDLAppToolAgentAppDetailDO
0899:                                        .getTOOLAGENTOID()
0900:                                        .getTOOLAGENT_APPOID()
0901:                                        .getTOOL_AGENT_NAME());
0902:                        am
0903:                                .setApplicationName(procLevelXPDLAppToolAgentAppDetailDO
0904:                                        .getTOOLAGENTOID()
0905:                                        .getTOOLAGENT_APPOID().getAPP_NAME());
0906:                        am.setApplicationMode(new Integer(
0907:                                procLevelXPDLAppToolAgentAppDetailDO
0908:                                        .getTOOLAGENTOID().getAPP_MODE()
0909:                                        .intValue()));
0910:                        am.setUsername(null);
0911:                        am.setPassword(null);
0912:                        return am;
0913:                    }
0914:
0915:                    // process level, mode not defined, username and password
0916:                    // defined
0917:                    ProcLevelXPDLAppTAAppUserQuery procLevelXPDLAppToolAgentAppUserQuery = new ProcLevelXPDLAppTAAppUserQuery(
0918:                            dbt);
0919:                    procLevelXPDLAppToolAgentAppUserQuery
0920:                            .setQueryXPDL_APPOID(procLevelXPDLAppDO);
0921:                    procLevelXPDLAppToolAgentAppUserQuery
0922:                            .requireUniqueInstance();
0923:                    ProcLevelXPDLAppTAAppUserDO procLevelXPDLAppToolAgentAppUserDO = procLevelXPDLAppToolAgentAppUserQuery
0924:                            .getNextDO();
0925:
0926:                    if (procLevelXPDLAppToolAgentAppUserDO != null) {
0927:                        am = this .createApplicationMap();
0928:                        am
0929:                                .setApplicationDefinitionId(procLevelXPDLAppToolAgentAppUserDO
0930:                                        .getXPDL_APPOID().getAPPLICATION_ID());
0931:                        am.setPackageId(procLevelXPDLAppToolAgentAppUserDO
0932:                                .getXPDL_APPOID().getPROCESSOID()
0933:                                .getPACKAGEOID().getPACKAGE_ID());
0934:                        am
0935:                                .setProcessDefinitionId(procLevelXPDLAppToolAgentAppUserDO
0936:                                        .getXPDL_APPOID().getPROCESSOID()
0937:                                        .getPROCESS_ID());
0938:                        am
0939:                                .setToolAgentClassName(procLevelXPDLAppToolAgentAppUserDO
0940:                                        .getTOOLAGENTOID()
0941:                                        .getTOOLAGENT_APPOID()
0942:                                        .getTOOL_AGENT_NAME());
0943:                        am
0944:                                .setApplicationName(procLevelXPDLAppToolAgentAppUserDO
0945:                                        .getTOOLAGENTOID()
0946:                                        .getTOOLAGENT_APPOID().getAPP_NAME());
0947:                        am.setApplicationMode(null);
0948:                        am.setUsername(procLevelXPDLAppToolAgentAppUserDO
0949:                                .getTOOLAGENTOID().getUSEROID().getUSERNAME());
0950:                        am.setPassword(procLevelXPDLAppToolAgentAppUserDO
0951:                                .getTOOLAGENTOID().getUSEROID().getPWD());
0952:                        return am;
0953:                    }
0954:
0955:                    // process level, mode, username and password defined
0956:                    ProcLevelXPDLAppTAAppDetailUsrQuery procLevelXPDLAppToolAgentAppDetailUserQuery = new ProcLevelXPDLAppTAAppDetailUsrQuery(
0957:                            dbt);
0958:                    procLevelXPDLAppToolAgentAppDetailUserQuery
0959:                            .setQueryXPDL_APPOID(procLevelXPDLAppDO);
0960:                    procLevelXPDLAppToolAgentAppDetailUserQuery
0961:                            .requireUniqueInstance();
0962:                    ProcLevelXPDLAppTAAppDetailUsrDO procLevelXPDLAppToolAgentAppDetailUserDO = procLevelXPDLAppToolAgentAppDetailUserQuery
0963:                            .getNextDO();
0964:
0965:                    if (procLevelXPDLAppToolAgentAppDetailUserDO != null) {
0966:                        am = this .createApplicationMap();
0967:                        am
0968:                                .setApplicationDefinitionId(procLevelXPDLAppToolAgentAppDetailUserDO
0969:                                        .getXPDL_APPOID().getAPPLICATION_ID());
0970:                        am
0971:                                .setPackageId(procLevelXPDLAppToolAgentAppDetailUserDO
0972:                                        .getXPDL_APPOID().getPROCESSOID()
0973:                                        .getPACKAGEOID().getPACKAGE_ID());
0974:                        am
0975:                                .setProcessDefinitionId(procLevelXPDLAppToolAgentAppDetailUserDO
0976:                                        .getXPDL_APPOID().getPROCESSOID()
0977:                                        .getPROCESS_ID());
0978:                        am
0979:                                .setToolAgentClassName(procLevelXPDLAppToolAgentAppDetailUserDO
0980:                                        .getTOOLAGENTOID()
0981:                                        .getTOOLAGENT_APPOID()
0982:                                        .getTOOLAGENT_APPOID()
0983:                                        .getTOOL_AGENT_NAME());
0984:                        am
0985:                                .setApplicationName(procLevelXPDLAppToolAgentAppDetailUserDO
0986:                                        .getTOOLAGENTOID()
0987:                                        .getTOOLAGENT_APPOID()
0988:                                        .getTOOLAGENT_APPOID().getAPP_NAME());
0989:                        am.setApplicationMode(new Integer(
0990:                                procLevelXPDLAppToolAgentAppDetailUserDO
0991:                                        .getTOOLAGENTOID()
0992:                                        .getTOOLAGENT_APPOID().getAPP_MODE()
0993:                                        .intValue()));
0994:                        am.setUsername(procLevelXPDLAppToolAgentAppDetailUserDO
0995:                                .getTOOLAGENTOID().getUSEROID().getUSERNAME());
0996:                        am.setPassword(procLevelXPDLAppToolAgentAppDetailUserDO
0997:                                .getTOOLAGENTOID().getUSEROID().getPWD());
0998:                        return am;
0999:                    }
1000:
1001:                }
1002:                return am;
1003:            }
1004:
1005:            /**
1006:             * Checks validity of application mapping.
1007:             * 
1008:             * @param am an ApplicationMapping
1009:             * @return a boolean
1010:             */
1011:            public boolean checkValidity(ApplicationMap am) {
1012:                if (am == null || am.getPackageId() == null
1013:                        || am.getPackageId().trim().equals("")
1014:                        || am.getApplicationDefinitionId() == null
1015:                        || am.getApplicationDefinitionId().trim().equals("")
1016:                        || am.getToolAgentClassName() == null
1017:                        || am.getToolAgentClassName().trim().equals("")
1018:                        || am.getApplicationName() == null
1019:                        || am.getApplicationName().trim().equals("")) {
1020:                    return false;
1021:                }
1022:
1023:                return true;
1024:            }
1025:
1026:            private ProcLevelXPDLAppDO checkProcLevelXPDLApp(ApplicationMap am)
1027:                    throws Exception {
1028:                DBTransaction dbt = getDBTransaction();
1029:
1030:                ProcLevelXPDLAppQuery procLevelXPDLAppQuery = new ProcLevelXPDLAppQuery(
1031:                        dbt);
1032:                ProcLevelXPDLAppDO procLevelXPDLAppDO = null;
1033:
1034:                XPDLApplicationProcessDO procDO = this .checkProcess(am);
1035:
1036:                procLevelXPDLAppQuery.setQueryAPPLICATION_ID(am
1037:                        .getApplicationDefinitionId());
1038:                procLevelXPDLAppQuery.setQueryPROCESSOID(procDO);
1039:                procLevelXPDLAppQuery.requireUniqueInstance();
1040:                procLevelXPDLAppDO = procLevelXPDLAppQuery.getNextDO();
1041:                if (procLevelXPDLAppDO == null) {
1042:                    procLevelXPDLAppDO = ProcLevelXPDLAppDO.createVirgin(dbt);
1043:                    procLevelXPDLAppDO.setAPPLICATION_ID(am
1044:                            .getApplicationDefinitionId());
1045:                    procLevelXPDLAppDO.setPROCESSOID(procDO);
1046:                    procLevelXPDLAppDO.save();
1047:
1048:                }
1049:                return procLevelXPDLAppDO;
1050:            }
1051:
1052:            private PackLevelXPDLAppDO checkPackLevelXPDLApp(ApplicationMap am)
1053:                    throws Exception {
1054:                DBTransaction dbt = getDBTransaction();
1055:
1056:                PackLevelXPDLAppQuery packLevelXPDLAppQuery = new PackLevelXPDLAppQuery(
1057:                        dbt);
1058:                PackLevelXPDLAppDO packLevelXPDLAppDO = null;
1059:
1060:                XPDLApplicationPackageDO packDO = this .checkPackage(am);
1061:
1062:                packLevelXPDLAppQuery.setQueryAPPLICATION_ID(am
1063:                        .getApplicationDefinitionId());
1064:                packLevelXPDLAppQuery.setQueryPACKAGEOID(packDO);
1065:                packLevelXPDLAppQuery.requireUniqueInstance();
1066:                packLevelXPDLAppDO = packLevelXPDLAppQuery.getNextDO();
1067:                if (packLevelXPDLAppDO == null) {
1068:                    packLevelXPDLAppDO = PackLevelXPDLAppDO.createVirgin(dbt);
1069:                    packLevelXPDLAppDO.setAPPLICATION_ID(am
1070:                            .getApplicationDefinitionId());
1071:                    packLevelXPDLAppDO.setPACKAGEOID(packDO);
1072:                    packLevelXPDLAppDO.save();
1073:
1074:                }
1075:                return packLevelXPDLAppDO;
1076:            }
1077:
1078:            private ToolAgentAppDetailUserDO checkToolAgentAppDetailUser(
1079:                    ApplicationMap am) throws Exception {
1080:                DBTransaction dbt = getDBTransaction();
1081:
1082:                ToolAgentAppDetailUserQuery toolAgentAppDetailUserQuery = new ToolAgentAppDetailUserQuery(
1083:                        dbt);
1084:                ToolAgentAppDetailUserDO toolAgentAppDetailUserDO = null;
1085:
1086:                ToolAgentAppDetailDO toolAgentAppDetailDO = this 
1087:                        .checkToolAgentAppDetail(am);
1088:                ToolAgentUserDO userDO = this .checkUser(am);
1089:
1090:                toolAgentAppDetailUserQuery
1091:                        .setQueryTOOLAGENT_APPOID(toolAgentAppDetailDO);
1092:                toolAgentAppDetailUserQuery.setQueryUSEROID(userDO);
1093:                toolAgentAppDetailUserQuery.requireUniqueInstance();
1094:                toolAgentAppDetailUserDO = toolAgentAppDetailUserQuery
1095:                        .getNextDO();
1096:                if (toolAgentAppDetailUserDO == null) {
1097:                    toolAgentAppDetailUserDO = ToolAgentAppDetailUserDO
1098:                            .createVirgin(dbt);
1099:                    toolAgentAppDetailUserDO
1100:                            .setTOOLAGENT_APPOID(toolAgentAppDetailDO);
1101:                    toolAgentAppDetailUserDO.setUSEROID(userDO);
1102:                    toolAgentAppDetailUserDO.save();
1103:
1104:                }
1105:                return toolAgentAppDetailUserDO;
1106:            }
1107:
1108:            private ToolAgentAppDetailDO checkToolAgentAppDetail(
1109:                    ApplicationMap am) throws Exception {
1110:                DBTransaction dbt = getDBTransaction();
1111:
1112:                ToolAgentAppDetailQuery toolAgentAppDetailQuery = new ToolAgentAppDetailQuery(
1113:                        dbt);
1114:                ToolAgentAppDetailDO toolAgentAppDetailDO = null;
1115:
1116:                ToolAgentAppDO toolAgentAppDO = this .checkToolAgentApp(am);
1117:
1118:                toolAgentAppDetailQuery
1119:                        .setQueryTOOLAGENT_APPOID(toolAgentAppDO);
1120:                toolAgentAppDetailQuery.setQueryAPP_MODE(new BigDecimal(am
1121:                        .getApplicationMode().intValue()));
1122:                toolAgentAppDetailQuery.requireUniqueInstance();
1123:                toolAgentAppDetailDO = toolAgentAppDetailQuery.getNextDO();
1124:                if (toolAgentAppDetailDO == null) {
1125:                    toolAgentAppDetailDO = ToolAgentAppDetailDO
1126:                            .createVirgin(dbt);
1127:                    toolAgentAppDetailDO.setTOOLAGENT_APPOID(toolAgentAppDO);
1128:                    toolAgentAppDetailDO.setAPP_MODE(new BigDecimal(am
1129:                            .getApplicationMode().intValue()));
1130:                    toolAgentAppDetailDO.save();
1131:
1132:                }
1133:                return toolAgentAppDetailDO;
1134:            }
1135:
1136:            private ToolAgentAppUserDO checkToolAgentAppUser(ApplicationMap am)
1137:                    throws Exception {
1138:                DBTransaction dbt = getDBTransaction();
1139:
1140:                ToolAgentAppUserQuery toolAgentAppUserQuery = new ToolAgentAppUserQuery(
1141:                        dbt);
1142:                ToolAgentAppUserDO toolAgentAppUserDO = null;
1143:
1144:                ToolAgentAppDO toolAgentAppDO = this .checkToolAgentApp(am);
1145:                ToolAgentUserDO userDO = this .checkUser(am);
1146:
1147:                toolAgentAppUserQuery.setQueryTOOLAGENT_APPOID(toolAgentAppDO);
1148:                toolAgentAppUserQuery.setQueryUSEROID(userDO);
1149:                toolAgentAppUserQuery.requireUniqueInstance();
1150:                toolAgentAppUserDO = toolAgentAppUserQuery.getNextDO();
1151:                if (toolAgentAppUserDO == null) {
1152:                    toolAgentAppUserDO = ToolAgentAppUserDO.createVirgin(dbt);
1153:                    toolAgentAppUserDO.setTOOLAGENT_APPOID(toolAgentAppDO);
1154:                    toolAgentAppUserDO.setUSEROID(userDO);
1155:                    toolAgentAppUserDO.save();
1156:
1157:                }
1158:                return toolAgentAppUserDO;
1159:            }
1160:
1161:            private ToolAgentAppDO checkToolAgentApp(ApplicationMap am)
1162:                    throws Exception {
1163:                DBTransaction dbt = getDBTransaction();
1164:
1165:                ToolAgentAppQuery toolAgentAppQuery = new ToolAgentAppQuery(dbt);
1166:                ToolAgentAppDO toolAgentAppDO = null;
1167:
1168:                toolAgentAppQuery.setQueryTOOL_AGENT_NAME(am
1169:                        .getToolAgentClassName());
1170:                toolAgentAppQuery.setQueryAPP_NAME(am.getApplicationName());
1171:                toolAgentAppQuery.requireUniqueInstance();
1172:                toolAgentAppDO = toolAgentAppQuery.getNextDO();
1173:                if (toolAgentAppDO == null) {
1174:                    toolAgentAppDO = ToolAgentAppDO.createVirgin(dbt);
1175:                    toolAgentAppDO.setTOOL_AGENT_NAME(am
1176:                            .getToolAgentClassName());
1177:                    toolAgentAppDO.setAPP_NAME(am.getApplicationName());
1178:                    toolAgentAppDO.save();
1179:                }
1180:
1181:                return toolAgentAppDO;
1182:            }
1183:
1184:            private XPDLApplicationProcessDO checkProcess(ApplicationMap am)
1185:                    throws Exception {
1186:                DBTransaction dbt = getDBTransaction();
1187:
1188:                XPDLApplicationProcessDO processDO = null;
1189:                String processID = am.getProcessDefinitionId();
1190:
1191:                if (processID != null) {
1192:                    XPDLApplicationPackageDO pckgDO = this .checkPackage(am);
1193:
1194:                    XPDLApplicationProcessQuery procQuery = new XPDLApplicationProcessQuery(
1195:                            dbt);
1196:                    procQuery.setQueryPROCESS_ID(processID);
1197:                    procQuery.setQueryPACKAGEOID(pckgDO);
1198:                    procQuery.requireUniqueInstance();
1199:                    processDO = procQuery.getNextDO();
1200:                    if (processDO == null) {
1201:                        // insert new process
1202:                        processDO = XPDLApplicationProcessDO.createVirgin(dbt);
1203:                        processDO.setPROCESS_ID(am.getProcessDefinitionId());
1204:                        processDO.setPACKAGEOID(pckgDO);
1205:                        processDO.save();
1206:                    }
1207:                }
1208:
1209:                return processDO;
1210:            }
1211:
1212:            private XPDLApplicationPackageDO checkPackage(ApplicationMap am)
1213:                    throws Exception {
1214:                DBTransaction dbt = getDBTransaction();
1215:
1216:                XPDLApplicationPackageQuery packQuery = new XPDLApplicationPackageQuery(
1217:                        dbt);
1218:                XPDLApplicationPackageDO packageDO = null;
1219:                packQuery.setQueryPACKAGE_ID(am.getPackageId());
1220:                packQuery.requireUniqueInstance();
1221:                packageDO = packQuery.getNextDO();
1222:                if (packageDO == null) {
1223:                    // insert new package
1224:                    packageDO = XPDLApplicationPackageDO.createVirgin(dbt);
1225:                    packageDO.setPACKAGE_ID(am.getPackageId());
1226:                    packageDO.save();
1227:                }
1228:
1229:                return packageDO;
1230:            }
1231:
1232:            private ToolAgentUserDO checkUser(ApplicationMap am)
1233:                    throws Exception {
1234:                DBTransaction dbt = getDBTransaction();
1235:
1236:                ToolAgentUserQuery userQuery = new ToolAgentUserQuery(dbt);
1237:                ToolAgentUserDO userDO = null;
1238:
1239:                userQuery.setQueryUSERNAME(am.getUsername());
1240:                userQuery.setQueryPWD(am.getPassword());
1241:                userQuery.requireUniqueInstance();
1242:                userDO = userQuery.getNextDO();
1243:
1244:                if (userDO == null) {
1245:                    userDO = ToolAgentUserDO.createVirgin(dbt);
1246:                    userDO.setUSERNAME(am.getUsername());
1247:                    userDO.setPWD(am.getPassword());
1248:                    userDO.save();
1249:                }
1250:
1251:                return userDO;
1252:            }
1253:
1254:            private void deleteProcLevelXPDLAppToolAgentAppDetailUser(
1255:                    ApplicationMap am) throws Exception {
1256:                DBTransaction dbt = getDBTransaction();
1257:
1258:                String packageId = am.getPackageId();
1259:                String processId = am.getProcessDefinitionId();
1260:                String applicationId = am.getApplicationDefinitionId();
1261:
1262:                String toolagent = am.getToolAgentClassName();
1263:                String username = am.getUsername();
1264:                String password = am.getPassword();
1265:                String appName = am.getApplicationName();
1266:                Integer appMode = am.getApplicationMode();
1267:
1268:                // package
1269:                XPDLApplicationPackageQuery packageQuery = new XPDLApplicationPackageQuery(
1270:                        dbt);
1271:                packageQuery.setQueryPACKAGE_ID(packageId);
1272:                packageQuery.requireUniqueInstance();
1273:                XPDLApplicationPackageDO packageDO = packageQuery.getNextDO();
1274:
1275:                // process
1276:                XPDLApplicationProcessQuery processQuery = new XPDLApplicationProcessQuery(
1277:                        dbt);
1278:                processQuery.setQueryPROCESS_ID(processId);
1279:                processQuery.setQueryPACKAGEOID(packageDO);
1280:                processQuery.requireUniqueInstance();
1281:                XPDLApplicationProcessDO processDO = processQuery.getNextDO();
1282:
1283:                // procLevelXPDLApp
1284:                ProcLevelXPDLAppQuery procLevelXPDLAppQuery = new ProcLevelXPDLAppQuery(
1285:                        dbt);
1286:                procLevelXPDLAppQuery.setQueryAPPLICATION_ID(applicationId);
1287:                procLevelXPDLAppQuery.setQueryPROCESSOID(processDO);
1288:                procLevelXPDLAppQuery.requireUniqueInstance();
1289:                ProcLevelXPDLAppDO procLevelXPDLAppDO = procLevelXPDLAppQuery
1290:                        .getNextDO();
1291:
1292:                // user
1293:                ToolAgentUserQuery userQuery = new ToolAgentUserQuery(dbt);
1294:                userQuery.setQueryUSERNAME(username);
1295:                userQuery.setQueryPWD(password);
1296:                userQuery.requireUniqueInstance();
1297:                ToolAgentUserDO userDO = userQuery.getNextDO();
1298:
1299:                // toolagentApp
1300:                ToolAgentAppQuery toolAgentAppQuery = new ToolAgentAppQuery(dbt);
1301:                toolAgentAppQuery.setQueryTOOL_AGENT_NAME(toolagent);
1302:                toolAgentAppQuery.setQueryAPP_NAME(appName);
1303:                toolAgentAppQuery.requireUniqueInstance();
1304:                ToolAgentAppDO toolAgentAppDO = toolAgentAppQuery.getNextDO();
1305:
1306:                // toolagentAppDetail
1307:                ToolAgentAppDetailQuery toolAgentAppDetailQuery = new ToolAgentAppDetailQuery(
1308:                        dbt);
1309:                toolAgentAppDetailQuery.setQueryAPP_MODE(new BigDecimal(appMode
1310:                        .intValue()));
1311:                toolAgentAppDetailQuery
1312:                        .setQueryTOOLAGENT_APPOID(toolAgentAppDO);
1313:                toolAgentAppDetailQuery.requireUniqueInstance();
1314:                ToolAgentAppDetailDO toolAgentAppDetailDO = toolAgentAppDetailQuery
1315:                        .getNextDO();
1316:
1317:                // toolAgentAppDetailUser
1318:                ToolAgentAppDetailUserQuery toolAgentAppDetailUserQuery = new ToolAgentAppDetailUserQuery(
1319:                        dbt);
1320:                toolAgentAppDetailUserQuery
1321:                        .setQueryTOOLAGENT_APPOID(toolAgentAppDetailDO);
1322:                toolAgentAppDetailUserQuery.setQueryUSEROID(userDO);
1323:                toolAgentAppDetailUserQuery.requireUniqueInstance();
1324:                ToolAgentAppDetailUserDO toolAgentAppDetailUserDO = toolAgentAppDetailUserQuery
1325:                        .getNextDO();
1326:
1327:                // ProcLevelXPDLAppToolAgentAppDetailUser
1328:                ProcLevelXPDLAppTAAppDetailUsrQuery procLevelXPDLAppToolAgentAppDetailUserQuery = new ProcLevelXPDLAppTAAppDetailUsrQuery(
1329:                        dbt);
1330:                procLevelXPDLAppToolAgentAppDetailUserQuery
1331:                        .setQueryXPDL_APPOID(procLevelXPDLAppDO);
1332:                procLevelXPDLAppToolAgentAppDetailUserQuery
1333:                        .setQueryTOOLAGENTOID(toolAgentAppDetailUserDO);
1334:
1335:                ProcLevelXPDLAppTAAppDetailUsrDO[] procLevelXPDLAppToolAgentAppDetailUserDOArr = procLevelXPDLAppToolAgentAppDetailUserQuery
1336:                        .getDOArray();
1337:                for (int i = 0; i < procLevelXPDLAppToolAgentAppDetailUserDOArr.length; i++) {
1338:                    procLevelXPDLAppToolAgentAppDetailUserDOArr[i].delete();
1339:                }
1340:
1341:                // delete unnecessairly data
1342:                // ToolAgentAppDetailUser
1343:                this .deleteToolAgentAppDetailUser(toolAgentAppDetailUserDO);
1344:                // ToolagentAppDetail
1345:                this .deleteToolAgentAppDetail(toolAgentAppDetailDO);
1346:                // ToolAgentApp
1347:                this .deleteToolAgentApp(toolAgentAppDO);
1348:                // user
1349:                this .deleteUser(userDO);
1350:                // procLevelXPDLApp
1351:                this .deleteProcLevelXPDLApp(procLevelXPDLAppDO);
1352:                // process
1353:                this .deleteProcess(processDO);
1354:                // package
1355:                this .deletePackage(packageDO);
1356:            }
1357:
1358:            private void deleteProcLevelXPDLAppToolAgentAppDetail(
1359:                    ApplicationMap am) throws Exception {
1360:                DBTransaction dbt = getDBTransaction();
1361:
1362:                String packageId = am.getPackageId();
1363:                String processId = am.getProcessDefinitionId();
1364:                String applicationId = am.getApplicationDefinitionId();
1365:
1366:                String toolagent = am.getToolAgentClassName();
1367:                String appName = am.getApplicationName();
1368:                Integer appMode = am.getApplicationMode();
1369:
1370:                // package
1371:                XPDLApplicationPackageQuery packageQuery = new XPDLApplicationPackageQuery(
1372:                        dbt);
1373:                packageQuery.setQueryPACKAGE_ID(packageId);
1374:                packageQuery.requireUniqueInstance();
1375:                XPDLApplicationPackageDO packageDO = packageQuery.getNextDO();
1376:
1377:                // process
1378:                XPDLApplicationProcessQuery processQuery = new XPDLApplicationProcessQuery(
1379:                        dbt);
1380:                processQuery.setQueryPROCESS_ID(processId);
1381:                processQuery.setQueryPACKAGEOID(packageDO);
1382:                processQuery.requireUniqueInstance();
1383:                XPDLApplicationProcessDO processDO = processQuery.getNextDO();
1384:
1385:                // procLevelXPDLApp
1386:                ProcLevelXPDLAppQuery procLevelXPDLAppQuery = new ProcLevelXPDLAppQuery(
1387:                        dbt);
1388:                procLevelXPDLAppQuery.setQueryAPPLICATION_ID(applicationId);
1389:                procLevelXPDLAppQuery.setQueryPROCESSOID(processDO);
1390:                procLevelXPDLAppQuery.requireUniqueInstance();
1391:                ProcLevelXPDLAppDO procLevelXPDLAppDO = procLevelXPDLAppQuery
1392:                        .getNextDO();
1393:
1394:                // toolagentApp
1395:                ToolAgentAppQuery toolAgentAppQuery = new ToolAgentAppQuery(dbt);
1396:                toolAgentAppQuery.setQueryTOOL_AGENT_NAME(toolagent);
1397:                toolAgentAppQuery.setQueryAPP_NAME(appName);
1398:                toolAgentAppQuery.requireUniqueInstance();
1399:                ToolAgentAppDO toolAgentAppDO = toolAgentAppQuery.getNextDO();
1400:
1401:                // toolAgentAppDetail
1402:                ToolAgentAppDetailQuery toolAgentAppDetailQuery = new ToolAgentAppDetailQuery(
1403:                        dbt);
1404:                toolAgentAppDetailQuery
1405:                        .setQueryTOOLAGENT_APPOID(toolAgentAppDO);
1406:                toolAgentAppDetailQuery.setQueryAPP_MODE(new BigDecimal(appMode
1407:                        .intValue()));
1408:                toolAgentAppDetailQuery.requireUniqueInstance();
1409:                ToolAgentAppDetailDO toolAgentAppDetailDO = toolAgentAppDetailQuery
1410:                        .getNextDO();
1411:
1412:                // ProcLevelXPDLAppToolAgentAppDetail
1413:                ProcLevelXPDLAppTAAppDetailQuery procLevelXPDLAppToolAgentAppDetailQuery = new ProcLevelXPDLAppTAAppDetailQuery(
1414:                        dbt);
1415:                procLevelXPDLAppToolAgentAppDetailQuery
1416:                        .setQueryXPDL_APPOID(procLevelXPDLAppDO);
1417:                procLevelXPDLAppToolAgentAppDetailQuery
1418:                        .setQueryTOOLAGENTOID(toolAgentAppDetailDO);
1419:
1420:                ProcLevelXPDLAppTAAppDetailDO[] procLevelXPDLAppToolAgentAppDetailDOArr = procLevelXPDLAppToolAgentAppDetailQuery
1421:                        .getDOArray();
1422:                for (int i = 0; i < procLevelXPDLAppToolAgentAppDetailDOArr.length; i++) {
1423:                    procLevelXPDLAppToolAgentAppDetailDOArr[i].delete();
1424:                }
1425:
1426:                // delete unnecessairly data
1427:                // ToolagentAppDetail
1428:                this .deleteToolAgentAppDetail(toolAgentAppDetailDO);
1429:                // ToolAgentApp
1430:                this .deleteToolAgentApp(toolAgentAppDO);
1431:                // procLevelXPDLApp
1432:                this .deleteProcLevelXPDLApp(procLevelXPDLAppDO);
1433:                // process
1434:                this .deleteProcess(processDO);
1435:                // package
1436:                this .deletePackage(packageDO);
1437:            }
1438:
1439:            private void deleteProcLevelXPDLAppToolAgentAppUser(
1440:                    ApplicationMap am) throws Exception {
1441:                DBTransaction dbt = getDBTransaction();
1442:
1443:                String packageId = am.getPackageId();
1444:                String processId = am.getProcessDefinitionId();
1445:                String applicationId = am.getApplicationDefinitionId();
1446:
1447:                String toolagent = am.getToolAgentClassName();
1448:                String username = am.getUsername();
1449:                String password = am.getPassword();
1450:                String appName = am.getApplicationName();
1451:
1452:                // package
1453:                XPDLApplicationPackageQuery packageQuery = new XPDLApplicationPackageQuery(
1454:                        dbt);
1455:                packageQuery.setQueryPACKAGE_ID(packageId);
1456:                packageQuery.requireUniqueInstance();
1457:                XPDLApplicationPackageDO packageDO = packageQuery.getNextDO();
1458:
1459:                // process
1460:                XPDLApplicationProcessQuery processQuery = new XPDLApplicationProcessQuery(
1461:                        dbt);
1462:                processQuery.setQueryPROCESS_ID(processId);
1463:                processQuery.setQueryPACKAGEOID(packageDO);
1464:                processQuery.requireUniqueInstance();
1465:                XPDLApplicationProcessDO processDO = processQuery.getNextDO();
1466:
1467:                // procLevelXPDLApp
1468:                ProcLevelXPDLAppQuery procLevelXPDLAppQuery = new ProcLevelXPDLAppQuery(
1469:                        dbt);
1470:                procLevelXPDLAppQuery.setQueryAPPLICATION_ID(applicationId);
1471:                procLevelXPDLAppQuery.setQueryPROCESSOID(processDO);
1472:                procLevelXPDLAppQuery.requireUniqueInstance();
1473:                ProcLevelXPDLAppDO procLevelXPDLAppDO = procLevelXPDLAppQuery
1474:                        .getNextDO();
1475:
1476:                // user
1477:                ToolAgentUserQuery userQuery = new ToolAgentUserQuery(dbt);
1478:                userQuery.setQueryUSERNAME(username);
1479:                userQuery.setQueryPWD(password);
1480:                userQuery.requireUniqueInstance();
1481:                ToolAgentUserDO userDO = userQuery.getNextDO();
1482:
1483:                // toolagentApp
1484:                ToolAgentAppQuery toolAgentAppQuery = new ToolAgentAppQuery(dbt);
1485:                toolAgentAppQuery.setQueryTOOL_AGENT_NAME(toolagent);
1486:                toolAgentAppQuery.setQueryAPP_NAME(appName);
1487:                toolAgentAppQuery.requireUniqueInstance();
1488:                ToolAgentAppDO toolAgentAppDO = toolAgentAppQuery.getNextDO();
1489:
1490:                // toolAgentAppUser
1491:                ToolAgentAppUserQuery toolAgentAppUserQuery = new ToolAgentAppUserQuery(
1492:                        dbt);
1493:                toolAgentAppUserQuery.setQueryTOOLAGENT_APPOID(toolAgentAppDO);
1494:                toolAgentAppUserQuery.setQueryUSEROID(userDO);
1495:                toolAgentAppUserQuery.requireUniqueInstance();
1496:                ToolAgentAppUserDO toolAgentAppUserDO = toolAgentAppUserQuery
1497:                        .getNextDO();
1498:
1499:                // ProcLevelXPDLAppToolAgentAppUser
1500:                ProcLevelXPDLAppTAAppUserQuery procLevelXPDLAppToolAgentAppUserQuery = new ProcLevelXPDLAppTAAppUserQuery(
1501:                        dbt);
1502:                procLevelXPDLAppToolAgentAppUserQuery
1503:                        .setQueryXPDL_APPOID(procLevelXPDLAppDO);
1504:                procLevelXPDLAppToolAgentAppUserQuery
1505:                        .setQueryTOOLAGENTOID(toolAgentAppUserDO);
1506:
1507:                ProcLevelXPDLAppTAAppUserDO[] procLevelXPDLAppToolAgentAppUserDOArr = procLevelXPDLAppToolAgentAppUserQuery
1508:                        .getDOArray();
1509:                for (int i = 0; i < procLevelXPDLAppToolAgentAppUserDOArr.length; i++) {
1510:                    procLevelXPDLAppToolAgentAppUserDOArr[i].delete();
1511:                }
1512:
1513:                // delete unnecessairly data
1514:                // ToolAgentAppUser
1515:                this .deleteToolAgentAppUser(toolAgentAppUserDO);
1516:                // ToolAgentApp
1517:                this .deleteToolAgentApp(toolAgentAppDO);
1518:                // user
1519:                this .deleteUser(userDO);
1520:                // procLevelXPDLApp
1521:                this .deleteProcLevelXPDLApp(procLevelXPDLAppDO);
1522:                // process
1523:                this .deleteProcess(processDO);
1524:                // package
1525:                this .deletePackage(packageDO);
1526:            }
1527:
1528:            private void deleteProcLevelXPDLAppToolAgentApp(ApplicationMap am)
1529:                    throws Exception {
1530:                DBTransaction dbt = getDBTransaction();
1531:
1532:                String packageId = am.getPackageId();
1533:                String processId = am.getProcessDefinitionId();
1534:                String applicationId = am.getApplicationDefinitionId();
1535:
1536:                String toolagent = am.getToolAgentClassName();
1537:                String appName = am.getApplicationName();
1538:
1539:                // package
1540:                XPDLApplicationPackageQuery packageQuery = new XPDLApplicationPackageQuery(
1541:                        dbt);
1542:                packageQuery.setQueryPACKAGE_ID(packageId);
1543:                packageQuery.requireUniqueInstance();
1544:                XPDLApplicationPackageDO packageDO = packageQuery.getNextDO();
1545:
1546:                // process
1547:                XPDLApplicationProcessQuery processQuery = new XPDLApplicationProcessQuery(
1548:                        dbt);
1549:                processQuery.setQueryPROCESS_ID(processId);
1550:                processQuery.setQueryPACKAGEOID(packageDO);
1551:                processQuery.requireUniqueInstance();
1552:                XPDLApplicationProcessDO processDO = processQuery.getNextDO();
1553:
1554:                // procLevelXPDLApp
1555:                ProcLevelXPDLAppQuery procLevelXPDLAppQuery = new ProcLevelXPDLAppQuery(
1556:                        dbt);
1557:                procLevelXPDLAppQuery.setQueryAPPLICATION_ID(applicationId);
1558:                procLevelXPDLAppQuery.setQueryPROCESSOID(processDO);
1559:                procLevelXPDLAppQuery.requireUniqueInstance();
1560:                ProcLevelXPDLAppDO procLevelXPDLAppDO = procLevelXPDLAppQuery
1561:                        .getNextDO();
1562:
1563:                // toolagentApp
1564:                ToolAgentAppQuery toolAgentAppQuery = new ToolAgentAppQuery(dbt);
1565:                toolAgentAppQuery.setQueryTOOL_AGENT_NAME(toolagent);
1566:                toolAgentAppQuery.setQueryAPP_NAME(appName);
1567:                toolAgentAppQuery.requireUniqueInstance();
1568:                ToolAgentAppDO toolAgentAppDO = toolAgentAppQuery.getNextDO();
1569:
1570:                // ProcLevelXPDLAppToolAgentApp
1571:                ProcLevelXPDLAppToolAgentAppQuery procLevelXPDLAppToolAgentAppQuery = new ProcLevelXPDLAppToolAgentAppQuery(
1572:                        dbt);
1573:                procLevelXPDLAppToolAgentAppQuery
1574:                        .setQueryXPDL_APPOID(procLevelXPDLAppDO);
1575:                procLevelXPDLAppToolAgentAppQuery
1576:                        .setQueryTOOLAGENTOID(toolAgentAppDO);
1577:
1578:                ProcLevelXPDLAppToolAgentAppDO[] procLevelXPDLAppToolAgentAppDOArr = procLevelXPDLAppToolAgentAppQuery
1579:                        .getDOArray();
1580:                for (int i = 0; i < procLevelXPDLAppToolAgentAppDOArr.length; i++) {
1581:                    procLevelXPDLAppToolAgentAppDOArr[i].delete();
1582:                }
1583:
1584:                // delete unnecessairly data
1585:                // ToolAgentApp
1586:                this .deleteToolAgentApp(toolAgentAppDO);
1587:                // procLevelXPDLApp
1588:                this .deleteProcLevelXPDLApp(procLevelXPDLAppDO);
1589:                // process
1590:                this .deleteProcess(processDO);
1591:                // package
1592:                this .deletePackage(packageDO);
1593:            }
1594:
1595:            private void deletePackLevelXPDLAppToolAgentAppDetailUser(
1596:                    ApplicationMap am) throws Exception {
1597:                DBTransaction dbt = getDBTransaction();
1598:
1599:                String packageId = am.getPackageId();
1600:                String applicationId = am.getApplicationDefinitionId();
1601:
1602:                String toolagent = am.getToolAgentClassName();
1603:                String username = am.getUsername();
1604:                String password = am.getPassword();
1605:                String appName = am.getApplicationName();
1606:                Integer appMode = am.getApplicationMode();
1607:
1608:                // package
1609:                XPDLApplicationPackageQuery packageQuery = new XPDLApplicationPackageQuery(
1610:                        dbt);
1611:                packageQuery.setQueryPACKAGE_ID(packageId);
1612:                packageQuery.requireUniqueInstance();
1613:                XPDLApplicationPackageDO packageDO = packageQuery.getNextDO();
1614:
1615:                // packLevelXPDLApp
1616:                PackLevelXPDLAppQuery packLevelXPDLAppQuery = new PackLevelXPDLAppQuery(
1617:                        dbt);
1618:                packLevelXPDLAppQuery.setQueryAPPLICATION_ID(applicationId);
1619:                packLevelXPDLAppQuery.setQueryPACKAGEOID(packageDO);
1620:                packLevelXPDLAppQuery.requireUniqueInstance();
1621:                PackLevelXPDLAppDO packLevelXPDLAppDO = packLevelXPDLAppQuery
1622:                        .getNextDO();
1623:
1624:                // user
1625:                ToolAgentUserQuery userQuery = new ToolAgentUserQuery(dbt);
1626:                userQuery.setQueryUSERNAME(username);
1627:                userQuery.setQueryPWD(password);
1628:                userQuery.requireUniqueInstance();
1629:                ToolAgentUserDO userDO = userQuery.getNextDO();
1630:
1631:                // toolagentApp
1632:                ToolAgentAppQuery toolAgentAppQuery = new ToolAgentAppQuery(dbt);
1633:                toolAgentAppQuery.setQueryTOOL_AGENT_NAME(toolagent);
1634:                toolAgentAppQuery.setQueryAPP_NAME(appName);
1635:                toolAgentAppQuery.requireUniqueInstance();
1636:                ToolAgentAppDO toolAgentAppDO = toolAgentAppQuery.getNextDO();
1637:
1638:                // toolagentAppDetail
1639:                ToolAgentAppDetailQuery toolAgentAppDetailQuery = new ToolAgentAppDetailQuery(
1640:                        dbt);
1641:                toolAgentAppDetailQuery.setQueryAPP_MODE(new BigDecimal(appMode
1642:                        .intValue()));
1643:                toolAgentAppDetailQuery
1644:                        .setQueryTOOLAGENT_APPOID(toolAgentAppDO);
1645:                toolAgentAppDetailQuery.requireUniqueInstance();
1646:                ToolAgentAppDetailDO toolAgentAppDetailDO = toolAgentAppDetailQuery
1647:                        .getNextDO();
1648:
1649:                // toolAgentAppDetailUser
1650:                ToolAgentAppDetailUserQuery toolAgentAppDetailUserQuery = new ToolAgentAppDetailUserQuery(
1651:                        dbt);
1652:                toolAgentAppDetailUserQuery
1653:                        .setQueryTOOLAGENT_APPOID(toolAgentAppDetailDO);
1654:                toolAgentAppDetailUserQuery.setQueryUSEROID(userDO);
1655:                toolAgentAppDetailUserQuery.requireUniqueInstance();
1656:                ToolAgentAppDetailUserDO toolAgentAppDetailUserDO = toolAgentAppDetailUserQuery
1657:                        .getNextDO();
1658:
1659:                // PackLevelXPDLAppToolAgentAppDetailUser
1660:                PackLevelXPDLAppTAAppDetailUsrQuery packLevelXPDLAppToolAgentAppDetailUserQuery = new PackLevelXPDLAppTAAppDetailUsrQuery(
1661:                        dbt);
1662:                packLevelXPDLAppToolAgentAppDetailUserQuery
1663:                        .setQueryXPDL_APPOID(packLevelXPDLAppDO);
1664:                packLevelXPDLAppToolAgentAppDetailUserQuery
1665:                        .setQueryTOOLAGENTOID(toolAgentAppDetailUserDO);
1666:
1667:                PackLevelXPDLAppTAAppDetailUsrDO[] packLevelXPDLAppToolAgentAppDetailUserDOArr = packLevelXPDLAppToolAgentAppDetailUserQuery
1668:                        .getDOArray();
1669:                for (int i = 0; i < packLevelXPDLAppToolAgentAppDetailUserDOArr.length; i++) {
1670:                    packLevelXPDLAppToolAgentAppDetailUserDOArr[i].delete();
1671:                }
1672:
1673:                // delete unnecessairly data
1674:                // ToolAgentAppDetailUser
1675:                this .deleteToolAgentAppDetailUser(toolAgentAppDetailUserDO);
1676:                // ToolagentAppDetail
1677:                this .deleteToolAgentAppDetail(toolAgentAppDetailDO);
1678:                // ToolAgentApp
1679:                this .deleteToolAgentApp(toolAgentAppDO);
1680:                // user
1681:                this .deleteUser(userDO);
1682:                // packLevelXPDLApp
1683:                this .deletePackLevelXPDLApp(packLevelXPDLAppDO);
1684:                // package
1685:                this .deletePackage(packageDO);
1686:            }
1687:
1688:            private void deletePackLevelXPDLAppToolAgentAppDetail(
1689:                    ApplicationMap am) throws Exception {
1690:                DBTransaction dbt = getDBTransaction();
1691:
1692:                String packageId = am.getPackageId();
1693:                String applicationId = am.getApplicationDefinitionId();
1694:
1695:                String toolagent = am.getToolAgentClassName();
1696:                String appName = am.getApplicationName();
1697:                Integer appMode = am.getApplicationMode();
1698:
1699:                // package
1700:                XPDLApplicationPackageQuery packageQuery = new XPDLApplicationPackageQuery(
1701:                        dbt);
1702:                packageQuery.setQueryPACKAGE_ID(packageId);
1703:                packageQuery.requireUniqueInstance();
1704:                XPDLApplicationPackageDO packageDO = packageQuery.getNextDO();
1705:
1706:                // packLevelXPDLApp
1707:                PackLevelXPDLAppQuery packLevelXPDLAppQuery = new PackLevelXPDLAppQuery(
1708:                        dbt);
1709:                packLevelXPDLAppQuery.setQueryAPPLICATION_ID(applicationId);
1710:                packLevelXPDLAppQuery.setQueryPACKAGEOID(packageDO);
1711:                packLevelXPDLAppQuery.requireUniqueInstance();
1712:                PackLevelXPDLAppDO packLevelXPDLAppDO = packLevelXPDLAppQuery
1713:                        .getNextDO();
1714:
1715:                // toolagentApp
1716:                ToolAgentAppQuery toolAgentAppQuery = new ToolAgentAppQuery(dbt);
1717:                toolAgentAppQuery.setQueryTOOL_AGENT_NAME(toolagent);
1718:                toolAgentAppQuery.setQueryAPP_NAME(appName);
1719:                toolAgentAppQuery.requireUniqueInstance();
1720:                ToolAgentAppDO toolAgentAppDO = toolAgentAppQuery.getNextDO();
1721:
1722:                // toolAgentAppDetail
1723:                ToolAgentAppDetailQuery toolAgentAppDetailQuery = new ToolAgentAppDetailQuery(
1724:                        dbt);
1725:                toolAgentAppDetailQuery
1726:                        .setQueryTOOLAGENT_APPOID(toolAgentAppDO);
1727:                toolAgentAppDetailQuery.setQueryAPP_MODE(new BigDecimal(appMode
1728:                        .intValue()));
1729:                toolAgentAppDetailQuery.requireUniqueInstance();
1730:                ToolAgentAppDetailDO toolAgentAppDetailDO = toolAgentAppDetailQuery
1731:                        .getNextDO();
1732:
1733:                // ProcLevelXPDLAppToolAgentAppDetail
1734:                PackLevelXPDLAppTAAppDetailQuery packLevelXPDLAppToolAgentAppDetailQuery = new PackLevelXPDLAppTAAppDetailQuery(
1735:                        dbt);
1736:                packLevelXPDLAppToolAgentAppDetailQuery
1737:                        .setQueryXPDL_APPOID(packLevelXPDLAppDO);
1738:                packLevelXPDLAppToolAgentAppDetailQuery
1739:                        .setQueryTOOLAGENTOID(toolAgentAppDetailDO);
1740:
1741:                PackLevelXPDLAppTAAppDetailDO[] packLevelXPDLAppToolAgentAppDetailDOArr = packLevelXPDLAppToolAgentAppDetailQuery
1742:                        .getDOArray();
1743:                for (int i = 0; i < packLevelXPDLAppToolAgentAppDetailDOArr.length; i++) {
1744:                    packLevelXPDLAppToolAgentAppDetailDOArr[i].delete();
1745:                }
1746:
1747:                // delete unnecessairly data
1748:                // ToolAgentAppDetail
1749:                this .deleteToolAgentAppDetail(toolAgentAppDetailDO);
1750:                // ToolAgentApp
1751:                this .deleteToolAgentApp(toolAgentAppDO);
1752:                // packLevelXPDLApp
1753:                this .deletePackLevelXPDLApp(packLevelXPDLAppDO);
1754:                // package
1755:                this .deletePackage(packageDO);
1756:            }
1757:
1758:            private void deletePackLevelXPDLAppToolAgentAppUser(
1759:                    ApplicationMap am) throws Exception {
1760:                DBTransaction dbt = getDBTransaction();
1761:
1762:                String packageId = am.getPackageId();
1763:                String applicationId = am.getApplicationDefinitionId();
1764:
1765:                String toolagent = am.getToolAgentClassName();
1766:                String username = am.getUsername();
1767:                String password = am.getPassword();
1768:                String appName = am.getApplicationName();
1769:
1770:                // package
1771:                XPDLApplicationPackageQuery packageQuery = new XPDLApplicationPackageQuery(
1772:                        dbt);
1773:                packageQuery.setQueryPACKAGE_ID(packageId);
1774:                packageQuery.requireUniqueInstance();
1775:                XPDLApplicationPackageDO packageDO = packageQuery.getNextDO();
1776:
1777:                // packLevelXPDLApp
1778:                PackLevelXPDLAppQuery packLevelXPDLAppQuery = new PackLevelXPDLAppQuery(
1779:                        dbt);
1780:                packLevelXPDLAppQuery.setQueryAPPLICATION_ID(applicationId);
1781:                packLevelXPDLAppQuery.setQueryPACKAGEOID(packageDO);
1782:                packLevelXPDLAppQuery.requireUniqueInstance();
1783:                PackLevelXPDLAppDO packLevelXPDLAppDO = packLevelXPDLAppQuery
1784:                        .getNextDO();
1785:
1786:                // user
1787:                ToolAgentUserQuery userQuery = new ToolAgentUserQuery(dbt);
1788:                userQuery.setQueryUSERNAME(username);
1789:                userQuery.setQueryPWD(password);
1790:                userQuery.requireUniqueInstance();
1791:                ToolAgentUserDO userDO = userQuery.getNextDO();
1792:
1793:                // toolagentApp
1794:                ToolAgentAppQuery toolAgentAppQuery = new ToolAgentAppQuery(dbt);
1795:                toolAgentAppQuery.setQueryTOOL_AGENT_NAME(toolagent);
1796:                toolAgentAppQuery.setQueryAPP_NAME(appName);
1797:                toolAgentAppQuery.requireUniqueInstance();
1798:                ToolAgentAppDO toolAgentAppDO = toolAgentAppQuery.getNextDO();
1799:
1800:                // toolAgentAppUser
1801:                ToolAgentAppUserQuery toolAgentAppUserQuery = new ToolAgentAppUserQuery(
1802:                        dbt);
1803:                toolAgentAppUserQuery.setQueryTOOLAGENT_APPOID(toolAgentAppDO);
1804:                toolAgentAppUserQuery.setQueryUSEROID(userDO);
1805:                toolAgentAppUserQuery.requireUniqueInstance();
1806:                ToolAgentAppUserDO toolAgentAppUserDO = toolAgentAppUserQuery
1807:                        .getNextDO();
1808:
1809:                // ProcLevelXPDLAppToolAgentAppUser
1810:                PackLevelXPDLAppTAAppUserQuery packLevelXPDLAppToolAgentAppUserQuery = new PackLevelXPDLAppTAAppUserQuery(
1811:                        dbt);
1812:                packLevelXPDLAppToolAgentAppUserQuery
1813:                        .setQueryXPDL_APPOID(packLevelXPDLAppDO);
1814:                packLevelXPDLAppToolAgentAppUserQuery
1815:                        .setQueryTOOLAGENTOID(toolAgentAppUserDO);
1816:
1817:                PackLevelXPDLAppTAAppUserDO[] packLevelXPDLAppToolAgentAppUserDOArr = packLevelXPDLAppToolAgentAppUserQuery
1818:                        .getDOArray();
1819:                for (int i = 0; i < packLevelXPDLAppToolAgentAppUserDOArr.length; i++) {
1820:                    packLevelXPDLAppToolAgentAppUserDOArr[i].delete();
1821:                }
1822:
1823:                // delete unnecessairly data
1824:                // ToolAgentAppUser
1825:                this .deleteToolAgentAppUser(toolAgentAppUserDO);
1826:                // ToolAgentApp
1827:                this .deleteToolAgentApp(toolAgentAppDO);
1828:                // user
1829:                this .deleteUser(userDO);
1830:                // packLevelXPDLApp
1831:                this .deletePackLevelXPDLApp(packLevelXPDLAppDO);
1832:                // package
1833:                this .deletePackage(packageDO);
1834:            }
1835:
1836:            private void deletePackLevelXPDLAppToolAgentApp(ApplicationMap am)
1837:                    throws Exception {
1838:                DBTransaction dbt = getDBTransaction();
1839:
1840:                String packageId = am.getPackageId();
1841:                String applicationId = am.getApplicationDefinitionId();
1842:
1843:                String toolagent = am.getToolAgentClassName();
1844:                String appName = am.getApplicationName();
1845:
1846:                // package
1847:                XPDLApplicationPackageQuery packageQuery = new XPDLApplicationPackageQuery(
1848:                        dbt);
1849:                packageQuery.setQueryPACKAGE_ID(packageId);
1850:                packageQuery.requireUniqueInstance();
1851:                XPDLApplicationPackageDO packageDO = packageQuery.getNextDO();
1852:
1853:                // packLevelXPDLApp
1854:                PackLevelXPDLAppQuery packLevelXPDLAppQuery = new PackLevelXPDLAppQuery(
1855:                        dbt);
1856:                packLevelXPDLAppQuery.setQueryAPPLICATION_ID(applicationId);
1857:                packLevelXPDLAppQuery.setQueryPACKAGEOID(packageDO);
1858:                packLevelXPDLAppQuery.requireUniqueInstance();
1859:                PackLevelXPDLAppDO packLevelXPDLAppDO = packLevelXPDLAppQuery
1860:                        .getNextDO();
1861:
1862:                // toolagentApp
1863:                ToolAgentAppQuery toolAgentAppQuery = new ToolAgentAppQuery(dbt);
1864:                toolAgentAppQuery.setQueryTOOL_AGENT_NAME(toolagent);
1865:                toolAgentAppQuery.setQueryAPP_NAME(appName);
1866:                toolAgentAppQuery.requireUniqueInstance();
1867:                ToolAgentAppDO toolAgentAppDO = toolAgentAppQuery.getNextDO();
1868:
1869:                // PackLevelXPDLAppToolAgentApp
1870:                PackLevelXPDLAppToolAgentAppQuery packLevelXPDLAppToolAgentAppQuery = new PackLevelXPDLAppToolAgentAppQuery(
1871:                        dbt);
1872:                packLevelXPDLAppToolAgentAppQuery
1873:                        .setQueryXPDL_APPOID(packLevelXPDLAppDO);
1874:                packLevelXPDLAppToolAgentAppQuery
1875:                        .setQueryTOOLAGENTOID(toolAgentAppDO);
1876:
1877:                PackLevelXPDLAppToolAgentAppDO[] packLevelXPDLAppToolAgentAppDOArr = packLevelXPDLAppToolAgentAppQuery
1878:                        .getDOArray();
1879:                for (int i = 0; i < packLevelXPDLAppToolAgentAppDOArr.length; i++) {
1880:                    packLevelXPDLAppToolAgentAppDOArr[i].delete();
1881:                }
1882:
1883:                // delete unnecessarily data
1884:                // ToolAgentApp
1885:                this .deleteToolAgentApp(toolAgentAppDO);
1886:                // packLevelXPDLApp
1887:                this .deletePackLevelXPDLApp(packLevelXPDLAppDO);
1888:                // package
1889:                this .deletePackage(packageDO);
1890:            }
1891:
1892:            private void deletePackage(XPDLApplicationPackageDO packageDO)
1893:                    throws Exception {
1894:                if (packageDO == null)
1895:                    return;
1896:
1897:                DBTransaction dbt = getDBTransaction();
1898:
1899:                XPDLApplicationProcessQuery processQuery = new XPDLApplicationProcessQuery(
1900:                        dbt);
1901:                processQuery.setQueryPACKAGEOID(packageDO);
1902:
1903:                PackLevelXPDLAppQuery packLevelXPDLAppQuery = new PackLevelXPDLAppQuery(
1904:                        dbt);
1905:                packLevelXPDLAppQuery.setQueryPACKAGEOID(packageDO);
1906:
1907:                if (processQuery.getDOArray().length == 0
1908:                        && packLevelXPDLAppQuery.getDOArray().length == 0)
1909:                    packageDO.delete();
1910:            }
1911:
1912:            private void deleteProcess(XPDLApplicationProcessDO processDO)
1913:                    throws Exception {
1914:                if (processDO == null)
1915:                    return;
1916:
1917:                DBTransaction dbt = getDBTransaction();
1918:
1919:                ProcLevelXPDLAppQuery procLevelXPDLAppQuery = new ProcLevelXPDLAppQuery(
1920:                        dbt);
1921:                procLevelXPDLAppQuery.setQueryPROCESSOID(processDO);
1922:
1923:                if (procLevelXPDLAppQuery.getDOArray().length == 0)
1924:                    processDO.delete();
1925:            }
1926:
1927:            private void deleteUser(ToolAgentUserDO userDO) throws Exception {
1928:                if (userDO == null)
1929:                    return;
1930:
1931:                DBTransaction dbt = getDBTransaction();
1932:
1933:                ToolAgentAppUserQuery toolAgentAppUserQuery = new ToolAgentAppUserQuery(
1934:                        dbt);
1935:                toolAgentAppUserQuery.setQueryUSEROID(userDO);
1936:
1937:                ToolAgentAppDetailUserQuery toolAgentAppDetailUserQuery = new ToolAgentAppDetailUserQuery(
1938:                        dbt);
1939:                toolAgentAppDetailUserQuery.setQueryUSEROID(userDO);
1940:
1941:                if (toolAgentAppUserQuery.getDOArray().length == 0
1942:                        && toolAgentAppDetailUserQuery.getDOArray().length == 0) {
1943:                    userDO.delete();
1944:                }
1945:            }
1946:
1947:            private void deleteToolAgentApp(ToolAgentAppDO toolAgentAppDO)
1948:                    throws Exception {
1949:
1950:                if (toolAgentAppDO == null)
1951:                    return;
1952:
1953:                DBTransaction dbt = getDBTransaction();
1954:
1955:                ToolAgentAppDetailQuery toolAgentAppDetailQuery = new ToolAgentAppDetailQuery(
1956:                        dbt);
1957:                toolAgentAppDetailQuery
1958:                        .setQueryTOOLAGENT_APPOID(toolAgentAppDO);
1959:
1960:                ToolAgentAppUserQuery toolAgentAppUserQuery = new ToolAgentAppUserQuery(
1961:                        dbt);
1962:                toolAgentAppUserQuery.setQueryTOOLAGENT_APPOID(toolAgentAppDO);
1963:
1964:                PackLevelXPDLAppToolAgentAppQuery packLevelXPDLAppToolAgentAppQuery = new PackLevelXPDLAppToolAgentAppQuery(
1965:                        dbt);
1966:                packLevelXPDLAppToolAgentAppQuery
1967:                        .setQueryTOOLAGENTOID(toolAgentAppDO);
1968:
1969:                ProcLevelXPDLAppToolAgentAppQuery procLevelXPDLAppToolAgentAppQuery = new ProcLevelXPDLAppToolAgentAppQuery(
1970:                        dbt);
1971:                procLevelXPDLAppToolAgentAppQuery
1972:                        .setQueryTOOLAGENTOID(toolAgentAppDO);
1973:
1974:                if (toolAgentAppDetailQuery.getDOArray().length == 0
1975:                        && toolAgentAppUserQuery.getDOArray().length == 0
1976:                        && packLevelXPDLAppToolAgentAppQuery.getDOArray().length == 0
1977:                        && procLevelXPDLAppToolAgentAppQuery.getDOArray().length == 0) {
1978:                    toolAgentAppDO.delete();
1979:                }
1980:            }
1981:
1982:            private void deleteToolAgentAppUser(
1983:                    ToolAgentAppUserDO toolAgentAppUserDO) throws Exception {
1984:
1985:                if (toolAgentAppUserDO == null)
1986:                    return;
1987:
1988:                DBTransaction dbt = getDBTransaction();
1989:
1990:                PackLevelXPDLAppTAAppUserQuery packLevelXPDLAppToolAgentAppUserQuery = new PackLevelXPDLAppTAAppUserQuery(
1991:                        dbt);
1992:                packLevelXPDLAppToolAgentAppUserQuery
1993:                        .setQueryTOOLAGENTOID(toolAgentAppUserDO);
1994:
1995:                ProcLevelXPDLAppTAAppUserQuery procLevelXPDLAppToolAgentAppUserQuery = new ProcLevelXPDLAppTAAppUserQuery(
1996:                        dbt);
1997:                procLevelXPDLAppToolAgentAppUserQuery
1998:                        .setQueryTOOLAGENTOID(toolAgentAppUserDO);
1999:
2000:                if (packLevelXPDLAppToolAgentAppUserQuery.getDOArray().length == 0
2001:                        && procLevelXPDLAppToolAgentAppUserQuery.getDOArray().length == 0) {
2002:                    toolAgentAppUserDO.delete();
2003:                }
2004:            }
2005:
2006:            private void deleteToolAgentAppDetail(
2007:                    ToolAgentAppDetailDO toolAgentAppDetailDO) throws Exception {
2008:
2009:                if (toolAgentAppDetailDO == null)
2010:                    return;
2011:
2012:                DBTransaction dbt = getDBTransaction();
2013:
2014:                ToolAgentAppDetailUserQuery toolAgentAppDetailUserQuery = new ToolAgentAppDetailUserQuery(
2015:                        dbt);
2016:                toolAgentAppDetailUserQuery
2017:                        .setQueryTOOLAGENT_APPOID(toolAgentAppDetailDO);
2018:
2019:                PackLevelXPDLAppTAAppDetailQuery packLevelXPDLAppToolAgentAppDetailQuery = new PackLevelXPDLAppTAAppDetailQuery(
2020:                        dbt);
2021:                packLevelXPDLAppToolAgentAppDetailQuery
2022:                        .setQueryTOOLAGENTOID(toolAgentAppDetailDO);
2023:
2024:                ProcLevelXPDLAppTAAppDetailQuery procLevelXPDLAppToolAgentAppDetailQuery = new ProcLevelXPDLAppTAAppDetailQuery(
2025:                        dbt);
2026:                procLevelXPDLAppToolAgentAppDetailQuery
2027:                        .setQueryTOOLAGENTOID(toolAgentAppDetailDO);
2028:
2029:                if (toolAgentAppDetailUserQuery.getDOArray().length == 0
2030:                        && packLevelXPDLAppToolAgentAppDetailQuery.getDOArray().length == 0
2031:                        && procLevelXPDLAppToolAgentAppDetailQuery.getDOArray().length == 0) {
2032:                    toolAgentAppDetailDO.delete();
2033:                }
2034:            }
2035:
2036:            private void deleteToolAgentAppDetailUser(
2037:                    ToolAgentAppDetailUserDO toolAgentAppDetailUserDO)
2038:                    throws Exception {
2039:
2040:                if (toolAgentAppDetailUserDO == null)
2041:                    return;
2042:
2043:                DBTransaction dbt = getDBTransaction();
2044:
2045:                PackLevelXPDLAppTAAppDetailUsrQuery packLevelXPDLAppToolAgentAppDetailUserQuery = new PackLevelXPDLAppTAAppDetailUsrQuery(
2046:                        dbt);
2047:                packLevelXPDLAppToolAgentAppDetailUserQuery
2048:                        .setQueryTOOLAGENTOID(toolAgentAppDetailUserDO);
2049:
2050:                ProcLevelXPDLAppTAAppDetailUsrQuery procLevelXPDLAppToolAgentAppDetailUserQuery = new ProcLevelXPDLAppTAAppDetailUsrQuery(
2051:                        dbt);
2052:                procLevelXPDLAppToolAgentAppDetailUserQuery
2053:                        .setQueryTOOLAGENTOID(toolAgentAppDetailUserDO);
2054:
2055:                if (packLevelXPDLAppToolAgentAppDetailUserQuery.getDOArray().length == 0
2056:                        && procLevelXPDLAppToolAgentAppDetailUserQuery
2057:                                .getDOArray().length == 0) {
2058:                    toolAgentAppDetailUserDO.delete();
2059:                }
2060:            }
2061:
2062:            private void deletePackLevelXPDLApp(
2063:                    PackLevelXPDLAppDO packLevelXPDLAppDO) throws Exception {
2064:
2065:                if (packLevelXPDLAppDO == null)
2066:                    return;
2067:
2068:                DBTransaction dbt = getDBTransaction();
2069:
2070:                PackLevelXPDLAppToolAgentAppQuery packLevelXPDLAppToolAgentAppQuery = new PackLevelXPDLAppToolAgentAppQuery(
2071:                        dbt);
2072:                packLevelXPDLAppToolAgentAppQuery
2073:                        .setQueryXPDL_APPOID(packLevelXPDLAppDO);
2074:
2075:                PackLevelXPDLAppTAAppDetailQuery packLevelXPDLAppToolAgentAppDetailQuery = new PackLevelXPDLAppTAAppDetailQuery(
2076:                        dbt);
2077:                packLevelXPDLAppToolAgentAppDetailQuery
2078:                        .setQueryXPDL_APPOID(packLevelXPDLAppDO);
2079:
2080:                PackLevelXPDLAppTAAppUserQuery packLevelXPDLAppToolAgentAppUserQuery = new PackLevelXPDLAppTAAppUserQuery(
2081:                        dbt);
2082:                packLevelXPDLAppToolAgentAppUserQuery
2083:                        .setQueryXPDL_APPOID(packLevelXPDLAppDO);
2084:
2085:                PackLevelXPDLAppTAAppDetailUsrQuery packLevelXPDLAppToolAgentAppDetailUserQuery = new PackLevelXPDLAppTAAppDetailUsrQuery(
2086:                        dbt);
2087:                packLevelXPDLAppToolAgentAppDetailUserQuery
2088:                        .setQueryXPDL_APPOID(packLevelXPDLAppDO);
2089:
2090:                if (packLevelXPDLAppToolAgentAppQuery.getDOArray().length == 0
2091:                        && packLevelXPDLAppToolAgentAppDetailQuery.getDOArray().length == 0
2092:                        && packLevelXPDLAppToolAgentAppUserQuery.getDOArray().length == 0
2093:                        && packLevelXPDLAppToolAgentAppDetailUserQuery
2094:                                .getDOArray().length == 0) {
2095:                    packLevelXPDLAppDO.delete();
2096:                }
2097:            }
2098:
2099:            private void deleteProcLevelXPDLApp(
2100:                    ProcLevelXPDLAppDO procLevelXPDLAppDO) throws Exception {
2101:                if (procLevelXPDLAppDO == null)
2102:                    return;
2103:
2104:                DBTransaction dbt = getDBTransaction();
2105:
2106:                ProcLevelXPDLAppToolAgentAppQuery procLevelXPDLAppToolAgentAppQuery = new ProcLevelXPDLAppToolAgentAppQuery(
2107:                        dbt);
2108:                procLevelXPDLAppToolAgentAppQuery
2109:                        .setQueryXPDL_APPOID(procLevelXPDLAppDO);
2110:
2111:                ProcLevelXPDLAppTAAppDetailQuery procLevelXPDLAppToolAgentAppDetailQuery = new ProcLevelXPDLAppTAAppDetailQuery(
2112:                        dbt);
2113:                procLevelXPDLAppToolAgentAppDetailQuery
2114:                        .setQueryXPDL_APPOID(procLevelXPDLAppDO);
2115:
2116:                ProcLevelXPDLAppTAAppUserQuery procLevelXPDLAppToolAgentAppUserQuery = new ProcLevelXPDLAppTAAppUserQuery(
2117:                        dbt);
2118:                procLevelXPDLAppToolAgentAppUserQuery
2119:                        .setQueryXPDL_APPOID(procLevelXPDLAppDO);
2120:
2121:                ProcLevelXPDLAppTAAppDetailUsrQuery procLevelXPDLAppToolAgentAppDetailUserQuery = new ProcLevelXPDLAppTAAppDetailUsrQuery(
2122:                        dbt);
2123:                procLevelXPDLAppToolAgentAppDetailUserQuery
2124:                        .setQueryXPDL_APPOID(procLevelXPDLAppDO);
2125:
2126:                if (procLevelXPDLAppToolAgentAppQuery.getDOArray().length == 0
2127:                        && procLevelXPDLAppToolAgentAppDetailQuery.getDOArray().length == 0
2128:                        && procLevelXPDLAppToolAgentAppUserQuery.getDOArray().length == 0
2129:                        && procLevelXPDLAppToolAgentAppDetailUserQuery
2130:                                .getDOArray().length == 0) {
2131:                    procLevelXPDLAppDO.delete();
2132:                }
2133:            }
2134:
2135:            protected DBTransaction getDBTransaction() throws Exception {
2136:                return db.createTransaction();
2137:            }
2138:
2139:            protected void setLDBName() {
2140:                String defDBName = DODS.getDatabaseManager().getDefaultDB();
2141:                try {
2142:                    String dbName = db.getName();
2143:                    DODS.getDatabaseManager().setDefaultDatabase(dbName);
2144:                    refreshDOCaches();
2145:                } catch (Exception _) {
2146:                    _.printStackTrace();
2147:                } finally {
2148:                    try {
2149:                        DODS.getDatabaseManager().setDefaultDatabase(defDBName);
2150:                    } catch (DatabaseManagerException e) {
2151:                        e.printStackTrace();
2152:                    }
2153:                }
2154:            }
2155:
2156:            protected void refreshDOCaches() throws Exception {
2157:                XPDLApplicationProcessDO.refreshCache();
2158:                ToolAgentUserDO.refreshCache();
2159:                ProcLevelXPDLAppToolAgentAppDO.refreshCache();
2160:                PackLevelXPDLAppTAAppDetailUsrDO.refreshCache();
2161:                PackLevelXPDLAppDO.refreshCache();
2162:                PackLevelXPDLAppTAAppUserDO.refreshCache();
2163:                PackLevelXPDLAppToolAgentAppDO.refreshCache();
2164:                PackLevelXPDLAppTAAppDetailDO.refreshCache();
2165:                ProcLevelXPDLAppTAAppDetailDO.refreshCache();
2166:                ToolAgentAppUserDO.refreshCache();
2167:                XPDLApplicationPackageDO.refreshCache();
2168:                ProcLevelXPDLAppDO.refreshCache();
2169:                ProcLevelXPDLAppTAAppDetailUsrDO.refreshCache();
2170:                ToolAgentAppDetailDO.refreshCache();
2171:                ToolAgentAppDO.refreshCache();
2172:                ProcLevelXPDLAppTAAppUserDO.refreshCache();
2173:                ToolAgentAppDetailUserDO.refreshCache();
2174:            }
2175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.