package com.alterdekim.game.entity; import com.alterdekim.game.controller.result.api.ApiResult; import com.alterdekim.game.controller.result.api.LocationObjectInstanceResult; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import jakarta.persistence.*; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @NoArgsConstructor @AllArgsConstructor @Getter @Table(name = "location_objects") @Entity public class LocationObjectInstance implements ApiResult { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @JacksonXmlProperty(isAttribute = true, localName = "ID") private Long id; @JacksonXmlProperty(isAttribute = true, localName = "AObjectTypeId") private Integer objectTypeId; @JacksonXmlProperty(isAttribute = true, localName = "AObjectId") private Integer objectId; @JacksonXmlProperty(isAttribute = true, localName = "AObjectRefId") private Integer objectReferenceId; @JacksonXmlProperty(isAttribute = true, localName = "MediaResourceID") private Long mediaResourceId; @JsonIgnore private Long locationId; @JacksonXmlProperty(isAttribute = true, localName = "x") private Double x; @JacksonXmlProperty(isAttribute = true, localName = "y") private Double y; @JsonIgnore private String options; @JsonIgnore private String comment; @Override public LocationObjectInstanceResult toAPIResult() { return new LocationObjectInstanceResult(this.id, this.objectTypeId, this.objectId, this.objectReferenceId, this.mediaResourceId, this.locationId, this.x, this.y, this.options, this.comment); } public LocationObjectInstance(Integer objectTypeId, Integer objectId, Integer objectReferenceId, Long mediaResourceId, Long locationId, Double x, Double y, String options, String comment) { this.objectTypeId = objectTypeId; this.objectId = objectId; this.objectReferenceId = objectReferenceId; this.mediaResourceId = mediaResourceId; this.locationId = locationId; this.x = x; this.y = y; this.options = options; this.comment = comment; } }