Skip to content

Commit

Permalink
feat(cb2-10457): update ADR certificate data (#98)
Browse files Browse the repository at this point in the history
* feat(cb2-10457): add ignore properties to ADR cert data

* feat(cb2-10457): update naming conventions

* feat(cb2-10457): repair tests

* feat(cb2-10457): update formatting on document

* feat(cb2-10457): update formatting on document

* feat(cb2-10457): add replacement line to record

* feat(cb2-10457): update adr cert style

* feat(cb2-10457): add new statements into dangerous goods

* feat(cb2-10457): update cert
  • Loading branch information
naathanbrown authored Feb 2, 2024
1 parent 3ed7997 commit 948a629
Show file tree
Hide file tree
Showing 9 changed files with 400 additions and 409 deletions.
14 changes: 2 additions & 12 deletions src/main/java/uk/gov/dvsa/model/cvs/AdrPassCertificate.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package uk.gov.dvsa.model.cvs;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import uk.gov.dvsa.model.Document;
import uk.gov.dvsa.model.cvs.certificateData.AdrPassCertificateData;
import uk.gov.dvsa.model.cvs.certificateData.Signature;

@JsonIgnoreProperties(ignoreUnknown = true)
public class AdrPassCertificate extends Document {
@JsonProperty("ID")
private String id;

@JsonProperty("Signature")
private Signature signature;

@JsonProperty("ADR_DATA")
protected AdrPassCertificateData adrData;

Expand All @@ -32,13 +31,4 @@ public Document setAdrData(AdrPassCertificateData adrData) {
this.adrData = adrData;
return this;
}

public Signature getSignature() {
return signature;
}

public AdrPassCertificate setSignature(Signature signature) {
this.signature = signature;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,97 +3,78 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

@JsonIgnoreProperties(ignoreUnknown = true)
public class AdrPassCertificateData {
private final String SUBSTANCES_PERMITTED_OPTION_1 = "Substances permitted under the tank code and any special provisions specified in 9 may be carried";
private final String PERMITTED_DANGEROUS_GOODS_EXPLOSIVES_2 = "Explosives (type 2)";
private final String PERMITTED_DANGEROUS_GOODS_EXPLOSIVES_3 = "Explosives (type 3)";

@JsonProperty("ChasisNumber")
private String chasisNumber;


@JsonProperty("Make")
@JsonProperty("vin")
private String vin;
@JsonProperty("make")
private String make;


@JsonProperty("Model")
private String model;


@JsonProperty("RegistrationNumber")
private String registrationNumber;


@JsonProperty("ApplicantDetails")
@JsonProperty("vrm")
private String vrm;
@JsonProperty("applicantDetails")
private ApplicantDetails applicantDetails;
@JsonProperty("adrVehicleType")
private String adrVehicleType;
@JsonProperty("permittedDangerousGoods")


@JsonProperty("VehicleType")
private String vehicleType;


@JsonProperty("PermittedDangerousGoods")
private String[] permittedDangerousGoods;
@JsonProperty("brakeEndurance")


@JsonProperty("BrakeEndurance")
private boolean brakeEndurance;
@JsonProperty("weight")


@JsonProperty("Weight")
private String weight;
@JsonProperty("tankManufacturer")


@JsonProperty("TankManufacturer")
private String tankManufacturer;
@JsonProperty("tankManufactureSerialNo")


@JsonProperty("Tc2InitApprovalNo")
private String tc2InitApprovalNo;


@JsonProperty("TankManufactureSerialNo")
private String tankManufactureSerialNo;


@JsonProperty("YearOfManufacture")
@JsonProperty("tc2InitApprovalNo")

private String tc2InitApprovalNo;
@JsonProperty("yearOfManufacture")

private String yearOfManufacture;


@JsonProperty("TankCode")
@JsonProperty("tankCode")

private String tankCode;
@JsonProperty("specialProvisions")


@JsonProperty("SpecialProvisions")
private String specialProvisions;
@JsonProperty("tankStatement")


@JsonProperty("TankStatement")
private TankStatement tankStatement;


@JsonProperty("ExpiryDate")
private String expiryDate;
@JsonProperty("notes")
private String notes;


@JsonProperty("AtfNameAtfPNumber")
private String atfNameAtfPNumber;
@JsonProperty("replacement")
private boolean replacement;


@JsonProperty("Notes")
private String notes;
@JsonProperty("batteryListNumber")
private String batteryListNumber;


@JsonProperty("TestTypeDate")
private String testTypeDate;
@JsonProperty("m145Statement")
private boolean m145Statement;

public String getChasisNumber() {
return chasisNumber;
public String getVin() {
return vin;
}

public AdrPassCertificateData setChasisNumber(String chasisNumber) {
this.chasisNumber = chasisNumber;
public AdrPassCertificateData setVin(String vin) {
this.vin = vin;
return this;
}

Expand All @@ -106,21 +87,12 @@ public AdrPassCertificateData setMake(String make) {
return this;
}

public String getModel() {
return model;
}

public AdrPassCertificateData setModel(String model) {
this.model = model;
return this;
}

public String getRegistrationNumber() {
return registrationNumber;
public String getVrm() {
return vrm;
}

public AdrPassCertificateData setRegistrationNumber(String registrationNumber) {
this.registrationNumber = registrationNumber;
public AdrPassCertificateData setVrm(String vrm) {
this.vrm = vrm;
return this;
}

Expand All @@ -133,12 +105,12 @@ public AdrPassCertificateData setApplicantDetails(ApplicantDetails applicantDeta
return this;
}

public String getVehicleType() {
return vehicleType;
public String getAdrVehicleType() {
return adrVehicleType;
}

public AdrPassCertificateData setVehicleType(String vehicleType) {
this.vehicleType = vehicleType;
public AdrPassCertificateData setAdrVehicleType(String adrVehicleType) {
this.adrVehicleType = adrVehicleType;
return this;
}

Expand Down Expand Up @@ -232,24 +204,6 @@ public AdrPassCertificateData setTankStatement(TankStatement tankStatement) {
return this;
}

public String getExpiryDate() {
return expiryDate;
}

public AdrPassCertificateData setExpiryDate(String expiryDate) {
this.expiryDate = expiryDate;
return this;
}

public String getAtfNameAtfPNumber() {
return atfNameAtfPNumber;
}

public AdrPassCertificateData setAtfNameAtfPNumber(String atfNameAtfPNumber) {
this.atfNameAtfPNumber = atfNameAtfPNumber;
return this;
}

public String getNotes() {
return notes;
}
Expand Down Expand Up @@ -282,31 +236,58 @@ public boolean getHasNotes4Lines(){
return this.notes.length() >= 474 && this.notes.length() <= 632;
}

public String getTestTypeDate() {
return testTypeDate;
}

public AdrPassCertificateData setTestTypeDate(String testTypeDate) {
this.testTypeDate = testTypeDate;
return this;
}

public String getFormattedPermittedDangerousGoods() {
StringBuilder formattedPermittedDangerousGoods = new StringBuilder("");
if(this.permittedDangerousGoods == null)
return "";
public boolean getPermittedDangerousGoodsHasFL() {
for (String permittedDangerousGood : this.permittedDangerousGoods) {
formattedPermittedDangerousGoods.append(permittedDangerousGood + " ");
if (permittedDangerousGood.equals("FP <61 (FL)")){
return true;
}
}
return formattedPermittedDangerousGoods.toString();
}
return false;
};
public boolean getPermittedDangerousGoodsHasAT() {
for (String permittedDangerousGood : this.permittedDangerousGoods) {
if (permittedDangerousGood.equals("AT")){
return true;
}
}
return false;
};
public boolean getPermittedDangerousGoodsHasMEMU() {
for (String permittedDangerousGood : this.permittedDangerousGoods) {
if (permittedDangerousGood.equals("MEMU")){
return true;
}
}
return false;
};
public boolean getPermittedDangerousGoodsHasEXII() {
for (String permittedDangerousGood : this.permittedDangerousGoods) {
if (permittedDangerousGood.equals("Explosives (type 2)")){
return true;
}
}
return false;
};
public boolean getPermittedDangerousGoodsHasEXIII() {
for (String permittedDangerousGood : this.permittedDangerousGoods) {
if (permittedDangerousGood.equals("Explosives (type 3)")){
return true;
}
}
return false;
};


public boolean getFormattedSubstancesPermitted() { // returns true for the first value that tankStatement can have and false for the other one so it can be processed in view
if(this.tankStatement != null && tankStatement.getSubstancesPermitted() != null && this.tankStatement.getSubstancesPermitted().equals(SUBSTANCES_PERMITTED_OPTION_1)){
return true;
} else {
return false;
}
return this.tankStatement != null && tankStatement.getSubstancesPermitted() != null && this.tankStatement.getSubstancesPermitted().equals(SUBSTANCES_PERMITTED_OPTION_1);
}

public List<String> carriageBodyTypes = Arrays.asList("Rigid skeletal", "Full drawbar skeletal",
"Centre axle skeletal", "Semi trailer skeletal");


public boolean getHasCarriageStatement(){
return (this.getPermittedDangerousGoodsHasEXII() || this.getPermittedDangerousGoodsHasEXIII()) && carriageBodyTypes.contains(adrVehicleType);
}

public boolean getIsTankStatementNull() {
Expand All @@ -318,7 +299,7 @@ public boolean getIsApplicantDetailsNull() {
}

public boolean getIsVehicleTypeNull() {
return this.vehicleType == null;
return this.adrVehicleType == null;
}

public boolean getIsExplosivesType2() {
Expand All @@ -345,4 +326,28 @@ public boolean getIsExplosivesType3() {
}
return false;
}

public boolean isReplacement() {
return replacement;
}

public void setReplacement(boolean replacement) {
this.replacement = replacement;
}

public String isBatteryListNumber() {
return batteryListNumber;
}

public void setBatteryListNumber(String batteryListNumber) {
this.batteryListNumber = batteryListNumber;
}

public boolean isM145Statement() {
return m145Statement;
}

public void setM145Statement(boolean m145Statement) {
this.m145Statement = m145Statement;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ public class TankStatement {
@JsonProperty
private String statement;

@JsonProperty
private String town;

@JsonProperty
private String productList;
Expand All @@ -24,7 +22,6 @@ public TankStatement() {
public TankStatement(String substancesPermitted, String statement, String productList) {
this.substancesPermitted = substancesPermitted;
this.statement = statement;
this.town = town;
this.productList = productList;
}

Expand All @@ -44,13 +41,6 @@ public void setStatement(String statement) {
this.statement = statement;
}

public String getTown() {
return town;
}

public void setTown(String town) {
this.town = town;
}

public String getProductList() {
return productList;
Expand Down
Loading

0 comments on commit 948a629

Please sign in to comment.