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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations