Source Code Cross Referenced for ProjectServiceBean.java in  » Workflow-Engines » JFolder » org » jfolder » services » project » 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 » JFolder » org.jfolder.services.project 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JFolder, Copyright 2001-2006 Gary Steinmetz
003:         *
004:         * Distributable under LGPL license.
005:         * See terms of license at gnu.org.
006:         */
007:
008:        package org.jfolder.services.project;
009:
010:        //base classes
011:        import java.io.File;
012:        import java.io.IOException;
013:        import java.math.BigDecimal;
014:        import java.sql.Connection;
015:        import java.util.ArrayList;
016:        import java.util.Collection;
017:        import java.util.Collections;
018:        import java.util.HashMap;
019:        import java.util.Iterator;
020:        import javax.xml.parsers.ParserConfigurationException;
021:        import org.w3c.dom.Document;
022:        import org.w3c.dom.Element;
023:        import org.w3c.dom.Node;
024:        import org.w3c.dom.NodeList;
025:        import org.xml.sax.SAXException;
026:
027:        //project specific classes
028:        import org.jfolder.common.UnexpectedSystemException;
029:        import org.jfolder.common.entity.properties.SystemEntityPropertiesUpdates;
030:        import org.jfolder.common.entity.properties.v1.SystemEntityPropertiesTag;
031:        import org.jfolder.common.tagging.ConceptTagCharacteristic;
032:        import org.jfolder.common.tagging.ConceptTagCharacteristicHolder;
033:        import org.jfolder.common.tagging.ConceptTagMenuBranch;
034:        import org.jfolder.common.tagging.ConceptTagMenuContext;
035:        import org.jfolder.common.tagging.ConceptTagPreferences;
036:        import org.jfolder.common.tagging.ConceptTagSetContext;
037:        import org.jfolder.common.tagging.ConceptTagSetHolder;
038:        import org.jfolder.common.tagging.RootConceptTagHolder;
039:        import org.jfolder.common.utils.misc.MiscHelper;
040:        import org.jfolder.common.utils.xml.LinearXPath;
041:        import org.jfolder.common.utils.xml.LinearXPathHelper;
042:        import org.jfolder.common.utils.xml.XMLHelper;
043:        import org.jfolder.config.instance.ConfigInstance;
044:        import org.jfolder.config.instance.ConfigInstanceConfig;
045:        import org.jfolder.config.instance.ConfigInstanceTagHelper;
046:        import org.jfolder.dms.model.DocumentFileSystemRootUpdates;
047:        import org.jfolder.dms.model.v1.DocumentFileSystemRootTag;
048:        import org.jfolder.platforms.stores.base.CreateStatement;
049:        import org.jfolder.platforms.stores.base.InsertStatement;
050:        import org.jfolder.platforms.stores.base.SelectStatement;
051:        import org.jfolder.platforms.stores.base.SystemDatabase;
052:        import org.jfolder.platforms.stores.base.SystemResultSet;
053:        import org.jfolder.platforms.stores.base.SystemStatement;
054:        import org.jfolder.platforms.stores.base.SystemStore;
055:        import org.jfolder.platforms.stores.base.SystemStoreFactory;
056:        import org.jfolder.project.model.ProjectSystem;
057:        import org.jfolder.project.model.ProjectSystemUpdates;
058:        import org.jfolder.project.model.v1.ProjectSystemTag;
059:        import org.jfolder.security.audit.SecurityAudit;
060:        import org.jfolder.security.audit.SecurityAuditHelper;
061:        import org.jfolder.security.audit.v1.SecurityAuditTag;
062:        import org.jfolder.security.lifecycle.SecurityLifecycle;
063:        import org.jfolder.security.lifecycle.SecurityLifecycleHelper;
064:        import org.jfolder.security.model.SimpleUserIdentity;
065:        import org.jfolder.security.model.UserIdentity;
066:        import org.jfolder.security.model.v1.UserIdentityTag;
067:        import org.jfolder.services.base.AbstractBaseServiceBean;
068:        import org.jfolder.services.dms.DMSService;
069:        import org.jfolder.services.dms.DMSServiceCallerFactory;
070:
071:        //other classes
072:
073:        class ProjectServiceBean extends AbstractBaseServiceBean implements 
074:                ProjectService {
075:
076:            protected ProjectServiceBean() {
077:            }
078:
079:            public HashMap accessDeployableProjects(
080:                    ConceptTagCharacteristic inCtchar, int inIndex) {
081:                //
082:                HashMap outValue = new HashMap();
083:
084:                Connection conn = null;
085:
086:                try {
087:
088:                    ConceptTagCharacteristic resultsCtchar = createResultsCtchar(
089:                            inCtchar, inIndex);
090:
091:                    SystemStore ss = SystemStoreFactory.getSystemStore();
092:                    SystemDatabase sd = SystemDatabase.newInstance();
093:                    conn = SystemStore.getConnection(ss);
094:                    //
095:                    CreateStatement projectSysTable = sd
096:                            .createProjectSysTable();
097:                    CreateStatement auditTable = sd.createAuditTable();
098:                    CreateStatement userTable = sd.createUserTable();
099:                    //
100:                    SecurityLifecycle sl = SecurityLifecycleHelper
101:                            .getSecurityLifecycle();
102:                    //
103:                    SelectStatement maxProjectSysSelect = getLatestProjects(
104:                            null, new Boolean(false), null, sd, conn, ss);
105:                    //
106:                    SelectStatement projSysSelect = SelectStatement
107:                            .createOrderById(projectSysTable, null);
108:                    //
109:                    projSysSelect.addSelectColumn(
110:                            SystemDatabase.C_PROJECT_SYS_RO_ID_T_PROJECT_SYS,
111:                            projectSysTable, null);
112:                    projSysSelect.addSelectColumn(SystemDatabase.C_NAME_T_USER,
113:                            userTable, null);
114:                    projSysSelect.addSelectColumn(
115:                            SystemDatabase.C_ACTUAL_NAME_T_PROJECT_SYS,
116:                            projectSysTable, null);
117:                    projSysSelect.addSelectIdColumn(auditTable, null);
118:                    //
119:                    projSysSelect.addWhereColumn(null,
120:                            SelectStatement.ID_COLUMN, projectSysTable,
121:                            maxProjectSysSelect, SelectStatement.IN, null);
122:                    //
123:                    projSysSelect.addWhereColumn(SystemDatabase.C_TYPE_T_USER,
124:                            SelectStatement.NORMAL_COLUMN, userTable, sl
125:                                    .getSecurityType(), SelectStatement.EQUALS,
126:                            null);
127:                    //
128:                    ss.execute(projSysSelect, conn);
129:                    SystemResultSet projSysSrs = projSysSelect.getResults();
130:                    for (int i = 0; i < projSysSrs.getRowCount(); i++) {
131:                        //
132:                        ConceptTagCharacteristic nextResultCtchar = createResultsCtchar(
133:                                resultsCtchar, resultsCtchar.getValueLength());
134:                        //
135:                        BigDecimal projectSysId = projSysSrs.getDecimal(i, 0);
136:                        BigDecimal projectSysRoId = projSysSrs.getDecimal(i, 1);
137:                        String userName = projSysSrs.getSString(i, 2);
138:                        String projectName = projSysSrs.getSString(i, 3);
139:                        //
140:                        UserIdentity ui = UserIdentityTag.newInstance(
141:                                nextResultCtchar, 0, userName, sl
142:                                        .getSecurityType(), true, false);
143:                        //
144:                        ProjectSystem ps = accessProjectSystem(
145:                                nextResultCtchar, 1, ui, false, projectName);
146:                        //
147:                        if (ps.isActive() && ps.isDeployVisible()) {
148:                            ArrayList nextResult = null;
149:                            if (outValue.containsKey(ui)) {
150:                                nextResult = (ArrayList) outValue.get(ui);
151:                            } else {
152:                                nextResult = new ArrayList();
153:                                outValue.put(ui, nextResult);
154:                            }
155:                            nextResult.add(ps);
156:                        } else {
157:                            resultsCtchar
158:                                    .removeValueWithLocalFiles(resultsCtchar
159:                                            .getValueLength() - 1);
160:                        }
161:                    }
162:                } finally {
163:                    SystemStore.closeSQLObjects(conn, null, null);
164:                }
165:
166:                //MiscHelper.println("ProServBean accDeplProj outValue = " + outValue);
167:                //MiscHelper.println("ProServBean accDeplProj outValue = " + outValue);
168:                //MiscHelper.println("ProServBean accDeplProj outValue = " + outValue);
169:
170:                return outValue;
171:            }
172:
173:            //
174:            public ProjectSystem accessProjectSystem(
175:                    ConceptTagCharacteristic inCtchar, int inIndex,
176:                    UserIdentity inUi, boolean inDeployed, String inProjectName) {
177:                //
178:                ProjectSystemTag outValue = null;
179:
180:                Connection conn = null;
181:
182:                try {
183:                    SystemStore ss = SystemStoreFactory.getSystemStore();
184:                    SystemDatabase sd = SystemDatabase.newInstance();
185:                    conn = SystemStore.getConnection(ss);
186:                    CreateStatement projectSysTable = sd
187:                            .createProjectSysTable();
188:                    CreateStatement projectSysRoTable = sd
189:                            .createProjectSysReadOnlyTable();
190:                    //
191:                    SelectStatement maxProjectSysSelect = getLatestProjects(
192:                            inUi, new Boolean(inDeployed), inProjectName, sd,
193:                            conn, ss);
194:                    //
195:                    SelectStatement projectSysSelect = SelectStatement
196:                            .createOrderById(projectSysTable, null);
197:                    //
198:                    projectSysSelect.addSelectColumn(
199:                            SystemDatabase.C_ACTUAL_NAME_T_PROJECT_SYS,
200:                            projectSysTable, null);
201:                    projectSysSelect.addSelectColumn(
202:                            SystemDatabase.C_AUDIT_ID_T_PROJECT_SYS,
203:                            projectSysTable, null);
204:                    projectSysSelect.addSelectColumn(
205:                            SystemDatabase.C_DEPLOY_VISIBLE_T_PROJECT_SYS,
206:                            projectSysTable, null);
207:                    projectSysSelect.addSelectColumn(
208:                            SystemDatabase.C_VERSION_T_PROJECT_SYS,
209:                            projectSysTable, null);
210:                    projectSysSelect.addSelectColumn(
211:                            SystemDatabase.C_PROP_RO_ID_T_PROJECT_SYS_RO,
212:                            projectSysRoTable, null);
213:                    projectSysSelect.addSelectColumn(
214:                            SystemDatabase.C_DOC_SYS_RO_ID_T_PROJECT_SYS_RO,
215:                            projectSysRoTable, null);
216:                    projectSysSelect.addSelectColumn(
217:                            SystemDatabase.C_ACTIVE_T_PROJECT_SYS,
218:                            projectSysTable, null);
219:                    //
220:                    projectSysSelect.addWhereColumn(null,
221:                            SelectStatement.ID_COLUMN, projectSysTable,
222:                            maxProjectSysSelect, SelectStatement.IN, null);
223:                    //
224:                    ss.execute(projectSysSelect, conn);
225:                    SystemResultSet projSysSrs = projectSysSelect.getResults();
226:                    //
227:                    //
228:                    if (projSysSrs.getRowCount() > 0) {
229:                        //
230:                        String actualName = projSysSrs.getSString(0, 1);
231:                        BigDecimal auditId = projSysSrs.getDecimal(0, 2);
232:                        Boolean deployVisable = projSysSrs.getBoolean(0, 3);
233:                        BigDecimal version = projSysSrs.getDecimal(0, 4);
234:                        BigDecimal propRoId = projSysSrs.getDecimal(0, 5);
235:                        BigDecimal docSysId = projSysSrs.getDecimal(0, 6);
236:                        Boolean active = projSysSrs.getBoolean(0, 7);
237:
238:                        //
239:                        outValue = ProjectSystemTag.newInstance(inCtchar,
240:                                inIndex, inUi, actualName, deployVisable
241:                                        .booleanValue(), version.intValue(),
242:                                inDeployed, active.booleanValue());
243:                        //
244:                        SecurityAudit sa = accessAudit(auditId, conn, ss);
245:                        SecurityAuditTag.newInstance(outValue.getAuditCtchar(),
246:                                0, sa.getAuditUserIdentity(), sa
247:                                        .getAuditSequenceNumber(), sa
248:                                        .getAuditMachineOfOrigin(), sa
249:                                        .getAuditDateTime(), sa
250:                                        .getAuditSeverityLevel(),
251:                                SecurityAuditHelper.convertAuditTypeToString(sa
252:                                        .getAuditCategoryType()),
253:                                SecurityAuditHelper.convertAuditTypeToString(sa
254:                                        .getAuditSourceType()), sa
255:                                        .getAuditServerVersion(), sa
256:                                        .getAuditCustomCode(),
257:                                SecurityAuditHelper.convertAuditTypeToString(sa
258:                                        .getAuditCustomCategoryType()),
259:                                SecurityAuditHelper.convertAuditTypeToString(sa
260:                                        .getAuditCustomSourceType()), sa
261:                                        .getAuditCustomMessage(), false);
262:                        //
263:                        //UserIdentityTag.newInstance(
264:                        //    outValue.getUserCtchar(), 0, inUi.getName(),
265:                        //    inUi.getSecurityType(), inUi.isValid(),
266:                        //    inUi.isAnonymous());
267:                        //
268:                        accessProperties(outValue.getPropertyCtchar(), 0,
269:                                propRoId, conn, ss);
270:                        //
271:                        CreateStatement docSysRoTable = sd
272:                                .createDocSysReadOnlyTable();
273:                        SelectStatement docSysRoSelect = SelectStatement
274:                                .createOrderByColumn(
275:                                        SystemDatabase.C_SECTION_T_DOC_SYS_RO,
276:                                        docSysRoTable, null);
277:                        docSysRoSelect.addSelectColumn(
278:                                SystemDatabase.C_SUB_SECTION_T_DOC_SYS_RO,
279:                                docSysRoTable, null);
280:                        docSysRoSelect.addWhereColumn(null,
281:                                SystemStatement.ID_COLUMN, docSysRoTable,
282:                                docSysId, SelectStatement.EQUALS, null);
283:                        //
284:                        ss.execute(docSysRoSelect, conn);
285:                        SystemResultSet docSysRoSrs = docSysRoSelect
286:                                .getResults();
287:                        if (docSysRoSrs.getRowCount() > 0) {
288:                            String section = docSysRoSrs.getSString(0, 0);
289:                            String subSection = docSysRoSrs.getSString(0, 1);
290:                            //
291:                            DMSService dmss = DMSServiceCallerFactory
292:                                    .getDMSService();
293:                            dmss.accessDocumentSystem(outValue
294:                                    .getWebDocCtchar(), 0, section, subSection);
295:                        }
296:                    } else {
297:                        final int VERSION = 0;
298:                        outValue = ProjectSystemTag.newInstance(inCtchar,
299:                                inIndex, inUi, inProjectName, false, VERSION,
300:                                inDeployed, true);
301:                        //
302:                        String docSection = null;
303:                        String docSubSection = null;
304:                        if (inDeployed) {
305:                            docSection = "SERVER_APPLICATION";
306:                            docSubSection = inProjectName.toUpperCase();
307:                        } else {
308:                            docSection = "USER_APPLICATION";
309:                            docSubSection = inUi.getSecurityType().length()
310:                                    + "|" + inUi.getName().length() + "|"
311:                                    + inUi.getSecurityType() + "|"
312:                                    + inUi.getName() + "|"
313:                                    + inProjectName.toUpperCase();
314:                        }
315:                        DocumentFileSystemRootTag.newInstance(outValue
316:                                .getWebDocCtchar(), 0, docSection,
317:                                docSubSection, VERSION);
318:                        //
319:                        SystemEntityPropertiesTag.newInstance(outValue
320:                                .getPropertyCtchar(), 0,
321:                                "<project>SampleData</project>", VERSION,
322:                                new HashMap(), new HashMap(), new HashMap());
323:                        //
324:                        SecurityAuditTag
325:                                .newInstance(
326:                                        outValue.getAuditCtchar(),
327:                                        0,
328:                                        inUi,
329:                                        new BigDecimal(0),
330:                                        "",
331:                                        MiscHelper.fromTimeToString(MiscHelper
332:                                                .currentUTC()),
333:                                        SecurityAuditHelper.SEVERITY_LEVEL__INFORMATION,
334:                                        "", "", "", new BigDecimal(0), "", "",
335:                                        "", false);
336:                        //
337:                        outValue.resetToDefault();
338:                    }
339:
340:                    //
341:                    int projectVersion = outValue.getVersion();
342:                    int docSysVersion = outValue.getDocumentSystemRoot()
343:                            .getVersion();
344:                    int propVersion = outValue.getProperties().getVersion();
345:                    if ((projectVersion == propVersion)
346:                            && (projectVersion == docSysVersion)) {
347:                        //
348:                    } else {
349:                        throw new UnexpectedSystemException(
350:                                "Unsynchronized Versions " + ", Project = "
351:                                        + projectVersion + ", Properties = "
352:                                        + propVersion + ", Documents = "
353:                                        + docSysVersion);
354:                    }
355:                } finally {
356:                    SystemStore.closeSQLObjects(conn, null, null);
357:                }
358:
359:                return outValue;
360:            }
361:
362:            public void saveProjectSystem(ProjectSystemUpdates inPsu) {
363:
364:                Connection conn = null;
365:
366:                try {
367:                    SystemStore ss = SystemStoreFactory.getSystemStore();
368:                    SystemDatabase sd = SystemDatabase.newInstance();
369:                    conn = SystemStore.getConnection(ss);
370:                    CreateStatement projectSysRoTable = sd
371:                            .createProjectSysReadOnlyTable();
372:
373:                    SecurityAudit sa = inPsu.getSecurityAudit();
374:                    SystemEntityPropertiesUpdates sepu = inPsu
375:                            .getPropertyUpdates();
376:                    DocumentFileSystemRootUpdates dsru = inPsu
377:                            .getWebDocUpdates();
378:
379:                    if ((inPsu.getVersion() == sepu.getVersion())
380:                            && (inPsu.getVersion() == dsru.getVersion())) {
381:                        //
382:                    } else {
383:                        throw new UnexpectedSystemException(
384:                                "Unsynchronized Versions " + ", Project = "
385:                                        + inPsu.getVersion()
386:                                        + ", Properties = " + sepu.getVersion()
387:                                        + ", Documents = " + dsru.getVersion());
388:                    }
389:
390:                    UserIdentity ui = inPsu.getUserIdentity();
391:                    String name = inPsu.getName();
392:                    int version = inPsu.getVersion();
393:                    boolean deployVisible = inPsu.isDeployVisible();
394:                    boolean deployed = inPsu.isDeployed();
395:                    boolean active = inPsu.isActive();
396:
397:                    BigDecimal userId = saveUser(ui, conn, ss);
398:
399:                    //////////
400:                    SelectStatement projectSysRoSelect = getProjects(ui,
401:                            new Boolean(deployed), name.toUpperCase(), sd,
402:                            conn, ss);
403:                    projectSysRoSelect.addSelectColumn(
404:                            SystemDatabase.C_PROP_RO_ID_T_PROJECT_SYS_RO,
405:                            projectSysRoTable, null);
406:                    //
407:                    ss.execute(projectSysRoSelect, conn);
408:                    SystemResultSet projectSysRoSrs = projectSysRoSelect
409:                            .getResults();
410:                    //
411:                    BigDecimal projectSysRoId = null;
412:                    BigDecimal propRoId = null;
413:                    if (projectSysRoSrs.getRowCount() > 0) {
414:                        projectSysRoId = projectSysRoSrs.getDecimal(0, 0);
415:                        propRoId = projectSysRoSrs.getDecimal(0, 1);
416:                    } else {
417:                    }
418:                    ////////////////////
419:                    propRoId = saveProperties(sepu, propRoId, conn, ss);
420:                    //
421:                    DMSService dmss = DMSServiceCallerFactory.getDMSService();
422:                    BigDecimal docSysRoId = dmss.saveDocumentSystem(dsru, conn);
423:                    //
424:                    if (projectSysRoId == null) {
425:                        InsertStatement projectSysRoIs = SystemStatement
426:                                .newInsertStatement(projectSysRoTable);
427:                        //
428:                        projectSysRoIs.setSStringColumn(
429:                                SystemDatabase.C_GROUP_NAME_T_PROJECT_SYS_RO,
430:                                name.toUpperCase());
431:                        projectSysRoIs.setDecimalColumn(
432:                                SystemDatabase.C_USER_ID_T_PROJECT_SYS_RO,
433:                                userId);
434:                        projectSysRoIs.setBooleanColumn(
435:                                SystemDatabase.C_PROD_LIVE_T_PROJECT_SYS_RO,
436:                                new Boolean(deployed));
437:                        projectSysRoIs.setDecimalColumn(
438:                                SystemDatabase.C_PROP_RO_ID_T_PROJECT_SYS_RO,
439:                                propRoId);
440:                        projectSysRoIs
441:                                .setDecimalColumn(
442:                                        SystemDatabase.C_DOC_SYS_RO_ID_T_PROJECT_SYS_RO,
443:                                        docSysRoId);
444:                        //
445:                        ss.execute(projectSysRoIs, conn);
446:                        projectSysRoId = projectSysRoIs.getIdColumnValue();
447:                    }
448:                    //
449:                    //
450:                    BigDecimal auditId = saveAudit(sa, conn, ss);
451:                    //
452:                    //
453:                    CreateStatement projectSysTable = sd
454:                            .createProjectSysTable();
455:                    InsertStatement projectSysIs = SystemStatement
456:                            .newInsertStatement(projectSysTable);
457:                    //
458:                    projectSysIs.setDecimalColumn(
459:                            SystemDatabase.C_PROJECT_SYS_RO_ID_T_PROJECT_SYS,
460:                            projectSysRoId);
461:                    projectSysIs.setDecimalColumn(
462:                            SystemDatabase.C_VERSION_T_PROJECT_SYS,
463:                            new BigDecimal(version));
464:                    projectSysIs.setDecimalColumn(
465:                            SystemDatabase.C_AUDIT_ID_T_PROJECT_SYS, auditId);
466:                    projectSysIs.setBooleanColumn(
467:                            SystemDatabase.C_ACTIVE_T_PROJECT_SYS, new Boolean(
468:                                    active));
469:                    projectSysIs.setSStringColumn(
470:                            SystemDatabase.C_ACTUAL_NAME_T_PROJECT_SYS, name);
471:                    projectSysIs.setBooleanColumn(
472:                            SystemDatabase.C_DEPLOY_VISIBLE_T_PROJECT_SYS,
473:                            new Boolean(deployVisible));
474:                    //
475:                    ss.execute(projectSysIs, conn);
476:
477:                    //
478:                    //MiscHelper.println("ProjServBean ABOUT TO SAVE PROJECT");
479:                    //MiscHelper.println(dsru.toString());
480:
481:                    ss.commit(conn);
482:                } finally {
483:                    SystemStore.closeSQLObjects(conn, null, null);
484:                }
485:            }
486:
487:            public ArrayList accessProjectSystemNames(
488:                    ConceptTagCharacteristic inCtchar, UserIdentity inUi,
489:                    boolean inDeployed, String inProjectName) {
490:
491:                ArrayList outValue = null;
492:
493:                Connection conn = null;
494:
495:                try {
496:                    SystemStore ss = SystemStoreFactory.getSystemStore();
497:                    //SystemDatabase sd = SystemDatabase.newInstance();
498:
499:                    conn = SystemStore.getConnection(ss);
500:                    outValue = getProjectNames(inUi, new Boolean(inDeployed),
501:                            inProjectName, conn, ss);
502:                    Collections.sort(outValue);
503:                    //
504:                    for (int i = 0; i < outValue.size(); i++) {
505:                        String nextValue = (String) outValue.get(i);
506:                        inCtchar.addValue(inCtchar.getValueLength(), nextValue);
507:                    }
508:                } finally {
509:                    SystemStore.closeSQLObjects(conn, null, null);
510:                }
511:
512:                return outValue;
513:            }
514:
515:            private ArrayList getProjectNames(UserIdentity inUi,
516:                    Boolean inDeployed, String inProjectName,
517:                    Connection inConn, SystemStore inSs) {
518:
519:                ArrayList outValue = new ArrayList();
520:
521:                //
522:                SystemDatabase sd = SystemDatabase.newInstance();
523:                CreateStatement projectSysTable = sd.createProjectSysTable();
524:
525:                //
526:                SelectStatement maxProjSysSelect = getLatestProjects(inUi,
527:                        inDeployed, inProjectName, sd, inConn, inSs);
528:                //
529:                SelectStatement projSysSelect = SelectStatement
530:                        .createOrderById(projectSysTable, null);
531:                //
532:                projSysSelect.addSelectColumn(
533:                        SystemDatabase.C_ACTUAL_NAME_T_PROJECT_SYS,
534:                        projectSysTable, null);
535:                projSysSelect.addSelectColumn(
536:                        SystemDatabase.C_ACTIVE_T_PROJECT_SYS, projectSysTable,
537:                        null);
538:                //
539:                projSysSelect.addWhereColumn(null, SelectStatement.ID_COLUMN,
540:                        projectSysTable, maxProjSysSelect, SelectStatement.IN,
541:                        null);
542:                //
543:                inSs.execute(projSysSelect, inConn);
544:                SystemResultSet projSysSrs = projSysSelect.getResults();
545:                //
546:                for (int i = 0; i < projSysSrs.getRowCount(); i++) {
547:                    String nextActualName = projSysSrs.getSString(i, 1);
548:                    Boolean nextActive = projSysSrs.getBoolean(i, 2);
549:                    if (nextActive.booleanValue()) {
550:                        outValue.add(nextActualName);
551:                    }
552:                }
553:
554:                return outValue;
555:            }
556:
557:            private SelectStatement getLatestProjects(UserIdentity inUi,
558:                    Boolean inDeployed, String inProjectName,
559:                    SystemDatabase inSd, Connection inConn, SystemStore inSs) {
560:
561:                SelectStatement outValue = null;
562:
563:                //
564:                CreateStatement projectSysTable = inSd.createProjectSysTable();
565:                //
566:                outValue = SelectStatement.createOrderById(projectSysTable,
567:                        SelectStatement.MAX_COLUMN);
568:                //
569:                outValue.addWhereColumn(
570:                        SystemDatabase.C_PROJECT_SYS_RO_ID_T_PROJECT_SYS,
571:                        SelectStatement.NORMAL_COLUMN, projectSysTable,
572:                        getProjects(inUi, inDeployed, inProjectName, inSd,
573:                                inConn, inSs), SelectStatement.IN, null);
574:                //
575:                outValue.addGroupByColumn(
576:                        SystemDatabase.C_PROJECT_SYS_RO_ID_T_PROJECT_SYS,
577:                        SelectStatement.NORMAL_COLUMN, projectSysTable);
578:
579:                return outValue;
580:            }
581:
582:            private SelectStatement getProjects(UserIdentity inUi,
583:                    Boolean inDeployed, String inProjectName,
584:                    SystemDatabase inSd, Connection inConn, SystemStore inSs) {
585:
586:                SelectStatement outValue = null;
587:
588:                //
589:                CreateStatement projSysRoTable = inSd
590:                        .createProjectSysReadOnlyTable();
591:                //
592:                SelectStatement projSysRoSelect = SelectStatement
593:                        .createOrderById(projSysRoTable, null);
594:                //
595:                if (inUi != null) {
596:                    BigDecimal userId = saveUser(inUi, inConn, inSs);
597:                    projSysRoSelect.addWhereColumn(
598:                            SystemDatabase.C_USER_ID_T_PROJECT_SYS_RO,
599:                            SystemStatement.NORMAL_COLUMN, projSysRoTable,
600:                            userId, SelectStatement.EQUALS, null);
601:                }
602:                //
603:                if (inDeployed != null) {
604:                    projSysRoSelect.addWhereColumn(
605:                            SystemDatabase.C_PROD_LIVE_T_PROJECT_SYS_RO,
606:                            SystemStatement.NORMAL_COLUMN, projSysRoTable,
607:                            inDeployed, SelectStatement.EQUALS, null);
608:                }
609:                //
610:                if (inProjectName != null) {
611:                    projSysRoSelect.addWhereColumn(
612:                            SystemDatabase.C_GROUP_NAME_T_PROJECT_SYS_RO,
613:                            SystemStatement.NORMAL_COLUMN, projSysRoTable,
614:                            inProjectName.toUpperCase(),
615:                            SelectStatement.EQUALS, null);
616:                }
617:
618:                outValue = projSysRoSelect;
619:
620:                return outValue;
621:            }
622:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.