Skip to content

Commit

Permalink
#29498 Applying PR feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgambarios committed Nov 11, 2024
1 parent 67162b2 commit c99a4fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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));
}

/**
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit c99a4fa

Please sign in to comment.