use of model.testtypeid.TestCodes in project cvs-auto-svc by dvsa.
the class DataMapper method findTestType.
private static TestTypeById findTestType(List<TestTypeById> listTest, String testTypeClassification, String forVehicleType, String forVehicleSize, String forVehicleConfiguration, String forVehicleAxles) {
Boolean found = false;
TestTypeById testTypeByIdReturned = new TestTypeById();
testTypeLoop: for (TestTypeById testTypeById : listTest) {
if ((testTypeById.getNextTestTypesOrCategories() != null)) {
testTypeByIdReturned = findTestType(testTypeById.getNextTestTypesOrCategories(), testTypeClassification, forVehicleType, forVehicleSize, forVehicleConfiguration, forVehicleAxles);
if (testTypeByIdReturned != null && testTypeByIdReturned.getId() != null) {
return testTypeByIdReturned;
}
} else {
int size = 0;
for (TestCodes testCodes : testTypeById.getTestCodes()) {
size++;
if (testTypeById.getTestTypeClassification().equalsIgnoreCase(testTypeClassification) && testCodes.getForVehicleType().equalsIgnoreCase(forVehicleType) && testCodes.getForVehicleSize().equalsIgnoreCase(forVehicleSize) && testCodes.getForVehicleConfiguration().equalsIgnoreCase(forVehicleConfiguration)) {
if (forVehicleAxles != null) {
if (testTypeByIdReturned.getDefaultTestCode() == null) {
testTypeByIdReturned.setDefaultTestCode(testCodes.getDefaultTestCode());
testTypeByIdReturned.setLinkedTestCode(testCodes.getLinkedTestCode());
}
if (testCodes.getForVehicleAxles().equalsIgnoreCase(forVehicleAxles)) {
testTypeByIdReturned.setTestTypeClassification(testTypeClassification);
testTypeByIdReturned.setId(testTypeById.getId());
testTypeByIdReturned.setDefaultTestCode(testCodes.getDefaultTestCode());
testTypeByIdReturned.setLinkedTestCode(testCodes.getLinkedTestCode());
found = true;
} else if (testTypeById.getTestCodes().size() == size && found == false) {
testTypeByIdReturned.setTestTypeClassification(testTypeClassification);
testTypeByIdReturned.setId(testTypeById.getId());
continue;
} else {
continue;
}
} else {
testTypeByIdReturned.setTestTypeClassification(testTypeClassification);
testTypeByIdReturned.setId(testTypeById.getId());
testTypeByIdReturned.setDefaultTestCode(testCodes.getDefaultTestCode());
testTypeByIdReturned.setLinkedTestCode(testCodes.getLinkedTestCode());
found = true;
break;
}
}
}
}
if (found == true) {
return testTypeByIdReturned;
}
}
return testTypeByIdReturned;
}
use of model.testtypeid.TestCodes in project cvs-auto-svc by dvsa.
the class DataMapper method findNotExistingTestType.
private static TestTypeById findNotExistingTestType(List<TestTypeById> listTest, String testTypeClassification, String forVehicleType, String forVehicleSize, String forVehicleConfiguration, String forVehicleAxles) {
Boolean found = false;
TestTypeById testTypeByIdReturned = new TestTypeById();
testTypeLoop: for (TestTypeById testTypeById : listTest) {
if ((testTypeById.getNextTestTypesOrCategories() != null)) {
testTypeByIdReturned = findNotExistingTestType(testTypeById.getNextTestTypesOrCategories(), testTypeClassification, forVehicleType, forVehicleSize, forVehicleConfiguration, forVehicleAxles);
if (testTypeByIdReturned != null && testTypeByIdReturned.getId() != null) {
return testTypeByIdReturned;
}
} else {
int size = 0;
for (TestCodes testCodes : testTypeById.getTestCodes()) {
size++;
if (!(testTypeById.getTestTypeClassification().equalsIgnoreCase(testTypeClassification) && testCodes.getForVehicleType().equalsIgnoreCase(forVehicleType) && testCodes.getForVehicleSize().equalsIgnoreCase(forVehicleSize) && testCodes.getForVehicleConfiguration().equalsIgnoreCase(forVehicleConfiguration))) {
if (testTypeById.getTestCodes().size() == size && found == false) {
testTypeByIdReturned.setTestTypeClassification(testTypeClassification);
testTypeByIdReturned.setId(testTypeById.getId());
found = true;
}
}
}
}
if (found == true) {
return testTypeByIdReturned;
}
}
return testTypeByIdReturned;
}
Aggregations