Java Doc for RelationshipManager.java in  » Database-ORM » JPOX » org » jpox » state » 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 » Database ORM » JPOX » org.jpox.state 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jpox.state.RelationshipManager

RelationshipManager
public class RelationshipManager (Code)
Manager for relationships of a class. Performs management of (bidirectional) relations. If one side is set yet the other isnt, corrects the other side.
version:
   $Revision$


Field Summary
final protected static  LocaliserLOCALISER
     Localiser for messages.
final  MapfieldChanges
     Map of bidirectional field "changes".
final  StateManagerownerSM
     StateManager for the object we are managing the relationships for.
final  Objectpc
     Object being managed.

Constructor Summary
public  RelationshipManager(StateManager sm)
     Constructor.

Method Summary
public  voidcheckConsistency()
     Method to check for consistency the managed relations of this object with the related objects.
protected  voidcheckManyToManyBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, ArrayList changes)
     Method to check consistency of the passed field as M-N.
protected  voidcheckManyToOneBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, Object oldValue, Object newValue)
     Method to check the consistency of the passed field as N-1. Processes the case where we had an N-1 field set at this side previously to some value and now to some other value.That is, this object was in some collection/map originally, and now should be in some other collection/map.
protected  voidcheckOneToManyBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, ArrayList changes)
     Method to check the consistency of the passed field as 1-N.
protected  voidcheckOneToOneBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, Object oldValue, Object newValue)
     Method to check the consistency of the passed field as 1-1. Processes the case where we had a 1-1 field set at this side previously to some value and now to some other value.
public  voidclearFields()
     Convenience method to clear all fields from being managed.
public  voidprocess()
     Method to process the (bidirectional) relations for this object.
protected  voidprocessManyToManyBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, ArrayList changes)
     Method to process all M-N bidir fields.
protected  voidprocessManyToOneBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, Object oldValue, Object newValue)
     Method to process all N-1 bidir fields. Processes the case where we had an N-1 field set at this side previously to some value and now to some other value.That is, this object was in some collection/map originally, and now should be in some other collection/map.
protected  voidprocessOneToManyBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, ArrayList changes)
     Method to process all 1-N bidir fields.
protected  voidprocessOneToOneBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, Object oldValue, Object newValue)
     Method to process all 1-1 bidir fields. Processes the case where we had a 1-1 field set at this side previously to some value and now to some other value.
public  voidrelationAdd(int fieldNumber, Object val)
     Method to register a change in the contents of a container field, with an object being added.
public  voidrelationChange(int fieldNumber, Object oldValue, Object newValue)
     Method that is called when the user calls setXXX() on a field.
public  voidrelationRemove(int fieldNumber, Object val)
     Method to register a change in the contents of a container field, with an object being removed.

Field Detail
LOCALISER
final protected static Localiser LOCALISER(Code)
Localiser for messages.



fieldChanges
final Map fieldChanges(Code)
Map of bidirectional field "changes". For 1-1, N-1 fields the "change" is actually the original value (for later comparison). For 1-N, M-N fields the "change" is an ArrayList of RelationChange objects.



ownerSM
final StateManager ownerSM(Code)
StateManager for the object we are managing the relationships for.



pc
final Object pc(Code)
Object being managed.




Constructor Detail
RelationshipManager
public RelationshipManager(StateManager sm)(Code)
Constructor.
Parameters:
  sm - StateManager for the object that we are managing relations for.




Method Detail
checkConsistency
public void checkConsistency()(Code)
Method to check for consistency the managed relations of this object with the related objects.



checkManyToManyBidirectionalRelation
protected void checkManyToManyBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, ArrayList changes)(Code)
Method to check consistency of the passed field as M-N.
Parameters:
  mmd - MetaData for the field
Parameters:
  clr - ClassLoader resolver
Parameters:
  om - ObjectManager
Parameters:
  changes - List of changes to the collection



checkManyToOneBidirectionalRelation
protected void checkManyToOneBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, Object oldValue, Object newValue)(Code)
Method to check the consistency of the passed field as N-1. Processes the case where we had an N-1 field set at this side previously to some value and now to some other value.That is, this object was in some collection/map originally, and now should be in some other collection/map. So in terms of an example this object "a" was in collection "b1.as" before and is now in "b2.as". The following changes are likely to be necessary
  • b1.getAs().remove(a) - remove it from b1.as if still present
  • b2.getAs().add(a) - add it to b1.as if not present

Parameters:
  mmd - MetaData for the field
Parameters:
  clr - ClassLoader resolver
Parameters:
  om - ObjectManager
