Source Code Cross Referenced for PartPicture.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_PART_PIC table.
032:         * @author  Auto-Generated
033:         */
034:        public class PartPicture extends Persistent {
035:
036:            private static final Logger log = Logger
037:                    .getLogger(PartPicture.class);
038:
039:            /** Holds value of property part. */
040:            private java.lang.String m_part;
041:
042:            /** Holds value of property smallPicture. */
043:            private byte[] m_smallPicture;
044:
045:            /** Holds value of property picture. */
046:            private byte[] m_picture;
047:
048:            /** Holds related Part object. */
049:            private transient Part m_partObject;
050:
051:            /** Check if the domain object exists for the input Primary Key.
052:             * @return true if the domain object exists for the input Primary Key.
053:             * @throws FrameworkException Indicates some system error
054:             */
055:            public static boolean exists(UOW uow, java.lang.String part)
056:                    throws FrameworkException {
057:                return findByPK(uow, part) != null ? true : false;
058:            }
059:
060:            /** Returns the domain object for the input Primary Key.
061:             * @return the domain object for the input Primary Key. A null is returned if the domain object is not found.
062:             * @throws FrameworkException Indicates some system error
063:             */
064:            public static PartPicture findByPK(UOW uow, java.lang.String part)
065:                    throws FrameworkException {
066:                boolean localUow = false;
067:                try {
068:                    if (uow == null || !uow.isActive()) {
069:                        uow = new UOW();
070:                        localUow = true;
071:                    }
072:                    Criteria criteria = findByPKCriteria(part);
073:                    Iterator itr = uow.query(criteria).iterator();
074:                    if (itr.hasNext())
075:                        return (PartPicture) itr.next();
076:                    else
077:                        return null;
078:                } finally {
079:                    if (localUow && uow != null)
080:                        uow.rollback();
081:                }
082:            }
083:
084:            /** Returns a Criteria object for retrieving the domain object based on the input Primary Key.
085:             * @return a Criteria object for retrieving the domain object based on the input Primary Key.
086:             */
087:            public static Criteria findByPKCriteria(java.lang.String part) {
088:                Criteria criteria = new Criteria();
089:                criteria.setTable(PartPictureMeta.getName());
090:                criteria.addCriteria(PartPictureMeta.PART, part);
091:                return criteria;
092:            }
093:
094:            // .//GEN-END:2_be
095:            // .//GEN-BEGIN:part_be
096:            /** Getter for property part.
097:             * @return Value of property part.
098:             */
099:            public java.lang.String getPart() {
100:                return m_part;
101:            }
102:
103:            /** Use this method to update the property part.
104:             * This method will do nothing and simply return if the input value is the same as the current value.
105:             * Validation will be performed on the input value.
106:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
107:             * @param part New value of property part.
108:             * @throws ValidationException if an invalid value is passed.
109:             * @throws UpdatePrimaryKeyException if this domain object was loaded from the database.
110:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
111:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
112:             * @throws FrameworkException Indicates some system error
113:             */
114:            public void setPart(java.lang.String part)
115:                    throws ValidationException, UpdatePrimaryKeyException,
116:                    ReadOnlyObjectException, AlreadyLockedObjectException,
117:                    FrameworkException {
118:                // ignore, if the current value and new value are the same
119:                if (m_part == null ? part == null : m_part.equals(part))
120:                    return;
121:
122:                // this is part of the primary key.. do not update if its a database occurence.
123:                if (isDatabaseOccurence())
124:                    throw new UpdatePrimaryKeyException();
125:
126:                part = validatePart(part);
127:                // .//GEN-END:part_be
128:                // Add custom code before setting the value//GEN-FIRST:part
129:
130:                // .//GEN-LAST:part
131:                // .//GEN-BEGIN:part_1_be
132:                super .update();
133:                super .addInitialValue(PartPictureMeta.PART, m_part);
134:                m_part = part;
135:                m_partObject = null;
136:                // .//GEN-END:part_1_be
137:                // Add custom code after setting the value//GEN-FIRST:part_3
138:
139:                // .//GEN-LAST:part_3
140:                // .//GEN-BEGIN:part_2_be
141:            }
142:
143:            /** This method is present for backwards compatibility only.
144:             * It merely invokes the setPart() method.
145:             * @param part New value of property part.
146:             * @throws ValidationException if an invalid value is passed.
147:             * @throws UpdatePrimaryKeyException if this domain object was loaded from the database.
148:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
149:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
150:             * @throws FrameworkException Indicates some system error
151:             */
152:            public void updatePart(java.lang.String part)
153:                    throws ValidationException, UpdatePrimaryKeyException,
154:                    ReadOnlyObjectException, AlreadyLockedObjectException,
155:                    FrameworkException {
156:                setPart(part);
157:            }
158:
159:            /** Use this method to validate a value for the property part.
160:             * @param part Value to be validated for the property part.
161:             * @throws ValidationException if an invalid value is passed
162:             * @throws FrameworkException Indicates some system error
163:             */
164:            public java.lang.String validatePart(java.lang.String part)
165:                    throws ValidationException, FrameworkException {
166:                // .//GEN-END:part_2_be
167:                // Add custom code before validation//GEN-FIRST:part_1
168:
169:                // .//GEN-LAST:part_1
170:                // .//GEN-BEGIN:part_3_be
171:                part = FieldValidator.validate(part,
172:                        (StringFieldMetaData) PartPictureMeta.META_PART, true);
173:
174:                // Invoke the Dynamic Rules Engine
175:                RulesEngine.doAllValidationsForDomainField(PartPictureMeta
176:                        .getName(), PartPictureMeta.PART, part, this .getUOW());
177:
178:                // .//GEN-END:part_3_be
179:                // Add custom code after a successful validation//GEN-FIRST:part_2
180:
181:                // .//GEN-LAST:part_2
182:                // .//GEN-BEGIN:part_4_be
183:                return part;
184:            }
185:
186:            // .//GEN-END:part_4_be
187:            // .//GEN-BEGIN:smallPicture_be
188:            /** Getter for property smallPicture.
189:             * @return Value of property smallPicture.
190:             */
191:            public byte[] getSmallPicture() {
192:                return m_smallPicture;
193:            }
194:
195:            /** Use this method to update the property smallPicture.
196:             * This method will do nothing and simply return if the input value is the same as the current value.
197:             * Validation will be performed on the input value.
198:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
199:             * @param smallPicture New value of property smallPicture.
200:             * @throws ValidationException if an invalid value is passed.
201:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
202:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
203:             * @throws FrameworkException Indicates some system error
204:             */
205:            public void setSmallPicture(byte[] smallPicture)
206:                    throws ValidationException, ReadOnlyObjectException,
207:                    AlreadyLockedObjectException, FrameworkException {
208:                // ignore, if the current value and new value are the same
209:                if (m_smallPicture == null ? smallPicture == null
210:                        : m_smallPicture.equals(smallPicture))
211:                    return;
212:
213:                smallPicture = validateSmallPicture(smallPicture);
214:                // .//GEN-END:smallPicture_be
215:                // Add custom code before setting the value//GEN-FIRST:smallPicture
216:
217:                // .//GEN-LAST:smallPicture
218:                // .//GEN-BEGIN:smallPicture_1_be
219:                super .update();
220:                super .addInitialValue(PartPictureMeta.SMALL_PICTURE,
221:                        m_smallPicture);
222:                m_smallPicture = smallPicture;
223:                // .//GEN-END:smallPicture_1_be
224:                // Add custom code after setting the value//GEN-FIRST:smallPicture_3
225:
226:                // .//GEN-LAST:smallPicture_3
227:                // .//GEN-BEGIN:smallPicture_2_be
228:            }
229:
230:            /** This method is present for backwards compatibility only.
231:             * It merely invokes the setSmallPicture() method.
232:             * @param smallPicture New value of property smallPicture.
233:             * @throws ValidationException if an invalid value is passed.
234:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
235:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
236:             * @throws FrameworkException Indicates some system error
237:             */
238:            public void updateSmallPicture(byte[] smallPicture)
239:                    throws ValidationException, ReadOnlyObjectException,
240:                    AlreadyLockedObjectException, FrameworkException {
241:                setSmallPicture(smallPicture);
242:            }
243:
244:            /** Use this method to validate a value for the property smallPicture.
245:             * @param smallPicture Value to be validated for the property smallPicture.
246:             * @throws ValidationException if an invalid value is passed
247:             * @throws FrameworkException Indicates some system error
248:             */
249:            public byte[] validateSmallPicture(byte[] smallPicture)
250:                    throws ValidationException, FrameworkException {
251:                // .//GEN-END:smallPicture_2_be
252:                // Add custom code before validation//GEN-FIRST:smallPicture_1
253:
254:                // .//GEN-LAST:smallPicture_1
255:                // .//GEN-BEGIN:smallPicture_3_be
256:                smallPicture = FieldValidator.validate(smallPicture,
257:                        (RawFieldMetaData) PartPictureMeta.META_SMALL_PICTURE,
258:                        true);
259:
260:                // Invoke the Dynamic Rules Engine
261:                RulesEngine.doAllValidationsForDomainField(PartPictureMeta
262:                        .getName(), PartPictureMeta.SMALL_PICTURE,
263:                        smallPicture, this .getUOW());
264:
265:                // .//GEN-END:smallPicture_3_be
266:                // Add custom code after a successful validation//GEN-FIRST:smallPicture_2
267:
268:                // .//GEN-LAST:smallPicture_2
269:                // .//GEN-BEGIN:smallPicture_4_be
270:                return smallPicture;
271:            }
272:
273:            // .//GEN-END:smallPicture_4_be
274:            // .//GEN-BEGIN:picture_be
275:            /** Getter for property picture.
276:             * @return Value of property picture.
277:             */
278:            public byte[] getPicture() {
279:                return m_picture;
280:            }
281:
282:            /** Use this method to update the property picture.
283:             * This method will do nothing and simply return if the input value is the same as the current value.
284:             * Validation will be performed on the input value.
285:             * This will try to lock the underlying database row, in case CAUTIOUS locking is specified at the time of query.
286:             * @param picture New value of property picture.
287:             * @throws ValidationException if an invalid value is passed.
288:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
289:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
290:             * @throws FrameworkException Indicates some system error
291:             */
292:            public void setPicture(byte[] picture) throws ValidationException,
293:                    ReadOnlyObjectException, AlreadyLockedObjectException,
294:                    FrameworkException {
295:                // ignore, if the current value and new value are the same
296:                if (m_picture == null ? picture == null : m_picture
297:                        .equals(picture))
298:                    return;
299:
300:                picture = validatePicture(picture);
301:                // .//GEN-END:picture_be
302:                // Add custom code before setting the value//GEN-FIRST:picture
303:
304:                // .//GEN-LAST:picture
305:                // .//GEN-BEGIN:picture_1_be
306:                super .update();
307:                super .addInitialValue(PartPictureMeta.PICTURE, m_picture);
308:                m_picture = picture;
309:                // .//GEN-END:picture_1_be
310:                // Add custom code after setting the value//GEN-FIRST:picture_3
311:
312:                // .//GEN-LAST:picture_3
313:                // .//GEN-BEGIN:picture_2_be
314:            }
315:
316:            /** This method is present for backwards compatibility only.
317:             * It merely invokes the setPicture() method.
318:             * @param picture New value of property picture.
319:             * @throws ValidationException if an invalid value is passed.
320:             * @throws ReadOnlyObjectException if a Read-Only object is updated.
321:             * @throws AlreadyLockedObjectException if the underlying database row is already locked by another process.
322:             * @throws FrameworkException Indicates some system error
323:             */
324:            public void updatePicture(byte[] picture)
325:                    throws ValidationException, ReadOnlyObjectException,
326:                    AlreadyLockedObjectException, FrameworkException {
327:                setPicture(picture);
328:            }
329:
330:            /** Use this method to validate a value for the property picture.
331:             * @param picture Value to be validated for the property picture.
332:             * @throws ValidationException if an invalid value is passed
333:             * @throws FrameworkException Indicates some system error
334:             */
335:            public byte[] validatePicture(byte[] picture)
336:                    throws ValidationException, FrameworkException {
337:                // .//GEN-END:picture_2_be
338:                // Add custom code before validation//GEN-FIRST:picture_1
339:
340:                // .//GEN-LAST:picture_1
341:                // .//GEN-BEGIN:picture_3_be
342:                picture = FieldValidator.validate(picture,
343:                        (RawFieldMetaData) PartPictureMeta.META_PICTURE, true);
344:
345:                // Invoke the Dynamic Rules Engine
346:                RulesEngine.doAllValidationsForDomainField(PartPictureMeta
347:                        .getName(), PartPictureMeta.PICTURE, picture, this 
348:                        .getUOW());
349:
350:                // .//GEN-END:picture_3_be
351:                // Add custom code after a successful validation//GEN-FIRST:picture_2
352:
353:                // .//GEN-LAST:picture_2
354:                // .//GEN-BEGIN:picture_4_be
355:                return picture;
356:            }
357:
358:            // .//GEN-END:picture_4_be
359:            // .//GEN-BEGIN:partObject_1_be
360:            /** Returns a related Part object.
361:             * @return a related Part object.
362:             * @throws ValidationException if an invalid foreign key is set.
363:             * @throws FrameworkException Indicates some system error
364:             */
365:            public Part getPartObject() throws ValidationException,
366:                    FrameworkException {
367:                UOW uow = getUOW();
368:                boolean localUow = false;
369:                try {
370:                    if (m_partObject == null && getPart() != null) {
371:                        Criteria criteria = new Criteria();
372:                        criteria.setTable(PartMeta.getName());
373:                        criteria.addCriteria(PartMeta.PART, getPart());
374:                        if (uow == null || !uow.isActive()) {
375:                            uow = new UOW();
376:                            localUow = true;
377:                        }
378:                        Iterator itr = uow.query(criteria).iterator();
379:                        if (itr.hasNext())
380:                            m_partObject = (Part) itr.next();
381:                        if (m_partObject == null)
382:                            throw new InvalidForeignKeyException(
383:                                    PartPictureMeta.META_PART.getLabelToken(),
384:                                    new Object[] { PartMeta.getLabelToken(),
385:                                            PartMeta.META_PART.getLabelToken() });
386:                    }
387:                    return m_partObject;
388:                } finally {
389:                    if (localUow && uow != null)
390:                        uow.rollback();
391:                }
392:            }
393:
394:            // .//GEN-END:partObject_1_be
395:            // .//GEN-BEGIN:toString_1_be
396:            /** This returns the diagnostic information.
397:             * @return the diagnostic information.
398:             */
399:            public String toString() {
400:                StringBuffer buf = new StringBuffer();
401:                buf.append("<PartPicture>");
402:                buf.append("<part>");
403:                if (m_part != null)
404:                    buf.append(m_part);
405:                buf.append("</part>");
406:                buf.append("<smallPicture>");
407:                if (m_smallPicture != null)
408:                    buf.append(m_smallPicture);
409:                buf.append("</smallPicture>");
410:                buf.append("<picture>");
411:                if (m_picture != null)
412:                    buf.append(m_picture);
413:                buf.append("</picture>");
414:                // .//GEN-END:toString_1_be
415:                // Add custom debug information//GEN-FIRST:toString_1
416:
417:                // .//GEN-LAST:toString_1
418:                // .//GEN-BEGIN:toString_2_be
419:                buf.append(super .toString());
420:                buf.append("</PartPicture>");
421:                return buf.toString();
422:            }
423:
424:            // .//GEN-END:toString_2_be
425:            // .//GEN-BEGIN:clone_1_be
426:            /** Returns a clone of the object.
427:             * @throws CloneNotSupportedException if cloning is not supported. This should never happen.
428:             * @return a clone of the object.
429:             */
430:            public Object clone() throws CloneNotSupportedException {
431:                PartPicture obj = (PartPicture) super .clone();
432:                obj.m_partObject = null;
433:                return obj;
434:            }
435:
436:            // .//GEN-END:clone_1_be
437:            // .//GEN-BEGIN:performForeignKeyValidations_1_be
438:            /** This method ensures that the modified foreign-keys are valid.
439:             * @throws ApplicationExceptions if an invalid foreign key is set.
440:             * @throws FrameworkException Indicates some system error
441:             */
442:            public void performForeignKeyValidations()
443:                    throws ApplicationExceptions, FrameworkException {
444:                ApplicationExceptions appExps = new ApplicationExceptions();
445:                try {
446:                    if (isModified(PartPictureMeta.PART))
447:                        getPartObject();
448:                } catch (ValidationException e) {
449:                    appExps.add(e);
450:                }
451:                if (appExps.size() > 0)
452:                    throw appExps;
453:            }
454:
455:            // .//GEN-END:performForeignKeyValidations_1_be
456:            // .//GEN-BEGIN:performPreDeleteReferentialIntegrity_1_be
457:            /** This method is triggered by the UOW, before adding this object to the Delete-Store.
458:             * This will raise an exception if any associated/aggregated objects exist.
459:             * This will cascade delete all composite objects.
460:             * @throws PreDeleteFailedException if any error occurs during the process.
461:             */
462:            public void performPreDeleteReferentialIntegrity()
463:                    throws PreDeleteFailedException {
464:            }
465:            // .//GEN-END:performPreDeleteReferentialIntegrity_1_be
466:            // .//GEN-BEGIN:3_be
467:            /**
468:             * @clientCardinality 0..1
469:             * @supplierCardinality 1
470:             * @clientQualifier part
471:             * @supplierQualifier part
472:             * @link association
473:             */
474:            /*#Part lnkPart;*/
475:
476:            // .//GEN-END:3_be
477:            // All the custom code goes here//GEN-FIRST:custom
478:
479:            // .//GEN-LAST:custom
480:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.