SearchResult.java

package ui.assembly64;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import javafx.beans.property.*;

import java.time.LocalDate;
import java.time.LocalDateTime;

@JsonIgnoreProperties(ignoreUnknown = true)
public class SearchResult {

    public static final String YES = "Y";
    public static final String NO = "N";
    public static final String DATE_PATTERN = "yyyyMMdd";
    public static final String LOCAL_DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss.SSSSSS";

    private final StringProperty idProperty = new SimpleStringProperty();
    private final StringProperty nameProperty = new SimpleStringProperty();
    private final StringProperty groupProperty = new SimpleStringProperty();
    private final IntegerProperty yearProperty = new SimpleIntegerProperty();
    private final StringProperty handleProperty = new SimpleStringProperty();
    private final StringProperty eventProperty = new SimpleStringProperty();
    private final IntegerProperty ratingProperty = new SimpleIntegerProperty();
    private final ObjectProperty<LocalDateTime> updatedProperty = new SimpleObjectProperty<>();
    private final ObjectProperty<LocalDate> releasedProperty = new SimpleObjectProperty<>();
    private final ObjectProperty<Category> categoryProperty = new SimpleObjectProperty<>();

    public SearchResult() {
    }

    public String getId() {
        return idProperty.get();
    }

    public void setId(String id) {
        idProperty.set(id);
    }

    public String getName() {
        return nameProperty.get();
    }

    public void setName(String name) {
        nameProperty.set(name);
    }

    public String getGroup() {
        return groupProperty.get();
    }

    public void setGroup(String group) {
        groupProperty.set(group);
    }

    public Integer getYear() {
        return yearProperty.get();
    }

    public void setYear(Integer year) {
        yearProperty.set(year == null ? 0 : year);
    }

    public String getHandle() {
        return handleProperty.get();
    }

    public void setHandle(String handle) {
        handleProperty.set(handle);
    }

    public String getEvent() {
        return eventProperty.get();
    }

    public void setEvent(String event) {
        eventProperty.set(event);
    }

    public Integer getRating() {
        return ratingProperty.get();
    }

    public void setRating(Integer rating) {
        ratingProperty.set(rating == null ? 0 : rating);
    }

    @JsonDeserialize(using = Assembly64DateTimeDeserializer.class)
    public LocalDateTime getUpdated() {
        return updatedProperty.get();
    }

    public void setUpdated(LocalDateTime updated) {
        updatedProperty.set(updated);
    }

    public Category getCategory() {
        return categoryProperty.get();
    }

    public void setCategory(Category category) {
        categoryProperty.set(category);
    }

    public LocalDate getReleased() {
        return releasedProperty.get();
    }

    public void setReleased(LocalDate released) {
        releasedProperty.set(released);
    }
}