Skip to content

Commit

Permalink
DefaultColumnUtils: Joda date formatting replaced with JDK 8 API
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed May 30, 2020
1 parent bf8b6d1 commit 4748f69
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 0 additions & 6 deletions model/model-common/pom.xml
Expand Up @@ -149,12 +149,6 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!-- TODO: go away, Joda -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>


<dependency>
<groupId>org.codehaus.groovy</groupId>
Expand Down
Expand Up @@ -8,13 +8,13 @@

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.*;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;

import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.Nullable;
import org.joda.time.format.DateTimeFormat;

import com.evolveum.midpoint.audit.api.AuditEventRecord;
import com.evolveum.midpoint.common.LocalizationService;
Expand Down Expand Up @@ -334,8 +334,11 @@ public static <O extends ObjectType> String processSpecialColumn(
if (itemPath.equivalent(TaskType.F_COMPLETION_TIMESTAMP)) {
XMLGregorianCalendar timestamp = task.getCompletionTimestamp();
if (timestamp != null && task.getExecutionStatus().equals(TaskExecutionStatusType.CLOSED)) {
String pattern = DateTimeFormat.patternForStyle("SM", Locale.getDefault());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
// Do we want default locale or default locale for FORMAT category?
// For latter no .withLocale() would be needed.
DateTimeFormatter formatter = DateTimeFormatter
.ofLocalizedDateTime(FormatStyle.SHORT, FormatStyle.MEDIUM)
.withLocale(Locale.getDefault());
ZonedDateTime time = timestamp.toGregorianCalendar().toZonedDateTime();
String dateTime = formatter.format(time);
String key = "pageTasks.task.closedAt";
Expand Down

0 comments on commit 4748f69

Please sign in to comment.