Search in sources :

Example 21 with NamedElement

use of com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement in project coprhd-controller by CoprHD.

the class ActionableEventFinder method findPendingByAffectedResources.

public List<ActionableEvent> findPendingByAffectedResources(URI affectedResourceId) {
    List<NamedElement> events = findIdsByAffectedResources(affectedResourceId);
    List<ActionableEvent> result = Lists.newArrayList();
    for (ActionableEvent event : findByIds(toURIs(events))) {
        if (event != null && event.getEventStatus() != null && (event.getEventStatus().equalsIgnoreCase(ActionableEvent.Status.pending.name().toString()) || event.getEventStatus().equalsIgnoreCase(ActionableEvent.Status.failed.name().toString()))) {
            result.add(event);
        }
    }
    return result;
}
Also used : ActionableEvent(com.emc.storageos.db.client.model.ActionableEvent) NamedElement(com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement)

Example 22 with NamedElement

use of com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement in project coprhd-controller by CoprHD.

the class CatalogCategoryFinder method getRootCategory.

public CatalogCategory getRootCategory(String tenant) {
    CatalogCategory root = null;
    if (StringUtils.isBlank(tenant)) {
        return root;
    }
    List<NamedElement> catalogCategoryIds = client.findBy(CatalogCategory.class, CatalogCategory.CATALOG_CATEGORY_ID, URI.create(CatalogCategory.NO_PARENT));
    List<CatalogCategory> tenantRootCategories = TenantUtils.filter(findByIds(toURIs(catalogCategoryIds)), tenant);
    if (tenantRootCategories != null && !tenantRootCategories.isEmpty()) {
        root = tenantRootCategories.get(0);
    }
    return root;
}
Also used : CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory) NamedElement(com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement)

Example 23 with NamedElement

use of com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement in project coprhd-controller by CoprHD.

the class CustomServicesWorkflowFinder method prepareNamedElementFromURI.

private List<NamedElement> prepareNamedElementFromURI(final List<URI> ids) {
    final Iterator<CustomServicesWorkflow> it = client.findAllFields(clazz, ids, ImmutableList.<String>builder().add("label").build());
    final List<NamedElement> results = new ArrayList<NamedElement>();
    while (it.hasNext()) {
        final CustomServicesWorkflow element = it.next();
        results.add(NamedElement.createElement(element.getId(), element.getLabel()));
    }
    return results;
}
Also used : ArrayList(java.util.ArrayList) CustomServicesWorkflow(com.emc.storageos.db.client.model.uimodels.CustomServicesWorkflow) NamedElement(com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement)

Example 24 with NamedElement

use of com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement in project coprhd-controller by CoprHD.

the class ScheduledEventFinder method findScheduledEventsByExecutionWindow.

public List<ScheduledEvent> findScheduledEventsByExecutionWindow(String executionWindowId) {
    List<ScheduledEvent> results = Lists.newArrayList();
    if (StringUtils.isBlank(executionWindowId)) {
        return results;
    }
    Set<URI> eventIds = Sets.newHashSet();
    List<NamedElement> scheduledEventElems = client.findByAlternateId(ScheduledEvent.class, ScheduledEvent.EVENT_STATUS, ScheduledEventStatus.APPROVED.name());
    for (NamedElement scheduledEventElem : scheduledEventElems) {
        ScheduledEvent scheduledEvent = client.findById(ScheduledEvent.class, scheduledEventElem.getId());
        if (scheduledEvent.getExecutionWindowId() != null && scheduledEvent.getExecutionWindowId().getURI() != null && executionWindowId.equalsIgnoreCase(scheduledEvent.getExecutionWindowId().getURI().toString())) {
            results.add(scheduledEvent);
        }
    }
    results.addAll(findByIds(Lists.newArrayList(eventIds)));
    return results;
}
Also used : ScheduledEvent(com.emc.storageos.db.client.model.uimodels.ScheduledEvent) URI(java.net.URI) NamedElement(com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement)

Example 25 with NamedElement

use of com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement in project coprhd-controller by CoprHD.

the class WorkflowServiceDescriptor method listDescriptors.

// This method will only return service descriptors for PUBLISHED workflows
public Collection<ServiceDescriptor> listDescriptors() {
    List<ServiceDescriptor> wfServiceDescriptors = new ArrayList<>();
    List<NamedElement> oeElements = customServicesWorkflowManager.listByStatus(CustomServicesWorkflowStatus.PUBLISHED);
    if (null != oeElements) {
        CustomServicesWorkflow oeWorkflow;
        for (NamedElement oeElement : oeElements) {
            oeWorkflow = customServicesWorkflowManager.getById(oeElement.getId());
            wfServiceDescriptors.add(mapWorkflowToServiceDescriptor(oeWorkflow));
        }
    }
    return wfServiceDescriptors;
}
Also used : ServiceDescriptor(com.emc.sa.descriptor.ServiceDescriptor) ArrayList(java.util.ArrayList) CustomServicesWorkflow(com.emc.storageos.db.client.model.uimodels.CustomServicesWorkflow) NamedElement(com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement)

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