Parameters:
  oldValue - The old value
Parameters:
  newValue - The new value



checkOneToManyBidirectionalRelation
protected void checkOneToManyBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, ArrayList changes)(Code)
Method to check the consistency of the passed field as 1-N.
Parameters:
  mmd - MetaData for the field
Parameters:
  clr - ClassLoader resolver
Parameters:
  om - ObjectManager
Parameters:
  changes - List of changes to the collection



checkOneToOneBidirectionalRelation
protected void checkOneToOneBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, Object oldValue, Object newValue)(Code)
Method to check the consistency of the passed field as 1-1. Processes the case where we had a 1-1 field set at this side previously to some value and now to some other value. We need to make sure that all of the affected objects are now related consistently. Taking an example
a.b = b1; a.b = b2;
so A's b field is changed from b1 to b2. The following changes are likely to be necessary
  • b1.a = null - so we null out the old related objects link back to this object
  • b2.oldA = null - if b2 was previously related to a different A, null out that objects link to b2
  • b2.a = a - set the link from b2 back to a so it is bidirectional

Parameters:
  mmd - MetaData for the field
Parameters:
  clr - ClassLoader resolver
Parameters:
  om - ObjectManager
Parameters:
  oldValue - The old value
Parameters:
  newValue - The new value



clearFields
public void clearFields()(Code)
Convenience method to clear all fields from being managed.



process
public void process()(Code)
Method to process the (bidirectional) relations for this object.



processManyToManyBidirectionalRelation
protected void processManyToManyBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, ArrayList changes)(Code)
Method to process all M-N bidir fields.
Parameters:
  mmd - MetaData for the field
Parameters:
  clr - ClassLoader resolver
Parameters:
  om - ObjectManager
Parameters:
  changes - List of changes to the collection



processManyToOneBidirectionalRelation
protected void processManyToOneBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, Object oldValue, Object newValue)(Code)
Method to process all N-1 bidir fields. Processes the case where we had an N-1 field set at this side previously to some value and now to some other value.That is, this object was in some collection/map originally, and now should be in some other collection/map. So in terms of an example this object "a" was in collection "b1.as" before and is now in "b2.as". The following changes are likely to be necessary
  • b1.getAs().remove(a) - remove it from b1.as if still present
  • b2.getAs().add(a) - add it to b1.as if not present

Parameters:
  mmd - MetaData for the field
Parameters:
  clr - ClassLoader resolver
Parameters:
  om - ObjectManager
Parameters:
  oldValue - The old value
Parameters:
  newValue - The new value



processOneToManyBidirectionalRelation
protected void processOneToManyBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, ArrayList changes)(Code)
Method to process all 1-N bidir fields.
Parameters:
  mmd - MetaData for the field
Parameters:
  clr - ClassLoader resolver
Parameters:
  om - ObjectManager
Parameters:
  changes - List of changes to the collection



processOneToOneBidirectionalRelation
protected void processOneToOneBidirectionalRelation(AbstractMemberMetaData mmd, ClassLoaderResolver clr, ObjectManager om, Object oldValue, Object newValue)(Code)
Method to process all 1-1 bidir fields. Processes the case where we had a 1-1 field set at this side previously to some value and now to some other value. We need to make sure that all of the affected objects are now related consistently. Taking an example
a.b = b1; a.b = b2;
so A's b field is changed from b1 to b2. The following changes are likely to be necessary
  • b1.a = null - so we null out the old related objects link back to this object
  • b2.oldA = null - if b2 was previously related to a different A, null out that objects link to b2
  • b2.a = a - set the link from b2 back to a so it is bidirectional

Parameters:
  mmd - MetaData for the field
Parameters:
  clr - ClassLoader resolver
Parameters:
  om - ObjectManager
Parameters:
  oldValue - The old value
Parameters:
  newValue - The new value



relationAdd
public void relationAdd(int fieldNumber, Object val)(Code)
Method to register a change in the contents of a container field, with an object being added.
Parameters:
  fieldNumber - Number of the field
Parameters:
  val - Value being added



relationChange
public void relationChange(int fieldNumber, Object oldValue, Object newValue)(Code)
Method that is called when the user calls setXXX() on a field.
Parameters:
  fieldNumber - Number of the field
Parameters:
  oldValue - The old value
Parameters:
  newValue - The new value



relationRemove
public void relationRemove(int fieldNumber, Object val)(Code)
Method to register a change in the contents of a container field, with an object being removed.
Parameters:
  fieldNumber - Number of the field
Parameters:
  val - Value being removed



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.