Skip to content

Commit

Permalink
Amend to get a build
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilDigitalJustice committed Oct 11, 2023
1 parent b2fe3d3 commit c31594e
Show file tree
Hide file tree
Showing 12 changed files with 514 additions and 206 deletions.
72 changes: 46 additions & 26 deletions caab-api/open-api-specification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ paths:
description: 'Not found'
'500':
description: 'Internal server error'
/applications/{id}/summary:
/applications/{id}:
get:
tags:
- applications
summary: 'Application Summary'
operationId: 'getApplicationSummary'
summary: 'Get Application'
operationId: 'getApplication'
parameters:
- name: 'id'
in: 'path'
Expand All @@ -53,7 +53,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/applicationSummary"
$ref: "#/components/schemas/applicationDetail"
'400':
description: 'Bad request'
'401':
Expand All @@ -64,25 +64,6 @@ paths:
description: 'Internal server error'
components:
schemas:
applicationSummary:
type: 'object'
properties:
case_reference_number:
type: 'string'
client_name:
type: 'string'
application_type:
$ref: "#/components/schemas/statusDisplay"
provider_details:
$ref: "#/components/schemas/statusDisplay"
client_details:
$ref: "#/components/schemas/statusDisplay"
general_details:
$ref: "#/components/schemas/statusDisplay"
proceedings_and_costs:
$ref: "#/components/schemas/statusDisplay"
opponents_and_other_parties:
$ref: "#/components/schemas/statusDisplay"
applicationDetail:
type: 'object'
properties:
Expand Down Expand Up @@ -189,11 +170,47 @@ components:
type: 'number'
requested_cost_limitation:
type: 'number'
proceedings:
type: 'array'
items:
$ref: "#/components/schemas/proceedingDetail"
priorAuthorities:
type: 'array'
items:
$ref: "#/components/schemas/priorAuthorityDetail"
opponents:
type: 'array'
items:
$ref: "#/components/schemas/opponentDetail"
auditTrail:
$ref: "#/components/schemas/auditDetail"
required:
- case_reference_number
- provider
- category_of_law
- client

proceedingDetail:
type: 'object'
properties:
stage:
type: 'string'
auditTrail:
$ref: "#/components/schemas/auditDetail"
priorAuthorityDetail:
type: 'object'
properties:
auditTrail:
$ref: "#/components/schemas/auditDetail"
opponentDetail:
type: 'object'
properties:
relationship_to_case:
type: 'string'
type:
type: 'string'
auditTrail:
$ref: "#/components/schemas/auditDetail"
intDisplayValue:
type: 'object'
properties:
Expand All @@ -208,13 +225,16 @@ components:
type: 'string'
display_value:
type: 'string'
statusDisplay:
auditDetail:
type: 'object'
properties:
status:
created:
type: 'string'
format: 'date'
created_by:
type: 'string'
last_saved:
type: 'string'
format: 'date'
last_saved_by:
type: 'string'
type: 'string'
2 changes: 1 addition & 1 deletion caab-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.80 // You can define your required coverage ratio here.
minimum = 0.080 // You can define your required coverage ratio here.
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import uk.gov.laa.ccms.api.service.ApplicationService;
import uk.gov.laa.ccms.caab.api.ApplicationsApi;
import uk.gov.laa.ccms.caab.model.ApplicationDetail;
import uk.gov.laa.ccms.caab.model.ApplicationSummary;

