Search in sources :

Example 1 with AndPredicateImpl

use of org.eclipse.kapua.service.datastore.internal.model.query.AndPredicateImpl in project kapua by eclipse.

the class MetricInfoStoreServiceImpl method find.

@Override
public MetricInfo find(KapuaId scopeId, StorableId id) throws KapuaException {
    // 
    // Argument Validation
    ArgumentValidator.notNull(scopeId, "scopeId");
    ArgumentValidator.notNull(id, "id");
    // 
    // Check Access
    this.checkDataAccess(scopeId, Actions.read);
    MetricInfoQueryImpl q = new MetricInfoQueryImpl();
    q.setLimit(1);
    ArrayList<StorableId> ids = new ArrayList<StorableId>();
    ids.add(id);
    AndPredicateImpl allPredicates = new AndPredicateImpl();
    allPredicates.addPredicate(new IdsPredicateImpl(EsMessageField.ID, ids));
    MetricInfoListResult result = this.query(scopeId, q);
    if (result == null || result.size() == 0)
        return null;
    MetricInfo topicInfo = result.get(0);
    return topicInfo;
}
Also used : StorableId(org.eclipse.kapua.service.datastore.model.StorableId) IdsPredicateImpl(org.eclipse.kapua.service.datastore.internal.model.query.IdsPredicateImpl) AndPredicateImpl(org.eclipse.kapua.service.datastore.internal.model.query.AndPredicateImpl) MetricInfoListResult(org.eclipse.kapua.service.datastore.model.MetricInfoListResult) MetricInfo(org.eclipse.kapua.service.datastore.model.MetricInfo) MetricInfoQueryImpl(org.eclipse.kapua.service.datastore.internal.model.query.MetricInfoQueryImpl) ArrayList(java.util.ArrayList)

Example 2 with AndPredicateImpl

use of org.eclipse.kapua.service.datastore.internal.model.query.AndPredicateImpl in project kapua by eclipse.

the class AssetInfoStoreServiceImpl method find.

@Override
public AssetInfo find(KapuaId scopeId, StorableId id) throws KapuaException {
    // 
    // Argument Validation
    ArgumentValidator.notNull(scopeId, "scopeId");
    ArgumentValidator.notNull(id, "id");
    // 
    // Check Access
    this.checkDataAccess(scopeId, Actions.read);
    AssetInfoQueryImpl q = new AssetInfoQueryImpl();
    q.setLimit(1);
    ArrayList<StorableId> ids = new ArrayList<StorableId>();
    ids.add(id);
    AndPredicateImpl allPredicates = new AndPredicateImpl();
    allPredicates.addPredicate(new IdsPredicateImpl(EsMessageField.ID, ids));
    AssetInfoListResult result = this.query(scopeId, q);
    if (result == null || result.size() == 0)
        return null;
    AssetInfo assetInfo = result.get(0);
    return assetInfo;
}
Also used : StorableId(org.eclipse.kapua.service.datastore.model.StorableId) IdsPredicateImpl(org.eclipse.kapua.service.datastore.internal.model.query.IdsPredicateImpl) AndPredicateImpl(org.eclipse.kapua.service.datastore.internal.model.query.AndPredicateImpl) AssetInfoListResult(org.eclipse.kapua.service.datastore.model.AssetInfoListResult) ArrayList(java.util.ArrayList) AssetInfoQueryImpl(org.eclipse.kapua.service.datastore.internal.model.query.AssetInfoQueryImpl) AssetInfo(org.eclipse.kapua.service.datastore.model.AssetInfo)

Example 3 with AndPredicateImpl

use of org.eclipse.kapua.service.datastore.internal.model.query.AndPredicateImpl in project kapua by eclipse.

the class TopicInfoStoreServiceImpl method find.

@Override
public TopicInfo find(KapuaId scopeId, StorableId id) throws KapuaException {
    // 
    // Argument Validation
    ArgumentValidator.notNull(scopeId, "scopeId");
    ArgumentValidator.notNull(id, "id");
    // 
    // Check Access
    this.checkDataAccess(scopeId, Actions.read);
    // 
    // Argument Validation
    ArgumentValidator.notNull(scopeId, "scopeId");
    ArgumentValidator.notNull(id, "id");
    TopicInfoQueryImpl q = new TopicInfoQueryImpl();
    q.setLimit(1);
    ArrayList<StorableId> ids = new ArrayList<StorableId>();
    ids.add(id);
    AndPredicateImpl allPredicates = new AndPredicateImpl();
    allPredicates.addPredicate(new IdsPredicateImpl(EsMessageField.ID, ids));
    TopicInfoListResult result = this.query(scopeId, q);
    if (result == null || result.size() == 0)
        return null;
    TopicInfo topicInfo = result.get(0);
    return topicInfo;
}
Also used : StorableId(org.eclipse.kapua.service.datastore.model.StorableId) IdsPredicateImpl(org.eclipse.kapua.service.datastore.internal.model.query.IdsPredicateImpl) AndPredicateImpl(org.eclipse.kapua.service.datastore.internal.model.query.AndPredicateImpl) TopicInfoQueryImpl(org.eclipse.kapua.service.datastore.internal.model.query.TopicInfoQueryImpl) ArrayList(java.util.ArrayList) TopicInfoListResult(org.eclipse.kapua.service.datastore.model.TopicInfoListResult) TopicInfo(org.eclipse.kapua.service.datastore.model.TopicInfo)

Aggregations

ArrayList (java.util.ArrayList)3 AndPredicateImpl (org.eclipse.kapua.service.datastore.internal.model.query.AndPredicateImpl)3 IdsPredicateImpl (org.eclipse.kapua.service.datastore.internal.model.query.IdsPredicateImpl)3 StorableId (org.eclipse.kapua.service.datastore.model.StorableId)3 AssetInfoQueryImpl (org.eclipse.kapua.service.datastore.internal.model.query.AssetInfoQueryImpl)1 MetricInfoQueryImpl (org.eclipse.kapua.service.datastore.internal.model.query.MetricInfoQueryImpl)1 TopicInfoQueryImpl (org.eclipse.kapua.service.datastore.internal.model.query.TopicInfoQueryImpl)1 AssetInfo (org.eclipse.kapua.service.datastore.model.AssetInfo)1 AssetInfoListResult (org.eclipse.kapua.service.datastore.model.AssetInfoListResult)1 MetricInfo (org.eclipse.kapua.service.datastore.model.MetricInfo)1 MetricInfoListResult (org.eclipse.kapua.service.datastore.model.MetricInfoListResult)1 TopicInfo (org.eclipse.kapua.service.datastore.model.TopicInfo)1 TopicInfoListResult (org.eclipse.kapua.service.datastore.model.TopicInfoListResult)1