本文整理了Java中datawave.webservice.query.Query
类的一些代码示例,展示了Query
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query
类的具体详情如下:
包路径:datawave.webservice.query.Query
类名称:Query
暂无
代码示例来源:origin: NationalSecurityAgency/datawave
@Override
public String toString() {
String host = System.getProperty("jboss.host.name");
return new StringBuilder().append("host:").append(host).append(", id:").append(this.getSettings().getId()).append(", query:")
.append(StringEscapeUtils.escapeHtml(this.getSettings().getQuery())).append(", auths:")
.append(this.getSettings().getQueryAuthorizations()).append(", user:").append(this.getSettings().getOwner()).append(", queryLogic:")
.append(this.getSettings().getQueryLogicName()).append(", name:").append(this.getSettings().getQueryName()).append(", pagesize:")
.append(this.getSettings().getPagesize()).append(", begin:").append(this.getSettings().getBeginDate()).append(", end:")
.append(this.getSettings().getEndDate()).append(", expiration:").append(this.getSettings().getExpirationDate()).append(", params: ")
.append(this.getSettings().getParameters()).append(", callTime: ")
.append((this.getTimeOfCurrentCall() == 0) ? 0 : System.currentTimeMillis() - this.getTimeOfCurrentCall()).toString();
}
代码示例来源:origin: NationalSecurityAgency/datawave
String typeList = query.findParameter(QueryParameters.DATATYPE_FILTER_SET).getParameterValue();
HashSet<String> typeFilter = null;
config.setBeginDate(query.getBeginDate());
config.setEndDate(query.getEndDate());
config.setQueryString(query.getQuery());
config.setAuthorizations(auths);
代码示例来源:origin: NationalSecurityAgency/datawave
private void addQueryToTrackingMap(Map<String,String> trackingMap, Query q) {
if (trackingMap == null || q == null) {
return;
}
if (q.getOwner() != null) {
trackingMap.put("query.user", q.getOwner());
}
if (q.getId() != null) {
trackingMap.put("query.id", q.getId().toString());
}
if (q.getId() != null) {
trackingMap.put("query.query", q.getQuery());
}
}
代码示例来源:origin: NationalSecurityAgency/datawave
private void addNDC() {
String user = this.settings.getUserDN();
UUID uuid = this.settings.getId();
if (user != null && uuid != null) {
NDC.push("[" + user + "] [" + uuid + "]");
}
}
代码示例来源:origin: NationalSecurityAgency/datawave
ps.setInt(x++, 10);
} else {
ps.setString(x++, query.getQuery());
if (query.getBeginDate() != null) {
ps.setTimestamp(x++, new Timestamp(query.getBeginDate().getTime()));
} else {
x++;
if (query.getEndDate() != null) {
ps.setTimestamp(x++, new Timestamp(query.getEndDate().getTime()));
} else {
x++;
ps.setString(x++, query.getQueryAuthorizations());
ps.setString(x++, query.getQueryLogicName());
ps.setString(x++, query.getQueryName());
ps.setString(x++, query.getOwner());
ps.setString(x++, query.getId().toString());
ps.setInt(x++, query.getPagesize());
ps.setString(x++, StringUtils.join(this.fixedFieldsInEvent, ","));
MultivaluedMapImpl<String,String> optionalQueryParameters = (MultivaluedMapImpl<String,String>) query.getOptionalQueryParameters();
if (optionalQueryParameters == null || optionalQueryParameters.isEmpty())
ps.setNull(x++, Types.BLOB);
代码示例来源:origin: NationalSecurityAgency/datawave
if (!q.getOwner().equals(userid)) {
throw new UnauthorizedQueryException(DatawaveErrorCode.QUERY_OWNER_MISMATCH, MessageFormat.format("{0} != {1}", userid, q.getOwner()));
QueryLogic<?> logic = queryLogicFactory.getQueryLogic(q.getQueryLogicName(), p);
AccumuloConnectionFactory.Priority priority = logic.getConnectionPriority();
RunningQuery query = new RunningQuery(metrics, null, priority, logic, q, q.getQueryAuthorizations(), p, new RunningQueryTimingImpl(
queryExpirationConf, qp.getPageTimeout()), this.executor, this.predictor, this.metricFactory);
results.add(query);
if (!queryCache.containsKey(q.getId().toString()))
queryCache.put(q.getId().toString(), query);
代码示例来源:origin: NationalSecurityAgency/datawave
public HudQuerySummary build(Query query) {
HudQuerySummary summary = new HudQuerySummary();
summary.setQueryLogicName(query.getQueryLogicName());
summary.setId(query.getId().toString());
summary.setQueryName(query.getQueryName());
summary.setUserDN(query.getUserDN());
summary.setQuery(query.getQuery());
summary.setQueryAuthorizations(query.getQueryAuthorizations());
summary.setExpirationDate(query.getExpirationDate().getTime());
return summary;
}
代码示例来源:origin: NationalSecurityAgency/datawave
q = originalQuery.duplicate(originalQuery.getQueryName());
q.setId(originalQuery.getId());
q.setUncaughtExceptionHandler(new QueryUncaughtExceptionHandler());
Thread.currentThread().setUncaughtExceptionHandler(q.getUncaughtExceptionHandler());
if (!auditType.equals(AuditType.NONE)) {
try {
MultivaluedMap<String,String> queryMap = q.toMap();
marking.validate(queryMap);
queryMap.putSingle(PrivateAuditConstants.COLUMN_VISIBILITY, marking.toColumnVisibilityString());
queryMap.putSingle(PrivateAuditConstants.AUDIT_TYPE, auditType.name());
queryMap.putSingle(PrivateAuditConstants.USER_DN, q.getUserDN());
queryMap.putSingle(PrivateAuditConstants.LOGIC_CLASS, logic.getLogicName());
try {
qlCache.add(q.getId().toString(), owner, logic, connector);
query = new RunningQuery(null, null, logic.getConnectionPriority(), logic, q, q.getQueryAuthorizations(), p, new RunningQueryTimingImpl(
queryExpirationConf, q.getPageTimeout()), executor, predictor, metricFactory);
query.setActiveCall(true);
qlCache.poll(q.getId().toString());
代码示例来源:origin: NationalSecurityAgency/datawave
Query q = templateQuery.getSettings().duplicate(newQueryName);
q.setQueryLogicName(queryLogicFactory.getQueryLogic(newQueryLogicName, ctx.getCallerPrincipal()).getLogicName());
q.setQuery(newQuery);
q.setBeginDate(newBeginDate);
q.setEndDate(newEndDate);
q.setQueryAuthorizations(newQueryAuthorizations);
q.setExpirationDate(newExpirationDate);
q.setPagesize(newPagesize);
q.setPageTimeout(newPageTimeout);
MultivaluedMap<String,String> newSettings = q.toMap();
newSettings.putSingle(QueryParameters.QUERY_PERSISTENCE, persistence.name());
return createQuery(q.getQueryLogicName(), newSettings);
} catch (DatawaveWebApplicationException e) {
throw e;
代码示例来源:origin: NationalSecurityAgency/datawave
query.setQuery(resultSet.getString(x++));
Timestamp bDate = resultSet.getTimestamp(x++);
if (bDate == null) {
query.setBeginDate(null);
} else {
query.setBeginDate(new Date(bDate.getTime()));
query.setBeginDate(null);
} else {
query.setEndDate(new Date(eDate.getTime()));
query.setQueryAuthorizations(resultSet.getString(x++));
query.setQueryLogicName(resultSet.getString(x++));
query.setQueryName(resultSet.getString(x++));
query.setUserDN(resultSet.getString(x++));
String uuid = resultSet.getString(x++);
if (uuid != null) {
query.setId(UUID.fromString(uuid));
query.setPagesize(resultSet.getInt(x++));
String fixedFields = resultSet.getString(x++);
if (!StringUtils.isEmpty(fixedFields)) {
if (optionalQueryParametersObject != null && optionalQueryParametersObject instanceof MultivaluedMapImpl) {
MultivaluedMapImpl<String,String> optionalQueryParameters = (MultivaluedMapImpl<String,String>) optionalQueryParametersObject;
query.setOptionalQueryParameters(optionalQueryParameters);
crq.queryLogicName = query.getQueryLogicName();
crq.originalQueryId = uuid;
代码示例来源:origin: NationalSecurityAgency/datawave
public QueryInformation(Query query, String queryStr) {
Preconditions.checkNotNull(query);
queryId = testAndSetOption(query.getId());
queryLogicName = testAndSetOption(query.getQueryLogicName());
queryName = testAndSetOption(query.getQueryName());
if (null == queryStr)
queryString = testAndSetOption(query.getQuery());
else
queryString = testAndSetOption(queryStr);
queryUser = testAndSetOption(query.getOwner());
}
代码示例来源:origin: NationalSecurityAgency/datawave
private void setMetricsInfo() {
BaseQueryMetric m = this.getMetric();
// set the metric information
m.setQueryType(this.getClass());
m.setQueryId(this.queryId);
m.setUser(this.user);
m.setUserDN(this.query.getUserDN());
if (this.query != null) {
m.setColumnVisibility(this.query.getColumnVisibility());
m.setQueryAuthorizations(this.query.getQueryAuthorizations());
m.setQueryLogic(this.query.getQueryLogicName());
m.setBeginDate(this.query.getBeginDate());
m.setEndDate(this.query.getEndDate());
}
}
代码示例来源:origin: NationalSecurityAgency/datawave
switch (persistenceMode) {
case PERSISTENT:
if (q.getQueryName() == null)
throw new BadRequestQueryException(DatawaveErrorCode.QUERY_NAME_REQUIRED);
break;
Query duplicate = q.duplicate(q.getQueryName());
duplicate.setId(q.getId());
Set<String> methodAuths = new HashSet<>(Arrays.asList(q.getQueryAuthorizations().split("\\s*,\\s*")));
cbAuths.retainAll(methodAuths);
AuditType auditType = runningQuery.getLogic().getAuditType(runningQuery.getSettings());
if (!auditType.equals(AuditType.NONE)) {
try {
auditor.audit(duplicate.toMap());
} catch (IllegalArgumentException e) {
log.error("Error validating audit parameters", e);
queryCache.put(q.getId().toString(), runningQuery);
代码示例来源:origin: NationalSecurityAgency/datawave
@Override
protected String serviceName() {
String id = "NoQueryId";
if (null != settings && null != settings.getId()) {
id = settings.getId().toString();
}
return "RangeStreamScanner (" + id + ")";
}
代码示例来源:origin: NationalSecurityAgency/datawave
public static <T extends Query> Mutation toMutation(T query, ColumnVisibility vis) {
// Store by sid for backwards compatibility
Mutation m = new Mutation(query.getOwner());
try {
@SuppressWarnings("unchecked")
Schema<T> schema = (Schema<T>) RuntimeSchema.getSchema(query.getClass());
byte[] bytes = ProtobufIOUtil.toByteArray(query, schema, BUFFER.get());
m.put(query.getQueryName(), query.getId() + NULL_BYTE + query.getClass().getName(), vis, query.getExpirationDate().getTime(), new Value(bytes));
return m;
} finally {
BUFFER.get().clear();
}
}
代码示例来源:origin: NationalSecurityAgency/datawave
public Query create(String userDN, List<String> dnList, SecurityMarking marking, String queryLogicName, QueryParameters qp,
MultivaluedMap<String,String> optionalQueryParameters) {
Query q = responseObjectFactory.getQueryImpl();
q.initialize(userDN, dnList, queryLogicName, qp, optionalQueryParameters);
q.setColumnVisibility(marking.toColumnVisibilityString());
q.setUncaughtExceptionHandler(new QueryUncaughtExceptionHandler());
Thread.currentThread().setUncaughtExceptionHandler(q.getUncaughtExceptionHandler());
// Persist the query object if required
if (qp.getPersistenceMode().equals(QueryPersistence.PERSISTENT)) {
log.debug("Persisting query with id: " + q.getId());
create(q);
}
return q;
}
代码示例来源:origin: NationalSecurityAgency/datawave
if (!sid.equals(q.getOwner()))
throw new QueryException("This query does not belong to you. expected: " + q.getOwner() + ", value: " + sid,
Response.Status.UNAUTHORIZED.getStatusCode());
logic = queryFactory.getQueryLogic(q.getQueryLogicName(), principal);
Set<Authorizations> runtimeQueryAuthorizations = AuthorizationsUtil.getDowngradedAuthorizations(q.getQueryAuthorizations(), principal);
代码示例来源:origin: NationalSecurityAgency/datawave
private RunningQuery adminGetQueryById(String id) throws Exception {
RunningQuery query = queryCache.get(id);
if (query == null) {
log.info("Query not found in cache, retrieving from accumulo");
List<Query> queries = persister.adminFindById(id);
if (queries == null || queries.isEmpty())
throw new NotFoundQueryException(DatawaveErrorCode.NO_QUERY_OBJECT_MATCH);
if (queries.size() > 1)
throw new NotFoundQueryException(DatawaveErrorCode.TOO_MANY_QUERY_OBJECT_MATCHES);
Query q = queries.get(0);
final String auths = q.getQueryAuthorizations();
// will throw IllegalArgumentException if not defined
final QueryLogic<?> logic = queryLogicFactory.getQueryLogic(q.getQueryLogicName(), ctx.getCallerPrincipal());
final AccumuloConnectionFactory.Priority priority = logic.getConnectionPriority();
query = RunningQuery.createQueryWithAuthorizations(metrics, null, priority, logic, q, auths,
new RunningQueryTimingImpl(queryExpirationConf, qp.getPageTimeout()), this.executor, this.predictor, this.metricFactory);
// Put in the cache by id and name, we will have two copies that reference the same object
queryCache.put(q.getId().toString(), query);
}
return query;
}
代码示例来源:origin: NationalSecurityAgency/datawave
this.auths = auths;
this.settings = settings.duplicate(settings.getQueryName() + "-chunk");
chunker.setBaseQuery(this.settings);
Set<Parameter> origParams = this.settings.getParameters();
for (Parameter p : origParams) {
if (p.getParameterName().equals(QueryParameters.QUERY_SYNTAX) == false) {
this.settings.setParameters(params);
String maxResultsOverrideStr = settings.findParameter(QueryParameters.MAX_RESULTS_OVERRIDE).getParameterValue().trim();
if (org.apache.commons.lang.StringUtils.isNotBlank(maxResultsOverrideStr)) {
try {
代码示例来源:origin: NationalSecurityAgency/datawave
Key skey = new Key(query.getOwner(), query.getQueryName(), query.getId().toString());
Key ekey = new Key(query.getOwner(), query.getQueryName(), query.getId() + "\u0001");
Range range = new Range(skey, ekey);
log.info("Deleting query range: " + range);
内容来源于网络,如有侵权,请联系作者删除!