io.mosip.kernel.masterdata.entity.Device Maven / Gradle / Ivy
package io.mosip.kernel.masterdata.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import io.mosip.kernel.masterdata.entity.id.IdAndLanguageCodeID;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
*
* Entity for Device Details
*
*/
/**
* @author Sidhant Agarwal
* @author Megha Tanga
* @since 1.0.1
*
*/
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "device_master", schema = "master")
@IdClass(IdAndLanguageCodeID.class)
public class Device extends BaseEntity implements Serializable {
/**
*
*/
private static final long serialVersionUID = -5585825705521742941L;
@Id
@AttributeOverrides({ @AttributeOverride(name = "id", column = @Column(name = "id", nullable = false, length = 36)),
@AttributeOverride(name = "langCode", column = @Column(name = "lang_code", nullable = false, length = 3)) })
private String id;
private String langCode;
/**
* Field for device name
*/
@Column(name = "name", nullable = false, length = 64)
private String name;
/**
* Field for device serial number
*/
@Column(name = "serial_num", nullable = false, length = 64)
private String serialNum;
/**
* Field for device ip address
*/
@Column(name = "ip_address", length = 17)
private String ipAddress;
/**
* Field for device mac address
*/
@Column(name = "mac_address", nullable = false, length = 64)
private String macAddress;
/**
* Field for device specific id
*/
@Column(name = "dspec_id", nullable = false, length = 36)
private String deviceSpecId;
@Column(name = "validity_end_dtimes")
private LocalDateTime validityDateTime;
@Column(name = "zone_code", length = 36)
private String zoneCode;
@Column(name = "regcntr_id", length = 10)
private String regCenterId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({ @JoinColumn(name = "dspec_id", referencedColumnName = "id", insertable = false, updatable = false),
@JoinColumn(name = "lang_code", referencedColumnName = "lang_code", insertable = false, updatable = false) })
private DeviceSpecification deviceSpecification;
@Transient
private String mapStatus;
}