Skip to content

Commit

Permalink
Merge pull request #20 from anshulv1401/Create-Entities-#18
Browse files Browse the repository at this point in the history
entities to store masterdata and registration metadata created
  • Loading branch information
ase-101 authored Mar 30, 2022
2 parents 20e9691 + 3bdee00 commit 2eb269b
Show file tree
Hide file tree
Showing 19 changed files with 937 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package io.mosip.registration.clientmanager.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;

import java.time.LocalDateTime;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
* The Audit Entity class with required fields to be captured and recorded
*
* @author Anshul Vanawat
*
*/
@Entity(tableName = "app_audit_log")
//schema = "audit"
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class Audit extends BaseAudit {

@NotNull
@Size(min = 1, max = 64)
@ColumnInfo(name = "event_id")//, nullable = false, updatable = false, length = 64)
@NotNull
private String eventId;

@NotNull
@Size(min = 1, max = 128)
@ColumnInfo(name = "event_name")//, nullable = false, updatable = false, length = 128)
private String eventName;

@NotNull
@Size(min = 1, max = 64)
@ColumnInfo(name = "event_type")//, nullable = false, updatable = false, length = 64)
private String eventType;

@NotNull
@ColumnInfo(name = "action_dtimes")//, nullable = false, updatable = false)
private LocalDateTime actionTimeStamp;

@NotNull
@Size(min = 1, max = 128)
@ColumnInfo(name = "host_name")//, nullable = false, updatable = false, length = 128)
private String hostName;

@NotNull
@Size(min = 1, max = 256)
@ColumnInfo(name = "host_ip")//, nullable = false, updatable = false, length = 256)
private String hostIp;

@NotNull
@Size(min = 1, max = 64)
@ColumnInfo(name = "app_id")//, nullable = false, updatable = false, length = 64)
private String applicationId;

@NotNull
@Size(min = 1, max = 128)
@ColumnInfo(name = "app_name")//, nullable = false, updatable = false, length = 128)
private String applicationName;

@NotNull
@Size(min = 1, max = 256)
@ColumnInfo(name = "session_user_id")//, nullable = false, updatable = false, length = 256)
private String sessionUserId;

@Size(max = 128)
@ColumnInfo(name = "session_user_name")//, updatable = false, length = 128)
private String sessionUserName;

@Size( max = 64)
@ColumnInfo(name = "ref_id")//, nullable = true, updatable = false, length = 64)
private String id;

@Size(max = 64)
@ColumnInfo(name = "ref_id_type")//, nullable = true, updatable = false, length = 64)
private String idType;

@NotNull
@Size(min = 1, max = 256)
@ColumnInfo(name = "cr_by")//, nullable = false, updatable = false, length = 256)
private String createdBy;

@Size(max = 128)
@ColumnInfo(name = "module_name")//, updatable = false, length = 128)
private String moduleName;

@Size(max = 64)
@ColumnInfo(name = "module_id")//, updatable = false, length = 64)
private String moduleId;

@Size(max = 2048)
@ColumnInfo(name = "log_desc")//, updatable = false, length = 2048)
private String description;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.mosip.registration.clientmanager.entity;

import androidx.room.ColumnInfo;
import androidx.room.PrimaryKey;

import java.time.LocalDateTime;
import java.util.UUID;

import javax.validation.constraints.NotNull;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
* Base class for {@link Audit} with {@link #uuid} and {@link #createdAt}
*
* @author Anshul vanawat
*/
//@MappedSuperclass
@Data
@AllArgsConstructor
public class BaseAudit {

/**
* Field for immutable universally unique identifier (UUID)
*/
@PrimaryKey
@ColumnInfo(name = "log_id")
@NotNull
//@Updateable = false
private String uuid;

@ColumnInfo(name = "log_dtimes")
@NotNull
//@Updateable = false
private LocalDateTime createdAt;

/**
* Constructor to initialize {@link BaseAudit} with uuid and timestamp
*/
public BaseAudit() {
uuid = UUID.randomUUID().toString();
createdAt = LocalDateTime.now();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package io.mosip.registration.clientmanager.entity;


import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
* This Entity Class contains list of dynamic fields
* which will be displayed in UI with respect to language code.
* The data for this table will come through sync from server master table
*
* @author Anshul vanawat
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Entity(tableName = "dynamic_field")
public class DynamicField {

@PrimaryKey
@ColumnInfo(name="id")
private String id;

@ColumnInfo(name="name")
private String name;

@ColumnInfo(name="description")
private String description;

@ColumnInfo(name="lang_code")
private String langCode;

@ColumnInfo(name="data_type")
private String dataType;

@ColumnInfo(name="value_json")
private String valueJson;

@ColumnInfo(name="is_active")
private boolean isActive;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.mosip.registration.clientmanager.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

import lombok.Data;

/**
* @author Anshul vanawat
*/

@Entity(tableName = "file_signature")
@Data
public class FileSignature {

@PrimaryKey
@ColumnInfo(name = "file_name")
private String fileName;

@ColumnInfo(name = "signature")
private String signature;

@ColumnInfo(name = "content_length")
private Integer contentLength;

@ColumnInfo(name = "encrypted")
private Boolean encrypted;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.mosip.registration.clientmanager.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;

import java.io.Serializable;

import lombok.Data;

/**
* This Entity Class contains list of locations that are being used in Registration with respect to language code.
* The data for this table will come through sync from server master table .
*
* @author Anshul Vanawat
*/

@Data
@Entity(tableName = "location", primaryKeys = {"code", "langCode"})
public class Location extends RegistrationCommonFields implements Serializable {

private static final long serialVersionUID = -5585825705521742941L;

@ColumnInfo(name = "code")
private String code;

@ColumnInfo(name = "lang_code")
private String langCode;

@ColumnInfo(name = "name")
private String name;

@ColumnInfo(name = "hierarchy_level")
private int hierarchyLevel;

@ColumnInfo(name = "hierarchy_level_name")
private String hierarchyName;

@ColumnInfo(name = "parent_loc_code")
private String parentLocCode;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package io.mosip.registration.clientmanager.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

import lombok.Data;

import java.io.Serializable;

import javax.validation.constraints.NotNull;

/**
* @author Anshul vanawat
*/

@Entity(tableName = "loc_hierarchy_list", primaryKeys = {"hierarchyLevel", "hierarchyLevelName", "langCode"})
@Data
public class LocationHierarchy extends RegistrationCommonFields implements Serializable {

@PrimaryKey
@NotNull
@ColumnInfo(name = "hierarchy_level")
//length = 36
private Integer hierarchyLevel;

@NotNull
@ColumnInfo(name = "hierarchy_level_name")
//length=64
private String hierarchyLevelName;

@NotNull
@ColumnInfo(name = "lang_code")
//length=3
private String langCode;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package io.mosip.registration.clientmanager.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

import java.io.Serializable;
import java.time.LocalDateTime;

import lombok.Data;

/**
* This Entity Class contains list of machine related data[mac address, serial number, machine name...]
* with respect to language code.
* The data for this table will come through sync from server master table.
*
* @author Anshul Vanawat
*/

@Entity(tableName = "machine_master")
@Data
public class MachineMaster extends RegistrationCommonFields implements Serializable {

private static final long serialVersionUID = -5585825705521742941L;

@PrimaryKey
@ColumnInfo(name = "id")
private String id;

@ColumnInfo(name = "lang_code")
private String langCode;

@ColumnInfo(name = "name")
private String name;

@ColumnInfo(name = "serial_num")
private String serialNum;

@ColumnInfo(name = "ip_address")
private String ipAddress;

@ColumnInfo(name = "mac_address")
private String macAddress;

@ColumnInfo(name = "mspec_id")
private String machineSpecId;

@ColumnInfo(name = "validity_end_dtimes")
private LocalDateTime validityDateTime;

@ColumnInfo(name = "public_key" /*, columnDefinition = "CLOB"*/)
private String publicKey;

@ColumnInfo(name = "key_index")
private String keyIndex;

@ColumnInfo(name = "reg_cntr_id")
private String regCenterId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.mosip.registration.clientmanager.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

import java.io.Serializable;

import lombok.Data;

/**
* This Entity Class contains list of machine types[Desktop,Laptop...] with respect to language code.
* The data for this table will come through sync from server master table.
*
* @author Anshul Vanawat
*/
@Entity(tableName = "machine_type")
@Data
public class MachineType extends RegistrationCommonFields implements Serializable {

private static final long serialVersionUID = -8541947587557590379L;

@PrimaryKey
@ColumnInfo(name = "code")
private String code;

@ColumnInfo(name = "name")
private String name;

@ColumnInfo(name = "descr")
private String description;
}
Loading

0 comments on commit 2eb269b

Please sign in to comment.