Queries

Agent Query

class dlkit.authentication.queries.AgentQuery

Bases: dlkit.osid.queries.OsidObjectQuery

This is the query for searching agents.

Each method specifies an AND term while multiple invocations of the same method produce a nested OR.

The following example returns agents whose display name begins with “Tom” and whose “login name” is “tom” or “tjcoppet” in an agent record specified by companyAgentType.

Agent Query query = session.getAgentQuery();

query.matchDisplayName(“Tom*”, wildcardStringMatchType, true);

companyAgentQuery = query.getAgentQueryRecord(companyAgentType); companyAgentQuery.matchLoginName(“tom”); companyAgentQuery = query.getAgentQueryRecord(companyAgentType); companyAgentQuery.matchLoginName(“tjcoppet”);

AgentList agentList = session.getAgentsByQuery(query);

match_resource_id(agency_id, match)

Sets the resource Id for this query.

Parameters:
  • agency_id (osid.id.Id) – a resource Id
  • match (boolean) – true for a positive match, false for a negative match
Raise:

NullArgumentagency_id is null

compliance: mandatory – This method must be implemented.

resource_id_terms
supports_resource_query()

Tests if a ResourceQuery is available.

Returns:true if a resource query is available, false otherwise
Return type:boolean

compliance: mandatory – This method must be implemented.

resource_query

Gets the query for a resource.

Multiple retrievals produce a nested OR term.

Returns:the resource query
Return type:osid.resource.ResourceQuery
Raise:Unimplementedsupports_resource_query() is false

compliance: optional – This method must be implemented if ``supports_resource_query()`` is ``true``.

match_any_resource(match)

Matches agents with any resource.

Parameters:match (boolean) – true if to match agents with a resource, false to match agents with no resource

compliance: mandatory – This method must be implemented.

resource_terms
match_agency_id(agency_id, match)

Sets the agency Id for this query.

Parameters:
  • agency_id (osid.id.Id) – an agency Id
  • match (boolean) – true for a positive match, false for negative match
Raise:

NullArgumentagency_id is null

compliance: mandatory – This method must be implemented.

agency_id_terms
supports_agency_query()

Tests if an AgencyQuery is available.

Returns:true if an agency query is available, false otherwise
Return type:boolean

compliance: mandatory – This method must be implemented.

agency_query

Gets the query for an agency.

Multiple retrievals produce a nested OR term.

Returns:the agency query
Return type:osid.authentication.AgencyQuery
Raise:Unimplementedsupports_agency_query() is false

compliance: optional – This method must be implemented if ``supports_agency_query()`` is ``true``.

agency_terms
get_agent_query_record(agent_record_type)

Gets the agent query record corresponding to the given Agent record Type.

Multiple retrievals produce a nested OR term.

Parameters:agent_record_type (osid.type.Type) – an agent record type
Returns:the agent query record
Return type:osid.authentication.records.AgentQueryRecord
Raise:NullArgumentagent_record_type is null
Raise:OperationFailed – unable to complete request
Raise:Unsupportedhas_record_type(agent_record_type) is false

compliance: mandatory – This method must be implemented.