edu.internet2.middleware.subject.provider
Class JDBCSourceAdapter2

java.lang.Object
  extended by edu.internet2.middleware.subject.provider.BaseSourceAdapter
      extended by edu.internet2.middleware.subject.provider.JDBCSourceAdapter
          extended by edu.internet2.middleware.subject.provider.JDBCSourceAdapter2
All Implemented Interfaces:
Source
Direct Known Subclasses:
HelperGrouperJdbcSourceAdapter2

public class JDBCSourceAdapter2
extends JDBCSourceAdapter

jdbc source adapter based on one table with more complex searches


Constructor Summary
JDBCSourceAdapter2()
           
JDBCSourceAdapter2(String id, String name)
           
 
Method Summary
 void checkConfig()
          make sure the config is ok, and log descriptive errors if not
 String getDbTableOrView()
          table or view where each row is a subject dbTableOrView
 String getDefaultSortCol()
          search queries will sort by this.
 String getDescriptionCol()
           
 String getLowerSearchCol()
          for searches (not by id or identifier), this is the col which holds the search terms, in lower case lowerSearchCol
 String getNameCol()
          column which holds the subject name nameCol
 Subject getSubject(String id, boolean exceptionIfNull)
          Gets a Subject by its ID.
 Map<String,String> getSubjectAttributeColToName()
          map of col to attribute name //subjectAttributeCol0 //subjectAttributeName0
 Subject getSubjectByIdentifier(String id, boolean exceptionIfNull)
          note, you should implement this method since this implementation will become abstract at some point
 String getSubjectIdCol()
          column which holds the subject id subjectIdCol
 Set<String> getSubjectIdentifierCols()
          cols which are used in a findByIdentifier query subjectIdentifierCol0
static void main(String[] args)
           
 Set<Subject> search(String searchValue)
          Unstructured search for Subjects.
 void setDbTableOrView(String dbTableOrView1)
          table or view where each row is a subject dbTableOrView
 void setDefaultSortCol(String defaultSortCol1)
          search queries will sort by this.
 void setDescriptionCol(String descriptionCol1)
           
 void setLowerSearchCol(String lowerSearchCol1)
          for searches (not by id or identifier), this is the col which holds the search terms, in lower case lowerSearchCol
 void setNameCol(String nameCol1)
          column which holds the subject name nameCol
 void setSubjectAttributeColToName(Map<String,String> subjectAttributeColToName1)
          map of col to attribute name //subjectAttributeCol0 //subjectAttributeName0
 void setSubjectIdCol(String subjectIdCol1)
          column which holds the subject id subjectIdCol
 void setSubjectIdentifierCols(Set<String> subjectIdentifierCols1)
          cols which are used in a findByIdentifier query subjectIdentifierCol0
 
Methods inherited from class edu.internet2.middleware.subject.provider.JDBCSourceAdapter
getDescriptionAttributeName, getNameAttributeName, getSubject, getSubjectByIdentifier, getSubjectIDAttributeName, getSubjectTypeString, init, loadDriver, printConfig
 
Methods inherited from class edu.internet2.middleware.subject.provider.BaseSourceAdapter
addAttribute, addInitParam, addSubjectType, equals, getId, getInitParam, getInitParams, getName, getSubjectByIdOrIdentifier, getSubjectsByIdentifiers, getSubjectsByIds, getSubjectsByIdsOrIdentifiers, getSubjectType, getSubjectTypes, hashCode, loadSearch, setId, setName
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCSourceAdapter2

public JDBCSourceAdapter2()

JDBCSourceAdapter2

public JDBCSourceAdapter2(String id,
                          String name)
Parameters:
id -
name -
Method Detail

checkConfig

public void checkConfig()
Description copied from interface: Source
make sure the config is ok, and log descriptive errors if not

Specified by:
checkConfig in interface Source
Overrides:
checkConfig in class JDBCSourceAdapter
See Also:
Source.checkConfig()

getDbTableOrView

public String getDbTableOrView()
table or view where each row is a subject dbTableOrView

Returns:
table or view

getSubject

public Subject getSubject(String id,
                          boolean exceptionIfNull)
                   throws SubjectNotFoundException,
                          SubjectNotUniqueException
