|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.jhu.tmaj.beans.manytomany.ManyToManyBean
public abstract class ManyToManyBean
This Bean represents Many-To-Many tables. ManyToMany Tables link the PrimaryKeys of two other tables. For example, the table UsersProjects links UserIDs to ProjectIDs. This bean is abstract, and must implement methods that give information about SQL statements to initialize the bean. The information in this bean is reversible. So for example, lets say the table is "UsersProjects". You can view all projects to which an individual user has access, as well as seeing all users given an individual project. This is accomplished by having two LinkGroups. One LinkGroup links projects to arrayslides, and the other linkGroup links arraySlides to projects. See LinkGroup class for details.
Constructor Summary | |
---|---|
ManyToManyBean(java.lang.String key1Name,
java.lang.String key2Name,
java.lang.String tableName)
Constructs this object. |
Method Summary | |
---|---|
(package private) java.util.Set<java.lang.Integer> |
getAllKey1s()
|
(package private) java.util.Set<java.lang.Integer> |
getAllKey2s()
|
java.util.Set<java.lang.Integer> |
getKeySetForKey(int key,
boolean isReversed)
Gets the Set of IDs that are linked to the given key. |
(package private) abstract java.lang.String |
getSQL()
Returns a SQL statement that will initialize the bean with every record in the ManyToMany table |
(package private) abstract java.lang.String |
getSQL(int userID)
Returns a SQL statement that will initialize the bean with limited records for which the user needs access |
void |
initialize()
Initializes the bean with all the records found in the ManyToMany table |
void |
initialize(int userID)
Initializes the bean for a particular user, which includes only some of the records in the ManyToMany table. |
void |
setKeySet(int key,
java.util.Set<java.lang.Integer> newKeySet,
boolean isReversed)
|
void |
syncDatabase(int key,
java.util.Set<java.lang.Integer> newKeySet,
java.util.Set<java.lang.Integer> usersFullKeySet,
boolean isReversed)
Writes the database for the new keys assigned to the individual key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
ManyToManyBean(java.lang.String key1Name, java.lang.String key2Name, java.lang.String tableName)
key1Name
- name of the first primary key. For example, in UsersProjects, "UserID".key2Name
- name of the second primary key. For example, in UsersProjects, "ProjectID".tableName
- the tableName of the ManyToMany table. For example, "UsersProjects"Method Detail |
---|
public java.util.Set<java.lang.Integer> getKeySetForKey(int key, boolean isReversed)
key
- the IDisReversed
- if true, 'key' is actually the Key2Name, and set returned is the set of
associated key1's. if false, 'key' is the Key1Name, and the set returned is a set
of associated key2's.java.util.Set<java.lang.Integer> getAllKey1s()
java.util.Set<java.lang.Integer> getAllKey2s()
public final void initialize(int userID) throws java.sql.SQLException
java.sql.SQLException
public final void initialize() throws java.sql.SQLException
java.sql.SQLException
public final void setKeySet(int key, java.util.Set<java.lang.Integer> newKeySet, boolean isReversed)
public final void syncDatabase(int key, java.util.Set<java.lang.Integer> newKeySet, java.util.Set<java.lang.Integer> usersFullKeySet, boolean isReversed) throws java.sql.SQLException
java.sql.SQLException
abstract java.lang.String getSQL()
abstract java.lang.String getSQL(int userID)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |