Skip to content

Commit

Permalink
Implement basic entity searching
Browse files Browse the repository at this point in the history
  • Loading branch information
RustyHMCTS committed Feb 12, 2024
1 parent 4044691 commit 166666b
Show file tree
Hide file tree
Showing 96 changed files with 797 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public DocumentController(@Qualifier("documentServiceProxy") DocumentServiceInte

@GetMapping(value = "/{documentId}")
@Operation(summary = "Returns the Document for the given documentId.")
public ResponseEntity<DocumentEntity> getDocumentById(@PathVariable Long documentId) {
public ResponseEntity<DocumentEntity> getDocumentById(@PathVariable String documentId) {

log.info(":GET:getDocumentById: documentId: {}", documentId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public LocalJusticeAreaController(

@GetMapping(value = "/{localJusticeAreaId}")
@Operation(summary = "Returns the LocalJusticeArea for the given localJusticeAreaId.")
public ResponseEntity<LocalJusticeAreaEntity> getLocalJusticeAreaById(@PathVariable Long localJusticeAreaId) {
public ResponseEntity<LocalJusticeAreaEntity> getLocalJusticeAreaById(@PathVariable Short localJusticeAreaId) {

log.info(":GET:getLocalJusticeAreaById: localJusticeAreaId: {}", localJusticeAreaId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public ResponseEntity<PaymentTermsEntity> getPaymentTermsById(@PathVariable Long
}

@PostMapping(value = "/search", consumes = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Searches PaymentTermss based upon criteria in request body")
public ResponseEntity<List<PaymentTermsEntity>> postPaymentTermssSearch(
@Operation(summary = "Searches PaymentTerms based upon criteria in request body")
public ResponseEntity<List<PaymentTermsEntity>> postPaymentTermsSearch(
@RequestBody PaymentTermsSearchDto criteria) {
log.info(":POST:postPaymentTermssSearch: query: \n{}", criteria);
log.info(":POST:postPaymentTermsSearch: query: \n{}", criteria);

List<PaymentTermsEntity> response = paymentTermsService.searchPaymentTerms(criteria);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@Builder
public class DebtorDetailSearchDto implements ToJsonString {

private String debtorId;
private String partyId;
private String email;
private String vehicleMake;
private String vehicleRegistration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package uk.gov.hmcts.opal.dto.search;

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

@Data
@Builder
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
public class LocalJusticeAreaSearchDto extends AddressSearch implements ToJsonString {

private String localJusticeAreaId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand All @@ -26,6 +27,7 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class AccountTransferEntity {

@Id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
Expand All @@ -15,6 +18,8 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "businessUnitId")
public class BusinessUnitEntity {

@Id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand All @@ -24,6 +25,7 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class CommittalWarrantProgressEntity {

@Id
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/CourtEntity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand All @@ -20,6 +23,8 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "courtId")
public class CourtEntity extends EnforcerCourtBaseEntity {

@Id
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/uk/gov/hmcts/opal/entity/DebtorDetailEntity.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
Expand All @@ -23,15 +22,13 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class DebtorDetailEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long debtorId;

@ManyToOne
@JoinColumn(name = "party_id", referencedColumnName = "party_id", nullable = false)
private PartyEntity party;
@Column(name = "party_id")
private Long partyId;

@Column(name = "telephone_home")
private String telephoneHome;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand Down Expand Up @@ -29,6 +32,8 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "defendantAccountId")
public class DefendantAccountEntity {

@Id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand All @@ -23,6 +25,7 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "defendantAccountPartyId")
public class DefendantAccountPartiesEntity {

@Id
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/uk/gov/hmcts/opal/entity/DocumentEntity.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
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;
Expand All @@ -18,13 +18,13 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "documentId")
public class DocumentEntity {

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "document_id_seq_generator")
@SequenceGenerator(name = "document_id_seq_generator", sequenceName = "document_id_seq", allocationSize = 1)
@Column(name = "document_id", nullable = false)
private Long documentId;
@Column(name = "document_id", length = 10, nullable = false)
private String documentId;

@Column(name = "recipient", length = 4, nullable = false)
private String recipient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand All @@ -24,6 +25,7 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class DocumentInstanceEntity {

@Id
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/EnforcementEntity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand All @@ -24,6 +27,8 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "enforcementId")
public class EnforcementEntity {

@Id
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/EnforcerEntity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand All @@ -19,6 +22,8 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "enforcerId")
public class EnforcerEntity extends EnforcerCourtBaseEntity {

@Id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand All @@ -20,6 +23,8 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "localJusticeAreaId")
public class LocalJusticeAreaEntity extends AddressEntity {

@Id
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/MisDebtorEntity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand All @@ -25,6 +26,7 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class MisDebtorEntity {

@Id
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/PartyEntity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand Down Expand Up @@ -27,6 +29,7 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "partyId")
public class PartyEntity implements FullNameBuilder {

@Id
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/PaymentInEntity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand All @@ -25,6 +26,7 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class PaymentInEntity {

@Id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
Expand All @@ -22,6 +23,7 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class PaymentTermsEntity {

@Id
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/PrisonEntity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand All @@ -22,6 +23,7 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class PrisonEntity extends AddressEntity {

@Id
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/uk/gov/hmcts/opal/entity/TillEntity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package uk.gov.hmcts.opal.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand All @@ -18,6 +21,8 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "tillId")
public class TillEntity {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@
@Repository
public interface AccountTransferRepository extends JpaRepository<AccountTransferEntity, Long>,
JpaSpecificationExecutor<AccountTransferEntity> {

AccountTransferEntity findByAccountTransferId(Long accountTransferId);
}
Loading

0 comments on commit 166666b

Please sign in to comment.