Search in sources :

Example 1 with PersistDataSetListener

use of org.jbpm.kie.services.impl.query.persistence.PersistDataSetListener in project jbpm by kiegroup.

the class QueryServiceImpl method init.

public void init() {
    if (dataSetDefRegistry == null && dataSetManager == null && providerRegistry == null) {
        dataSetDefRegistry = DataSetCore.get().getDataSetDefRegistry();
        dataSetManager = DataSetCore.get().getDataSetManager();
        providerRegistry = DataSetCore.get().getDataSetProviderRegistry();
        providerRegistry.registerDataProvider(SQLDataSetProvider.get());
        dataSetDefRegistry.addListener(new PersistDataSetListener(commandService));
    }
    // load previously registered query definitions
    if (commandService != null) {
        List<QueryDefinitionEntity> queries = commandService.execute(new QueryNameCommand<List<QueryDefinitionEntity>>("getQueryDefinitions"));
        for (QueryDefinitionEntity entity : queries) {
            QueryDefinition definition = entity.toQueryDefinition();
            try {
                registerQuery(definition);
            } catch (QueryAlreadyRegisteredException e) {
                logger.debug("Query {} already registered, skipping...", definition.getName());
            }
        }
    }
}
Also used : QueryDefinitionEntity(org.jbpm.kie.services.impl.query.persistence.QueryDefinitionEntity) QueryDefinition(org.jbpm.services.api.query.model.QueryDefinition) List(java.util.List) ArrayList(java.util.ArrayList) PersistDataSetListener(org.jbpm.kie.services.impl.query.persistence.PersistDataSetListener) QueryAlreadyRegisteredException(org.jbpm.services.api.query.QueryAlreadyRegisteredException)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 PersistDataSetListener (org.jbpm.kie.services.impl.query.persistence.PersistDataSetListener)1 QueryDefinitionEntity (org.jbpm.kie.services.impl.query.persistence.QueryDefinitionEntity)1 QueryAlreadyRegisteredException (org.jbpm.services.api.query.QueryAlreadyRegisteredException)1 QueryDefinition (org.jbpm.services.api.query.model.QueryDefinition)1