Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.cleanup

public Class TimestampToDateField

extends Object
implements CleanupJob
Class Inheritance
All Implemented Interfaces
org.jabref.logic.cleanup.CleanupJob
Imports
java.time.LocalDateTime, java.time.format.DateTimeFormatter, java.time.temporal.ChronoUnit, java.util.ArrayList, .List, .Optional, org.jabref.model.FieldChange, org.jabref.model.entry.BibEntry, .Date, org.jabref.model.entry.event.EntriesEventSource, org.jabref.model.entry.field.Field

This class handles the migration from a legacy timestamp field to creationdate and modificationdate fields.

If the legacy pre-5.3 updateTimestamp setting is enabled, the timestamp field for each entry are migrated to the date-modified field. Otherwise, it is migrated to the date-added field.

Field Summary

Modifier and TypeField and Description
private final Field
private final Field

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public List<FieldChange>
cleanup(BibEntry entry)

Implements org.jabref.logic.cleanup.CleanupJob.cleanup.

Cleans up the given entry and returns the list of changes made.

private Optional<String>
formatTimeStamp(String timeStamp)

Formats the time stamp into the local date and time format.

private int
getMonth(Date date)

Returns the month value of the passed date if available.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

sourceFieldback to summary
private final Field sourceField
targetFieldback to summary
private final Field targetField

Constructor Detail

TimestampToDateFieldback to summary
public TimestampToDateField(Field source, Field target)

Method Detail

cleanupback to summary
public List<FieldChange> cleanup(BibEntry entry)

Implements org.jabref.logic.cleanup.CleanupJob.cleanup.

Doc from org.jabref.logic.cleanup.CleanupJob.cleanup.

Cleans up the given entry and returns the list of changes made.

Annotations
@Override
formatTimeStampback to summary
private Optional<String> formatTimeStamp(String timeStamp)

Formats the time stamp into the local date and time format. If the existing timestamp could not be parsed, the day/month/year "1" is used. For the time portion 00:00:00 is used.

getMonthback to summary
private int getMonth(Date date)

Returns the month value of the passed date if available. Otherwise, returns the current month.