Description copied from class: JDBCSourceAdapter
Gets a Subject by its ID.

Specified by:
getSubject in interface Source
Overrides:
getSubject in class JDBCSourceAdapter
exceptionIfNull - if SubjectNotFoundException should be throws if the subject is null, or if null should be returned
Returns:
subject
Throws:
SubjectNotFoundException
SubjectNotUniqueException
See Also:
JDBCSourceAdapter.getSubject(java.lang.String, boolean)

search

public Set<Subject> search(String searchValue)
Description copied from class: JDBCSourceAdapter
Unstructured search for Subjects. Each implementation utilizes its own search algorithm tailored to the Subject repository and schema.

Specified by:
search in interface Source
Overrides:
search in class JDBCSourceAdapter
Returns:
set
See Also:
JDBCSourceAdapter.search(java.lang.String)

getSubjectByIdentifier

public Subject getSubjectByIdentifier(String id,
                                      boolean exceptionIfNull)
                               throws SubjectNotFoundException,
                                      SubjectNotUniqueException
Description copied from class: BaseSourceAdapter
note, you should implement this method since this implementation will become abstract at some point

Specified by:
getSubjectByIdentifier in interface Source
Overrides:
getSubjectByIdentifier in class JDBCSourceAdapter
Returns:
subject
Throws:
SubjectNotFoundException
SubjectNotUniqueException
See Also:
JDBCSourceAdapter.getSubjectByIdentifier(java.lang.String, boolean)

setDbTableOrView

public void setDbTableOrView(String dbTableOrView1)
table or view where each row is a subject dbTableOrView

Parameters:
dbTableOrView1 -

getSubjectIdCol

public String getSubjectIdCol()
column which holds the subject id subjectIdCol

Returns:
the subject id col

setSubjectIdCol

public void setSubjectIdCol(String subjectIdCol1)
column which holds the subject id subjectIdCol

Parameters:
subjectIdCol1 -

getNameCol

public String getNameCol()
column which holds the subject name nameCol

Returns:
the col for name

setNameCol

public void setNameCol(String nameCol1)
column which holds the subject name nameCol

Parameters:
nameCol1 -

getDescriptionCol

public String getDescriptionCol()
Returns:
description col

setDescriptionCol

public void setDescriptionCol(String descriptionCol1)
Parameters:
descriptionCol1 -

getLowerSearchCol

public String getLowerSearchCol()
for searches (not by id or identifier), this is the col which holds the search terms, in lower case lowerSearchCol

Returns:
lower search col

setLowerSearchCol

public void setLowerSearchCol(String lowerSearchCol1)
for searches (not by id or identifier), this is the col which holds the search terms, in lower case lowerSearchCol

Parameters:
lowerSearchCol1 -

getDefaultSortCol

public String getDefaultSortCol()
search queries will sort by this. Note it might be overridden by caller, e.g. UI defaultSortCol

Returns:
sort col

setDefaultSortCol

public void setDefaultSortCol(String defaultSortCol1)
search queries will sort by this. Note it might be overridden by caller, e.g. UI defaultSortCol

Parameters:
defaultSortCol1 -

getSubjectIdentifierCols

public Set<String> getSubjectIdentifierCols()
cols which are used in a findByIdentifier query subjectIdentifierCol0

Returns:
subject id cols

setSubjectIdentifierCols

public void setSubjectIdentifierCols(Set<String> subjectIdentifierCols1)
cols which are used in a findByIdentifier query subjectIdentifierCol0

Parameters:
subjectIdentifierCols1 -

getSubjectAttributeColToName

public Map<String,String> getSubjectAttributeColToName()
map of col to attribute name //subjectAttributeCol0 //subjectAttributeName0

Returns:
subject attribute col

setSubjectAttributeColToName

public void setSubjectAttributeColToName(Map<String,String> subjectAttributeColToName1)
map of col to attribute name //subjectAttributeCol0 //subjectAttributeName0

Parameters:
subjectAttributeColToName1 -

main

public static void main(String[] args)
                 throws Exception
Parameters:
args -
Throws:
Exception