Source Code Cross Referenced for Asset.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:        import org.jaffa.persistence.domainobjects.Condition;
025:        import org.jaffa.persistence.domainobjects.ConditionMeta;
026:
027:        // .//GEN-END:1_be
028:        // Add additional imports//GEN-FIRST:imports
029:
030:        // .//GEN-LAST:imports
031:        // .//GEN-BEGIN:2_be
032:        /**
033:         * Auto Generated Persistent class for the ZZ_JUT_ASSET table.
034:         * @author  Auto-Generated
035:         */
036:        public class Asset extends Persistent {
037:
038:            private static final Logger log = Logger.getLogger(Asset.class);
039:
040:            /** Holds value of property assetTk. */
041:            private java.lang.Long m_assetTk;
042:
043:            /** Holds value of property assetId. */
044:            private java.lang.String m_assetId;
045:
046:            /** Holds value of property part. */
047:            private java.lang.String m_part;
048:
049:            /** Holds value of property custodian. */
050:            private java.lang.String m_custodian;
051:
052:            /** Holds value of property condition. */
053:            private java.lang.String m_condition;
054:
055:            /** Holds value of property createdDatetime. */
056:            private org.jaffa.datatypes.DateTime m_createdDatetime;
057:
058:            /** Holds value of property qty. */
059:            private java.lang.Long m_qty;
060:
061:            /** Holds value of property keyRef. */
062:            private java.lang.String m_keyRef;
063:
064:            /** Holds related foreign Part object. */
065:            private transient Part m_partObject;
066:
067:            /** Holds related foreign Condition object. */
068:            private transient Condition m_conditionObject;
069:
070:            /** Check if the domain object exists for the input Primary Key.
071:             * @return true if the domain object exists for the input Primary Key.
072:             * @throws FrameworkException Indicates some system error
073:             */
074:            public static boolean exists(UOW uow, java.lang.Long assetTk)
075:                    throws FrameworkException {
076:                return findByPK(uow, assetTk) != null ? true : false;
077:            }
078:
079:            /** Returns the domain object for the input Primary Key.
080:             * @return the domain object for the input Primary Key. A null is returned if the domain object is not found.
081:             * @throws FrameworkException Indicates some system error
082:             */
083:            public static Asset findByPK(UOW uow, java.lang.Long assetTk)
084:                    throws FrameworkException {
085:                boolean localUow = false;
086:                try {
087:                    if (uow == null || !uow.isActive()) {
088:                        uow = new UOW();
089:                        localUow = true;
090:                    }
091:                    Criteria criteria = findByPKCriteria(assetTk);
092:                    Iterator itr = uow.query(criteria).iterator();
093:                    if (itr.hasNext())
094:                        return (Asset) itr.next();
095:                    else
096:                        return null;
097:                } finally {
098:                    if (localUow && uow != null)
099:                        uow.rollback();
100:                }
101:            }
102:
103:            /** Returns a Criteria object for retrieving the domain object based on the input Primary Key.
104:             * @return a Criteria object for retrieving the domain object based on the input Primary Key.
105:             */
106:            public static Criteria findByPKCriteria(java.lang.Long assetTk) {
107:                Criteria criteria = new Criteria();
108:                criteria.setTable(AssetMeta.getName());
109:                criteria.addCriteria(AssetMeta.ASSET_TK, assetTk);
110:                return criteria;
111:            }
112:
113:            // .//GEN-END:2_be
114:            // .//GEN-BEGIN:assetTk_be
115:            /** Getter for property assetTk.
116:             * @return Value of property assetTk.
117:             */
118:            public java.lang.Long getAssetTk() {
119:                return m_assetTk;
120:            }
121:
122:            /** Use this method to update the property assetTk.
123:             * This method will do nothing and simply return if the input value is the same as the current value.
124:             * Validation will be performed on the input value.
125:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
126:             * @param assetTk New value of property assetTk.
127:             * @throws ValidationException if an invalid value is passed.
128:             * @throws UpdatePrimaryKeyException if this domain object was loaded from the database.
129:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
130:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
131:             * @throws FrameworkException Indicates some system error
132:             */
133:            public void setAssetTk(java.lang.Long assetTk)
134:                    throws ValidationException, UpdatePrimaryKeyException,
135:                    ReadOnlyObjectException, AlreadyLockedObjectException,
136:                    FrameworkException {
137:                // ignore, if the current value and new value are the same
138:                if (m_assetTk == null ? assetTk == null : m_assetTk
139:                        .equals(assetTk))
140:                    return;
141:
142:                // this is part of the primary key.. do not update if its a database occurence.
143:                if (isDatabaseOccurence())
144:                    throw new UpdatePrimaryKeyException();
145:
146:                assetTk = validateAssetTk(assetTk);
147:                // .//GEN-END:assetTk_be
148:                // Add custom code before setting the value//GEN-FIRST:assetTk
149:
150:                // .//GEN-LAST:assetTk
151:                // .//GEN-BEGIN:assetTk_1_be
152:                super .update();
153:                super .addInitialValue(AssetMeta.ASSET_TK, m_assetTk);
154:                m_assetTk = assetTk;
155:                // .//GEN-END:assetTk_1_be
156:                // Add custom code after setting the value//GEN-FIRST:assetTk_3
157:
158:                // .//GEN-LAST:assetTk_3
159:                // .//GEN-BEGIN:assetTk_2_be
160:            }
161:
162:            /** This method is present for backwards compatibility only.
163:             * It merely invokes the setAssetTk() method.
164:             * @param assetTk New value of property assetTk.
165:             * @throws ValidationException if an invalid value is passed.
166:             * @throws UpdatePrimaryKeyException if this domain object was loaded from the database.
167:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
168:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
169:             * @throws FrameworkException Indicates some system error
170:             */
171:            public void updateAssetTk(java.lang.Long assetTk)
172:                    throws ValidationException, UpdatePrimaryKeyException,
173:                    ReadOnlyObjectException, AlreadyLockedObjectException,
174:                    FrameworkException {
175:                setAssetTk(assetTk);
176:            }
177:
178:            /** Use this method to validate a value for the property assetTk.
179:             * @param assetTk Value to be validated for the property assetTk.
180:             * @throws ValidationException if an invalid value is passed
181:             * @throws FrameworkException Indicates some system error
182:             */
183:            public java.lang.Long validateAssetTk(java.lang.Long assetTk)
184:                    throws ValidationException, FrameworkException {
185:                // .//GEN-END:assetTk_2_be
186:                // Add custom code before validation//GEN-FIRST:assetTk_1
187:
188:                // .//GEN-LAST:assetTk_1
189:                // .//GEN-BEGIN:assetTk_3_be
190:                assetTk = FieldValidator.validate(assetTk,
191:                        (IntegerFieldMetaData) AssetMeta.META_ASSET_TK, true);
192:
193:                // Invoke the Dynamic Rules Engine
194:                RulesEngine.doAllValidationsForDomainField(AssetMeta.getName(),
195:                        AssetMeta.ASSET_TK, assetTk, this .getUOW());
196:
197:                // .//GEN-END:assetTk_3_be
198:                // Add custom code after a successful validation//GEN-FIRST:assetTk_2
199:
200:                // .//GEN-LAST:assetTk_2
201:                // .//GEN-BEGIN:assetTk_4_be
202:                return assetTk;
203:            }
204:
205:            // .//GEN-END:assetTk_4_be
206:            // .//GEN-BEGIN:assetId_be
207:            /** Getter for property assetId.
208:             * @return Value of property assetId.
209:             */
210:            public java.lang.String getAssetId() {
211:                return m_assetId;
212:            }
213:
214:            /** Use this method to update the property assetId.
215:             * This method will do nothing and simply return if the input value is the same as the current value.
216:             * Validation will be performed on the input value.
217:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
218:             * @param assetId New value of property assetId.
219:             * @throws ValidationException if an invalid value is passed.
220:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
221:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
222:             * @throws FrameworkException Indicates some system error
223:             */
224:            public void setAssetId(java.lang.String assetId)
225:                    throws ValidationException, ReadOnlyObjectException,
226:                    AlreadyLockedObjectException, FrameworkException {
227:                // ignore, if the current value and new value are the same
228:                if (m_assetId == null ? assetId == null : m_assetId
229:                        .equals(assetId))
230:                    return;
231:
232:                assetId = validateAssetId(assetId);
233:                // .//GEN-END:assetId_be
234:                // Add custom code before setting the value//GEN-FIRST:assetId
235:
236:                // .//GEN-LAST:assetId
237:                // .//GEN-BEGIN:assetId_1_be
238:                super .update();
239:                super .addInitialValue(AssetMeta.ASSET_ID, m_assetId);
240:                m_assetId = assetId;
241:                // .//GEN-END:assetId_1_be
242:                // Add custom code after setting the value//GEN-FIRST:assetId_3
243:
244:                // .//GEN-LAST:assetId_3
245:                // .//GEN-BEGIN:assetId_2_be
246:            }
247:
248:            /** This method is present for backwards compatibility only.
249:             * It merely invokes the setAssetId() method.
250:             * @param assetId New value of property assetId.
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 updateAssetId(java.lang.String assetId)
257:                    throws ValidationException, ReadOnlyObjectException,
258:                    AlreadyLockedObjectException, FrameworkException {
259:                setAssetId(assetId);
260:            }
261:
262:            /** Use this method to validate a value for the property assetId.
263:             * @param assetId Value to be validated for the property assetId.
264:             * @throws ValidationException if an invalid value is passed
265:             * @throws FrameworkException Indicates some system error
266:             */
267:            public java.lang.String validateAssetId(java.lang.String assetId)
268:                    throws ValidationException, FrameworkException {
269:                // .//GEN-END:assetId_2_be
270:                // Add custom code before validation//GEN-FIRST:assetId_1
271:
272:                // .//GEN-LAST:assetId_1
273:                // .//GEN-BEGIN:assetId_3_be
274:                assetId = FieldValidator.validate(assetId,
275:                        (StringFieldMetaData) AssetMeta.META_ASSET_ID, true);
276:
277:                // Invoke the Dynamic Rules Engine
278:                RulesEngine.doAllValidationsForDomainField(AssetMeta.getName(),
279:                        AssetMeta.ASSET_ID, assetId, this .getUOW());
280:
281:                // .//GEN-END:assetId_3_be
282:                // Add custom code after a successful validation//GEN-FIRST:assetId_2
283:
284:                // .//GEN-LAST:assetId_2
285:                // .//GEN-BEGIN:assetId_4_be
286:                return assetId;
287:            }
288:
289:            // .//GEN-END:assetId_4_be
290:            // .//GEN-BEGIN:part_be
291:            /** Getter for property part.
292:             * @return Value of property part.
293:             */
294:            public java.lang.String getPart() {
295:                return m_part;
296:            }
297:
298:            /** Use this method to update the property part.
299:             * This method will do nothing and simply return if the input value is the same as the current value.
300:             * Validation will be performed on the input value.
301:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
302:             * @param part New value of property part.
303:             * @throws ValidationException if an invalid value is passed.
304:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
305:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
306:             * @throws FrameworkException Indicates some system error
307:             */
308:            public void setPart(java.lang.String part)
309:                    throws ValidationException, ReadOnlyObjectException,
310:                    AlreadyLockedObjectException, FrameworkException {
311:                // ignore, if the current value and new value are the same
312:                if (m_part == null ? part == null : m_part.equals(part))
313:                    return;
314:
315:                part = validatePart(part);
316:                // .//GEN-END:part_be
317:                // Add custom code before setting the value//GEN-FIRST:part
318:
319:                // .//GEN-LAST:part
320:                // .//GEN-BEGIN:part_1_be
321:                super .update();
322:                super .addInitialValue(AssetMeta.PART, m_part);
323:                m_part = part;
324:                m_partObject = null;
325:                // .//GEN-END:part_1_be
326:                // Add custom code after setting the value//GEN-FIRST:part_3
327:
328:                // .//GEN-LAST:part_3
329:                // .//GEN-BEGIN:part_2_be
330:            }
331:
332:            /** This method is present for backwards compatibility only.
333:             * It merely invokes the setPart() method.
334:             * @param part New value of property part.
335:             * @throws ValidationException if an invalid value is passed.
336:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
337:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
338:             * @throws FrameworkException Indicates some system error
339:             */
340:            public void updatePart(java.lang.String part)
341:                    throws ValidationException, ReadOnlyObjectException,
342:                    AlreadyLockedObjectException, FrameworkException {
343:                setPart(part);
344:            }
345:
346:            /** Use this method to validate a value for the property part.
347:             * @param part Value to be validated for the property part.
348:             * @throws ValidationException if an invalid value is passed
349:             * @throws FrameworkException Indicates some system error
350:             */
351:            public java.lang.String validatePart(java.lang.String part)
352:                    throws ValidationException, FrameworkException {
353:                // .//GEN-END:part_2_be
354:                // Add custom code before validation//GEN-FIRST:part_1
355:
356:                // .//GEN-LAST:part_1
357:                // .//GEN-BEGIN:part_3_be
358:                part = FieldValidator.validate(part,
359:                        (StringFieldMetaData) AssetMeta.META_PART, true);
360:
361:                // Invoke the Dynamic Rules Engine
362:                RulesEngine.doAllValidationsForDomainField(AssetMeta.getName(),
363:                        AssetMeta.PART, part, this .getUOW());
364:
365:                // .//GEN-END:part_3_be
366:                // Add custom code after a successful validation//GEN-FIRST:part_2
367:
368:                // .//GEN-LAST:part_2
369:                // .//GEN-BEGIN:part_4_be
370:                return part;
371:            }
372:
373:            // .//GEN-END:part_4_be
374:            // .//GEN-BEGIN:custodian_be
375:            /** Getter for property custodian.
376:             * @return Value of property custodian.
377:             */
378:            public java.lang.String getCustodian() {
379:                return m_custodian;
380:            }
381:
382:            /** Use this method to update the property custodian.
383:             * This method will do nothing and simply return if the input value is the same as the current value.
384:             * Validation will be performed on the input value.
385:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
386:             * @param custodian New value of property custodian.
387:             * @throws ValidationException if an invalid value is passed.
388:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
389:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
390:             * @throws FrameworkException Indicates some system error
391:             */
392:            public void setCustodian(java.lang.String custodian)
393:                    throws ValidationException, ReadOnlyObjectException,
394:                    AlreadyLockedObjectException, FrameworkException {
395:                // ignore, if the current value and new value are the same
396:                if (m_custodian == null ? custodian == null : m_custodian
397:                        .equals(custodian))
398:                    return;
399:
400:                custodian = validateCustodian(custodian);
401:                // .//GEN-END:custodian_be
402:                // Add custom code before setting the value//GEN-FIRST:custodian
403:
404:                // .//GEN-LAST:custodian
405:                // .//GEN-BEGIN:custodian_1_be
406:                super .update();
407:                super .addInitialValue(AssetMeta.CUSTODIAN, m_custodian);
408:                m_custodian = custodian;
409:                // .//GEN-END:custodian_1_be
410:                // Add custom code after setting the value//GEN-FIRST:custodian_3
411:
412:                // .//GEN-LAST:custodian_3
413:                // .//GEN-BEGIN:custodian_2_be
414:            }
415:
416:            /** This method is present for backwards compatibility only.
417:             * It merely invokes the setCustodian() method.
418:             * @param custodian New value of property custodian.
419:             * @throws ValidationException if an invalid value is passed.
420:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
421:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
422:             * @throws FrameworkException Indicates some system error
423:             */
424:            public void updateCustodian(java.lang.String custodian)
425:                    throws ValidationException, ReadOnlyObjectException,
426:                    AlreadyLockedObjectException, FrameworkException {
427:                setCustodian(custodian);
428:            }
429:
430:            /** Use this method to validate a value for the property custodian.
431:             * @param custodian Value to be validated for the property custodian.
432:             * @throws ValidationException if an invalid value is passed
433:             * @throws FrameworkException Indicates some system error
434:             */
435:            public java.lang.String validateCustodian(java.lang.String custodian)
436:                    throws ValidationException, FrameworkException {
437:                // .//GEN-END:custodian_2_be
438:                // Add custom code before validation//GEN-FIRST:custodian_1
439:
440:                // .//GEN-LAST:custodian_1
441:                // .//GEN-BEGIN:custodian_3_be
442:                custodian = FieldValidator.validate(custodian,
443:                        (StringFieldMetaData) AssetMeta.META_CUSTODIAN, true);
444:
445:                // Invoke the Dynamic Rules Engine
446:                RulesEngine.doAllValidationsForDomainField(AssetMeta.getName(),
447:                        AssetMeta.CUSTODIAN, custodian, this .getUOW());
448:
449:                // .//GEN-END:custodian_3_be
450:                // Add custom code after a successful validation//GEN-FIRST:custodian_2
451:
452:                // .//GEN-LAST:custodian_2
453:                // .//GEN-BEGIN:custodian_4_be
454:                return custodian;
455:            }
456:
457:            // .//GEN-END:custodian_4_be
458:            // .//GEN-BEGIN:condition_be
459:            /** Getter for property condition.
460:             * @return Value of property condition.
461:             */
462:            public java.lang.String getCondition() {
463:                return m_condition;
464:            }
465:
466:            /** Use this method to update the property condition.
467:             * This method will do nothing and simply return if the input value is the same as the current value.
468:             * Validation will be performed on the input value.
469:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
470:             * @param condition New value of property condition.
471:             * @throws ValidationException if an invalid value is passed.
472:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
473:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
474:             * @throws FrameworkException Indicates some system error
475:             */
476:            public void setCondition(java.lang.String condition)
477:                    throws ValidationException, ReadOnlyObjectException,
478:                    AlreadyLockedObjectException, FrameworkException {
479:                // ignore, if the current value and new value are the same
480:                if (m_condition == null ? condition == null : m_condition
481:                        .equals(condition))
482:                    return;
483:
484:                condition = validateCondition(condition);
485:                // .//GEN-END:condition_be
486:                // Add custom code before setting the value//GEN-FIRST:condition
487:
488:                // .//GEN-LAST:condition
489:                // .//GEN-BEGIN:condition_1_be
490:                super .update();
491:                super .addInitialValue(AssetMeta.CONDITION, m_condition);
492:                m_condition = condition;
493:                m_conditionObject = null;
494:                // .//GEN-END:condition_1_be
495:                // Add custom code after setting the value//GEN-FIRST:condition_3
496:
497:                // .//GEN-LAST:condition_3
498:                // .//GEN-BEGIN:condition_2_be
499:            }
500:
501:            /** This method is present for backwards compatibility only.
502:             * It merely invokes the setCondition() method.
503:             * @param condition New value of property condition.
504:             * @throws ValidationException if an invalid value is passed.
505:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
506:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
507:             * @throws FrameworkException Indicates some system error
508:             */
509:            public void updateCondition(java.lang.String condition)
510:                    throws ValidationException, ReadOnlyObjectException,
511:                    AlreadyLockedObjectException, FrameworkException {
512:                setCondition(condition);
513:            }
514:
515:            /** Use this method to validate a value for the property condition.
516:             * @param condition Value to be validated for the property condition.
517:             * @throws ValidationException if an invalid value is passed
518:             * @throws FrameworkException Indicates some system error
519:             */
520:            public java.lang.String validateCondition(java.lang.String condition)
521:                    throws ValidationException, FrameworkException {
522:                // .//GEN-END:condition_2_be
523:                // Add custom code before validation//GEN-FIRST:condition_1
524:
525:                // .//GEN-LAST:condition_1
526:                // .//GEN-BEGIN:condition_3_be
527:                condition = FieldValidator.validate(condition,
528:                        (StringFieldMetaData) AssetMeta.META_CONDITION, true);
529:
530:                // Invoke the Dynamic Rules Engine
531:                RulesEngine.doAllValidationsForDomainField(AssetMeta.getName(),
532:                        AssetMeta.CONDITION, condition, this .getUOW());
533:
534:                // .//GEN-END:condition_3_be
535:                // Add custom code after a successful validation//GEN-FIRST:condition_2
536:
537:                // .//GEN-LAST:condition_2
538:                // .//GEN-BEGIN:condition_4_be
539:                return condition;
540:            }
541:
542:            // .//GEN-END:condition_4_be
543:            // .//GEN-BEGIN:createdDatetime_be
544:            /** Getter for property createdDatetime.
545:             * @return Value of property createdDatetime.
546:             */
547:            public org.jaffa.datatypes.DateTime getCreatedDatetime() {
548:                return m_createdDatetime;
549:            }
550:
551:            /** Use this method to update the property createdDatetime.
552:             * This method will do nothing and simply return if the input value is the same as the current value.
553:             * Validation will be performed on the input value.
554:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
555:             * @param createdDatetime New value of property createdDatetime.
556:             * @throws ValidationException if an invalid value is passed.
557:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
558:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
559:             * @throws FrameworkException Indicates some system error
560:             */
561:            public void setCreatedDatetime(
562:                    org.jaffa.datatypes.DateTime createdDatetime)
563:                    throws ValidationException, ReadOnlyObjectException,
564:                    AlreadyLockedObjectException, FrameworkException {
565:                // ignore, if the current value and new value are the same
566:                if (m_createdDatetime == null ? createdDatetime == null
567:                        : m_createdDatetime.equals(createdDatetime))
568:                    return;
569:
570:                createdDatetime = validateCreatedDatetime(createdDatetime);
571:                // .//GEN-END:createdDatetime_be
572:                // Add custom code before setting the value//GEN-FIRST:createdDatetime
573:
574:                // .//GEN-LAST:createdDatetime
575:                // .//GEN-BEGIN:createdDatetime_1_be
576:                super .update();
577:                super .addInitialValue(AssetMeta.CREATED_DATETIME,
578:                        m_createdDatetime);
579:                m_createdDatetime = createdDatetime;
580:                // .//GEN-END:createdDatetime_1_be
581:                // Add custom code after setting the value//GEN-FIRST:createdDatetime_3
582:
583:                // .//GEN-LAST:createdDatetime_3
584:                // .//GEN-BEGIN:createdDatetime_2_be
585:            }
586:
587:            /** This method is present for backwards compatibility only.
588:             * It merely invokes the setCreatedDatetime() method.
589:             * @param createdDatetime New value of property createdDatetime.
590:             * @throws ValidationException if an invalid value is passed.
591:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
592:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
593:             * @throws FrameworkException Indicates some system error
594:             */
595:            public void updateCreatedDatetime(
596:                    org.jaffa.datatypes.DateTime createdDatetime)
597:                    throws ValidationException, ReadOnlyObjectException,
598:                    AlreadyLockedObjectException, FrameworkException {
599:                setCreatedDatetime(createdDatetime);
600:            }
601:
602:            /** Use this method to validate a value for the property createdDatetime.
603:             * @param createdDatetime Value to be validated for the property createdDatetime.
604:             * @throws ValidationException if an invalid value is passed
605:             * @throws FrameworkException Indicates some system error
606:             */
607:            public org.jaffa.datatypes.DateTime validateCreatedDatetime(
608:                    org.jaffa.datatypes.DateTime createdDatetime)
609:                    throws ValidationException, FrameworkException {
610:                // .//GEN-END:createdDatetime_2_be
611:                // Add custom code before validation//GEN-FIRST:createdDatetime_1
612:
613:                // .//GEN-LAST:createdDatetime_1
614:                // .//GEN-BEGIN:createdDatetime_3_be
615:                createdDatetime = FieldValidator
616:                        .validate(
617:                                createdDatetime,
618:                                (DateTimeFieldMetaData) AssetMeta.META_CREATED_DATETIME,
619:                                true);
620:
621:                // Invoke the Dynamic Rules Engine
622:                RulesEngine.doAllValidationsForDomainField(AssetMeta.getName(),
623:                        AssetMeta.CREATED_DATETIME, createdDatetime, this 
624:                                .getUOW());
625:
626:                // .//GEN-END:createdDatetime_3_be
627:                // Add custom code after a successful validation//GEN-FIRST:createdDatetime_2
628:
629:                // .//GEN-LAST:createdDatetime_2
630:                // .//GEN-BEGIN:createdDatetime_4_be
631:                return createdDatetime;
632:            }
633:
634:            // .//GEN-END:createdDatetime_4_be
635:            // .//GEN-BEGIN:qty_be
636:            /** Getter for property qty.
637:             * @return Value of property qty.
638:             */
639:            public java.lang.Long getQty() {
640:                return m_qty;
641:            }
642:
643:            /** Use this method to update the property qty.
644:             * This method will do nothing and simply return if the input value is the same as the current value.
645:             * Validation will be performed on the input value.
646:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
647:             * @param qty New value of property qty.
648:             * @throws ValidationException if an invalid value is passed.
649:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
650:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
651:             * @throws FrameworkException Indicates some system error
652:             */
653:            public void setQty(java.lang.Long qty) throws ValidationException,
654:                    ReadOnlyObjectException, AlreadyLockedObjectException,
655:                    FrameworkException {
656:                // ignore, if the current value and new value are the same
657:                if (m_qty == null ? qty == null : m_qty.equals(qty))
658:                    return;
659:
660:                qty = validateQty(qty);
661:                // .//GEN-END:qty_be
662:                // Add custom code before setting the value//GEN-FIRST:qty
663:
664:                // .//GEN-LAST:qty
665:                // .//GEN-BEGIN:qty_1_be
666:                super .update();
667:                super .addInitialValue(AssetMeta.QTY, m_qty);
668:                m_qty = qty;
669:                // .//GEN-END:qty_1_be
670:                // Add custom code after setting the value//GEN-FIRST:qty_3
671:
672:                // .//GEN-LAST:qty_3
673:                // .//GEN-BEGIN:qty_2_be
674:            }
675:
676:            /** This method is present for backwards compatibility only.
677:             * It merely invokes the setQty() method.
678:             * @param qty New value of property qty.
679:             * @throws ValidationException if an invalid value is passed.
680:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
681:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
682:             * @throws FrameworkException Indicates some system error
683:             */
684:            public void updateQty(java.lang.Long qty)
685:                    throws ValidationException, ReadOnlyObjectException,
686:                    AlreadyLockedObjectException, FrameworkException {
687:                setQty(qty);
688:            }
689:
690:            /** Use this method to validate a value for the property qty.
691:             * @param qty Value to be validated for the property qty.
692:             * @throws ValidationException if an invalid value is passed
693:             * @throws FrameworkException Indicates some system error
694:             */
695:            public java.lang.Long validateQty(java.lang.Long qty)
696:                    throws ValidationException, FrameworkException {
697:                // .//GEN-END:qty_2_be
698:                // Add custom code before validation//GEN-FIRST:qty_1
699:
700:                // .//GEN-LAST:qty_1
701:                // .//GEN-BEGIN:qty_3_be
702:                qty = FieldValidator.validate(qty,
703:                        (IntegerFieldMetaData) AssetMeta.META_QTY, true);
704:
705:                // Invoke the Dynamic Rules Engine
706:                RulesEngine.doAllValidationsForDomainField(AssetMeta.getName(),
707:                        AssetMeta.QTY, qty, this .getUOW());
708:
709:                // .//GEN-END:qty_3_be
710:                // Add custom code after a successful validation//GEN-FIRST:qty_2
711:
712:                // .//GEN-LAST:qty_2
713:                // .//GEN-BEGIN:qty_4_be
714:                return qty;
715:            }
716:
717:            // .//GEN-END:qty_4_be
718:            // .//GEN-BEGIN:keyRef_be
719:            /** Getter for property keyRef.
720:             * @return Value of property keyRef.
721:             */
722:            public java.lang.String getKeyRef() {
723:                return m_keyRef;
724:            }
725:
726:            /** Use this method to update the property keyRef.
727:             * This method will do nothing and simply return if the input value is the same as the current value.
728:             * Validation will be performed on the input value.
729:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
730:             * @param keyRef New value of property keyRef.
731:             * @throws ValidationException if an invalid value is passed.
732:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
733:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
734:             * @throws FrameworkException Indicates some system error
735:             */
736:            public void setKeyRef(java.lang.String keyRef)
737:                    throws ValidationException, ReadOnlyObjectException,
738:                    AlreadyLockedObjectException, FrameworkException {
739:                // ignore, if the current value and new value are the same
740:                if (m_keyRef == null ? keyRef == null : m_keyRef.equals(keyRef))
741:                    return;
742:
743:                keyRef = validateKeyRef(keyRef);
744:                // .//GEN-END:keyRef_be
745:                // Add custom code before setting the value//GEN-FIRST:keyRef
746:
747:                // .//GEN-LAST:keyRef
748:                // .//GEN-BEGIN:keyRef_1_be
749:                super .update();
750:                super .addInitialValue(AssetMeta.KEY_REF, m_keyRef);
751:                m_keyRef = keyRef;
752:                // .//GEN-END:keyRef_1_be
753:                // Add custom code after setting the value//GEN-FIRST:keyRef_3
754:
755:                // .//GEN-LAST:keyRef_3
756:                // .//GEN-BEGIN:keyRef_2_be
757:            }
758:
759:            /** This method is present for backwards compatibility only.
760:             * It merely invokes the setKeyRef() method.
761:             * @param keyRef New value of property keyRef.
762:             * @throws ValidationException if an invalid value is passed.
763:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
764:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
765:             * @throws FrameworkException Indicates some system error
766:             */
767:            public void updateKeyRef(java.lang.String keyRef)
768:                    throws ValidationException, ReadOnlyObjectException,
769:                    AlreadyLockedObjectException, FrameworkException {
770:                setKeyRef(keyRef);
771:            }
772:
773:            /** Use this method to validate a value for the property keyRef.
774:             * @param keyRef Value to be validated for the property keyRef.
775:             * @throws ValidationException if an invalid value is passed
776:             * @throws FrameworkException Indicates some system error
777:             */
778:            public java.lang.String validateKeyRef(java.lang.String keyRef)
779:                    throws ValidationException, FrameworkException {
780:                // .//GEN-END:keyRef_2_be
781:                // Add custom code before validation//GEN-FIRST:keyRef_1
782:
783:                // .//GEN-LAST:keyRef_1
784:                // .//GEN-BEGIN:keyRef_3_be
785:                keyRef = FieldValidator.validate(keyRef,
786:                        (StringFieldMetaData) AssetMeta.META_KEY_REF, true);
787:
788:                // Invoke the Dynamic Rules Engine
789:                RulesEngine.doAllValidationsForDomainField(AssetMeta.getName(),
790:                        AssetMeta.KEY_REF, keyRef, this .getUOW());
791:
792:                // .//GEN-END:keyRef_3_be
793:                // Add custom code after a successful validation//GEN-FIRST:keyRef_2
794:
795:                // .//GEN-LAST:keyRef_2
796:                // .//GEN-BEGIN:keyRef_4_be
797:                return keyRef;
798:            }
799:
800:            // .//GEN-END:keyRef_4_be
801:            // .//GEN-BEGIN:partObject_1_be
802:            /** Returns the related foreign Part object.
803:             * The object is lazy-loaded.
804:             * @return the related foreign Part object.
805:             * @throws ValidationException if an invalid foreign key is set.
806:             * @throws FrameworkException Indicates some system error
807:             */
808:            public Part getPartObject() throws ValidationException,
809:                    FrameworkException {
810:                UOW uow = getUOW();
811:                boolean localUow = false;
812:                try {
813:                    if (m_partObject == null && getPart() != null) {
814:                        Criteria criteria = new Criteria();
815:                        criteria.setTable(PartMeta.getName());
816:                        criteria.addCriteria(PartMeta.PART, getPart());
817:                        if (uow == null || !uow.isActive()) {
818:                            uow = new UOW();
819:                            localUow = true;
820:                        }
821:                        Iterator itr = uow.query(criteria).iterator();
822:                        if (itr.hasNext())
823:                            m_partObject = (Part) itr.next();
824:                        if (m_partObject == null)
825:                            throw new InvalidForeignKeyException(
826:                                    AssetMeta.META_PART.getLabelToken(),
827:                                    new Object[] { PartMeta.getLabelToken(),
828:                                            PartMeta.META_PART.getLabelToken() });
829:                    }
830:                    return m_partObject;
831:                } finally {
832:                    if (localUow && uow != null)
833:                        uow.rollback();
834:                }
835:            }
836:
837:            // .//GEN-END:partObject_1_be
838:            // .//GEN-BEGIN:conditionObject_1_be
839:            /** Returns the related foreign Condition object.
840:             * The object is lazy-loaded.
841:             * @return the related foreign Condition object.
842:             * @throws ValidationException if an invalid foreign key is set.
843:             * @throws FrameworkException Indicates some system error
844:             */
845:            public Condition getConditionObject() throws ValidationException,
846:                    FrameworkException {
847:                UOW uow = getUOW();
848:                boolean localUow = false;
849:                try {
850:                    if (m_conditionObject == null && getCondition() != null) {
851:                        Criteria criteria = new Criteria();
852:                        criteria.setTable(ConditionMeta.getName());
853:                        criteria.addCriteria(ConditionMeta.CONDITION,
854:                                getCondition());
855:                        if (uow == null || !uow.isActive()) {
856:                            uow = new UOW();
857:                            localUow = true;
858:                        }
859:                        Iterator itr = uow.query(criteria).iterator();
860:                        if (itr.hasNext())
861:                            m_conditionObject = (Condition) itr.next();
862:                        if (m_conditionObject == null)
863:                            throw new InvalidForeignKeyException(
864:                                    AssetMeta.META_CONDITION.getLabelToken(),
865:                                    new Object[] {
866:                                            ConditionMeta.getLabelToken(),
867:                                            ConditionMeta.META_CONDITION
868:                                                    .getLabelToken() });
869:                    }
870:                    return m_conditionObject;
871:                } finally {
872:                    if (localUow && uow != null)
873:                        uow.rollback();
874:                }
875:            }
876:
877:            // .//GEN-END:conditionObject_1_be
878:            // .//GEN-BEGIN:toString_1_be
879:            /** This returns the diagnostic information.
880:             * @return the diagnostic information.
881:             */
882:            public String toString() {
883:                StringBuffer buf = new StringBuffer();
884:                buf.append("<Asset>");
885:                buf.append("<assetTk>");
886:                if (m_assetTk != null)
887:                    buf.append(m_assetTk);
888:                buf.append("</assetTk>");
889:                buf.append("<assetId>");
890:                if (m_assetId != null)
891:                    buf.append(m_assetId);
892:                buf.append("</assetId>");
893:                buf.append("<part>");
894:                if (m_part != null)
895:                    buf.append(m_part);
896:                buf.append("</part>");
897:                buf.append("<custodian>");
898:                if (m_custodian != null)
899:                    buf.append(m_custodian);
900:                buf.append("</custodian>");
901:                buf.append("<condition>");
902:                if (m_condition != null)
903:                    buf.append(m_condition);
904:                buf.append("</condition>");
905:                buf.append("<createdDatetime>");
906:                if (m_createdDatetime != null)
907:                    buf.append(m_createdDatetime);
908:                buf.append("</createdDatetime>");
909:                buf.append("<qty>");
910:                if (m_qty != null)
911:                    buf.append(m_qty);
912:                buf.append("</qty>");
913:                buf.append("<keyRef>");
914:                if (m_keyRef != null)
915:                    buf.append(m_keyRef);
916:                buf.append("</keyRef>");
917:                // .//GEN-END:toString_1_be
918:                // Add custom debug information//GEN-FIRST:toString_1
919:
920:                // .//GEN-LAST:toString_1
921:                // .//GEN-BEGIN:toString_2_be
922:                buf.append(super .toString());
923:                buf.append("</Asset>");
924:                return buf.toString();
925:            }
926:
927:            // .//GEN-END:toString_2_be
928:            // .//GEN-BEGIN:clone_1_be
929:            /** Returns a clone of the object.
930:             * @throws CloneNotSupportedException if cloning is not supported. This should never happen.
931:             * @return a clone of the object.
932:             */
933:            public Object clone() throws CloneNotSupportedException {
934:                Asset obj = (Asset) super .clone();
935:                obj.m_partObject = null;
936:                obj.m_conditionObject = null;
937:                return obj;
938:            }
939:
940:            // .//GEN-END:clone_1_be
941:            // .//GEN-BEGIN:performForeignKeyValidations_1_be
942:            /** This method ensures that the modified foreign-keys are valid.
943:             * @throws ApplicationExceptions if an invalid foreign key is set.
944:             * @throws FrameworkException Indicates some system error
945:             */
946:            public void performForeignKeyValidations()
947:                    throws ApplicationExceptions, FrameworkException {
948:                ApplicationExceptions appExps = new ApplicationExceptions();
949:                try {
950:                    if (isModified(AssetMeta.PART))
951:                        getPartObject();
952:                } catch (ValidationException e) {
953:                    appExps.add(e);
954:                }
955:                try {
956:                    if (isModified(AssetMeta.CONDITION))
957:                        getConditionObject();
958:                } catch (ValidationException e) {
959:                    appExps.add(e);
960:                }
961:                if (appExps.size() > 0)
962:                    throw appExps;
963:            }
964:
965:            // .//GEN-END:performForeignKeyValidations_1_be
966:            // .//GEN-BEGIN:performPreDeleteReferentialIntegrity_1_be
967:            /** This method is triggered by the UOW, before adding this object to the Delete-Store.
968:             * This will raise an exception if any associated/aggregated objects exist.
969:             * This will cascade delete all composite objects.
970:             * @throws PreDeleteFailedException if any error occurs during the process.
971:             */
972:            public void performPreDeleteReferentialIntegrity()
973:                    throws PreDeleteFailedException {
974:            }
975:            // .//GEN-END:performPreDeleteReferentialIntegrity_1_be
976:            // .//GEN-BEGIN:3_be
977:            /**
978:             * @clientCardinality 0..*
979:             * @supplierCardinality 1
980:             * @clientQualifier part
981:             * @supplierQualifier part
982:             * @link association
983:             */
984:            /*#Part lnkPart;*/
985:
986:            /**
987:             * @clientCardinality 0..*
988:             * @supplierCardinality 1
989:             * @clientQualifier condition
990:             * @supplierQualifier condition
991:             * @link association
992:             */
993:            /*#Condition lnkCondition;*/
994:
995:            // .//GEN-END:3_be
996:            // All the custom code goes here//GEN-FIRST:custom
997:
998:            // .//GEN-LAST:custom
999:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.