diff --git a/dotCMS/src/main/java/com/dotcms/jobs/business/api/events/JobCancelRequestEvent.java b/dotCMS/src/main/java/com/dotcms/jobs/business/api/events/JobCancelRequestEvent.java index ed2a5a8012b5..9554b1e8f573 100644 --- a/dotCMS/src/main/java/com/dotcms/jobs/business/api/events/JobCancelRequestEvent.java +++ b/dotCMS/src/main/java/com/dotcms/jobs/business/api/events/JobCancelRequestEvent.java @@ -9,17 +9,17 @@ public class JobCancelRequestEvent { private final Job job; - private final LocalDateTime canceledAt; + private final LocalDateTime canceledOn; /** * Constructs a new JobCancelRequestEvent. * * @param job The job to cancel. - * @param canceledAt The timestamp when the cancel request was made. + * @param canceledOn The timestamp when the cancel request was made. */ - public JobCancelRequestEvent(Job job, LocalDateTime canceledAt) { + public JobCancelRequestEvent(Job job, LocalDateTime canceledOn) { this.job = job; - this.canceledAt = canceledAt; + this.canceledOn = canceledOn; } /** @@ -32,7 +32,7 @@ public Job getJob() { /** * @return The timestamp when the cancel request was made. */ - public LocalDateTime getCanceledAt() { - return canceledAt; + public LocalDateTime getCanceledOn() { + return canceledOn; } } diff --git a/dotCMS/src/main/java/com/dotcms/jobs/business/processor/impl/ImportContentletsProcessor.java b/dotCMS/src/main/java/com/dotcms/jobs/business/processor/impl/ImportContentletsProcessor.java index ec2b30cfae99..3c8b446f8b39 100644 --- a/dotCMS/src/main/java/com/dotcms/jobs/business/processor/impl/ImportContentletsProcessor.java +++ b/dotCMS/src/main/java/com/dotcms/jobs/business/processor/impl/ImportContentletsProcessor.java @@ -354,16 +354,16 @@ private String getWorkflowActionId(final Job job) { * Retrieves the language from the job parameters. * * @param job The job containing the parameters - * @return The language ID or ISO code + * @return An optional containing the language string, or an empty optional if not present */ - private String getLanguage(final Job job) { + private Optional getLanguage(final Job job) { if (!job.parameters().containsKey(PARAMETER_LANGUAGE) || job.parameters().get(PARAMETER_LANGUAGE) == null) { - return null; + return Optional.empty(); } - return (String) job.parameters().get(PARAMETER_LANGUAGE); + return Optional.of((String) job.parameters().get(PARAMETER_LANGUAGE)); } /** @@ -625,8 +625,13 @@ private ContentType findContentType(final Job job) private Language findLanguage(final Job job) { // Read the language from the job parameters - final var languageIsoOrId = getLanguage(job); - if (languageIsoOrId == null || languageIsoOrId.equals("-1")) { + final var languageIsoOrIdOptional = getLanguage(job); + if (languageIsoOrIdOptional.isEmpty()) { + return null; + } + + final var languageIsoOrId = languageIsoOrIdOptional.get(); + if (languageIsoOrId.equals("-1")) { return null; }