Skip to content

Commit

Permalink
Add new user & 'roles' entities
Browse files Browse the repository at this point in the history
  • Loading branch information
RustyHMCTS committed Feb 15, 2024
1 parent fa3144e commit 2fab713
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package uk.gov.hmcts.opal.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "application_functions")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ApplicationFunctionsEntity {

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "application_function_id_seq_generator")
@SequenceGenerator(name = "application_function_id_seq_generator", sequenceName = "application_function_id_seq",
allocationSize = 1)
@Column(name = "application_function_id")
private Long applicationFunctionId;

@Column(name = "function_name", length = 200)
private String functionName;

}
30 changes: 30 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/BusinessUnitUserEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package uk.gov.hmcts.opal.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "business_unit_users")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BusinessUnitUserEntity {

@Id
@Column(name = "business_unit_user_id", length = 6)
private String businessUnitUserId;

@Column(name = "business_unit_id")
private Short businessUnitId;

@Column(name = "user_id", length = 100)
private String userId;

}
3 changes: 3 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/NoteEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ public class NoteEntity {
@Column(name = "posted_by", length = 20)
private String postedBy;

@Column(name = "posted_by_aad", length = 100)
private String postedByAad;

}
32 changes: 32 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/TemplateEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package uk.gov.hmcts.opal.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "templates")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class TemplateEntity {

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "template_id_seq_generator")
@SequenceGenerator(name = "template_id_seq_generator", sequenceName = "template_id_seq", allocationSize = 1)
@Column(name = "template_id")
private Long templateId;

@Column(name = "template_name", length = 100)
private String templateName;

}
42 changes: 42 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/TemplateMappingEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package uk.gov.hmcts.opal.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Entity
@IdClass(TemplateMappingEntity.MappingId.class)
@Table(name = "template_mappings")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class TemplateMappingEntity {

@Id
@Column(name = "template_id")
private Long templateId;

@Id
@Column(name = "application_function_id")
private Long applicationFunctionId;

@Data
@NoArgsConstructor
@AllArgsConstructor
public static class MappingId implements Serializable {

public Long templateId;

public Long applicationFunctionId;
}

}
35 changes: 35 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/UserEntitlementEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package uk.gov.hmcts.opal.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "user_entitlements")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class UserEntitlementEntity {

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_entitlement_id_seq_generator")
@SequenceGenerator(name = "user_entitlement_id_seq_generator", sequenceName = "user_entitlement_id_seq",
allocationSize = 1)
@Column(name = "user_entitlement_id")
private Long userEntitlementId;

@Column(name = "business_unit_user_id", length = 6)
private String businessUnitUserId;

@Column(name = "application_function_id")
private Long applicationFunctionId;
}
33 changes: 33 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/UserEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package uk.gov.hmcts.opal.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "users")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class UserEntity {

@Id
@Column(name = "user_id", length = 100)
private String userId;

@Column(name = "username", length = 100)
private String username;

@Column(name = "password", length = 1000)
private String password;

@Column(name = "description", length = 100)
private String description;

}

0 comments on commit 2fab713

Please sign in to comment.