use of org.codice.alliance.nsili.endpoint.requests.SubmitStandingQueryRequestImpl in project alliance by codice.
the class SubmitStandingQueryRequestImplTest method setupStandingQueryRequest.
private void setupStandingQueryRequest() throws InvalidInputParameter, SystemFault, ProcessingFault, WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive {
Query query = getQuery();
String[] resultAttributes = new String[0];
SortAttribute[] sortAttributes = new SortAttribute[0];
QueryLifeSpan lifespan = getEmptyLifespan();
NameValue[] properties = new NameValue[0];
// Set artificially low for for test cases.
long defaultUpdateFrequencyMsec = 2000;
int maxPendingResults = 10000;
long maxWaitToStartTimeMsecs = TimeUnit.MINUTES.toMillis(5);
standingQueryRequest = new SubmitStandingQueryRequestImpl(query, resultAttributes, sortAttributes, lifespan, properties, mockFramework, filterBuilder, defaultUpdateFrequencyMsec, null, maxPendingResults, true, false, maxWaitToStartTimeMsecs);
standingQueryRequest.register_callback(mockCallback2);
String managerId = UUID.randomUUID().toString();
rootPOA.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), standingQueryRequest);
rootPOA.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), CreationMgrHelper.id());
}
use of org.codice.alliance.nsili.endpoint.requests.SubmitStandingQueryRequestImpl in project alliance by codice.
the class StandingQueryMgrImpl method submit_standing_query.
@Override
public SubmitStandingQueryRequest submit_standing_query(Query aQuery, String[] result_attributes, SortAttribute[] sort_attributes, QueryLifeSpan lifespan, NameValue[] properties) throws InvalidInputParameter, ProcessingFault, SystemFault {
if (aQuery == null) {
InvalidInputParameter except = new InvalidInputParameter();
exception_details details = new exception_details();
details.exception_name = "No Query Specified";
details.exception_desc = "Query must be specified for standing query request";
except.details = details;
throw except;
}
LOGGER.debug("Registering Standing Query View: {}, BQS: {}", aQuery.view, aQuery.bqs_query);
SubmitStandingQueryRequestImpl standingQueryRequest = new SubmitStandingQueryRequestImpl(aQuery, result_attributes, sort_attributes, lifespan, properties, catalogFramework, filterBuilder, defaultUpdateFrequencyMsec, querySources, maxPendingResults, removeSourceLibrary, outgoingValidationEnabled, maxWaitToStartTimeMsecs);
String id = UUID.randomUUID().toString();
try {
_poa().activate_object_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), standingQueryRequest);
} catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
LOGGER.debug("submit_standing_query : Unable to activate submitStandingQueryRequest object.", e);
}
org.omg.CORBA.Object obj = _poa().create_reference_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), SubmitStandingQueryRequestHelper.id());
SubmitStandingQueryRequest submitStandingQueryRequest = SubmitStandingQueryRequestHelper.narrow(obj);
return submitStandingQueryRequest;
}
Aggregations