Class FormRecognizerServiceImpl
java.lang.Object
com.markvarga21.studentmanager.service.form.impl.FormRecognizerServiceImpl
- All Implemented Interfaces:
FormRecognizerService
@Component
@Generated
public class FormRecognizerServiceImpl
extends Object
implements FormRecognizerService
A service which is used to verify the data entered by the user
against the data which can be found on the uploaded passport.
It uses Azure's Form Recognizer services.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeletePassportValidationByPassportNumber
(String passportNumber) Deletes a passport validation data identified by the passport number.extractDataFromPassport
(org.springframework.web.multipart.MultipartFile passport) Extracts and returns the data from the passport.getFieldsFromDocument
(org.springframework.web.multipart.MultipartFile passport) Extracts all fields from the uploaded passport.isUserValid
(String passportNumber) Checks if the user is valid or not.validatePassport
(String studentJson, org.springframework.web.multipart.MultipartFile passport) Validates the data entered by the user against the data, which can be found-, and has been extracted from the passport.validatePassportManually
(Long studentId) Validates the passport manually.
-
Field Details
-
EMPTY_FIELD_VALUE
The default value if the field is empty.- See Also:
-
-
Constructor Details
-
FormRecognizerServiceImpl
public FormRecognizerServiceImpl()
-
-
Method Details
-
getFieldsFromDocument
public Map<String,com.azure.ai.formrecognizer.documentanalysis.models.DocumentField> getFieldsFromDocument(org.springframework.web.multipart.MultipartFile passport) Extracts all fields from the uploaded passport.- Specified by:
getFieldsFromDocument
in interfaceFormRecognizerService
- Parameters:
passport
- The uploaded passport.- Returns:
- The extracted fields stored in a
Map
.
-
extractDataFromPassport
Extracts and returns the data from the passport.- Specified by:
extractDataFromPassport
in interfaceFormRecognizerService
- Parameters:
passport
- The photo of the passport.- Returns:
- The extracted
StudentDto
object.
-
validatePassport
public PassportValidationResponse validatePassport(String studentJson, org.springframework.web.multipart.MultipartFile passport) Validates the data entered by the user against the data, which can be found-, and has been extracted from the passport.- Specified by:
validatePassport
in interfaceFormRecognizerService
- Parameters:
studentJson
- The student itself in a JSONString
format.passport
- The passport file.- Returns:
- A
PassportValidationResponse
object.
-
deletePassportValidationByPassportNumber
Deletes a passport validation data identified by the passport number.- Specified by:
deletePassportValidationByPassportNumber
in interfaceFormRecognizerService
- Parameters:
passportNumber
- The passport number.- Returns:
- A feedback message.
-
validatePassportManually
Validates the passport manually.- Specified by:
validatePassportManually
in interfaceFormRecognizerService
- Parameters:
studentId
- The id of the student.- Returns:
- An informational message.
-
isUserValid
Checks if the user is valid or not.- Specified by:
isUserValid
in interfaceFormRecognizerService
- Parameters:
passportNumber
- The passport number.- Returns:
true
if the user is valid,false
otherwise.
-