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 4b2e7f2
Show file tree
Hide file tree
Showing 25 changed files with 430 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package uk.gov.hmcts.opal.dto.search;

import lombok.Builder;
import lombok.Data;
import uk.gov.hmcts.opal.dto.ToJsonString;

@Data
@Builder
public class ApplicationFunctionSearchDto implements ToJsonString {

private String applicationFunctionId;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package uk.gov.hmcts.opal.dto.search;

import lombok.Builder;
import lombok.Data;
import uk.gov.hmcts.opal.dto.ToJsonString;

@Data
@Builder
public class BusinessUnitUserSearchDto implements ToJsonString {

private String businessUnitUserId;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package uk.gov.hmcts.opal.dto.search;

import lombok.Builder;
import lombok.Data;
import uk.gov.hmcts.opal.dto.ToJsonString;

@Data
@Builder
public class TemplateMappingSearchDto implements ToJsonString {

private String templateMappingId;

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

import lombok.Builder;
import lombok.Data;
import uk.gov.hmcts.opal.dto.ToJsonString;

@Data
@Builder
public class TemplateSearchDto implements ToJsonString {

private String templateId;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package uk.gov.hmcts.opal.dto.search;

import lombok.Builder;
import lombok.Data;
import uk.gov.hmcts.opal.dto.ToJsonString;

@Data
@Builder
public class UserEntitlementSearchDto implements ToJsonString {

private String userEntitlementId;

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

import lombok.Builder;
import lombok.Data;
import uk.gov.hmcts.opal.dto.ToJsonString;

@Data
@Builder
public class UserSearchDto implements ToJsonString {

private String userId;

}
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 ApplicationFunctionEntity {

@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;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package uk.gov.hmcts.opal.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import uk.gov.hmcts.opal.entity.ApplicationFunctionEntity;

@Repository
public interface ApplicationFunctionRepository extends JpaRepository<ApplicationFunctionEntity, Long>,
JpaSpecificationExecutor<ApplicationFunctionEntity> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package uk.gov.hmcts.opal.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import uk.gov.hmcts.opal.entity.BusinessUnitUserEntity;

@Repository
public interface BusinessUnitUserRepository extends JpaRepository<BusinessUnitUserEntity, String>,
JpaSpecificationExecutor<BusinessUnitUserEntity> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package uk.gov.hmcts.opal.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import uk.gov.hmcts.opal.entity.TemplateMappingEntity;

@Repository
public interface TemplateMappingRepository extends JpaRepository<TemplateMappingEntity,
TemplateMappingEntity.MappingId>, JpaSpecificationExecutor<TemplateMappingEntity> {
}
11 changes: 11 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/repository/TemplateRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package uk.gov.hmcts.opal.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import uk.gov.hmcts.opal.entity.TemplateEntity;

@Repository
public interface TemplateRepository extends JpaRepository<TemplateEntity, Long>,
JpaSpecificationExecutor<TemplateEntity> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package uk.gov.hmcts.opal.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import uk.gov.hmcts.opal.entity.UserEntitlementEntity;

@Repository
public interface UserEntitlementRepository extends JpaRepository<UserEntitlementEntity, Long>,
JpaSpecificationExecutor<UserEntitlementEntity> {
}
11 changes: 11 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/repository/UserRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package uk.gov.hmcts.opal.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import uk.gov.hmcts.opal.entity.UserEntity;

@Repository
public interface UserRepository extends JpaRepository<UserEntity, String>,
JpaSpecificationExecutor<UserEntity> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package uk.gov.hmcts.opal.service;

import uk.gov.hmcts.opal.dto.search.ApplicationFunctionSearchDto;
import uk.gov.hmcts.opal.entity.ApplicationFunctionEntity;

import java.util.List;

public interface ApplicationFunctionServiceInterface {

ApplicationFunctionEntity getApplicationFunction(long applicationFunctionId);

List<ApplicationFunctionEntity> searchApplicationFunctions(ApplicationFunctionSearchDto criteria);
}
Loading

0 comments on commit 4b2e7f2

Please sign in to comment.