Search in sources :

Example 1 with Indexable

use of io.gravitee.rest.api.model.search.Indexable in project gravitee-management-rest-api by gravitee-io.

the class SearchEngineServiceImpl method process.

@Override
public void process(CommandSearchIndexerEntity content) {
    if (ACTION_DELETE.equals(content.getAction())) {
        try {
            Indexable source = createInstance(content.getClazz());
            source.setId(content.getId());
            deleteLocally(source);
        } catch (Exception ex) {
            throw new TechnicalManagementException("Unable to delete document for content [ " + content.getId() + " - " + content.getClazz() + " ]", ex);
        }
    } else if (ACTION_INDEX.equals(content.getAction())) {
        Indexable source = getSource(content.getClazz(), content.getId());
        if (source != null) {
            indexLocally(source);
        }
    }
}
Also used : Indexable(io.gravitee.rest.api.model.search.Indexable) TechnicalException(io.gravitee.repository.exceptions.TechnicalException) TechnicalManagementException(io.gravitee.rest.api.service.exceptions.TechnicalManagementException) AbstractNotFoundException(io.gravitee.rest.api.service.exceptions.AbstractNotFoundException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) TechnicalManagementException(io.gravitee.rest.api.service.exceptions.TechnicalManagementException)

Aggregations

JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 TechnicalException (io.gravitee.repository.exceptions.TechnicalException)1 Indexable (io.gravitee.rest.api.model.search.Indexable)1 AbstractNotFoundException (io.gravitee.rest.api.service.exceptions.AbstractNotFoundException)1 TechnicalManagementException (io.gravitee.rest.api.service.exceptions.TechnicalManagementException)1