本文整理了Java中datawave.webservice.query.Query.getOwner
方法的一些代码示例,展示了Query.getOwner
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getOwner
方法的具体详情如下:
包路径:datawave.webservice.query.Query
类名称:Query
方法名:getOwner
暂无
代码示例来源:origin: NationalSecurityAgency/datawave
@Override
public final String getJexlQueryString(Query settings) throws ParseException {
if (null == this.roles) {
this.roles = callerPrincipal.getPrimaryUser().getRoles();
}
String query = super.getJexlQueryString(settings);
if (this.roles.contains("MetricsAdministrator")) {
return query;
}
StringBuilder jexl = new StringBuilder();
if (!query.isEmpty()) {
jexl.append("(").append(query).append(")");
jexl.append(" AND (USER == '").append(settings.getOwner()).append("')");
} else {
jexl.append("USER == '").append(settings.getOwner()).append("'");
}
return jexl.toString();
}
}
代码示例来源: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 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
@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
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
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());
代码示例来源:origin: NationalSecurityAgency/datawave
/**
* Method to determine if a query has been idle too long based on configured values.
*
* @param query
* @param currentTime
* @return true if query has been idle too long, false otherwise
*/
private boolean isIdleTooLong(RunningQuery query, long currentTime) {
long difference = currentTime - query.getLastUsed();
if (log.isDebugEnabled()) {
long countDown = (conf.getIdleTimeInMS() / 1000) - (difference / 1000);
log.debug("Query: " + query.getSettings().getOwner() + " - " + query.getSettings().getId() + " will be evicted in: " + countDown + " seconds.");
}
return difference > conf.getIdleTimeInMS();
}
代码示例来源:origin: NationalSecurityAgency/datawave
/**
* Method to determine if a query next call has been running too long based on configured values.
*
* @param query
* @param currentTime
* @return true if query next has been running too long, false otherwise
*/
private boolean isNextTooLong(RunningQuery query, long currentTime) {
if (query.getTimeOfCurrentCall() == 0) {
log.warn("Query has active call set but a call time of 0ms.");
return false;
}
query.touch(); // Since we know we're still in a call, go ahead and reset the idle time.
long difference = currentTime - query.getTimeOfCurrentCall();
if (difference > conf.getCallTimeInMS()) {
log.warn("Query " + query.getSettings().getOwner() + " - " + query.getSettings().getId() + " has been in a call for " + (difference / 1000)
+ "s. We are evicting this query from the cache.");
return true;
} else {
if (log.isDebugEnabled()) {
log.debug("Query " + query.getSettings().getOwner() + " - " + query.getSettings().getId() + " has been in a call for " + (difference / 1000)
+ "s.");
}
return false;
}
}
}
代码示例来源: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());
代码示例来源:origin: NationalSecurityAgency/datawave
if (!query.getSettings().getOwner().equals(userid)) {
throw new UnauthorizedQueryException(DatawaveErrorCode.QUERY_OWNER_MISMATCH, MessageFormat.format("{0} != {1}", userid, query.getSettings()
.getOwner()));
代码示例来源: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);
代码示例来源:origin: NationalSecurityAgency/datawave
if (!q.getOwner().equals(userid)) {
throw new UnauthorizedQueryException(DatawaveErrorCode.QUERY_OWNER_MISMATCH, MessageFormat.format("{0} != {1}", userid, q.getOwner()));
代码示例来源: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
if (!query.getSettings().getOwner().equals(owner)) {
throw new UnauthorizedQueryException(DatawaveErrorCode.QUERY_OWNER_MISMATCH, MessageFormat.format("{0} != {1}", owner, query.getSettings()
.getOwner()));
代码示例来源:origin: NationalSecurityAgency/datawave
} else {
if (!query.getSettings().getOwner().equals(userid)) {
throw new UnauthorizedQueryException(DatawaveErrorCode.QUERY_OWNER_MISMATCH, MessageFormat.format("{0} != {1}", userid, query.getSettings()
.getOwner()));
代码示例来源:origin: NationalSecurityAgency/datawave
throw new NotFoundException(e, response);
} else {
if (query.getSettings().getOwner().equals(owner)) {
accumuloConnectionRequestBean.cancelConnectionRequest(originalQueryId);
query.cancel();
} else {
UnauthorizedQueryException e = new UnauthorizedQueryException(DatawaveErrorCode.QUERY_OWNER_MISMATCH, MessageFormat.format("{0} != {1}",
query.getSettings().getOwner(), owner));
throw new UnauthorizedException(e, response);
代码示例来源:origin: NationalSecurityAgency/datawave
} else {
if (!query.getSettings().getOwner().equals(userid)) {
throw new UnauthorizedQueryException(DatawaveErrorCode.QUERY_OWNER_MISMATCH, MessageFormat.format("{0} != {1}", userid, query.getSettings()
.getOwner()));
代码示例来源:origin: NationalSecurityAgency/datawave
} else {
if (!query.getSettings().getOwner().equals(userid)) {
throw new UnauthorizedQueryException(DatawaveErrorCode.QUERY_OWNER_MISMATCH, MessageFormat.format("{0} != {1}", userid, query.getSettings()
.getOwner()));
内容来源于网络,如有侵权,请联系作者删除!