use of org.eclipse.kapua.service.datastore.model.MessageListResult in project kapua by eclipse.
the class MessageStoreServiceImpl method find.
@Override
public Message find(KapuaId scopeId, StorableId id, MessageFetchStyle fetchStyle) throws KapuaException {
//
// Argument Validation
ArgumentValidator.notNull(scopeId, "scopeId");
ArgumentValidator.notNull(id, "id");
ArgumentValidator.notNull(fetchStyle, "fetchStyle");
//
// Check Access
this.checkDataAccess(scopeId, Actions.read);
AccountInfo accountInfo = getAccountServicePlan(scopeId);
String scopeName = accountInfo.getAccount().getName();
try {
String everyIndex = EsUtils.getAnyIndexName(scopeName);
MessageListResult result = null;
result = EsMessageDAO.connection(EsClient.getcurrent()).instance(everyIndex, EsSchema.MESSAGE_TYPE_NAME).query(null);
if (true)
throw KapuaException.internalError("Method not implemented.");
return null;
} catch (Exception exc) {
// CassandraUtils.handleException(e);
throw KapuaException.internalError(exc);
}
}
use of org.eclipse.kapua.service.datastore.model.MessageListResult in project kapua by eclipse.
the class MessageStoreServiceImpl method query.
@Override
public MessageListResult query(KapuaId scopeId, MessageQuery query) throws KapuaException {
//
// Argument Validation
ArgumentValidator.notNull(scopeId, "scopeId");
ArgumentValidator.notNull(query, "query");
//
// Check Access
this.checkDataAccess(scopeId, Actions.read);
//
// Do the find
AccountInfo accountInfo = getAccountServicePlan(scopeId);
String scopeName = accountInfo.getAccount().getName();
LocalServicePlan accountServicePlan = accountInfo.getServicePlan();
long ttl = accountServicePlan.getDataTimeToLive() * DAY_MILLIS;
if (!accountServicePlan.getDataStorageEnabled() || ttl == LocalServicePlan.DISABLED) {
logger.debug("Storage not enabled for account {}, returning empty result", scopeName);
return new MessageListResultImpl();
}
try {
String everyIndex = EsUtils.getAnyIndexName(scopeName);
MessageListResult result = null;
result = EsMessageDAO.connection(EsClient.getcurrent()).instance(everyIndex, EsSchema.MESSAGE_TYPE_NAME).query(query);
return result;
} catch (Exception exc) {
// CassandraUtils.handleException(e);
throw KapuaException.internalError(exc);
}
}
Aggregations