| 
					
				 | 
			
			
				@@ -16,6 +16,8 @@ import com.example.types.FingerprintCompareListItem; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.example.types.PersonFingerprintData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.example.types.VerificationResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import static com.example.utils.JavaResponse.buildJavaResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.example.utils.CheckEdgeScore; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.example.utils.TransparencyContents; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.example.utils.Verification; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.machinezoo.sourceafis.FingerprintImage; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -82,10 +84,10 @@ public class EventHandler { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return handleRegistration(id, imageBase64, fpTemplateList, personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case "verification": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return handleVerification(id, imageBase64, fpTemplateList, personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                case "qualityassurance": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                case "quality assurance": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return handleQualityAssurance(id, imageBase64, fpTemplateList, personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                case "updateRegisteredFingerprints": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return updateRegisteredFingerprints(id, fpTemplateList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                case "populate registered prints": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return populateRegisteredPrints(id, fpTemplateList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // Unknown command fallback 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     JSONObject unknown = new JSONObject(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -116,29 +118,29 @@ public class EventHandler { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // Calculate edge scores to determine fingerprint quality 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            edgeScore.set(TransparencyContents.calculateEdgeScore(imageBytes)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            edgeScore = CheckEdgeScore.calculateEdgeScore(imageBytes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // If no existing templates are provided, register the new one 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (templateArray == null || templateArray.length <= 0 && registeredFingerprints.length <= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // Register this new template 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                String response = buildJavaResponse(id, "Registration", "Success", "No existing templates. Registered as new.", probeTemplate, 100.0, edgeScore.get(), personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String response = buildJavaResponse(id, "Registration", "Success", "No existing templates. Registered as new.", probeTemplate, 100.0, edgeScore, personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return response.toString();  // Return the response as a JSON string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             VerificationResult matchedPerson = Verification.verifyFingeprint(probeTemplate, templateArray, registeredFingerprints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // Return response based on score 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (matchedPerson != null) { // Match found 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                String response = buildJavaResponse(id, "Registration", "Registered", "Existing Fingerprint template found for " + matchedPerson + "!", probeTemplate, matchedPerson.getScore(), edgeScore.get(), personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String response = buildJavaResponse(id, "Registration", "Registered", "Existing Fingerprint template found for " + matchedPerson + "!", probeTemplate, matchedPerson.getScore(), edgeScore, personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return response; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // Register new template 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                String response = buildJavaResponse(id, "Registration", "Success", "New fingerprint template constructed.", probeTemplate, 100.0, edgeScore.get(), personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String response = buildJavaResponse(id, "Registration", "Success", "New fingerprint template constructed.", probeTemplate, 100.0, edgeScore, personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return response.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // Handle errors during registration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String errorResponse = buildJavaResponse(id, "Registration", "Failed", "Template Construction Failed: " + e.getMessage(), null, 0.0, 0, personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String errorResponse = buildJavaResponse(id, "Registration", "Failed", "Template Construction Failed: " + e.getMessage(), null, 0.0, null, personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return errorResponse.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -157,20 +159,20 @@ public class EventHandler { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             FingerprintTemplate probeTemplate = new FingerprintTemplate(new FingerprintImage(imageBytes)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // Calculate edge scores to determine fingerprint quality 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            edgeScore.set(TransparencyContents.calculateEdgeScore(imageBytes)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            edgeScore = CheckEdgeScore.calculateEdgeScore(imageBytes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             VerificationResult matchedPerson = Verification.verifyFingeprint(probeTemplate, templateArray, registeredFingerprints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // Return response based on score 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (matchedPerson != null) { // Match found 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return buildJavaResponse(id, "Verification", "Registered", "Existing Fingerprint template found for " + matchedPerson.getName() + "!", probeTemplate, matchedPerson.getScore(), edgeScore.get(), personInfo, fingerPosition).toString().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return buildJavaResponse(id, "Verification", "Registered", "Existing Fingerprint template found for " + matchedPerson.getName() + "!", probeTemplate, matchedPerson.getScore(), null, personInfo, fingerPosition).toString().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // Register new template 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return buildJavaResponse(id, "Verification", "Not Registered", "Fingerprint Data Not found.", probeTemplate, 0, 0, personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return buildJavaResponse(id, "Verification", "Not Registered", "Fingerprint Data Not found.", probeTemplate, 0, null, personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String errorResponse = buildJavaResponse(id, "Verification", "Failed", "Verification operation faulty...", null, 0, 0, personInfo, fingerPosition); // defaul value 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String errorResponse = buildJavaResponse(id, "Verification", "Failed", "Verification operation faulty...", null, 0, null, personInfo, fingerPosition); // defaul value 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return errorResponse.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -189,31 +191,44 @@ public class EventHandler { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             FingerprintTemplate probeTemplate = new FingerprintTemplate(new FingerprintImage(imageBytes)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // Calculate edge scores to determine fingerprint quality 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            edgeScore.set(TransparencyContents.calculateEdgeScore(imageBytes)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            System.out.println("Edge Score " + edgeScore); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            edgeScore = CheckEdgeScore.calculateEdgeScore(imageBytes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             VerificationResult matchedPerson = Verification.verifyFingeprint(probeTemplate, templateArray, registeredFingerprints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // Return response based on score 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (matchedPerson != null) { // Match found 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return buildJavaResponse(id, "QualityAssurance", "Registered", "Registered fingeprint. ", null, 0, edgeScore.get(), personInfo, fingerPosition).toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return buildJavaResponse(id, "Quality Assurance", "Registered", "Registered fingeprint. ", null, 0, edgeScore, personInfo, fingerPosition).toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return buildJavaResponse(id, "QualityAssurance", "Not Registered", "New Fingerprint detected...", probeTemplate, 100, edgeScore.get(), personInfo, fingerPosition).toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return buildJavaResponse(id, "Quality Assurance", "Not Registered", "New Fingerprint detected...", probeTemplate, 100, edgeScore, personInfo, fingerPosition).toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // Handle errors during checking 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String errorResponse = buildJavaResponse(id, "QualityAssurance", "Failed", "Unable to produce Edge score... " + e.getMessage(), null, 0.0, 0, personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String errorResponse = buildJavaResponse(id, "Quality Assurance", "Failed", "Unable to produce Edge score... " + e.getMessage(), null, 0.0, null, personInfo, fingerPosition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return errorResponse.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public static String updateRegisteredFingerprints(String id, FingerprintCompareListItem[] fpTemplateList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static String populateRegisteredPrints(String id, FingerprintCompareListItem[] fpTemplateList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return "response here for now..."; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return "error response here for now..."; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // Static helper method to use this class easily 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // public static AtomicInteger CheckEdgeScore.calculateEdgeScore(byte[] imageBytes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //     AtomicInteger edgeScore = new AtomicInteger(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //     try (TransparencyContents transparency = new TransparencyContents()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //         // FingerprintTemplate probe = new FingerprintTemplate(new FingerprintImage(imageBytes)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //         transparency.accepts("edge-table"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //         transparency.take("edge-table", "application/cbor", imageBytes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //         // System.out.println(imageBytes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //         edgeScore.set(transparency.countEdgeNumber()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //     } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //         System.out.println("Error calculating edge score: " + e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //     return edgeScore; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |