Search in sources :

Example 11 with ListProviderException

use of org.opencastproject.index.service.exception.ListProviderException in project opencast by opencast.

the class WorkflowsListProvider method getList.

@Override
public Map<String, String> getList(String listName, ResourceListQuery query, Organization organization) throws ListProviderException {
    Map<String, String> workflowsList = new HashMap<String, String>();
    WorkflowQuery q = new WorkflowQuery();
    if (query != null) {
        if (query.getLimit().isSome())
            q.withCount(query.getLimit().get());
        if (query.getOffset().isSome())
            q.withStartPage(query.getOffset().get());
    }
    WorkflowInstance[] workflowInstances;
    try {
        workflowInstances = workflowService.getWorkflowInstances(q).getItems();
    } catch (WorkflowDatabaseException e) {
        logger.error("Error by querying the workflow instances from the DB: ", e);
        throw new ListProviderException(e.getMessage(), e.getCause());
    }
    for (WorkflowInstance w : workflowInstances) {
        workflowsList.put(Long.toString(w.getId()), w.getTitle() + " - " + w.getMediaPackage().getTitle());
    }
    return workflowsList;
}
Also used : WorkflowDatabaseException(org.opencastproject.workflow.api.WorkflowDatabaseException) WorkflowQuery(org.opencastproject.workflow.api.WorkflowQuery) HashMap(java.util.HashMap) ListProviderException(org.opencastproject.index.service.exception.ListProviderException) WorkflowInstance(org.opencastproject.workflow.api.WorkflowInstance)

Aggregations

ListProviderException (org.opencastproject.index.service.exception.ListProviderException)11 HashMap (java.util.HashMap)7 ResourceListQueryImpl (org.opencastproject.index.service.resources.list.query.ResourceListQueryImpl)3 ArrayList (java.util.ArrayList)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 JSONObject (org.json.simple.JSONObject)2 EndpointUtil.generateJSONObject (org.opencastproject.adminui.endpoint.EndpointUtil.generateJSONObject)2 JsonCreationException (org.opencastproject.adminui.exception.JsonCreationException)2 ResourceListProvider (org.opencastproject.index.service.resources.list.api.ResourceListProvider)2 ResourceListQuery (org.opencastproject.index.service.resources.list.api.ResourceListQuery)2 StringListFilter (org.opencastproject.index.service.resources.list.query.StringListFilter)2 ServiceRegistryException (org.opencastproject.serviceregistry.api.ServiceRegistryException)2 RestQuery (org.opencastproject.util.doc.rest.RestQuery)2 JValue (com.entwinemedia.fn.data.json.JValue)1 SimpleSerializer (com.entwinemedia.fn.data.json.SimpleSerializer)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1