com.xlrit.gears.base.model.Report Maven / Gradle / Ivy
package com.xlrit.gears.base.model;
import java.time.OffsetDateTime;
import java.util.Objects;
import com.xlrit.gears.base.meta.*;
import lombok.Getter;
import lombok.Setter;
/**
*
* REPORT in REPORTS =
* title : text
* body : tuple
*
*/
@EntityType(typeName = "REPORT", collectionName = "REPORTS")
@Attributes({ "title", "body" } )
public class Report implements Identifiable {
@Id @Getter
private String id;
@Getter @Setter
@Attribute(formalName = "title", type = DataType.TEXT, label = "Title")
private String title;
@Getter @Setter
@Attribute(formalName = "body", type = DataType.TUPLE, label = "Body")
private Object body;
@Getter @Setter
private User creator;
@Getter @Setter
private OffsetDateTime createdAt;
@Getter @Setter
private User modifier;
@Getter @Setter
private OffsetDateTime modifiedAt;
public Report() {}
public Report(String id) { this.id = id; }
@Override
public boolean equals(Object obj) {
if (this.id == null) return super.equals(obj);
if (!(obj instanceof Report that)) return false;
return Objects.equals(this.id, that.getId());
}
@Override
public int hashCode() {
return Objects.hash(this.id);
}
@Displayed
public String defaultDisplayed() {
return "title: " + title;
}
@Override
public String toString() {
return "Report[" + defaultDisplayed() + "]";
}
}