Class BaseSourceAdapter
java.lang.Object
edu.internet2.middleware.subject.provider.BaseSourceAdapter
- All Implemented Interfaces:
Source
- Direct Known Subclasses:
GrouperDataFieldSourceAdapter,GrouperSourceAdapter,InternalSourceAdapter,JDBCSourceAdapter,JNDISourceAdapterLegacy,LdapSourceAdapter,NullSourceAdapter
Base Source adapter. Developers note: you should implement the getSubject and getSubjectByIdentifier methods (that take boolean) since the base class method will soon become abstract, and the method overloads which are deprecated and dont take booleans will go away.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringinternal attributes.protected Stringprotected Stringprotected PropertiesThe three different kinds of searches:protected SubjectTypeprotected Set<SubjectType> -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.BaseSourceAdapter(String id1, String name1) Allocates adapter with ID and name. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String attributeName) voidaddInitParam(String name1, String value) (non-javadoc)voidaddInternalAttribute(String attributeName) voidaddSubjectType(String type1) (non-javadoc)return the attribute nameconvertSourceAttributeToSubjectAttribute(String nameOfSourceAttribute) convertSubjectAttributeToSourceAttribute(String nameOfSubjectAttribute) protected SubjectcreateSubject(Map<String, Object> sourceAttributesToValues, String subjectID) booleanCompares this source against the specified source.return export label to attribute name (if there are overrides)protected SetgetId()Returns the ID of this source.getInitParam(String name1) (non-javadoc)Get a set of attributes that are marked as being internal attributes.getName()Returns the name of this source.protected SearchGet the names of attributes used for searching.Get the names of attributes used for sorting.abstract SubjectgetSubject(String id1) Deprecated.use the overload insteadgetSubject(String id1, boolean exceptionIfNull) Gets a Subject by its ID.getSubject(String id1, boolean exceptionIfNull, String realm) Gets a Subject by its ID.abstract SubjectDeprecated.use the overload insteadgetSubjectByIdentifier(String id1, boolean exceptionIfNull) note, you should implement this method since this implementation will become abstract at some pointgetSubjectByIdentifier(String id1, boolean exceptionIfNull, String realm) Gets a Subject by other well-known identifiers, aside from the subject ID, for example, login ID.getSubjectByIdOrIdentifier(String idOrIdentifier, boolean exceptionIfNull) find by id or identifiergetSubjectByIdOrIdentifier(String idOrIdentifier, boolean exceptionIfNull, String realm) find by id or identifier.Get the names of attributes that are subject identifiers.Get all the names of attributes that are subject identifiers.getSubjectsByIdentifiers(Collection<String> identifiers) Get subjects by identifiers.getSubjectsByIdentifiers(Collection<String> identifiers, String realm) Get subjects by identifiers.getSubjectsByIds(Collection<String> ids) Get subjects by ids.getSubjectsByIds(Collection<String> ids, String realm) Get subjects by ids.getSubjectsByIdsOrIdentifiers(Collection<String> idsOrIdentifiers) Get subjects by ids or identifiers.getSubjectsByIdsOrIdentifiers(Collection<String> idsOrIdentifiers, String realm) Get subjects by ids or identifiers.get the config bean for this sourceGets the SubjectTypes supported by this source.inthashCode()abstract voidinit()Called by SourceManager when it loads this source.(non-javadoc)booleanbooleanvoidloadSearch(Search search) voidremoveInitParam(String name1) static IntegerresultSetLimit(boolean firstPageOnly, Integer pageSize, Integer theMaxResults) see what the result set limit should be (dont add one yet)get all subject idsUnstructured search for Subjects.Unstructured search for Subjects.searchPage(String searchValue) Unstructured search for Subjects.searchPage(String searchValue, String realm) Unstructured search for Subjects.voidsetConfigId(String configId) set config id for this sourcevoidSets the ID of this source.voidSets the name of this source.voidsetSearchAttributes(Map<Integer, String> searchAttributes) protected voidsetSearches(HashMap<String, Search> searches1) voidsetSortAttributes(Map<Integer, String> sortAttributes) voidsetSubjectIdentifierAttributes(Map<Integer, String> subjectIdentifierAttributes) voidsetSubjectIdentifierAttributesAll(Map<Integer, String> subjectIdentifierAttributesAll) virtualAttributesForSource(Source source) get the ordered list of virtual attributes for a source (new style)get the ordered list of virtual attributes for a sourceget the ordered list of virtual attributes for a sourceMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.internet2.middleware.subject.Source
checkConfig, loggingStart, loggingStop, printConfig
-
Field Details
-
nameAttributeName
-
descriptionAttributeName
-
id
-
name
-
types
-
type
-
params
-
searches
The three different kinds of searches: -
attributes
-
internalAttributes
internal attributes. -
subjectIdentifierAttributes
-
subjectIdentifierAttributesAll
-
sortAttributes
-
searchAttributes
-
-
Constructor Details
-
BaseSourceAdapter
public BaseSourceAdapter()Default constructor. -
BaseSourceAdapter
Allocates adapter with ID and name.- Parameters:
id1-name1-
-
-
Method Details
-
createSubject
-
getSourceAttributesToLowerCase
-
convertSubjectAttributeToSourceAttribute
- Specified by:
convertSubjectAttributeToSourceAttributein interfaceSource
-
exportLabelToAttributeName
return export label to attribute name (if there are overrides)- Returns:
- empty if no overrides, otherwise the attribute name to export label
-
attributeNameToViewerGroupName
return the attribute name- Returns:
- empty if no overrides, otherwise the attribute name to export label
-
convertSourceAttributeToSubjectAttribute
- Specified by:
convertSourceAttributeToSubjectAttributein interfaceSource
-
retrieveAllSubjectIds
Description copied from interface:Sourceget all subject ids- Specified by:
retrieveAllSubjectIdsin interfaceSource- Returns:
- all subjectIds
- See Also:
-
getSubject
public Subject getSubject(String id1, boolean exceptionIfNull, String realm) throws SubjectNotFoundException, SubjectNotUniqueException Description copied from interface:SourceGets a Subject by its ID.- Specified by:
getSubjectin interfaceSourceexceptionIfNull- if SubjectNotFoundException should be throws if the subject is null, or if null should be returnedrealm- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- subject
- Throws:
SubjectNotFoundExceptionSubjectNotUniqueException- See Also:
-
getSubjectByIdentifier
public Subject getSubjectByIdentifier(String id1, boolean exceptionIfNull, String realm) throws SubjectNotFoundException, SubjectNotUniqueException Description copied from interface:SourceGets a Subject by other well-known identifiers, aside from the subject ID, for example, login ID.- Specified by:
getSubjectByIdentifierin interfaceSourcerealm- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- subject
- Throws:
SubjectNotFoundExceptionSubjectNotUniqueException- See Also:
-
getSubjectByIdOrIdentifier
public Subject getSubjectByIdOrIdentifier(String idOrIdentifier, boolean exceptionIfNull, String realm) throws SubjectNotFoundException, SubjectNotUniqueException Description copied from interface:Sourcefind by id or identifier. pass in either an id or an identifier- Specified by:
getSubjectByIdOrIdentifierin interfaceSourceexceptionIfNull- if SubjectNotFoundException or nullrealm- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- the subject
- Throws:
SubjectNotFoundExceptionSubjectNotUniqueException- See Also:
-
getSubjectsByIdentifiers
Description copied from interface:SourceGet subjects by identifiers. Note, if the subjects arent found or arent unique, they wont be returned. Identifiers are unique ways to refer to a subject that isnt its id (e.g. netid). Duplicates are ok on the input, but will return one output.- Specified by:
getSubjectsByIdentifiersin interfaceSourcerealm- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- a map of results never null indexed by the identifiers
- See Also:
-
getSubjectsByIds
Description copied from interface:SourceGet subjects by ids. Note, if the subjects arent found or arent unique, they wont be returned. Duplicates are ok on the input, but will return one output.- Specified by:
getSubjectsByIdsin interfaceSourcerealm- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- a map of results never null indexed by the id
- See Also:
-
getSubjectsByIdsOrIdentifiers
public Map<String,Subject> getSubjectsByIdsOrIdentifiers(Collection<String> idsOrIdentifiers, String realm) Description copied from interface:SourceGet subjects by ids or identifiers. Note, if the subjects arent found or arent unique, they wont be returned. Identifiers are unique ways to refer to a subject that isnt its id (e.g. netid). Duplicates are ok on the input, but will return one output.- Specified by:
getSubjectsByIdsOrIdentifiersin interfaceSource- Parameters:
idsOrIdentifiers- each string could be a subject id or identifierrealm- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- a map of results never null indexed by the id or identifier that was passed in. Note, the same subject could be returned twice if looked up by id and identifier (two inputs)
- See Also:
-
search
Description copied from interface:SourceUnstructured search for Subjects. Each implementation utilizes its own search algorithm tailored to the Subject repository and schema. Note if config param: throwErrorOnFindAllFailure is false, then swallow and log exceptions -
searchPage
Description copied from interface:SourceUnstructured search for Subjects. Each implementation utilizes its own search algorithm tailored to the Subject repository and schema. Note if config param: throwErrorOnFindAllFailure is false, then swallow and log exceptions if maxPageSize is set in subject.properties, then only return max that many, and if there are more, set the tooManyResults flag- Specified by:
searchPagein interfaceSourcerealm- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- results and if there are too many, never return null!!!
- See Also:
-
getSubjectStatusConfig
Description copied from interface:Sourceget the config bean for this source- Specified by:
getSubjectStatusConfigin interfaceSource- Returns:
- the config bean for this source
- See Also:
-
resultSetLimit
public static Integer resultSetLimit(boolean firstPageOnly, Integer pageSize, Integer theMaxResults) see what the result set limit should be (dont add one yet)- Parameters:
firstPageOnly-pageSize-theMaxResults-- Returns:
- the limit or null if none
-
searchPage
Description copied from interface:SourceUnstructured search for Subjects. Each implementation utilizes its own search algorithm tailored to the Subject repository and schema. Note if config param: throwErrorOnFindAllFailure is false, then swallow and log exceptions if maxPageSize is set in subject.properties, then only return max that many, and if there are more, set the tooManyResults flag- Specified by:
searchPagein interfaceSource- Returns:
- results and if there are too many, never return null!!!
- See Also:
-
getSubjectsByIdentifiers
Description copied from interface:SourceGet subjects by identifiers. Note, if the subjects arent found or arent unique, they wont be returned. Identifiers are unique ways to refer to a subject that isnt its id (e.g. netid). Duplicates are ok on the input, but will return one output.- Specified by:
getSubjectsByIdentifiersin interfaceSource- Returns:
- a map of results never null indexed by the identifiers
- See Also:
-
getSubjectsByIds
Description copied from interface:SourceGet subjects by ids. Note, if the subjects arent found or arent unique, they wont be returned. Duplicates are ok on the input, but will return one output.- Specified by:
getSubjectsByIdsin interfaceSource- Returns:
- a map of results never null indexed by the id
- See Also:
-
getSubjectByIdOrIdentifier
public Subject getSubjectByIdOrIdentifier(String idOrIdentifier, boolean exceptionIfNull) throws SubjectNotFoundException, SubjectNotUniqueException find by id or identifier- Specified by:
getSubjectByIdOrIdentifierin interfaceSource- Parameters:
idOrIdentifier-exceptionIfNull- if SubjectNotFoundException or null- Returns:
- the subject
- Throws:
SubjectNotFoundExceptionSubjectNotUniqueException
-
getSubjectsByIdsOrIdentifiers
Description copied from interface:SourceGet subjects by ids or identifiers. Note, if the subjects arent found or arent unique, they wont be returned. Identifiers are unique ways to refer to a subject that isnt its id (e.g. netid). Duplicates are ok on the input, but will return one output.- Specified by:
getSubjectsByIdsOrIdentifiersin interfaceSource- Parameters:
idsOrIdentifiers- each string could be a subject id or identifier- Returns:
- a map of results never null indexed by the id or identifier that was passed in. Note, the same subject could be returned twice if looked up by id and identifier (two inputs)
- See Also:
-
getId
Returns the ID of this source. -
setId
Sets the ID of this source. -
getName
Returns the name of this source. -
setName
Sets the name of this source. -
getSubjectTypes
Gets the SubjectTypes supported by this source.- Specified by:
getSubjectTypesin interfaceSource- Returns:
- set
-
getSubjectType
- Returns:
- subject type
-
getSubject
@Deprecated public abstract Subject getSubject(String id1) throws SubjectNotFoundException, SubjectNotUniqueException Deprecated.use the overload insteadDescription copied from interface:SourceGets a Subject by its ID.- Specified by:
getSubjectin interfaceSource- Returns:
- subject
- Throws:
SubjectNotFoundExceptionSubjectNotUniqueException- See Also:
-
getSubject
public Subject getSubject(String id1, boolean exceptionIfNull) throws SubjectNotFoundException, SubjectNotUniqueException Description copied from interface:SourceGets a Subject by its ID.- Specified by:
getSubjectin interfaceSourceexceptionIfNull- if SubjectNotFoundException should be throws if the subject is null, or if null should be returned- Returns:
- subject
- Throws:
SubjectNotFoundExceptionSubjectNotUniqueException- See Also:
-
getSubjectByIdentifier
@Deprecated public abstract Subject getSubjectByIdentifier(String id1) throws SubjectNotFoundException, SubjectNotUniqueException Deprecated.use the overload insteadDescription copied from interface:SourceGets a Subject by other well-known identifiers, aside from the subject ID, for example, login ID.- Specified by:
getSubjectByIdentifierin interfaceSource- Returns:
- subject
- Throws:
SubjectNotFoundExceptionSubjectNotUniqueException- See Also:
-
getSubjectByIdentifier
public Subject getSubjectByIdentifier(String id1, boolean exceptionIfNull) throws SubjectNotFoundException, SubjectNotUniqueException note, you should implement this method since this implementation will become abstract at some point- Specified by:
getSubjectByIdentifierin interfaceSource- Returns:
- subject
- Throws:
SubjectNotFoundExceptionSubjectNotUniqueException- See Also:
-
search
Unstructured search for Subjects. Each implementation utilizes its own search algorithm tailored to the Subject repository and schema. Note if config param: throwErrorOnFindAllFailure is false, then swallow and log exceptions -
init
Called by SourceManager when it loads this source.- Specified by:
initin interfaceSource- Throws:
SourceUnavailableException
-
equals
Compares this source against the specified source. Returns true if the IDs of both sources are equal. -
hashCode
public int hashCode() -
addSubjectType
(non-javadoc)- Parameters:
type1-
-
addInitParam
(non-javadoc)- Parameters:
name1-value-
-
removeInitParam
- Parameters:
name1-
-
getInitParam
(non-javadoc)- Specified by:
getInitParamin interfaceSource- Parameters:
name1-- Returns:
- param
-
initParams
(non-javadoc)- Specified by:
initParamsin interfaceSource- Returns:
- params
-
addAttribute
- Parameters:
attributeName-
-
addInternalAttribute
- Parameters:
attributeName-
-
getAttributes
- Returns:
- set
-
getInternalAttributes
Description copied from interface:SourceGet a set of attributes that are marked as being internal attributes. Note, these will be in lower case- Specified by:
getInternalAttributesin interfaceSource- Returns:
- set
-
setSearches
- Parameters:
searches1-
-
getSearches
- Returns:
- map
-
getSearch
- Parameters:
searchType-- Returns:
- search
-
loadSearch
- Parameters:
search-
-
setSubjectIdentifierAttributes
- Parameters:
subjectIdentifierAttributes-
-
setSubjectIdentifierAttributesAll
- Parameters:
subjectIdentifierAttributesAll-
-
setSortAttributes
- Parameters:
sortAttributes-
-
setSearchAttributes
- Parameters:
searchAttributes-
-
getSubjectIdentifierAttributes
Description copied from interface:SourceGet the names of attributes that are subject identifiers. This only returns the first- Specified by:
getSubjectIdentifierAttributesin interfaceSource- Returns:
- subject identifiers
- See Also:
-
getSubjectIdentifierAttributesAll
Description copied from interface:SourceGet all the names of attributes that are subject identifiers.- Specified by:
getSubjectIdentifierAttributesAllin interfaceSource- Returns:
- subject identifiers
- See Also:
-
getSortAttributes
Description copied from interface:SourceGet the names of attributes used for sorting.- Specified by:
getSortAttributesin interfaceSource- Returns:
- sort attributes in lower case
- See Also:
-
getSearchAttributes
Description copied from interface:SourceGet the names of attributes used for searching.- Specified by:
getSearchAttributesin interfaceSource- Returns:
- search attributes in lower case
- See Also:
-
isEditable
public boolean isEditable()- Specified by:
isEditablein interfaceSource- Returns:
- true if the source is editable otherwise false
-
getConfigId
- Specified by:
getConfigIdin interfaceSource- Returns:
- configId for this source
-
setConfigId
Description copied from interface:Sourceset config id for this source- Specified by:
setConfigIdin interfaceSource
-
isEnabled
public boolean isEnabled() -
virtualAttributesForSource
get the ordered list of virtual attributes for a source (new style)- Parameters:
source-- Returns:
- the ordered list
-
virtualAttributesForSourceLegacy
get the ordered list of virtual attributes for a source- Parameters:
source-- Returns:
- the ordered list
-
virtualAttributeVariablesForSourceLegacy
get the ordered list of virtual attributes for a source- Parameters:
source-- Returns:
- the ordered list
-