use of com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement in project coprhd-controller by CoprHD.
the class BaseModelTest method findByAlternateId.
protected List<URI> findByAlternateId(String columnName, String value) {
List<NamedElement> results = getModelClient().findByAlternateId(type, columnName, value);
List<URI> ids = new ArrayList<URI>();
for (NamedElement result : results) {
ids.add(result.getId());
}
return ids;
}
use of com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement in project coprhd-controller by CoprHD.
the class InMemoryDbClient method findBy.
@Override
public <T extends DataObject> List<NamedElement> findBy(Class<T> clazz, String columnField, URI id) throws DataAccessException {
List<NamedElement> results = Lists.newArrayList();
for (URI modelId : findAllIds(clazz)) {
T model = findById(clazz, modelId);
Object o = getColumnField(model, columnField);
if (ObjectUtils.equals(o, id)) {
results.add(createNamedElement(model));
}
}
return results;
}
use of com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement in project coprhd-controller by CoprHD.
the class InMemoryDbClient method findByContainmentAndPrefix.
@Override
public <T extends DataObject> List<NamedElement> findByContainmentAndPrefix(Class<T> clazz, String columnField, URI id, String labelPrefix) throws DataAccessException {
List<NamedElement> results = Lists.newArrayList();
for (URI modelId : findAllIds(clazz)) {
T model = findById(clazz, modelId);
Object o = getColumnField(model, columnField);
if (ObjectUtils.equals(o, id) && StringUtils.startsWith(model.getLabel(), labelPrefix)) {
results.add(createNamedElement(model));
}
}
return results;
}
use of com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement in project coprhd-controller by CoprHD.
the class InMemoryDbClient method createNamedElement.
private NamedElement createNamedElement(DataObject value) {
NamedElement elem = new NamedElement();
elem.setId(value.getId());
elem.setName(value.getLabel());
return elem;
}
use of com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement in project coprhd-controller by CoprHD.
the class InMemoryDbClient method findByAlternateId.
@Override
public <T extends DataObject> List<NamedElement> findByAlternateId(Class<T> clazz, String columnField, String value) throws DataAccessException {
List<NamedElement> results = Lists.newArrayList();
for (URI modelId : findAllIds(clazz)) {
T model = findById(clazz, modelId);
Object o = getColumnField(model, columnField);
if (ObjectUtils.equals(o, value)) {
results.add(createNamedElement(model));
}
}
return results;
}
Aggregations