Source Code Cross Referenced for ReqFamily.java in  » Test-Coverage » salome-tmf » salomeTMF_plug » requirements » data » 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 » Test Coverage » salome tmf » salomeTMF_plug.requirements.data 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * SalomeTMF is a Test Management Framework
003:         * Copyright (C) 2005 France Telecom R&D
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2 of the License, or (at your option) any later version.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * Lesser General Public License for more details.
014:         *
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:         *
019:         * @author Marche Mikael
020:         *
021:         * Contact: mikael.marche@rd.francetelecom.com
022:         */
023:
024:        package salomeTMF_plug.requirements.data;
025:
026:        import java.util.Vector;
027:
028:        import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
029:
030:        import salomeTMF_plug.requirements.ReqPlugin;
031:        import salomeTMF_plug.requirements.sqlWrapper.ReqWrapper;
032:
033:        public class ReqFamily extends Requirement {
034:
035:            Vector reqLeafList;
036:
037:            public ReqFamily(String name, String description, ReqFamily parent) {
038:                super (name, description, parent);
039:                reqLeafList = new Vector();
040:            }
041:
042:            public ReqFamily(String name, String description) {
043:                super (name, description, null);
044:                reqLeafList = new Vector();
045:                idBdd = 0;
046:            }
047:
048:            public ReqFamily(ReqWrapper pReqWrapper, ReqFamily parent) {
049:                super (pReqWrapper.getName(), pReqWrapper.getDescription(),
050:                        parent);
051:                idBdd = pReqWrapper.getIdBDD();
052:                reqLeafList = new Vector();
053:                //LoadAttachement
054:            }
055:
056:            public Requirement getCopie(ReqFamily pReqFamily) {
057:                ReqFamily pReqFam = new ReqFamily(name, description, pReqFamily);
058:
059:                int size = reqLeafList.size();
060:                for (int i = 0; i < size; i++) {
061:                    Requirement pReq = (Requirement) reqLeafList.elementAt(i);
062:                    pReqFam.addRequirement(pReq.getCopie(pReqFam));
063:                }
064:                return pReqFam;
065:            }
066:
067:            public void pastInDBandModel(Requirement pReq,
068:                    ReqFamily pReqOringine, boolean testName) throws Exception {
069:                if (pReqOringine == null) {
070:                    pReq.m_parent = this ;
071:                }
072:                //GetUniqueName
073:                String tmpName = pReq.getNameFromModel();
074:                boolean trouve = false;
075:                int j = 0;
076:                while (!trouve && testName) {
077:                    ReqWrapper pReqWrapper = pSQLRequirement.getReq(pReq
078:                            .getNameFromModel(), idBdd, ReqPlugin
079:                            .getProjectRef().getIdBdd());
080:                    if (pReqWrapper == null) {
081:                        trouve = true;
082:                    } else {
083:                        pReq.updateNameInModel("copy_" + j + "_" + tmpName);
084:                        j++;
085:                    }
086:                }
087:                pReq.addInDB();
088:                if (pReq instanceof  ReqFamily) {
089:                    ReqFamily pReqFam = (ReqFamily) pReq;
090:                    Vector reqLeafList2 = pReqFam.reqLeafList;
091:                    int size = reqLeafList2.size();
092:                    for (int i = 0; i < size; i++) {
093:                        Requirement pReqTmp = (Requirement) reqLeafList2
094:                                .elementAt(i);
095:                        pastInDBandModel(pReqTmp, this , false);
096:                    }
097:                } else {
098:                    ReqLeaf pReqLef = (ReqLeaf) pReq;
099:                    pReqLef.updateInfoInDB(pReqLef.version, pReqLef.origine,
100:                            pReqLef.verif, pReqLef.reference);
101:                    pReqLef.updateCatInDB(pReqLef.cat);
102:                    pReqLef.updateComplexeInDB(pReqLef.complexe);
103:                    pReqLef.updateStateInDB(pReqLef.state);
104:                }
105:            }
106:
107:            public void addRequirement(Requirement req) {
108:                if (contain(req) == null) {
109:                    reqLeafList.add(req);
110:                }
111:            }
112:
113:            Requirement contain(Requirement reqTested) {
114:                int size = reqLeafList.size();
115:                for (int i = 0; i < size; i++) {
116:                    Requirement pReq = (Requirement) reqLeafList.elementAt(i);
117:                    if (reqTested.getNameFromModel().equals(
118:                            pReq.getNameFromModel())) {
119:                        return pReq;
120:                    }
121:                }
122:                return null;
123:            }
124:
125:            public Vector getFistLeaf() {
126:                Vector res = new Vector();
127:                int size = reqLeafList.size();
128:                for (int i = 0; i < size; i++) {
129:                    Requirement pReq = (Requirement) reqLeafList.elementAt(i);
130:                    if (pReq instanceof  ReqLeaf) {
131:                        res.add(pReq);
132:                    }
133:                }
134:                return res;
135:            }
136:
137:            public Vector getFirstFamily() {
138:                Vector res = new Vector();
139:                int size = reqLeafList.size();
140:                for (int i = 0; i < size; i++) {
141:                    Requirement pReq = (Requirement) reqLeafList.elementAt(i);
142:                    if (pReq instanceof  ReqFamily) {
143:                        res.add(pReq);
144:                    }
145:                }
146:                return res;
147:            }
148:
149:            public Vector getAllLeaf() {
150:                Vector res = new Vector();
151:                int size = reqLeafList.size();
152:                for (int i = 0; i < size; i++) {
153:                    Requirement pReq = (Requirement) reqLeafList.elementAt(i);
154:                    if (pReq instanceof  ReqLeaf) {
155:                        res.add(pReq);
156:                    } else {
157:                        Vector reqLeafList2 = ((ReqFamily) pReq).getAllLeaf();
158:                        for (int j = 0; j < reqLeafList2.size(); j++) {
159:                            res.add(reqLeafList2.elementAt(j));
160:                        }
161:                    }
162:                }
163:                return res;
164:            }
165:
166:            public Vector getAllLeaf(IReqFilter filtre) {
167:                Vector res = new Vector();
168:                int size = reqLeafList.size();
169:                for (int i = 0; i < size; i++) {
170:                    Requirement pReq = (Requirement) reqLeafList.elementAt(i);
171:
172:                    if (pReq instanceof  ReqLeaf) {
173:                        int reqP = ((ReqLeaf) pReq).getPriorityFromModel();
174:                        //if ((	reqP | filtre) == filtre){
175:                        if (filtre.isFiltred(pReq)) {
176:                            res.add(pReq);
177:                        }
178:                    } else {
179:                        Vector reqLeafList2 = ((ReqFamily) pReq)
180:                                .getAllLeaf(filtre);
181:                        for (int j = 0; j < reqLeafList2.size(); j++) {
182:                            res.add(reqLeafList2.elementAt(j));
183:                        }
184:                    }
185:                }
186:                return res;
187:            }
188:
189:            public Vector getAllLeafByPriority(int filtre) {
190:                Vector res = new Vector();
191:                int size = reqLeafList.size();
192:                for (int i = 0; i < size; i++) {
193:                    Requirement pReq = (Requirement) reqLeafList.elementAt(i);
194:
195:                    if (pReq instanceof  ReqLeaf) {
196:                        int reqP = ((ReqLeaf) pReq).getPriorityFromModel();
197:                        if ((reqP | filtre) == filtre) {
198:                            //if (filtre.isFiltred(pReq)){
199:                            res.add(pReq);
200:                        }
201:                    } else {
202:                        Vector reqLeafList2 = ((ReqFamily) pReq)
203:                                .getAllLeafByPriority(filtre);
204:                        for (int j = 0; j < reqLeafList2.size(); j++) {
205:                            res.add(reqLeafList2.elementAt(j));
206:                        }
207:                    }
208:                }
209:                return res;
210:            }
211:
212:            public boolean isFamilyReq() {
213:                return true;
214:            }
215:
216:            void removeRequirment(Requirement req) {
217:                //reqLeafList.remove(req);
218:                Requirement reqToDel = contain(req);
219:                if (reqToDel != null) {
220:                    reqLeafList.remove(reqToDel);
221:                }
222:            }
223:
224:            void deleteInModel() {
225:                reqLeafList.clear();
226:            }
227:
228:            public String toString() {
229:                return "ReqSet : " + name;
230:            }
231:
232:            public String getLongName() {
233:                if (m_parent != null) {
234:                    String parentName = m_parent.getLongName();
235:                    if (parentName != "") {
236:                        return parentName + "." + name;
237:                    } else {
238:                        return name;
239:                    }
240:                } else {
241:                    return "";
242:                }
243:            }
244:
245:            public void addInDB() throws Exception {
246:                if (isInBase()) {
247:                    throw new Exception(
248:                            "[ReqFamily->addInDB] requirment already in base");
249:                }
250:                int idParent = m_parent.getIdBdd();
251:                idBdd = pSQLRequirement.add(name, description, 0, idParent,
252:                        ReqPlugin.getProjectRef().getIdBdd(), 100);
253:            }
254:
255:            public void addTestCoverInDB(int idTest, boolean verifie)
256:                    throws Exception {
257:                throw new Exception(
258:                        "[ReqFamily->addTestCover] unable to link test with a set of requiments");
259:            }
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.