235 lines
7.9 KiB
Java
235 lines
7.9 KiB
Java
|
package com.kofax.mobile.sdk.capture.id;
|
||
|
|
||
|
import android.graphics.Bitmap;
|
||
|
import com.kofax.mobile.sdk._internal.extraction.IJsonExactionHelper;
|
||
|
import com.kofax.mobile.sdk._internal.extraction.id.IIdFieldNameConvention;
|
||
|
import com.kofax.mobile.sdk._internal.i;
|
||
|
import com.kofax.mobile.sdk._internal.impl.IBase64ImageDecoder;
|
||
|
import com.kofax.mobile.sdk.capture.model.Field;
|
||
|
import com.kofax.mobile.sdk.capture.model.Id;
|
||
|
import java.io.IOException;
|
||
|
import java.io.ObjectInputStream;
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Map;
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class ConventionBasedJsonIdDeserializer extends Id implements i {
|
||
|
private IJsonExactionHelper ZW;
|
||
|
private String ZX;
|
||
|
private IIdFieldNameConvention acl;
|
||
|
private IBase64ImageDecoder acm;
|
||
|
private transient Map<String, Bitmap> acn = new HashMap();
|
||
|
|
||
|
public ConventionBasedJsonIdDeserializer(IIdFieldNameConvention iIdFieldNameConvention, IJsonExactionHelper iJsonExactionHelper, IBase64ImageDecoder iBase64ImageDecoder, String str) {
|
||
|
if (str == null) {
|
||
|
throw new IllegalArgumentException("json cannot be null");
|
||
|
}
|
||
|
if (iIdFieldNameConvention == null) {
|
||
|
throw new IllegalArgumentException("convention cannot be null");
|
||
|
}
|
||
|
if (iJsonExactionHelper == null) {
|
||
|
throw new IllegalArgumentException("helper cannot be null");
|
||
|
}
|
||
|
this.ZW = iJsonExactionHelper;
|
||
|
iJsonExactionHelper.init(str);
|
||
|
this.acl = iIdFieldNameConvention;
|
||
|
this.acm = iBase64ImageDecoder;
|
||
|
setJson(str);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getDocumentType() {
|
||
|
return this.ZW.getString(this.acl.getDocumentTypeFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getFirstName() {
|
||
|
return this.ZW.getString(this.acl.getFirstNameFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getMiddleName() {
|
||
|
return this.ZW.getString(this.acl.getMiddleNameFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getLastName() {
|
||
|
return this.ZW.getString(this.acl.getLastNameFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getIdNumber() {
|
||
|
return this.ZW.getString(this.acl.getIdNumberFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getDateOfBirth() {
|
||
|
return this.ZW.getString(this.acl.getDateOfBirthFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getAddress() {
|
||
|
return this.ZW.getString(this.acl.getAddress1FieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getGender() {
|
||
|
return this.ZW.getString(this.acl.getGenderFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getZip() {
|
||
|
return this.ZW.getString(this.acl.getZipFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getState() {
|
||
|
return this.ZW.getString(this.acl.getStateFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getCity() {
|
||
|
return this.ZW.getString(this.acl.getCityFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getNameSuffix() {
|
||
|
return this.ZW.getString(this.acl.getNameSuffixFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getAddress2() {
|
||
|
return this.ZW.getString(this.acl.getAddress2FieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getAddress3() {
|
||
|
return this.ZW.getString(this.acl.getAddress3FieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getAddress4() {
|
||
|
return this.ZW.getString(this.acl.getAddress4FieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getAddress5() {
|
||
|
return this.ZW.getString(this.acl.getAddress5FieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getAddress6() {
|
||
|
return this.ZW.getString(this.acl.getAddress6FieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getIdClass() {
|
||
|
return this.ZW.getString(this.acl.getIdClassFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getCountryShort() {
|
||
|
return this.ZW.getString(this.acl.getCountryShortFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getCountry() {
|
||
|
return this.ZW.getString(this.acl.getCountryFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getExpirationDate() {
|
||
|
return this.ZW.getString(this.acl.getDateOfExpirationFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getEyes() {
|
||
|
return this.ZW.getString(this.acl.getEyesFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getHair() {
|
||
|
return this.ZW.getString(this.acl.getHairFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getHeight() {
|
||
|
return this.ZW.getString(this.acl.getHeightFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getIssueDate() {
|
||
|
return this.ZW.getString(this.acl.getDateOfIssueFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getNationality() {
|
||
|
return this.ZW.getString(this.acl.getNationalityFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getWeight() {
|
||
|
return this.ZW.getString(this.acl.getWeightFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getLicense() {
|
||
|
return this.ZW.getString(this.acl.getLicenseFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> isBarcodeRead() {
|
||
|
return this.ZW.getString(this.acl.getIsBarcodeReadFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> isOcrRead() {
|
||
|
return this.ZW.getString(this.acl.getIsOcrReadFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Field<String> getDocumentVerificationConfidenceRating() {
|
||
|
return this.ZW.getString(this.acl.getDocumentVerificationConfidenceFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Bitmap getSignatureImage() {
|
||
|
return getBitmap(this.acl.getSignatureImageFieldName());
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public Bitmap getFaceImage() {
|
||
|
return getBitmap(this.acl.getFaceImageFieldName());
|
||
|
}
|
||
|
|
||
|
Bitmap getBitmap(String str) {
|
||
|
Bitmap bitmap;
|
||
|
if (this.acn.containsKey(str)) {
|
||
|
return this.acn.get(str);
|
||
|
}
|
||
|
Field<String> string = this.ZW.getString(str);
|
||
|
if (string != null) {
|
||
|
bitmap = this.acm.decode(string.getObject());
|
||
|
} else {
|
||
|
bitmap = null;
|
||
|
}
|
||
|
this.acn.put(str, bitmap);
|
||
|
return bitmap;
|
||
|
}
|
||
|
|
||
|
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
||
|
objectInputStream.defaultReadObject();
|
||
|
this.acn = new HashMap();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.i
|
||
|
public void setJson(String str) {
|
||
|
this.ZX = str;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Id
|
||
|
public String getRawData() {
|
||
|
return this.ZX;
|
||
|
}
|
||
|
}
|