Search in sources :

Example 6 with NamedElement

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;
}
Also used : ArrayList(java.util.ArrayList) NamedElement(com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement) URI(java.net.URI)

Example 7 with NamedElement

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;
}
Also used : DataObject(com.emc.storageos.db.client.model.DataObject) NamedElement(com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement) URI(java.net.URI)

Example 8 with NamedElement

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;
}
Also used : DataObject(com.emc.storageos.db.client.model.DataObject) NamedElement(com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement) URI(java.net.URI)

Example 9 with NamedElement

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;
}
Also used : NamedElement(com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement)

Example 10 with NamedElement

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;
}
Also used : DataObject(com.emc.storageos.db.client.model.DataObject) NamedElement(com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement) URI(java.net.URI)

Aggregations

NamedElement (com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement)32 URI (java.net.URI)14 DataObject (com.emc.storageos.db.client.model.DataObject)6 ArrayList (java.util.ArrayList)6 NamedURI (com.emc.storageos.db.client.model.NamedURI)4 CustomServicesWorkflow (com.emc.storageos.db.client.model.uimodels.CustomServicesWorkflow)4 Order (com.emc.storageos.db.client.model.uimodels.Order)3 NamedElementQueryResultList (com.emc.storageos.db.client.constraint.NamedElementQueryResultList)2 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)2 ActionableEvent (com.emc.storageos.db.client.model.ActionableEvent)2 Cluster (com.emc.storageos.db.client.model.Cluster)2 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)2 Host (com.emc.storageos.db.client.model.Host)2 ScheduledEvent (com.emc.storageos.db.client.model.uimodels.ScheduledEvent)2 ImmutableList (com.google.common.collect.ImmutableList)2 HashSet (java.util.HashSet)2 ServiceDescriptor (com.emc.sa.descriptor.ServiceDescriptor)1 ResourcePackage (com.emc.sa.workflow.CustomServicesWorkflowPackage.ResourcePackage)1 TimeSeriesConstraint (com.emc.storageos.db.client.constraint.TimeSeriesConstraint)1 CatalogCategory (com.emc.storageos.db.client.model.uimodels.CatalogCategory)1