minor refactoring
This commit is contained in:
parent
9d79316040
commit
6a4c939df2
|
@ -18,7 +18,7 @@ import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service("monitorService")
|
@Service("monitorService")
|
||||||
public class MonitorServiceImpl implements MonitorService {
|
public class MonitorServiceImpl implements MonitorService {
|
||||||
|
@ -171,16 +171,20 @@ public class MonitorServiceImpl implements MonitorService {
|
||||||
try {
|
try {
|
||||||
job = getValidationService().getStoredJob(Integer.parseInt(jobId), groupBy);
|
job = getValidationService().getStoredJob(Integer.parseInt(jobId), groupBy);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Job with id '{}' not found in Validator. Trying CRIS...", jobId, e);
|
if (e.getMessage() == null) {
|
||||||
|
logger.warn("Job with id '{}' not found in Validator. Trying CRIS...", jobId);
|
||||||
|
} else {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// FIXME: this is a hack for CRIS Jan Dvorak Validator, should be implemented properly //
|
// FIXME: this is a hack for CRIS Jan Dvorak Validator, should be implemented properly //
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
// not a good way to do it but Job id field is string
|
// not a good way to do it but Job id field is string
|
||||||
List<Job> cJobs = crisJobs.getAll().stream().filter(j -> j.getId().hashCode() == Integer.parseInt(jobId)).collect(Collectors.toList());
|
Optional<Job> cJob = crisJobs.get(jobId);
|
||||||
if (!cJobs.isEmpty()) {
|
if (cJob.isPresent()) {
|
||||||
job = CrisValidatorUtils.convertJobToStoredJob(cJobs.get(0));
|
job = CrisValidatorUtils.convertJobToStoredJob(cJob.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue