Commit 61ff78dd authored by Enriko Käsper's avatar Enriko Käsper
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Enriko Käsper

See merge request teis/scheduler-service!23
parents 729bc3f5 f1ff6b21
theGroup=ee.sm.ti.teis
theVersion=1.9.0
theVersion=1.10.0
commonsVersion=1.10.0
commonApiGatewayVersion=1.8.0
adminApiGatewayVersion=1.4.0
adminApiGatewayVersion=1.5.0
pluginVersion=1.1.1
mapstructVersion=1.3.0.Final
......@@ -14,6 +14,7 @@ import ee.sm.ti.teis.scheduler.processor.JobLauncherService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
......@@ -42,7 +43,18 @@ public class AdminBusinessService {
public List<JobDefinitionDto> getSystemJobs() {
List<JobDefinitionEntity> definitions = jobDefinitionRepository.findAll();
return jobDefinitionMapper.toGwDtoList(definitions);
}
List<JobDefinitionDto> definitionDtoList = new ArrayList<>();
definitions.forEach(definition -> {
JobExecutionEntity execution = jobExecutionRepository.findFirstByJobDefinitionId(definition.getId());
if (execution != null) {
JobDefinitionDto jobDefinitionDto = jobDefinitionMapper.toGwDto(definition);
jobDefinitionDto.setLastResponseMessage(execution.getResponseMessage());
definitionDtoList.add(jobDefinitionDto);
}
});
return definitionDtoList;
}
}
......@@ -7,4 +7,6 @@ import java.util.UUID;
public interface JobExecutionRepository extends CrudRepository<JobExecutionEntity, UUID> {
List<JobExecutionEntity> findAllByJobDefinitionIdOrderByCreatedAtAsc(String jobId);
JobExecutionEntity findFirstByJobDefinitionId(String jobId);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment