Ejemplo n.º 1
0
 private void registerNewIndexActionForDirtyJobs(IndexJobExecution indexJobExecution) {
   String id = indexJobExecution.getIndexActionJobID();
   dataService
       .findAll(
           IndexActionMetaData.INDEX_ACTION,
           new QueryImpl<IndexAction>().eq(IndexActionMetaData.INDEX_ACTION_GROUP_ATTR, id),
           IndexAction.class)
       .forEach(
           action ->
               indexActionRegisterService.register(
                   action.getEntityFullName(), action.getEntityId()));
   dataService.delete(IndexJobExecutionMeta.INDEX_JOB_EXECUTION, indexJobExecution);
 }
Ejemplo n.º 2
0
 public void bootstrap() {
   if (!searchService.hasMapping(AttributeMetadata.ATTRIBUTE_META_DATA)) {
     LOG.debug(
         "No index for Attribute found, asuming missing index, schedule (re)index for all entities");
     metaDataService
         .getRepositories()
         .forEach(repo -> indexActionRegisterService.register(repo.getName(), null));
     LOG.debug("Done scheduling (re)index jobs for all entities");
   } else {
     LOG.debug("Index for Attribute found, index is present, no (re)index needed");
     List<IndexJobExecution> failedIndexJobs =
         dataService
             .findAll(
                 IndexJobExecutionMeta.INDEX_JOB_EXECUTION,
                 new QueryImpl<IndexJobExecution>().eq(JobExecutionMetaData.STATUS, FAILED),
                 IndexJobExecution.class)
             .collect(Collectors.toList());
     failedIndexJobs.forEach(job -> registerNewIndexActionForDirtyJobs(job));
   }
 }