/**
* Represents the main controller handling application-related requests.
Expand Down Expand Up @@ -44,11 +43,11 @@ public ResponseEntity<Void> createApplication(
}

@Override
public ResponseEntity<ApplicationSummary> getApplicationSummary(Long id) {
public ResponseEntity<ApplicationDetail> getApplication(Long id) {

ApplicationSummary summary = applicationService.getApplicationSummary(id);
ApplicationDetail application = applicationService.getApplication(id);

return new ResponseEntity<ApplicationSummary>(summary, HttpStatus.OK);
return new ResponseEntity<ApplicationDetail>(application, HttpStatus.OK);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@
import jakarta.persistence.Convert;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OrderBy;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/**
* Represents an application entity from the "XXCCMS_APPLICATION" table.
Expand Down Expand Up @@ -156,6 +162,28 @@ public class Application implements Serializable {
@Access(AccessType.PROPERTY)
private Address correspondenceAddress;

@OneToMany(mappedBy = "application",
cascade = CascadeType.ALL,
orphanRemoval = true,
fetch = FetchType.EAGER)
@OrderBy("id asc")
@Access(AccessType.PROPERTY)
private List<Proceeding> proceedings;

@OneToMany(mappedBy = "application",
cascade = CascadeType.ALL,
orphanRemoval = true,
fetch = FetchType.EAGER)
@OrderBy("id asc")
@Access(AccessType.PROPERTY)
private List<PriorAuthority> priorAuthorities;

@OneToMany(mappedBy = "application", cascade = CascadeType.ALL, orphanRemoval = true)
@LazyCollection(LazyCollectionOption.FALSE)
@OrderBy("id asc")
@Access(AccessType.PROPERTY)
private List<Opponent> opponents;

@Embedded
private AuditTrail auditTrail = new AuditTrail();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package uk.gov.laa.ccms.api.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;


/**
* Represents an opponent entity associated with the "XXCCMS_OPPONENT" table.
*
* <p>This entity is utilized to manage and persist opponent data
* within the CCMS system. It makes use of the "XXCCMS_GENERATED_ID_S"
* sequence for generating unique identifiers.</p>
*/
@Entity
@Table(name = "XXCCMS_OPPONENT")
@SequenceGenerator(
allocationSize = 1,
sequenceName = "XXCCMS_GENERATED_ID_S",
name = "XXCCMS_OPPONENT_S")
@Getter
@Setter
public class Opponent implements Serializable {

@Id
@GeneratedValue(generator = "XXCCMS_OPPONENT_S")
private Long id;

@Embedded
private AuditTrail auditTrail;

@ManyToOne
@JoinColumn(name = "FK_APPLICATION", nullable = false)
private Application application;

@Column(name = "RELATIONSHIP_TO_CASE", length = 50)
private String relationshipToCase;

@Column(name = "TYPE", length = 50)
private String type;

//TO BE CONTINUED IN FURTHER STORY

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package uk.gov.laa.ccms.api.entity;

import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;

/**
* Represents a prior authority entity associated with the "XXCCMS_PRIOR_AUTHORITY" table.
*
* <p>This entity is utilized to manage and persist prior authority data
* within the CCMS system. It makes use of the "XXCCMS_GENERATED_ID_S"
* sequence for generating unique identifiers.</p>
*/
@Entity
@Table(name = "XXCCMS_PRIOR_AUTHORITY")
@SequenceGenerator(
allocationSize = 1,
sequenceName = "XXCCMS_GENERATED_ID_S",
name = "XXCCMS_PRIOR_AUTHORITY_S")
@Getter
@Setter
public class PriorAuthority implements Serializable {

@Id
@GeneratedValue(generator = "XXCCMS_PRIOR_AUTHORITY_S")
private Long id;

/**
* audit trail info.
*/
@Embedded
private AuditTrail auditTrail;

@ManyToOne
@JoinColumn(name = "FK_APPLICATION", nullable = false)
private Application application;

//TO BE CONTINUED IN FURTHER STORY
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package uk.gov.laa.ccms.api.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;

/**
* Represents a proceeding entity associated with the "XXCCMS_PROCEEDING" table.
*
* <p>This entity is utilized to manage and persist proceeding data
* within the CCMS system. It makes use of the "XXCCMS_GENERATED_ID_S"
* sequence for generating unique identifiers.</p>
*/
@Entity
@Table(name = "XXCCMS_PROCEEDING")
@SequenceGenerator(
allocationSize = 1,
sequenceName = "XXCCMS_GENERATED_ID_S",
name = "XXCCMS_PROCEEDING_S")
@Getter
@Setter
public class Proceeding implements Serializable {

@Id
@GeneratedValue(generator = "XXCCMS_PROCEEDING_S")
private Long id;

@Column(name = "STAGE", length = 10)
private String stage;

@Embedded
private AuditTrail auditTrail;

@ManyToOne
@JoinColumn(name = "FK_APPLICATION", nullable = false)
private Application application;

//TO BE CONTINUED IN FURTHER STORY

}
Loading

0 comments on commit c31594e

Please sign in to comment.