Source Code Cross Referenced for CategoryOfInstrument.java in  » J2EE » Jaffa » org » jaffa » persistence » domainobjects » 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 » J2EE » Jaffa » org.jaffa.persistence.domainobjects 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // .//GEN-BEGIN:1_be
002:        /******************************************************
003:         * Code Generated From JAFFA Framework Default Pattern
004:         * 
005:         * The JAFFA Project can be found at http://jaffa.sourceforge.net
006:         * and is available under the Lesser GNU Public License
007:         ******************************************************/package org.jaffa.persistence.domainobjects;
008:
009:        import org.apache.log4j.Logger;
010:        import java.util.*;
011:        import org.jaffa.datatypes.*;
012:        import org.jaffa.metadata.*;
013:        import org.jaffa.rules.RulesEngine;
014:        import org.jaffa.persistence.*;
015:        import org.jaffa.persistence.exceptions.*;
016:        import org.jaffa.exceptions.FrameworkException;
017:        import org.jaffa.exceptions.RelatedDomainObjectFoundException;
018:        import org.jaffa.exceptions.DuplicateKeyException;
019:        import org.jaffa.datatypes.exceptions.InvalidForeignKeyException;
020:        import org.jaffa.exceptions.ApplicationExceptions;
021:
022:        import org.jaffa.persistence.domainobjects.Part;
023:        import org.jaffa.persistence.domainobjects.PartMeta;
024:
025:        // .//GEN-END:1_be
026:        // Add additional imports//GEN-FIRST:imports
027:
028:        // .//GEN-LAST:imports
029:        // .//GEN-BEGIN:2_be
030:        /**
031:         * Auto Generated Persistent class for the ZZ_JUT_INSTRUMENT table.
032:         * @author  Auto-Generated
033:         */
034:        public class CategoryOfInstrument extends Persistent {
035:
036:            private static final Logger log = Logger
037:                    .getLogger(CategoryOfInstrument.class);
038:
039:            /** Holds value of property categoryInstrument. */
040:            private java.lang.String m_categoryInstrument;
041:
042:            /** Holds value of property description. */
043:            private java.lang.String m_description;
044:
045:            /** Holds value of property supportEquip. */
046:            private java.lang.Boolean m_supportEquip;
047:
048:            /** Holds value of property calculateMtbf. */
049:            private java.lang.Boolean m_calculateMtbf;
050:
051:            /** Holds related Part objects. */
052:            private transient Collection m_partCollection;
053:
054:            /** Check if the domain object exists for the input Primary Key.
055:             * @return true if the domain object exists for the input Primary Key.
056:             * @throws FrameworkException Indicates some system error
057:             */
058:            public static boolean exists(UOW uow,
059:                    java.lang.String categoryInstrument)
060:                    throws FrameworkException {
061:                return findByPK(uow, categoryInstrument) != null ? true : false;
062:            }
063:
064:            /** Returns the domain object for the input Primary Key.
065:             * @return the domain object for the input Primary Key. A null is returned if the domain object is not found.
066:             * @throws FrameworkException Indicates some system error
067:             */
068:            public static CategoryOfInstrument findByPK(UOW uow,
069:                    java.lang.String categoryInstrument)
070:                    throws FrameworkException {
071:                boolean localUow = false;
072:                try {
073:                    if (uow == null || !uow.isActive()) {
074:                        uow = new UOW();
075:                        localUow = true;
076:                    }
077:                    Criteria criteria = findByPKCriteria(categoryInstrument);
078:                    Iterator itr = uow.query(criteria).iterator();
079:                    if (itr.hasNext())
080:                        return (CategoryOfInstrument) itr.next();
081:                    else
082:                        return null;
083:                } finally {
084:                    if (localUow && uow != null)
085:                        uow.rollback();
086:                }
087:            }
088:
089:            /** Returns a Criteria object for retrieving the domain object based on the input Primary Key.
090:             * @return a Criteria object for retrieving the domain object based on the input Primary Key.
091:             */
092:            public static Criteria findByPKCriteria(
093:                    java.lang.String categoryInstrument) {
094:                Criteria criteria = new Criteria();
095:                criteria.setTable(CategoryOfInstrumentMeta.getName());
096:                criteria.addCriteria(
097:                        CategoryOfInstrumentMeta.CATEGORY_INSTRUMENT,
098:                        categoryInstrument);
099:                return criteria;
100:            }
101:
102:            // .//GEN-END:2_be
103:            // .//GEN-BEGIN:categoryInstrument_be
104:            /** Getter for property categoryInstrument.
105:             * @return Value of property categoryInstrument.
106:             */
107:            public java.lang.String getCategoryInstrument() {
108:                return m_categoryInstrument;
109:            }
110:
111:            /** Use this method to update the property categoryInstrument.
112:             * This method will do nothing and simply return if the input value is the same as the current value.
113:             * Validation will be performed on the input value.
114:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
115:             * @param categoryInstrument New value of property categoryInstrument.
116:             * @throws ValidationException if an invalid value is passed.
117:             * @throws UpdatePrimaryKeyException if this domain object was loaded from the database.
118:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
119:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
120:             * @throws FrameworkException Indicates some system error
121:             */
122:            public void setCategoryInstrument(
123:                    java.lang.String categoryInstrument)
124:                    throws ValidationException, UpdatePrimaryKeyException,
125:                    ReadOnlyObjectException, AlreadyLockedObjectException,
126:                    FrameworkException {
127:                // ignore, if the current value and new value are the same
128:                if (m_categoryInstrument == null ? categoryInstrument == null
129:                        : m_categoryInstrument.equals(categoryInstrument))
130:                    return;
131:
132:                // this is part of the primary key.. do not update if its a database occurence.
133:                if (isDatabaseOccurence())
134:                    throw new UpdatePrimaryKeyException();
135:
136:                categoryInstrument = validateCategoryInstrument(categoryInstrument);
137:                // .//GEN-END:categoryInstrument_be
138:                // Add custom code before setting the value//GEN-FIRST:categoryInstrument
139:
140:                // .//GEN-LAST:categoryInstrument
141:                // .//GEN-BEGIN:categoryInstrument_1_be
142:                super .update();
143:                super .addInitialValue(
144:                        CategoryOfInstrumentMeta.CATEGORY_INSTRUMENT,
145:                        m_categoryInstrument);
146:                m_categoryInstrument = categoryInstrument;
147:                // .//GEN-END:categoryInstrument_1_be
148:                // Add custom code after setting the value//GEN-FIRST:categoryInstrument_3
149:
150:                // .//GEN-LAST:categoryInstrument_3
151:                // .//GEN-BEGIN:categoryInstrument_2_be
152:            }
153:
154:            /** This method is present for backwards compatibility only.
155:             * It merely invokes the setCategoryInstrument() method.
156:             * @param categoryInstrument New value of property categoryInstrument.
157:             * @throws ValidationException if an invalid value is passed.
158:             * @throws UpdatePrimaryKeyException if this domain object was loaded from the database.
159:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
160:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
161:             * @throws FrameworkException Indicates some system error
162:             */
163:            public void updateCategoryInstrument(
164:                    java.lang.String categoryInstrument)
165:                    throws ValidationException, UpdatePrimaryKeyException,
166:                    ReadOnlyObjectException, AlreadyLockedObjectException,
167:                    FrameworkException {
168:                setCategoryInstrument(categoryInstrument);
169:            }
170:
171:            /** Use this method to validate a value for the property categoryInstrument.
172:             * @param categoryInstrument Value to be validated for the property categoryInstrument.
173:             * @throws ValidationException if an invalid value is passed
174:             * @throws FrameworkException Indicates some system error
175:             */
176:            public java.lang.String validateCategoryInstrument(
177:                    java.lang.String categoryInstrument)
178:                    throws ValidationException, FrameworkException {
179:                // .//GEN-END:categoryInstrument_2_be
180:                // Add custom code before validation//GEN-FIRST:categoryInstrument_1
181:
182:                // .//GEN-LAST:categoryInstrument_1
183:                // .//GEN-BEGIN:categoryInstrument_3_be
184:                categoryInstrument = FieldValidator
185:                        .validate(
186:                                categoryInstrument,
187:                                (StringFieldMetaData) CategoryOfInstrumentMeta.META_CATEGORY_INSTRUMENT,
188:                                true);
189:
190:                // Invoke the Dynamic Rules Engine
191:                RulesEngine.doAllValidationsForDomainField(
192:                        CategoryOfInstrumentMeta.getName(),
193:                        CategoryOfInstrumentMeta.CATEGORY_INSTRUMENT,
194:                        categoryInstrument, this .getUOW());
195:
196:                // .//GEN-END:categoryInstrument_3_be
197:                // Add custom code after a successful validation//GEN-FIRST:categoryInstrument_2
198:
199:                // .//GEN-LAST:categoryInstrument_2
200:                // .//GEN-BEGIN:categoryInstrument_4_be
201:                return categoryInstrument;
202:            }
203:
204:            // .//GEN-END:categoryInstrument_4_be
205:            // .//GEN-BEGIN:description_be
206:            /** Getter for property description.
207:             * @return Value of property description.
208:             */
209:            public java.lang.String getDescription() {
210:                return m_description;
211:            }
212:
213:            /** Use this method to update the property description.
214:             * This method will do nothing and simply return if the input value is the same as the current value.
215:             * Validation will be performed on the input value.
216:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
217:             * @param description New value of property description.
218:             * @throws ValidationException if an invalid value is passed.
219:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
220:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
221:             * @throws FrameworkException Indicates some system error
222:             */
223:            public void setDescription(java.lang.String description)
224:                    throws ValidationException, ReadOnlyObjectException,
225:                    AlreadyLockedObjectException, FrameworkException {
226:                // ignore, if the current value and new value are the same
227:                if (m_description == null ? description == null : m_description
228:                        .equals(description))
229:                    return;
230:
231:                description = validateDescription(description);
232:                // .//GEN-END:description_be
233:                // Add custom code before setting the value//GEN-FIRST:description
234:
235:                // .//GEN-LAST:description
236:                // .//GEN-BEGIN:description_1_be
237:                super .update();
238:                super .addInitialValue(CategoryOfInstrumentMeta.DESCRIPTION,
239:                        m_description);
240:                m_description = description;
241:                // .//GEN-END:description_1_be
242:                // Add custom code after setting the value//GEN-FIRST:description_3
243:
244:                // .//GEN-LAST:description_3
245:                // .//GEN-BEGIN:description_2_be
246:            }
247:
248:            /** This method is present for backwards compatibility only.
249:             * It merely invokes the setDescription() method.
250:             * @param description New value of property description.
251:             * @throws ValidationException if an invalid value is passed.
252:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
253:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
254:             * @throws FrameworkException Indicates some system error
255:             */
256:            public void updateDescription(java.lang.String description)
257:                    throws ValidationException, ReadOnlyObjectException,
258:                    AlreadyLockedObjectException, FrameworkException {
259:                setDescription(description);
260:            }
261:
262:            /** Use this method to validate a value for the property description.
263:             * @param description Value to be validated for the property description.
264:             * @throws ValidationException if an invalid value is passed
265:             * @throws FrameworkException Indicates some system error
266:             */
267:            public java.lang.String validateDescription(
268:                    java.lang.String description) throws ValidationException,
269:                    FrameworkException {
270:                // .//GEN-END:description_2_be
271:                // Add custom code before validation//GEN-FIRST:description_1
272:
273:                // .//GEN-LAST:description_1
274:                // .//GEN-BEGIN:description_3_be
275:                description = FieldValidator
276:                        .validate(
277:                                description,
278:                                (StringFieldMetaData) CategoryOfInstrumentMeta.META_DESCRIPTION,
279:                                true);
280:
281:                // Invoke the Dynamic Rules Engine
282:                RulesEngine.doAllValidationsForDomainField(
283:                        CategoryOfInstrumentMeta.getName(),
284:                        CategoryOfInstrumentMeta.DESCRIPTION, description, this 
285:                                .getUOW());
286:
287:                // .//GEN-END:description_3_be
288:                // Add custom code after a successful validation//GEN-FIRST:description_2
289:
290:                // .//GEN-LAST:description_2
291:                // .//GEN-BEGIN:description_4_be
292:                return description;
293:            }
294:
295:            // .//GEN-END:description_4_be
296:            // .//GEN-BEGIN:supportEquip_be
297:            /** Getter for property supportEquip.
298:             * @return Value of property supportEquip.
299:             */
300:            public java.lang.Boolean getSupportEquip() {
301:                return m_supportEquip;
302:            }
303:
304:            /** Use this method to update the property supportEquip.
305:             * This method will do nothing and simply return if the input value is the same as the current value.
306:             * Validation will be performed on the input value.
307:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
308:             * @param supportEquip New value of property supportEquip.
309:             * @throws ValidationException if an invalid value is passed.
310:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
311:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
312:             * @throws FrameworkException Indicates some system error
313:             */
314:            public void setSupportEquip(java.lang.Boolean supportEquip)
315:                    throws ValidationException, ReadOnlyObjectException,
316:                    AlreadyLockedObjectException, FrameworkException {
317:                // ignore, if the current value and new value are the same
318:                if (m_supportEquip == null ? supportEquip == null
319:                        : m_supportEquip.equals(supportEquip))
320:                    return;
321:
322:                supportEquip = validateSupportEquip(supportEquip);
323:                // .//GEN-END:supportEquip_be
324:                // Add custom code before setting the value//GEN-FIRST:supportEquip
325:
326:                // .//GEN-LAST:supportEquip
327:                // .//GEN-BEGIN:supportEquip_1_be
328:                super .update();
329:                super .addInitialValue(CategoryOfInstrumentMeta.SUPPORT_EQUIP,
330:                        m_supportEquip);
331:                m_supportEquip = supportEquip;
332:                // .//GEN-END:supportEquip_1_be
333:                // Add custom code after setting the value//GEN-FIRST:supportEquip_3
334:
335:                // .//GEN-LAST:supportEquip_3
336:                // .//GEN-BEGIN:supportEquip_2_be
337:            }
338:
339:            /** This method is present for backwards compatibility only.
340:             * It merely invokes the setSupportEquip() method.
341:             * @param supportEquip New value of property supportEquip.
342:             * @throws ValidationException if an invalid value is passed.
343:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
344:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
345:             * @throws FrameworkException Indicates some system error
346:             */
347:            public void updateSupportEquip(java.lang.Boolean supportEquip)
348:                    throws ValidationException, ReadOnlyObjectException,
349:                    AlreadyLockedObjectException, FrameworkException {
350:                setSupportEquip(supportEquip);
351:            }
352:
353:            /** Use this method to validate a value for the property supportEquip.
354:             * @param supportEquip Value to be validated for the property supportEquip.
355:             * @throws ValidationException if an invalid value is passed
356:             * @throws FrameworkException Indicates some system error
357:             */
358:            public java.lang.Boolean validateSupportEquip(
359:                    java.lang.Boolean supportEquip) throws ValidationException,
360:                    FrameworkException {
361:                // .//GEN-END:supportEquip_2_be
362:                // Add custom code before validation//GEN-FIRST:supportEquip_1
363:
364:                // .//GEN-LAST:supportEquip_1
365:                // .//GEN-BEGIN:supportEquip_3_be
366:                supportEquip = FieldValidator
367:                        .validate(
368:                                supportEquip,
369:                                (BooleanFieldMetaData) CategoryOfInstrumentMeta.META_SUPPORT_EQUIP,
370:                                true);
371:
372:                // Invoke the Dynamic Rules Engine
373:                RulesEngine.doAllValidationsForDomainField(
374:                        CategoryOfInstrumentMeta.getName(),
375:                        CategoryOfInstrumentMeta.SUPPORT_EQUIP, supportEquip,
376:                        this .getUOW());
377:
378:                // .//GEN-END:supportEquip_3_be
379:                // Add custom code after a successful validation//GEN-FIRST:supportEquip_2
380:
381:                // .//GEN-LAST:supportEquip_2
382:                // .//GEN-BEGIN:supportEquip_4_be
383:                return supportEquip;
384:            }
385:
386:            // .//GEN-END:supportEquip_4_be
387:            // .//GEN-BEGIN:calculateMtbf_be
388:            /** Getter for property calculateMtbf.
389:             * @return Value of property calculateMtbf.
390:             */
391:            public java.lang.Boolean getCalculateMtbf() {
392:                return m_calculateMtbf;
393:            }
394:
395:            /** Use this method to update the property calculateMtbf.
396:             * This method will do nothing and simply return if the input value is the same as the current value.
397:             * Validation will be performed on the input value.
398:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
399:             * @param calculateMtbf New value of property calculateMtbf.
400:             * @throws ValidationException if an invalid value is passed.
401:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
402:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
403:             * @throws FrameworkException Indicates some system error
404:             */
405:            public void setCalculateMtbf(java.lang.Boolean calculateMtbf)
406:                    throws ValidationException, ReadOnlyObjectException,
407:                    AlreadyLockedObjectException, FrameworkException {
408:                // ignore, if the current value and new value are the same
409:                if (m_calculateMtbf == null ? calculateMtbf == null
410:                        : m_calculateMtbf.equals(calculateMtbf))
411:                    return;
412:
413:                calculateMtbf = validateCalculateMtbf(calculateMtbf);
414:                // .//GEN-END:calculateMtbf_be
415:                // Add custom code before setting the value//GEN-FIRST:calculateMtbf
416:
417:                // .//GEN-LAST:calculateMtbf
418:                // .//GEN-BEGIN:calculateMtbf_1_be
419:                super .update();
420:                super .addInitialValue(CategoryOfInstrumentMeta.CALCULATE_MTBF,
421:                        m_calculateMtbf);
422:                m_calculateMtbf = calculateMtbf;
423:                // .//GEN-END:calculateMtbf_1_be
424:                // Add custom code after setting the value//GEN-FIRST:calculateMtbf_3
425:
426:                // .//GEN-LAST:calculateMtbf_3
427:                // .//GEN-BEGIN:calculateMtbf_2_be
428:            }
429:
430:            /** This method is present for backwards compatibility only.
431:             * It merely invokes the setCalculateMtbf() method.
432:             * @param calculateMtbf New value of property calculateMtbf.
433:             * @throws ValidationException if an invalid value is passed.
434:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
435:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
436:             * @throws FrameworkException Indicates some system error
437:             */
438:            public void updateCalculateMtbf(java.lang.Boolean calculateMtbf)
439:                    throws ValidationException, ReadOnlyObjectException,
440:                    AlreadyLockedObjectException, FrameworkException {
441:                setCalculateMtbf(calculateMtbf);
442:            }
443:
444:            /** Use this method to validate a value for the property calculateMtbf.
445:             * @param calculateMtbf Value to be validated for the property calculateMtbf.
446:             * @throws ValidationException if an invalid value is passed
447:             * @throws FrameworkException Indicates some system error
448:             */
449:            public java.lang.Boolean validateCalculateMtbf(
450:                    java.lang.Boolean calculateMtbf)
451:                    throws ValidationException, FrameworkException {
452:                // .//GEN-END:calculateMtbf_2_be
453:                // Add custom code before validation//GEN-FIRST:calculateMtbf_1
454:
455:                // .//GEN-LAST:calculateMtbf_1
456:                // .//GEN-BEGIN:calculateMtbf_3_be
457:                calculateMtbf = FieldValidator
458:                        .validate(
459:                                calculateMtbf,
460:                                (BooleanFieldMetaData) CategoryOfInstrumentMeta.META_CALCULATE_MTBF,
461:                                true);
462:
463:                // Invoke the Dynamic Rules Engine
464:                RulesEngine.doAllValidationsForDomainField(
465:                        CategoryOfInstrumentMeta.getName(),
466:                        CategoryOfInstrumentMeta.CALCULATE_MTBF, calculateMtbf,
467:                        this .getUOW());
468:
469:                // .//GEN-END:calculateMtbf_3_be
470:                // Add custom code after a successful validation//GEN-FIRST:calculateMtbf_2
471:
472:                // .//GEN-LAST:calculateMtbf_2
473:                // .//GEN-BEGIN:calculateMtbf_4_be
474:                return calculateMtbf;
475:            }
476:
477:            // .//GEN-END:calculateMtbf_4_be
478:            // .//GEN-BEGIN:partArray_1_be
479:            /** Returns an array of related Part objects.
480:             * @return an array of related Part objects.
481:             * @throws FrameworkException Indicates some system error
482:             */
483:            public Part[] getPartArray() throws FrameworkException {
484:                UOW uow = getUOW();
485:                boolean localUow = false;
486:                try {
487:                    Part[] output = null;
488:                    if (m_partCollection == null && isDatabaseOccurence()) {
489:                        Criteria criteria = findPartCriteria();
490:                        if (uow == null || !uow.isActive()) {
491:                            uow = new UOW();
492:                            localUow = true;
493:                        }
494:                        Collection col = uow.query(criteria);
495:                        m_partCollection = new ArrayList();
496:                        for (Iterator itr = col.iterator(); itr.hasNext();)
497:                            m_partCollection.add(itr.next());
498:                    }
499:
500:                    if (m_partCollection != null)
501:                        output = (Part[]) m_partCollection.toArray(new Part[0]);
502:                    return output;
503:                } finally {
504:                    if (localUow && uow != null)
505:                        uow.rollback();
506:                }
507:            }
508:
509:            /** Returns a Criteria object for retrieving the related Part objects.
510:             * @return a Criteria object for retrieving the related Part objects.
511:             */
512:            public Criteria findPartCriteria() {
513:                Criteria criteria = new Criteria();
514:                criteria.setTable(PartMeta.getName());
515:                criteria.addCriteria(PartMeta.CATEGORY_INSTRUMENT,
516:                        getCategoryInstrument());
517:                // .//GEN-END:partArray_1_be
518:                // Add custom criteria//GEN-FIRST:partArray_1
519:
520:                // .//GEN-LAST:partArray_1
521:                // .//GEN-BEGIN:partArray_2_be
522:                return criteria;
523:            }
524:
525:            /** Creates a new Part object and initializes the related fields.
526:             * This will uncache the related Part objects.
527:             * @throws ValidationException if an invalid value is passed.
528:             * @throws FrameworkException Indicates some system error
529:             * @return the related Part object with the initialized related fields.
530:             */
531:            public Part newPartObject() throws ValidationException,
532:                    FrameworkException {
533:                m_partCollection = null;
534:                Part part = new Part();
535:                part.setCategoryInstrument(getCategoryInstrument());
536:                // .//GEN-END:partArray_2_be
537:                // Add custom code//GEN-FIRST:partArray_2
538:
539:                // .//GEN-LAST:partArray_2
540:                // .//GEN-BEGIN:partArray_3_be
541:                return part;
542:            }
543:
544:            // .//GEN-END:partArray_3_be
545:            // .//GEN-BEGIN:toString_1_be
546:            /** This returns the diagnostic information.
547:             * @return the diagnostic information.
548:             */
549:            public String toString() {
550:                StringBuffer buf = new StringBuffer();
551:                buf.append("<CategoryOfInstrument>");
552:                buf.append("<categoryInstrument>");
553:                if (m_categoryInstrument != null)
554:                    buf.append(m_categoryInstrument);
555:                buf.append("</categoryInstrument>");
556:                buf.append("<description>");
557:                if (m_description != null)
558:                    buf.append(m_description);
559:                buf.append("</description>");
560:                buf.append("<supportEquip>");
561:                if (m_supportEquip != null)
562:                    buf.append(m_supportEquip);
563:                buf.append("</supportEquip>");
564:                buf.append("<calculateMtbf>");
565:                if (m_calculateMtbf != null)
566:                    buf.append(m_calculateMtbf);
567:                buf.append("</calculateMtbf>");
568:                // .//GEN-END:toString_1_be
569:                // Add custom debug information//GEN-FIRST:toString_1
570:
571:                // .//GEN-LAST:toString_1
572:                // .//GEN-BEGIN:toString_2_be
573:                buf.append(super .toString());
574:                buf.append("</CategoryOfInstrument>");
575:                return buf.toString();
576:            }
577:
578:            // .//GEN-END:toString_2_be
579:            // .//GEN-BEGIN:clone_1_be
580:            /** Returns a clone of the object.
581:             * @throws CloneNotSupportedException if cloning is not supported. This should never happen.
582:             * @return a clone of the object.
583:             */
584:            public Object clone() throws CloneNotSupportedException {
585:                CategoryOfInstrument obj = (CategoryOfInstrument) super .clone();
586:                obj.m_partCollection = null;
587:                return obj;
588:            }
589:
590:            // .//GEN-END:clone_1_be
591:            // .//GEN-BEGIN:performForeignKeyValidations_1_be
592:            /** This method ensures that the modified foreign-keys are valid.
593:             * @throws ApplicationExceptions if an invalid foreign key is set.
594:             * @throws FrameworkException Indicates some system error
595:             */
596:            public void performForeignKeyValidations()
597:                    throws ApplicationExceptions, FrameworkException {
598:                ApplicationExceptions appExps = new ApplicationExceptions();
599:                if (appExps.size() > 0)
600:                    throw appExps;
601:            }
602:
603:            // .//GEN-END:performForeignKeyValidations_1_be
604:            // .//GEN-BEGIN:performPreDeleteReferentialIntegrity_1_be
605:            /** This method is triggered by the UOW, before adding this object to the Delete-Store.
606:             * This will raise an exception if any associated/aggregated objects exist.
607:             * This will cascade delete all composite objects.
608:             * @throws PreDeleteFailedException if any error occurs during the process.
609:             */
610:            public void performPreDeleteReferentialIntegrity()
611:                    throws PreDeleteFailedException {
612:                Part[] partArray = null;
613:                try {
614:                    partArray = getPartArray();
615:                } catch (FrameworkException e) {
616:                    throw new PreDeleteFailedException(null, e);
617:                }
618:                if (partArray != null && partArray.length > 0) {
619:                    // Stop the deletion !!
620:                    throw new PreDeleteFailedException(null,
621:                            new RelatedDomainObjectFoundException(PartMeta
622:                                    .getLabelToken()));
623:                }
624:            }
625:            // .//GEN-END:performPreDeleteReferentialIntegrity_1_be
626:            // .//GEN-BEGIN:3_be
627:            /**
628:             * @clientCardinality 1
629:             * @supplierCardinality 0..*
630:             * @clientQualifier categoryInstrument
631:             * @supplierQualifier categoryInstrument
632:             * @link association
633:             */
634:            /*#Part lnkPart;*/
635:
636:            // .//GEN-END:3_be
637:            // All the custom code goes here//GEN-FIRST:custom
638:
639:            // .//GEN-LAST:custom
640:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.