Assembly Pattern

Build complex OSID queries by flowing through an assembler and adding terms one at a time.

Overview

An assembler accepts individual query terms and accumulates them into a completed OsidQuery. You obtain an assembler from a lookup or query session, add matching criteria — display name, type, catalog scope, any domain-specific field — and then call assemble() to get the finished query object ready to pass to a query session.

Assemblers decouple query construction from query execution and make it easy to build queries programmatically or from user-supplied criteria without constructing query objects directly.

Javadoc Reference

net.okapia.osid.jamocha.assembly.query

Example

GradeQueryAssembler asm = gradebookQuerySession.getGradeQueryAssembler(); asm.matchDisplayName("A", StringMatchType.STARTS_WITH, true); asm.matchGradeSystem(gradeSystemId, true); GradeQuery query = asm.assemble(); GradeList grades = gradebookQuerySession.getGradesByQuery(query);

Class Declaration Pattern

public final class OsidObjectQueryAssembler
extends Object
implements OsidAssembler<OsidObjectQuery>

Constructor Pattern

OsidObjectQueryAssembler(OsidObjectQuery query)
ParameterTypeDescription
query OsidObjectQuery the query object to accumulate terms into

Static Factory Method Pattern

static OsidObjectQueryAssembler start(OsidObjectQuery query)
ParameterTypeDescription
query OsidObjectQuery a fresh query obtained from the session

Returns OsidObjectQueryAssembler — a new assembler ready to accept terms