diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c5c5421..055514c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,7 +1,7 @@
name: Publish package to GitHub Packages
on:
release:
- types: [created]
+ types: [ created ]
jobs:
publish:
runs-on: ubuntu-latest
diff --git a/MessageBundle.properties b/MessageBundle.properties
index 4336b05..2684316 100644
--- a/MessageBundle.properties
+++ b/MessageBundle.properties
@@ -50,7 +50,6 @@ m2sys.response.error.CS077="Picture capture not permitted by Biometric api";
m2sys.response.error.CS078="BioMetricWith: Default value not permitted.";
m2sys.response.error.CS079="BiometricImage license not available"
m2sys.response.error.CS036="Capture data not found"
-
// BiometricEngineStatus status code descriptions
m2sys.getStatus.decription.200="Everything works fine"
m2sys.getStatus.decription.default="Server doesn't work properly"
diff --git a/MessageBundle_es.properties b/MessageBundle_es.properties
index 4336b05..2684316 100644
--- a/MessageBundle_es.properties
+++ b/MessageBundle_es.properties
@@ -50,7 +50,6 @@ m2sys.response.error.CS077="Picture capture not permitted by Biometric api";
m2sys.response.error.CS078="BioMetricWith: Default value not permitted.";
m2sys.response.error.CS079="BiometricImage license not available"
m2sys.response.error.CS036="Capture data not found"
-
// BiometricEngineStatus status code descriptions
m2sys.getStatus.decription.200="Everything works fine"
m2sys.getStatus.decription.default="Server doesn't work properly"
diff --git a/MessageBundle_fr.properties b/MessageBundle_fr.properties
index 4336b05..2684316 100644
--- a/MessageBundle_fr.properties
+++ b/MessageBundle_fr.properties
@@ -50,7 +50,6 @@ m2sys.response.error.CS077="Picture capture not permitted by Biometric api";
m2sys.response.error.CS078="BioMetricWith: Default value not permitted.";
m2sys.response.error.CS079="BiometricImage license not available"
m2sys.response.error.CS036="Capture data not found"
-
// BiometricEngineStatus status code descriptions
m2sys.getStatus.decription.200="Everything works fine"
m2sys.getStatus.decription.default="Server doesn't work properly"
diff --git a/README.md b/README.md
index bdc39d5..3170937 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,18 @@
-
# iSantePlus m2Sys Biometrics Module
+
[](https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/actions/workflows/ci.yml)
[](https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/actions/workflows/release.yml)
-This an implementation of the Biometrics interfaces from the registration core module that use the m2sys Biometrics server. The module uses the CloudScanner API by m2sys in order to communicate with the server and invoke the fingerprint reader.
+This an implementation of the Biometrics interfaces from the registration core module that use the m2sys Biometrics server.
+The module uses the CloudScanner API by m2sys in order to communicate with the server and invoke the fingerprint reader.
## Requirements
To set up this module, so it works properly there are three things needed:
+
- BioPlugin server 8
-- Cloudscanner
+- Cloudscanner
- M2Sys fingerprint reader
This module is using REST to communicate with CloudScanner API and send requests.
@@ -23,8 +25,8 @@ In order to build the module you must use mvn command. Example below:
mvn clean install
```
-Note: in the api/src/main/resource/wsdl directory you can find the BioPlugin Web Service WSDL file.
-Currently the module uses the **V8** version of the service.
+Note: in the api/src/main/resource/wsdl directory you can find the BioPlugin Web Service WSDL file. Currently the module uses
+the **V8** version of the service.
## Worklflow
@@ -36,19 +38,23 @@ Currently the module uses the **V8** version of the service.
6. This module sends a REST request to the national CloudABIS server
7. This module gets the response from both the local BioPlugin server and the national CloudABIS server interprets it.
8. If the fingerprint(s) are missing in either of the servers, this module registers them
-9. If a patient already exists with a biometric identifier matching the processed Id, this module prompts the use to laod that patient
+9. If a patient already exists with a biometric identifier matching the processed Id, this module prompts the use to laod
+ that patient
## Configuration variables
### Template if no scanner exists
-If no fingerprint scanner exists, simulations may be performed using a pre-loaded fingerprint template to be stored as a global property:
+If no fingerprint scanner exists, simulations may be performed using a pre-loaded fingerprint template to be stored as a
+global property:
m2sys-biometrics.server.constTestTemplate - String representation of the fingerprint template
### Local variables
+
m2sys-biometrics.accessPointID - The m2sys server AccessPointID
-m2sys-biometrics.accessPointMap - A map of IP addresses to Access Point IDs. Has format of IP1:AccessPointID1;IP2:AccessPointID2;...
-For example 127.0.0.1:APID1;8.8.8.8:APID2... The IPs must match the IPs of the clients calling the server.
+m2sys-biometrics.accessPointMap - A map of IP addresses to Access Point IDs. Has format of IP1:AccessPointID1;IP2:
+AccessPointID2;... For example 127.0.0.1:APID1;8.8.8.8:APID2... The IPs must match the IPs of the clients calling the
+server.
m2sys-biometrics.captureTimeout - The m2sys server CaptureTimeout
m2sys-biometrics.customKey - The m2sys server CustomKey
m2sys-biometrics.locationID - The m2sys server location ID
@@ -59,6 +65,7 @@ m2sys-biometrics.server.user - The m2sys server username
m2sys-biometrics.local-service.url - The URL to the SOAP service of the local (local to the clinic) M2Sys BioPlugin Server.
### National variables
+
m2sys-biometrics.cloudabis.app.key - The cloud client app key
m2sys-biometrics.cloudabis.secret.key - The cloud client secret key
m2sys-biometrics.cloudabis.grant.type - The cloud client grant type
diff --git a/api/pom.xml b/api/pom.xml
index 1da19bf..a55cdca 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -1,114 +1,114 @@
-
- 4.0.0
-
- org.openmrs.module
- m2sys-biometrics
- 1.2.0-SNAPSHOT
-
+ 4.0.0
+
+ org.openmrs.module
+ m2sys-biometrics
+ 1.2.0-SNAPSHOT
+
- m2sys-biometrics-api
- jar
- m2sys Biometrics Module API
- API project for m2SysBiometrics
+ m2sys-biometrics-api
+ jar
+ m2sys Biometrics Module API
+ API project for m2SysBiometrics
-
-
- org.openmrs
- event-api-2.x
-
-
- org.openmrs.module
- idgen-api
-
-
- org.openmrs.api
- openmrs-api
- jar
-
+
+
+ org.openmrs
+ event-api-2.x
+
+
+ org.openmrs.module
+ idgen-api
+
+
+ org.openmrs.api
+ openmrs-api
+ jar
+
-
- org.openmrs.api
- openmrs-api
- test-jar
- test
-
-
- org.openmrs.module
- registrationcore-api
- ${registrationCoreVersion}
- system
- ${project.basedir}/lib/registrationcore-api.jar
-
+
+ org.openmrs.api
+ openmrs-api
+ test-jar
+ test
+
+
+ org.openmrs.module
+ registrationcore-api
+ ${registrationCoreVersion}
+ system
+ ${project.basedir}/lib/registrationcore-api.jar
+
-
- commons-httpclient
- commons-httpclient
-
-
- org.apache.servicemix.bundles
- org.apache.servicemix.bundles.spring-web
-
-
- org.springframework.ws
- spring-ws-core
-
-
- org.mockito
- mockito-all
-
-
- com.github.tomakehurst
- wiremock
- 2.7.1
- test
-
-
- org.apache.httpcomponents
- httpclient
- 4.5.13
- test
-
-
- javax.servlet
- javax.servlet-api
-
-
+
+ commons-httpclient
+ commons-httpclient
+
+
+ org.apache.servicemix.bundles
+ org.apache.servicemix.bundles.spring-web
+
+
+ org.springframework.ws
+ spring-ws-core
+
+
+ org.mockito
+ mockito-all
+
+
+ com.github.tomakehurst
+ wiremock
+ 2.7.1
+ test
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.13
+ test
+
+
+ javax.servlet
+ javax.servlet-api
+
+
-
-
-
- src/main/resources
- true
-
-
-
-
- src/test/resources
- true
-
-
-
-
- org.jvnet.jaxb2.maven2
- maven-jaxb2-plugin
- 0.13.1
-
-
-
- generate
-
-
-
-
- WSDL
- org.openmrs.module.m2sysbiometrics.bioplugin
- ${project.basedir}/src/main/resources/wsdl
-
- *.wsdl
-
-
-
-
-
+
+
+
+ src/main/resources
+ true
+
+
+
+
+ src/test/resources
+ true
+
+
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin
+ 0.13.1
+
+
+
+ generate
+
+
+
+
+ WSDL
+ org.openmrs.module.m2sysbiometrics.bioplugin
+ ${project.basedir}/src/main/resources/wsdl
+
+ *.wsdl
+
+
+
+
+
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/M2SysBiometricsActivator.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/M2SysBiometricsActivator.java
index 3355eaa..663078c 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/M2SysBiometricsActivator.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/M2SysBiometricsActivator.java
@@ -24,17 +24,17 @@
*/
public class M2SysBiometricsActivator extends BaseModuleActivator {
- private static final Logger LOGGER = LoggerFactory.getLogger(M2SysBiometricsActivator.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(M2SysBiometricsActivator.class);
- @Override
- public void started() {
- LOGGER.info("Starting m2sys Biometrics Module");
- Context.getRegisteredComponents(M2SysSchedulerServiceImpl.class).get(0).runM2SysScheduler();
- }
+ @Override
+ public void started() {
+ LOGGER.info("Starting m2sys Biometrics Module");
+ Context.getRegisteredComponents(M2SysSchedulerServiceImpl.class).get(0).runM2SysScheduler();
+ }
- @Override
- public void stopped() {
- LOGGER.info("Shutting down m2sys Biometrics Module");
- }
+ @Override
+ public void stopped() {
+ LOGGER.info("Shutting down m2sys Biometrics Module");
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/M2SysBiometricsConstants.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/M2SysBiometricsConstants.java
index b31cfc5..236bfab 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/M2SysBiometricsConstants.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/M2SysBiometricsConstants.java
@@ -5,71 +5,78 @@
public final class M2SysBiometricsConstants {
- public static final String M2SYS_CLOUD_SCANR_URL = "m2sys-biometrics.server.url";
+ public static final String M2SYS_CLOUD_SCANR_URL = "m2sys-biometrics.server.url";
- public static final String M2SYS_CAPTURE_DEVICE_NAME = "m2sys-biometrics.device.name";
+ public static final String M2SYS_CAPTURE_DEVICE_NAME = "m2sys-biometrics.device.name";
- // public static final String M2SYS_CLOUD_SCANR_USERNAME = "m2sys-biometrics.server.user";
+ // public static final String M2SYS_CLOUD_SCANR_USERNAME = "m2sys-biometrics.server.user";
- // public static final String M2SYS_CLOUD_SCANR_PASSWORD = "m2sys-biometrics.server.password";
+ // public static final String M2SYS_CLOUD_SCANR_PASSWORD = "m2sys-biometrics.server.password";
- public static final String M2SYS_LOCAL_SERVICE_URL = "m2sys-biometrics.local-service.url";
+ public static final String M2SYS_LOCAL_SERVICE_URL = "m2sys-biometrics.local-service.url";
- public static final String M2SYS_NATIONAL_SERVICE_URL = "m2sys-biometrics.national-service.url";
+ public static final String M2SYS_NATIONAL_SERVICE_URL = "m2sys-biometrics.national-service.url";
- public static final String M2SYS_NATIONAL_USERNAME = "m2sys-biometrics.server.national.user";
+ public static final String M2SYS_NATIONAL_USERNAME = "m2sys-biometrics.server.national.user";
- public static final String M2SYS_NATIONAL_PASSWORD = "m2sys-biometrics.server.national.password";
+ public static final String M2SYS_NATIONAL_PASSWORD = "m2sys-biometrics.server.national.password";
- public static final String M2SYS_LOCATION_ID = "m2sys-biometrics.locationID";
+ public static final String M2SYS_LOCATION_ID = "m2sys-biometrics.locationID";
- // public static final String M2SYS_CUSTOMER_KEY = "m2sys-biometrics.customKey";
+ // public static final String M2SYS_CUSTOMER_KEY = "m2sys-biometrics.customKey";
- // public static final String M2SYS_ACCESS_POINT_ID = "m2sys-biometrics.accessPointID";
+ // public static final String M2SYS_ACCESS_POINT_ID = "m2sys-biometrics.accessPointID";
- // public static final String M2SYS_ACCESS_POINT_MAP = "m2sys-biometrics.accessPointMap";
+ // public static final String M2SYS_ACCESS_POINT_MAP = "m2sys-biometrics.accessPointMap";
- public static final String M2SYS_CAPTURE_TIMEOUT = "m2sys-biometrics.captureTimeout";
+ public static final String M2SYS_CAPTURE_TIMEOUT = "m2sys-biometrics.captureTimeout";
- public static final String M2SYS_NATIONAL_REGISTRATIONS_TASK_INTERVAL = "m2sys-biometrics"
- + ".nationalRegistrationTaskInterval";
+ public static final String M2SYS_NATIONAL_REGISTRATIONS_TASK_INTERVAL = "m2sys-biometrics"
+ + ".nationalRegistrationTaskInterval";
- public static final String M2SYS_LOOKUP_ENDPOINT = "/api/Biometric/IsRegistered";
+ public static final String M2SYS_LOOKUP_ENDPOINT = "/api/Biometric/IsRegistered";
- public static final String M2SYS_SEARCH_ENDPOINT = "/api/Biometric/Identify";
+ public static final String M2SYS_SEARCH_ENDPOINT = "/api/Biometric/Identify";
- public static final String M2SYS_REGISTER_ENDPOINT = "/api/Biometric/Register";
+ public static final String M2SYS_REGISTER_ENDPOINT = "/api/Biometric/Register";
- public static final String M2SYS_UPDATE_ENDPOINT = "/api/Biometric/Update";
+ public static final String M2SYS_UPDATE_ENDPOINT = "/api/Biometric/Update";
- public static final String M2SYS_DELETE_ID_ENDPOINT = "/api/Biometric/DeleteID";
+ public static final String M2SYS_DELETE_ID_ENDPOINT = "/api/Biometric/DeleteID";
- public static final String M2SYS_CHANGE_ID_ENDPOINT = "/api/Biometric/ChangeID";
+ public static final String M2SYS_CHANGE_ID_ENDPOINT = "/api/Biometric/ChangeID";
- public static final String M2SYS_CAPTURE_ENDPOINT = "/api/CloudScanr/FPCapture";
+ public static final String M2SYS_CAPTURE_ENDPOINT = "/api/CloudScanr/FPCapture";
- public static final String ERROR_CODE_OF_SUBJECT_NOT_EXIST = "CS004";
+ public static final String ERROR_CODE_OF_SUBJECT_NOT_EXIST = "CS004";
- // if this system var is set, always returns the value as the template, skipping scanning
- public static final String CONST_TEST_TEMPLATE = "m2sys-biometrics.server.constTestTemplate";
+ // if this system var is set, always returns the value as the template, skipping scanning
+ public static final String CONST_TEST_TEMPLATE = "m2sys-biometrics.server.constTestTemplate";
- public static final String M2SYS_CLOUDABIS_APP_KEY = "m2sys-biometrics.cloudabis.app.key";
- public static final String M2SYS_CLOUDABIS_SECRET_KEY = "m2sys-biometrics.cloudabis.secret.key";
- public static final String M2SYS_CLOUDABIS_GRANT_TYPE = "m2sys-biometrics.cloudabis.grant.type";
- public static final String M2SYS_CLOUDABIS_API_URL = "m2sys-biometrics.cloudabis.api.url";
- public static final String M2SYS_CLOUDABIS_CUSTOMER_KEY = "m2sys-biometrics.cloudabis.customer.key";
- public static final String M2SYS_CLOUDABIS_ENGINE_NAME = "m2sys-biometrics.cloudabis.engine.name";
- public static final String M2SYS_CLOUDABIS_TEMPLATE_FORMAT = "m2sys-biometrics.cloudabis.template.format";
+ public static final String M2SYS_CLOUDABIS_APP_KEY = "m2sys-biometrics.cloudabis.app.key";
- public static String getErrorMessage(String errorCode) {
- return ResourceBundle.getBundle("MessageBundle").getString("m2sys.response.error." + errorCode);
- }
+ public static final String M2SYS_CLOUDABIS_SECRET_KEY = "m2sys-biometrics.cloudabis.secret.key";
- public static String getServerStatusDescription(int responseCode) {
- try {
- return ResourceBundle.getBundle("MessageBundle").getString("m2sys.getStatus.decription." + responseCode);
- } catch (MissingResourceException ex) {
- return ResourceBundle.getBundle("MessageBundle").getString("m2sys.getStatus.decription.default");
- }
- }
+ public static final String M2SYS_CLOUDABIS_GRANT_TYPE = "m2sys-biometrics.cloudabis.grant.type";
+
+ public static final String M2SYS_CLOUDABIS_API_URL = "m2sys-biometrics.cloudabis.api.url";
+
+ public static final String M2SYS_CLOUDABIS_CUSTOMER_KEY = "m2sys-biometrics.cloudabis.customer.key";
+
+ public static final String M2SYS_CLOUDABIS_ENGINE_NAME = "m2sys-biometrics.cloudabis.engine.name";
+
+ public static final String M2SYS_CLOUDABIS_TEMPLATE_FORMAT = "m2sys-biometrics.cloudabis.template.format";
+
+ public static String getErrorMessage(String errorCode) {
+ return ResourceBundle.getBundle("MessageBundle").getString("m2sys.response.error." + errorCode);
+ }
+
+ public static String getServerStatusDescription(int responseCode) {
+ try {
+ return ResourceBundle.getBundle("MessageBundle").getString("m2sys.getStatus.decription." + responseCode);
+ }
+ catch (MissingResourceException ex) {
+ return ResourceBundle.getBundle("MessageBundle").getString("m2sys.getStatus.decription.default");
+ }
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/M2SysEngine.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/M2SysEngine.java
index b85bad7..accc547 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/M2SysEngine.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/M2SysEngine.java
@@ -1,6 +1,8 @@
package org.openmrs.module.m2sysbiometrics;
+import java.util.List;
import java.util.UUID;
+
import org.apache.commons.lang3.StringUtils;
import org.openmrs.module.m2sysbiometrics.client.M2SysClient;
import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
@@ -14,98 +16,96 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import java.util.List;
-
@Component("m2sysbiometrics.M2SysEngine")
public class M2SysEngine implements BiometricEngine {
- private static final Logger LOGGER = LoggerFactory.getLogger(M2SysEngine.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(M2SysEngine.class);
- @Autowired
- private M2SysClient client;
+ @Autowired
+ private M2SysClient client;
- /**
- * Gets a status of biometric server.
- */
- @Override
- public BiometricEngineStatus getStatus() {
- return client.getStatus();
- }
+ /**
+ * Gets a status of biometric server.
+ */
+ @Override
+ public BiometricEngineStatus getStatus() {
+ return client.getStatus();
+ }
- @Override
- public EnrollmentResult enroll() {
- LOGGER.info("Called enroll()");
- BiometricSubject subjectId = generateSubjectId();
- return client.enroll(subjectId);
- }
+ @Override
+ public EnrollmentResult enroll() {
+ LOGGER.info("Called enroll()");
+ BiometricSubject subjectId = generateSubjectId();
+ return client.enroll(subjectId);
+ }
- @Override
- public EnrollmentResult enroll(String fingerprintsXmlTemplate) {
- LOGGER.info("Called enroll(String fingerprintsXmlTemplate)");
- if (StringUtils.isBlank(fingerprintsXmlTemplate)) {
- throw new M2SysBiometricsException("Fingerprints XML cannot be blank");
- }
- BiometricSubject subjectId = generateSubjectId();
- return client.enroll(subjectId, fingerprintsXmlTemplate);
- }
+ @Override
+ public EnrollmentResult enroll(String fingerprintsXmlTemplate) {
+ LOGGER.info("Called enroll(String fingerprintsXmlTemplate)");
+ if (StringUtils.isBlank(fingerprintsXmlTemplate)) {
+ throw new M2SysBiometricsException("Fingerprints XML cannot be blank");
+ }
+ BiometricSubject subjectId = generateSubjectId();
+ return client.enroll(subjectId, fingerprintsXmlTemplate);
+ }
- private BiometricSubject generateSubjectId() {
- BiometricSubject subjectId = new BiometricSubject(UUID.randomUUID().toString());
- LOGGER.debug(String.format("Generated a new SubjectId: %s", subjectId.getSubjectId()));
- return subjectId;
- }
+ private BiometricSubject generateSubjectId() {
+ BiometricSubject subjectId = new BiometricSubject(UUID.randomUUID().toString());
+ LOGGER.debug(String.format("Generated a new SubjectId: %s", subjectId.getSubjectId()));
+ return subjectId;
+ }
- /**
- * Updates subject on M2Sys server.
- *
- * @param subject to update
- * @return updated subject
- */
- @Override
- public BiometricSubject update(BiometricSubject subject) {
- return client.update(subject);
- }
+ /**
+ * Updates subject on M2Sys server.
+ *
+ * @param subject to update
+ * @return updated subject
+ */
+ @Override
+ public BiometricSubject update(BiometricSubject subject) {
+ return client.update(subject);
+ }
- /**
- * Updates subject identifier on M2Sys server.
- *
- * @param oldId an old ID
- * @param newId a new ID
- * @return updated subject
- */
- @Override
- public BiometricSubject updateSubjectId(String oldId, String newId) {
- return client.updateSubjectId(oldId, newId);
- }
+ /**
+ * Updates subject identifier on M2Sys server.
+ *
+ * @param oldId an old ID
+ * @param newId a new ID
+ * @return updated subject
+ */
+ @Override
+ public BiometricSubject updateSubjectId(String oldId, String newId) {
+ return client.updateSubjectId(oldId, newId);
+ }
- /**
- * Scan fingerprints and return matching patients.
- *
- * @return a list of matching data from M2Sys Server
- */
- @Override
- public List search(BiometricSubject subject) {
- return client.search();
- }
+ /**
+ * Scan fingerprints and return matching patients.
+ *
+ * @return a list of matching data from M2Sys Server
+ */
+ @Override
+ public List search(BiometricSubject subject) {
+ return client.search();
+ }
- /**
- * Lookup a biometric data using a given id of pattern subject.
- *
- * @param subjectId a pattern subject Id
- * @return a biometric subject object
- */
- @Override
- public BiometricSubject lookup(String subjectId) {
- return client.lookup(subjectId);
- }
+ /**
+ * Lookup a biometric data using a given id of pattern subject.
+ *
+ * @param subjectId a pattern subject Id
+ * @return a biometric subject object
+ */
+ @Override
+ public BiometricSubject lookup(String subjectId) {
+ return client.lookup(subjectId);
+ }
- /**
- * Deleting a biometric subject with a specific id
- *
- * @param subjectId a biometric subject id
- */
- @Override
- public void delete(String subjectId) {
- client.delete(subjectId);
- }
+ /**
+ * Deleting a biometric subject with a specific id
+ *
+ * @param subjectId a biometric subject id
+ */
+ @Override
+ public void delete(String subjectId) {
+ client.delete(subjectId);
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/AbstractBioServerClient.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/AbstractBioServerClient.java
index 4bca36e..e4bf2f3 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/AbstractBioServerClient.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/AbstractBioServerClient.java
@@ -1,149 +1,149 @@
package org.openmrs.module.m2sysbiometrics.bioplugin;
+import javax.annotation.PostConstruct;
+
import org.openmrs.module.m2sysbiometrics.M2SysBiometricsConstants;
import org.openmrs.module.m2sysbiometrics.util.M2SysProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.context.ApplicationContext;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
import org.springframework.ws.WebServiceException;
-import org.springframework.ws.WebServiceMessageFactory;
import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
-import javax.annotation.PostConstruct;
-
public abstract class AbstractBioServerClient extends WebServiceGatewaySupport implements BioServerClient {
- private static final String LOCATION_ID_PROPERTY = M2SysBiometricsConstants.M2SYS_LOCATION_ID;
- private static final Logger logger = LoggerFactory.getLogger(AbstractBioServerClient.class);
-
- @Autowired
- @Qualifier("m2sysbiometrics.jax2b")
- private Jaxb2Marshaller marshaller;
-
- @Autowired
- private M2SysProperties properties;
-
- @Autowired
- @Qualifier("m2sysbiometrics.messageFactory")
- protected SaajSoapMessageFactory messageFactory;
-
- @PostConstruct
- public void init() {
- setMarshaller(marshaller);
- setUnmarshaller(marshaller);
- setMessageFactory(messageFactory);
- }
-
- @Override
- public String enroll(String subjectId, String biometricXml) {
- Register register = new Register();
- register.setLocationID(getLocationId());
- register.setID(subjectId);
-
- register.setBiometricXml(biometricXml);
- RegisterResponse response;
- try {
- response = (RegisterResponse) getResponse(register);
- }catch (Exception ex) {
- logger.error(ex.getMessage());
- return null;
- }
- return response.getRegisterResult();
- }
-// @Override
-// public String enroll(BiometricSubject biometricSubject) {
-// Register register = new Register();
-// register.setLocationID(getLocationId());
-// register.setID(biometricSubject.getSubjectId());
-//
-// register.setBiometricXml(marshaller.marshal(biometricSubject.));
-// RegisterResponse response;
-// try {
-// response = (RegisterResponse) getResponse(register);
-// }catch (Exception ex) {
-// logger.error(ex.getMessage());
-// return null;
-// }
-// return response.getRegisterResult();
-// }
-
- @Override
- public String isRegistered(String subjectId) {
- IsRegistered isRegistered = new IsRegistered();
- isRegistered.setID(subjectId);
-
- IsRegisteredResponse response = (IsRegisteredResponse) getResponse(isRegistered);
-
- return response.getIsRegisteredResult();
- }
-
- @Override
- public String changeId(String oldId, String newId) {
- ChangeID changeID = new ChangeID();
- changeID.setNewID(newId);
- changeID.setOldID(oldId);
-
- ChangeIDResponse response = (ChangeIDResponse) getResponse(changeID);
-
- return response.getChangeIDResult();
- }
-
- @Override
- public String update(String subjectId, String biometricXml) {
- Update update = new Update();
- update.setLocationID(getLocationId());
- update.setID(subjectId);
-
- update.setBiometricXml(biometricXml);
-
- UpdateResponse response = (UpdateResponse) getResponse(update);
-
- return response.getUpdateResult();
- }
-
- @Override
- public String identify(String biometricXml) {
- Identify identify = new Identify();
-
- identify.setBiometricXml(biometricXml);
- identify.setLocationID(getLocationId());
-
- IdentifyResponse response = (IdentifyResponse) getResponse(identify);
-
- return response.identifyResult;
- }
-
- @Override
- public String delete(String subjectId) {
- DeleteID deleteID = new DeleteID();
- deleteID.setID(subjectId);
-
- DeleteIDResponse response = (DeleteIDResponse) getResponse(deleteID);
- return response.getDeleteIDResult();
- }
-
- @Override
- public boolean isServerUrlConfigured() {
- return properties.isGlobalPropertySet(getServerUrlPropertyName());
- }
-
- protected abstract String getServerUrlPropertyName();
-
- protected abstract Object getResponse(Object requestPayload) throws WebServiceException;
-
- protected String getProperty(String propertyName) {
- return properties.getGlobalProperty(propertyName);
- }
-
- protected String getServiceUrl() {
- return getProperty(getServerUrlPropertyName());
- }
-
- private int getLocationId() {
- return Integer.parseInt(getProperty(LOCATION_ID_PROPERTY));
- }
+ private static final String LOCATION_ID_PROPERTY = M2SysBiometricsConstants.M2SYS_LOCATION_ID;
+
+ private static final Logger logger = LoggerFactory.getLogger(AbstractBioServerClient.class);
+
+ @Autowired
+ @Qualifier("m2sysbiometrics.messageFactory")
+ protected SaajSoapMessageFactory messageFactory;
+
+ @Autowired
+ @Qualifier("m2sysbiometrics.jax2b")
+ private Jaxb2Marshaller marshaller;
+
+ @Autowired
+ private M2SysProperties properties;
+
+ @PostConstruct
+ public void init() {
+ setMarshaller(marshaller);
+ setUnmarshaller(marshaller);
+ setMessageFactory(messageFactory);
+ }
+
+ @Override
+ public String enroll(String subjectId, String biometricXml) {
+ Register register = new Register();
+ register.setLocationID(getLocationId());
+ register.setID(subjectId);
+
+ register.setBiometricXml(biometricXml);
+ RegisterResponse response;
+ try {
+ response = (RegisterResponse) getResponse(register);
+ }
+ catch (Exception ex) {
+ logger.error(ex.getMessage());
+ return null;
+ }
+ return response.getRegisterResult();
+ }
+ // @Override
+ // public String enroll(BiometricSubject biometricSubject) {
+ // Register register = new Register();
+ // register.setLocationID(getLocationId());
+ // register.setID(biometricSubject.getSubjectId());
+ //
+ // register.setBiometricXml(marshaller.marshal(biometricSubject.));
+ // RegisterResponse response;
+ // try {
+ // response = (RegisterResponse) getResponse(register);
+ // }catch (Exception ex) {
+ // logger.error(ex.getMessage());
+ // return null;
+ // }
+ // return response.getRegisterResult();
+ // }
+
+ @Override
+ public String isRegistered(String subjectId) {
+ IsRegistered isRegistered = new IsRegistered();
+ isRegistered.setID(subjectId);
+
+ IsRegisteredResponse response = (IsRegisteredResponse) getResponse(isRegistered);
+
+ return response.getIsRegisteredResult();
+ }
+
+ @Override
+ public String changeId(String oldId, String newId) {
+ ChangeID changeID = new ChangeID();
+ changeID.setNewID(newId);
+ changeID.setOldID(oldId);
+
+ ChangeIDResponse response = (ChangeIDResponse) getResponse(changeID);
+
+ return response.getChangeIDResult();
+ }
+
+ @Override
+ public String update(String subjectId, String biometricXml) {
+ Update update = new Update();
+ update.setLocationID(getLocationId());
+ update.setID(subjectId);
+
+ update.setBiometricXml(biometricXml);
+
+ UpdateResponse response = (UpdateResponse) getResponse(update);
+
+ return response.getUpdateResult();
+ }
+
+ @Override
+ public String identify(String biometricXml) {
+ Identify identify = new Identify();
+
+ identify.setBiometricXml(biometricXml);
+ identify.setLocationID(getLocationId());
+
+ IdentifyResponse response = (IdentifyResponse) getResponse(identify);
+
+ return response.identifyResult;
+ }
+
+ @Override
+ public String delete(String subjectId) {
+ DeleteID deleteID = new DeleteID();
+ deleteID.setID(subjectId);
+
+ DeleteIDResponse response = (DeleteIDResponse) getResponse(deleteID);
+ return response.getDeleteIDResult();
+ }
+
+ @Override
+ public boolean isServerUrlConfigured() {
+ return properties.isGlobalPropertySet(getServerUrlPropertyName());
+ }
+
+ protected abstract String getServerUrlPropertyName();
+
+ protected abstract Object getResponse(Object requestPayload) throws WebServiceException;
+
+ protected String getProperty(String propertyName) {
+ return properties.getGlobalProperty(propertyName);
+ }
+
+ protected String getServiceUrl() {
+ return getProperty(getServerUrlPropertyName());
+ }
+
+ private int getLocationId() {
+ return Integer.parseInt(getProperty(LOCATION_ID_PROPERTY));
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/BioServerClient.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/BioServerClient.java
index 0f14d33..3edc96b 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/BioServerClient.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/BioServerClient.java
@@ -2,17 +2,17 @@
public interface BioServerClient {
- String enroll(String subjectId, String biometricXml);
+ String enroll(String subjectId, String biometricXml);
- String isRegistered(String subjectId);
+ String isRegistered(String subjectId);
- String changeId(String oldId, String newId);
+ String changeId(String oldId, String newId);
- String update(String subjectId, String biometricXml);
+ String update(String subjectId, String biometricXml);
- String identify(String biometricXml);
+ String identify(String biometricXml);
- String delete(String subjectId);
+ String delete(String subjectId);
- boolean isServerUrlConfigured();
+ boolean isServerUrlConfigured();
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/LocalBioServerClient.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/LocalBioServerClient.java
index 12447d8..8d1bbc7 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/LocalBioServerClient.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/LocalBioServerClient.java
@@ -3,24 +3,21 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.module.m2sysbiometrics.M2SysBiometricsConstants;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
-import org.springframework.ws.WebServiceMessageFactory;
@Component
public class LocalBioServerClient extends AbstractBioServerClient {
private final Log log = LogFactory.getLog(LocalBioServerClient.class);
- @Override
- protected String getServerUrlPropertyName() {
- return M2SysBiometricsConstants.M2SYS_LOCAL_SERVICE_URL;
- }
+ @Override
+ protected String getServerUrlPropertyName() {
+ return M2SysBiometricsConstants.M2SYS_LOCAL_SERVICE_URL;
+ }
- @Override
- protected Object getResponse(Object requestPayload) {
- return getWebServiceTemplate().marshalSendAndReceive(getServiceUrl(), requestPayload);
- }
+ @Override
+ protected Object getResponse(Object requestPayload) {
+ return getWebServiceTemplate().marshalSendAndReceive(getServiceUrl(), requestPayload);
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/NationalBioServerClient.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/NationalBioServerClient.java
index 35ea115..89f9c77 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/NationalBioServerClient.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/bioplugin/NationalBioServerClient.java
@@ -2,49 +2,25 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codehaus.jackson.map.ObjectMapper;
import org.openmrs.module.m2sysbiometrics.M2SysBiometricsConstants;
-import org.openmrs.module.m2sysbiometrics.http.M2SysHttpClient;
-import org.openmrs.module.m2sysbiometrics.model.CloudAbisResult;
-import org.openmrs.module.m2sysbiometrics.model.M2SysData;
-import org.openmrs.module.m2sysbiometrics.model.Request;
-import org.openmrs.module.m2sysbiometrics.model.Token;
-import org.openmrs.module.m2sysbiometrics.util.M2SysProperties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
-import org.springframework.web.client.RestOperations;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.ws.WebServiceMessageFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.ProtocolException;
-import java.net.URL;
@Component
public class NationalBioServerClient extends AbstractBioServerClient {
- private final Log log = LogFactory.getLog(NationalBioServerClient.class);
+ private final Log log = LogFactory.getLog(NationalBioServerClient.class);
- public NationalBioServerClient() {
- setMessageFactory(messageFactory);
- }
+ public NationalBioServerClient() {
+ setMessageFactory(messageFactory);
+ }
- @Override
- protected String getServerUrlPropertyName() {
- return M2SysBiometricsConstants.M2SYS_NATIONAL_SERVICE_URL;
- }
+ @Override
+ protected String getServerUrlPropertyName() {
+ return M2SysBiometricsConstants.M2SYS_NATIONAL_SERVICE_URL;
+ }
- @Override
- protected Object getResponse(Object requestPayload) {
- return getWebServiceTemplate().marshalSendAndReceive(getServiceUrl(), requestPayload);
- }
+ @Override
+ protected Object getResponse(Object requestPayload) {
+ return getWebServiceTemplate().marshalSendAndReceive(getServiceUrl(), requestPayload);
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/capture/M2SysFingerCaptor.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/capture/M2SysFingerCaptor.java
index 02bbb47..d55d623 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/capture/M2SysFingerCaptor.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/capture/M2SysFingerCaptor.java
@@ -4,5 +4,5 @@
public interface M2SysFingerCaptor {
- M2SysCaptureResponse scanDoubleFingers();
+ M2SysCaptureResponse scanDoubleFingers();
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/capture/impl/CloudScanrCaptor.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/capture/impl/CloudScanrCaptor.java
index b84df41..8842aec 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/capture/impl/CloudScanrCaptor.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/capture/impl/CloudScanrCaptor.java
@@ -2,13 +2,10 @@
import org.openmrs.module.m2sysbiometrics.M2SysBiometricsConstants;
import org.openmrs.module.m2sysbiometrics.capture.M2SysFingerCaptor;
-import org.openmrs.module.m2sysbiometrics.client.M2SysV105Client;
import org.openmrs.module.m2sysbiometrics.http.M2SysHttpClient;
import org.openmrs.module.m2sysbiometrics.model.AbstractM2SysRequest;
import org.openmrs.module.m2sysbiometrics.model.M2SysCaptureRequest;
import org.openmrs.module.m2sysbiometrics.model.M2SysCaptureResponse;
-import org.openmrs.module.m2sysbiometrics.model.Token;
-//import org.openmrs.module.m2sysbiometrics.util.AccessPointIdResolver;
import org.openmrs.module.m2sysbiometrics.util.M2SysProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -18,36 +15,36 @@
@Component
public class CloudScanrCaptor implements M2SysFingerCaptor {
- private static final Logger LOGGER = LoggerFactory.getLogger(CloudScanrCaptor.class);
- @Autowired
- private M2SysProperties properties;
+ private static final Logger LOGGER = LoggerFactory.getLogger(CloudScanrCaptor.class);
- @Autowired
- private M2SysHttpClient httpClient;
+ @Autowired
+ private M2SysProperties properties;
- // @Autowired
- // private AccessPointIdResolver apIdResolver;
+ @Autowired
+ private M2SysHttpClient httpClient;
- @Override
- public M2SysCaptureResponse scanDoubleFingers() {
+ // @Autowired
+ // private AccessPointIdResolver apIdResolver;
- M2SysCaptureRequest request = new M2SysCaptureRequest();
- addRequiredValues(request);
- request.setCaptureType(1);
- request.setDeviceName("DigitalPersona");
+ @Override
+ public M2SysCaptureResponse scanDoubleFingers() {
-// Token token = getToken();
+ M2SysCaptureRequest request = new M2SysCaptureRequest();
+ addRequiredValues(request);
+ request.setCaptureType(1);
+ request.setDeviceName("DigitalPersona");
+ // Token token = getToken();
- return httpClient.postRequest(
- properties.getCloudScanrUrl() + M2SysBiometricsConstants.M2SYS_CAPTURE_ENDPOINT,
- request, null, M2SysCaptureResponse.class);
- }
+ return httpClient.postRequest(
+ properties.getCloudScanrUrl() + M2SysBiometricsConstants.M2SYS_CAPTURE_ENDPOINT,
+ request, null, M2SysCaptureResponse.class);
+ }
+
+ private void addRequiredValues(AbstractM2SysRequest request) {
+ //request.setAccessPointId(apIdResolver.getAccessPointId());
+ request.setCaptureTimeout(properties.getCaptureTimeOut());
+ //request.setCustomerKey(properties.getCustomerKey());
+ }
- private void addRequiredValues(AbstractM2SysRequest request) {
- //request.setAccessPointId(apIdResolver.getAccessPointId());
- request.setCaptureTimeout(properties.getCaptureTimeOut());
- //request.setCustomerKey(properties.getCustomerKey());
- }
-
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/capture/impl/TestEnvCaptor.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/capture/impl/TestEnvCaptor.java
index c6b3f62..3f55305 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/capture/impl/TestEnvCaptor.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/capture/impl/TestEnvCaptor.java
@@ -9,19 +9,19 @@
@Component
public class TestEnvCaptor implements M2SysFingerCaptor {
- @Override
- public M2SysCaptureResponse scanDoubleFingers() {
- String testTemplate = System.getenv(M2SysBiometricsConstants.CONST_TEST_TEMPLATE);
+ @Override
+ public M2SysCaptureResponse scanDoubleFingers() {
+ String testTemplate = System.getenv(M2SysBiometricsConstants.CONST_TEST_TEMPLATE);
- if (StringUtils.isNotBlank(testTemplate)) {
- M2SysCaptureResponse response = new M2SysCaptureResponse();
+ if (StringUtils.isNotBlank(testTemplate)) {
+ M2SysCaptureResponse response = new M2SysCaptureResponse();
- response.setTemplateData(testTemplate);
- response.setSuccess(true);
+ response.setTemplateData(testTemplate);
+ response.setSuccess(true);
- return response;
- } else {
- return null;
- }
- }
+ return response;
+ } else {
+ return null;
+ }
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/client/AbstractM2SysClient.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/client/AbstractM2SysClient.java
index 4c69ed8..ff60b51 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/client/AbstractM2SysClient.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/client/AbstractM2SysClient.java
@@ -1,5 +1,7 @@
package org.openmrs.module.m2sysbiometrics.client;
+import static org.openmrs.module.m2sysbiometrics.M2SysBiometricsConstants.getServerStatusDescription;
+
import org.openmrs.module.m2sysbiometrics.http.M2SysHttpClient;
import org.openmrs.module.m2sysbiometrics.model.Token;
import org.openmrs.module.m2sysbiometrics.util.M2SysProperties;
@@ -11,63 +13,62 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.ResourceAccessException;
-import static org.openmrs.module.m2sysbiometrics.M2SysBiometricsConstants.getServerStatusDescription;
-
public abstract class AbstractM2SysClient implements M2SysClient {
- private final Logger logger = LoggerFactory.getLogger(getClass());
+ private final Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private M2SysHttpClient httpClient;
+ @Autowired
+ private M2SysHttpClient httpClient;
- @Autowired
- private M2SysProperties properties;
+ @Autowired
+ private M2SysProperties properties;
- /**
- * Gets a status of biometric server.
- */
- @Override
- public BiometricEngineStatus getStatus() {
- logger.info("Called getStatus method");
- BiometricEngineStatus result = new BiometricEngineStatus();
+ /**
+ * Gets a status of biometric server.
+ */
+ @Override
+ public BiometricEngineStatus getStatus() {
+ logger.info("Called getStatus method");
+ BiometricEngineStatus result = new BiometricEngineStatus();
- ResponseEntity responseEntity;
- try {
- responseEntity = getHttpClient().getServerStatus(properties.getCloudScanrUrl(), getToken());
- } catch (ResourceAccessException e) {
- logger.error(e.getMessage());
- responseEntity = new ResponseEntity<>(HttpStatus.SERVICE_UNAVAILABLE);
- }
+ ResponseEntity responseEntity;
+ try {
+ responseEntity = getHttpClient().getServerStatus(properties.getCloudScanrUrl(), getToken());
+ }
+ catch (ResourceAccessException e) {
+ logger.error(e.getMessage());
+ responseEntity = new ResponseEntity<>(HttpStatus.SERVICE_UNAVAILABLE);
+ }
- if (null != responseEntity) {
- result.setStatusMessage(responseEntity.getStatusCode() + " " + responseEntity.getStatusCode().getReasonPhrase());
- result.setDescription(getServerStatusDescription(responseEntity.getStatusCode().value()));
- result.setEnabled(isSuccessfulStatus(responseEntity.getStatusCode()));
- }
+ if (null != responseEntity) {
+ result.setStatusMessage(responseEntity.getStatusCode() + " " + responseEntity.getStatusCode().getReasonPhrase());
+ result.setDescription(getServerStatusDescription(responseEntity.getStatusCode().value()));
+ result.setEnabled(isSuccessfulStatus(responseEntity.getStatusCode()));
+ }
- logger.debug(String.format("M2SysServer status: %s", result.getDescription()));
- return result;
- }
+ logger.debug(String.format("M2SysServer status: %s", result.getDescription()));
+ return result;
+ }
- protected Logger getLogger() {
- return logger;
- }
+ protected Logger getLogger() {
+ return logger;
+ }
- protected M2SysHttpClient getHttpClient() {
- return httpClient;
- }
+ protected M2SysHttpClient getHttpClient() {
+ return httpClient;
+ }
- protected Token getToken() {
- // String username = properties.getCloudScanrUsername();
- // String password = properties.getCloudScanrPassword();
- // String customerKey = properties.getCustomerKey();
- String cloudScanUrl = properties.getCloudScanrUrl();
+ protected Token getToken() {
+ // String username = properties.getCloudScanrUsername();
+ // String password = properties.getCloudScanrPassword();
+ // String customerKey = properties.getCustomerKey();
+ String cloudScanUrl = properties.getCloudScanrUrl();
- return httpClient.getToken(cloudScanUrl);
- // return httpClient.getToken(cloudScanUrl, username, password, customerKey);
- }
+ return httpClient.getToken(cloudScanUrl);
+ // return httpClient.getToken(cloudScanUrl, username, password, customerKey);
+ }
- protected boolean isSuccessfulStatus(HttpStatus httpStatus) {
- return httpStatus.equals(HttpStatus.OK);
- }
+ protected boolean isSuccessfulStatus(HttpStatus httpStatus) {
+ return httpStatus.equals(HttpStatus.OK);
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/client/M2SysClient.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/client/M2SysClient.java
index 5127b55..bebfa85 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/client/M2SysClient.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/client/M2SysClient.java
@@ -1,27 +1,27 @@
package org.openmrs.module.m2sysbiometrics.client;
+import java.util.List;
+
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricEngineStatus;
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricMatch;
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricSubject;
-
-import java.util.List;
import org.openmrs.module.registrationcore.api.biometrics.model.EnrollmentResult;
public interface M2SysClient {
- BiometricEngineStatus getStatus();
+ BiometricEngineStatus getStatus();
- EnrollmentResult enroll(BiometricSubject subjectId);
+ EnrollmentResult enroll(BiometricSubject subjectId);
- EnrollmentResult enroll(BiometricSubject subjectId, String fingerprintsXmlTemplate);
+ EnrollmentResult enroll(BiometricSubject subjectId, String fingerprintsXmlTemplate);
- BiometricSubject update(BiometricSubject subject);
+ BiometricSubject update(BiometricSubject subject);
- BiometricSubject updateSubjectId(String oldId, String newId);
+ BiometricSubject updateSubjectId(String oldId, String newId);
- List search();
+ List search();
- BiometricSubject lookup(String subjectId);
+ BiometricSubject lookup(String subjectId);
- void delete(String subjectId);
+ void delete(String subjectId);
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/client/M2SysV105Client.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/client/M2SysV105Client.java
index a4cfcdc..76c2ba4 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/client/M2SysV105Client.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/client/M2SysV105Client.java
@@ -1,5 +1,11 @@
package org.openmrs.module.m2sysbiometrics.client;
+import javax.annotation.PostConstruct;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.module.m2sysbiometrics.bioplugin.LocalBioServerClient;
@@ -7,7 +13,13 @@
import org.openmrs.module.m2sysbiometrics.capture.impl.CloudScanrCaptor;
import org.openmrs.module.m2sysbiometrics.capture.impl.TestEnvCaptor;
import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
-import org.openmrs.module.m2sysbiometrics.model.*;
+import org.openmrs.module.m2sysbiometrics.model.Finger;
+import org.openmrs.module.m2sysbiometrics.model.FingerScanStatus;
+import org.openmrs.module.m2sysbiometrics.model.Fingers;
+import org.openmrs.module.m2sysbiometrics.model.M2SysCaptureResponse;
+import org.openmrs.module.m2sysbiometrics.model.M2SysResult;
+import org.openmrs.module.m2sysbiometrics.model.M2SysResults;
+import org.openmrs.module.m2sysbiometrics.model.TempFingerprint;
import org.openmrs.module.m2sysbiometrics.service.RegistrationService;
import org.openmrs.module.m2sysbiometrics.service.SearchService;
import org.openmrs.module.m2sysbiometrics.service.TempFingerprintService;
@@ -20,270 +32,266 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import javax.annotation.PostConstruct;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import java.util.ArrayList;
-import java.util.List;
-
@Component("m2sysbiometrics.M2SysV1Client")
public class M2SysV105Client extends AbstractM2SysClient {
- private final Log log = LogFactory.getLog(M2SysV105Client.class);
-
- @Autowired
- private LocalBioServerClient localBioServerClient;
-
- @Autowired
- private NationalBioServerClient nationalBioServerClient;
-
- @Autowired
- private RegistrationService registrationService;
-
- @Autowired
- private SearchService searchService;
-
- @Autowired
- private CloudScanrCaptor cloudScanrCaptor;
-
- @Autowired
- private TestEnvCaptor testEnvCaptor;
-
- @Autowired
- private UpdateService updateService;
-
- @Autowired
- private TempFingerprintService tempFingerprintService;
-
- private JAXBContext jaxbContext;
-
- @PostConstruct
- public void init() throws JAXBException {
- jaxbContext = JAXBContext.newInstance(Fingers.class, Finger.class, M2SysResults.class,
- M2SysResult.class);
- }
-
- @Override
- public EnrollmentResult enroll(BiometricSubject subjectId) {
- M2SysCaptureResponse capture = scanDoubleFingers();
- log.info("M2SysV105Client.enroll======================================> : "+capture.getTemplateData());
- return enroll(subjectId, capture.getTemplateData());
- }
-
- @Override
- public EnrollmentResult enroll(BiometricSubject subjectId, String fingerprintXmlTemplate) {
- BiometricSubject nationalSubject = new BiometricSubject("");
- M2SysCaptureResponse capture = convertXmlTemplateToCapture(fingerprintXmlTemplate);
- FingerScanStatus fingerScanStatus = searchService.checkIfFingerScanExists(capture.getTemplateData());
- log.error("Fingerscan response =>>>>>>>>>>>>>: Local ==> "+ fingerScanStatus.isRegisteredLocally() + ", National ==> " + fingerScanStatus.isRegisteredNationally());
- EnrollmentStatus enrollmentStatus;
- Fingers fingers = capture.getFingerData(jaxbContext);
- subjectId.setFingerprints(fingers.toTwoOpenMrsFingerprints());
- nationalSubject.setFingerprints(fingers.toTwoOpenMrsFingerprints());
-
-// 1. If registered both locally and nationally, return the IDs
- if(fingerScanStatus.isRegisteredLocally() && fingerScanStatus.isRegisteredNationally()){
- subjectId = fingerScanStatus.getLocalBiometricSubject();
- nationalSubject = fingerScanStatus.getNationalBiometricSubject();
- enrollmentStatus = EnrollmentStatus.ALREADY_REGISTERED;
- }else if (fingerScanStatus.isRegisteredLocally() || fingerScanStatus.isRegisteredNationally()) {
-// 2. If registered locally but not nationally, try register nationally. If successful, return both IDs, if not, return local ID and queue for later national registration
-// 3. If registered nationally but not locally, try register locally. If successful, return both IDs, if not, return national ID and queue for later local registration - should be very rare
- enrollmentStatus = EnrollmentStatus.ALREADY_REGISTERED;
- if (fingerScanStatus.isRegisteredLocally()) {
- log.error("Processing the Local Match");
- subjectId = fingerScanStatus.getLocalBiometricSubject();
-// Enroll nationally
- if (nationalBioServerClient.isServerUrlConfigured()) {
- registrationService.registerNationally(capture);
- fingerScanStatus = searchService.checkIfFingerScanExists(capture.getTemplateData());
- if (fingerScanStatus.isRegisteredNationally()) {
- nationalSubject = fingerScanStatus.getNationalBiometricSubject();
- } else {
-// National registration did not happen - queue for later sync
-// SyncFingerprint syncFingerprint = new SyncFingerprint(subjectId.getSubjectId(), fingerprintXmlTemplate);
-// syncFingerprintService.saveOrUpdate(syncFingerprint);
- nationalSubject = null;
- }
- }
-
- } else {
- log.error("Processing the National Match");
- nationalSubject = fingerScanStatus.getNationalBiometricSubject();
-// Enroll Locally
- if (localBioServerClient.isServerUrlConfigured()) {
- registrationService.registerLocally(subjectId,capture);
- fingerScanStatus = searchService.checkIfFingerScanExists(capture.getTemplateData());
- if (fingerScanStatus.isRegisteredLocally()) {
- subjectId = fingerScanStatus.getLocalBiometricSubject();
- } else {
-// Local registration did not happen - queue for later sync
-// SyncFingerprint syncFingerprint = new SyncFingerprint(nationalSubject.getSubjectId(), fingerprintXmlTemplate);
-// syncFingerprintService.saveOrUpdate(syncFingerprint);
- subjectId = null;
- }
- }
- }
- }
- else {
- log.error("No match found on both local and national servers =========================>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
-// 4. Not registered locally and nationally - register - register locally and nationally
- if (localBioServerClient.isServerUrlConfigured()) {
- registrationService.registerLocally(subjectId,capture);
- log.error("Local EnrollmentStatus : " + EnrollmentStatus.SUCCESS);
- }
- if (nationalBioServerClient.isServerUrlConfigured()) {
- registrationService.registerNationally(capture);
- log.error("National EnrollmentStatus : " + EnrollmentStatus.SUCCESS);
- }
-// retrieve the registered biometrics
- fingerScanStatus = searchService.checkIfFingerScanExists(capture.getTemplateData());
- if (fingerScanStatus.isRegisteredNationally() || fingerScanStatus.isRegisteredLocally()) {
- enrollmentStatus = EnrollmentStatus.SUCCESS;
- }else{
- enrollmentStatus = EnrollmentStatus.ERROR;
- }
-
-// if (!fingerScanStatus.isRegisteredNationally() || !fingerScanStatus.isRegisteredLocally()) {
-// Registration did not happen - queue for later sync
-// SyncFingerprint syncFingerprint = new SyncFingerprint(subjectId.getSubjectId(), fingerprintXmlTemplate);
-// syncFingerprintService.saveOrUpdate(syncFingerprint);
-// }
- subjectId = fingerScanStatus.getLocalBiometricSubject();
- nationalSubject = fingerScanStatus.getNationalBiometricSubject();
- }
-
-// if (!fingerScanStatus.isRegisteredLocally()) {
-// if (fingerScanStatus.isRegisteredNationally()) {
-// nationalSubject = fingerScanStatus.getNationalBiometricSubject();
-// enrollmentStatus = EnrollmentStatus.ALREADY_REGISTERED;
-// if(localBioServerClient.isServerUrlConfigured()){
-// registrationService.registerLocally(subjectId);
-// log.error("Local EnrollmentStatus : "+EnrollmentStatus.SUCCESS);
-// }else{
-// log.error("Local Enrollment Aborted: Status - Local Server not configured!");
-// subjectId = new BiometricSubject("");
-// }
-// } else {
-//
-//
-// }
-// } else {
-// subjectId = fingerScanStatus.getLocalBiometricSubject();
-// enrollmentStatus = EnrollmentStatus.ALREADY_REGISTERED;
-// if (!fingerScanStatus.isRegisteredNationally()) {
-//// Enroll nationally
-// registrationService.registerNationally(capture);
-// fingerScanStatus = searchService.checkIfFingerScanExists(capture.getTemplateData());
-// if (fingerScanStatus.isRegisteredNationally()) {
-// nationalSubject = fingerScanStatus.getNationalBiometricSubject();
-// }else{
-//// National registration did not happen - queue for later sync
-// SyncFingerprint syncFingerprint = new SyncFingerprint(subjectId.getSubjectId(), fingerprintXmlTemplate);
-//// syncFingerprintService.saveOrUpdate(syncFingerprint);
-// }
-//
-// }else{
-// nationalSubject = fingerScanStatus.getNationalBiometricSubject();
-// }
-// }
- return new EnrollmentResult(subjectId, nationalSubject, enrollmentStatus);
- }
-
- private M2SysCaptureResponse convertXmlTemplateToCapture(String fingerprintXmlTemplate) {
- M2SysCaptureResponse capture = new M2SysCaptureResponse();
- capture.setTemplateData(fingerprintXmlTemplate);
- return capture;
- }
-
- @Override
- public BiometricSubject update(BiometricSubject subject) {
- M2SysCaptureResponse fingerScan = scanDoubleFingers();
- updateService.updateLocally(subject);
+ private final Log log = LogFactory.getLog(M2SysV105Client.class);
+
+ @Autowired
+ private LocalBioServerClient localBioServerClient;
+
+ @Autowired
+ private NationalBioServerClient nationalBioServerClient;
+
+ @Autowired
+ private RegistrationService registrationService;
+
+ @Autowired
+ private SearchService searchService;
+
+ @Autowired
+ private CloudScanrCaptor cloudScanrCaptor;
+
+ @Autowired
+ private TestEnvCaptor testEnvCaptor;
+
+ @Autowired
+ private UpdateService updateService;
+
+ @Autowired
+ private TempFingerprintService tempFingerprintService;
+
+ private JAXBContext jaxbContext;
+
+ @PostConstruct
+ public void init() throws JAXBException {
+ jaxbContext = JAXBContext.newInstance(Fingers.class, Finger.class, M2SysResults.class,
+ M2SysResult.class);
+ }
+
+ @Override
+ public EnrollmentResult enroll(BiometricSubject subjectId) {
+ M2SysCaptureResponse capture = scanDoubleFingers();
+ log.info("M2SysV105Client.enroll======================================> : " + capture.getTemplateData());
+ return enroll(subjectId, capture.getTemplateData());
+ }
+
+ @Override
+ public EnrollmentResult enroll(BiometricSubject subjectId, String fingerprintXmlTemplate) {
+ BiometricSubject nationalSubject = new BiometricSubject("");
+ M2SysCaptureResponse capture = convertXmlTemplateToCapture(fingerprintXmlTemplate);
+ FingerScanStatus fingerScanStatus = searchService.checkIfFingerScanExists(capture.getTemplateData());
+ log.error(
+ "Fingerscan response =>>>>>>>>>>>>>: Local ==> " + fingerScanStatus.isRegisteredLocally() + ", National ==> "
+ + fingerScanStatus.isRegisteredNationally());
+ EnrollmentStatus enrollmentStatus;
+ Fingers fingers = capture.getFingerData(jaxbContext);
+ subjectId.setFingerprints(fingers.toTwoOpenMrsFingerprints());
+ nationalSubject.setFingerprints(fingers.toTwoOpenMrsFingerprints());
+
+ // 1. If registered both locally and nationally, return the IDs
+ if (fingerScanStatus.isRegisteredLocally() && fingerScanStatus.isRegisteredNationally()) {
+ subjectId = fingerScanStatus.getLocalBiometricSubject();
+ nationalSubject = fingerScanStatus.getNationalBiometricSubject();
+ enrollmentStatus = EnrollmentStatus.ALREADY_REGISTERED;
+ } else if (fingerScanStatus.isRegisteredLocally() || fingerScanStatus.isRegisteredNationally()) {
+ // 2. If registered locally but not nationally, try register nationally. If successful, return both IDs, if not, return local ID and queue for later national registration
+ // 3. If registered nationally but not locally, try register locally. If successful, return both IDs, if not, return national ID and queue for later local registration - should be very rare
+ enrollmentStatus = EnrollmentStatus.ALREADY_REGISTERED;
+ if (fingerScanStatus.isRegisteredLocally()) {
+ log.error("Processing the Local Match");
+ subjectId = fingerScanStatus.getLocalBiometricSubject();
+ // Enroll nationally
+ if (nationalBioServerClient.isServerUrlConfigured()) {
+ registrationService.registerNationally(capture);
+ fingerScanStatus = searchService.checkIfFingerScanExists(capture.getTemplateData());
+ if (fingerScanStatus.isRegisteredNationally()) {
+ nationalSubject = fingerScanStatus.getNationalBiometricSubject();
+ } else {
+ // National registration did not happen - queue for later sync
+ // SyncFingerprint syncFingerprint = new SyncFingerprint(subjectId.getSubjectId(), fingerprintXmlTemplate);
+ // syncFingerprintService.saveOrUpdate(syncFingerprint);
+ nationalSubject = null;
+ }
+ }
+
+ } else {
+ log.error("Processing the National Match");
+ nationalSubject = fingerScanStatus.getNationalBiometricSubject();
+ // Enroll Locally
+ if (localBioServerClient.isServerUrlConfigured()) {
+ registrationService.registerLocally(subjectId, capture);
+ fingerScanStatus = searchService.checkIfFingerScanExists(capture.getTemplateData());
+ if (fingerScanStatus.isRegisteredLocally()) {
+ subjectId = fingerScanStatus.getLocalBiometricSubject();
+ } else {
+ // Local registration did not happen - queue for later sync
+ // SyncFingerprint syncFingerprint = new SyncFingerprint(nationalSubject.getSubjectId(), fingerprintXmlTemplate);
+ // syncFingerprintService.saveOrUpdate(syncFingerprint);
+ subjectId = null;
+ }
+ }
+ }
+ } else {
+ log.error(
+ "No match found on both local and national servers =========================>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
+ // 4. Not registered locally and nationally - register - register locally and nationally
+ if (localBioServerClient.isServerUrlConfigured()) {
+ registrationService.registerLocally(subjectId, capture);
+ log.error("Local EnrollmentStatus : " + EnrollmentStatus.SUCCESS);
+ }
+ if (nationalBioServerClient.isServerUrlConfigured()) {
+ registrationService.registerNationally(capture);
+ log.error("National EnrollmentStatus : " + EnrollmentStatus.SUCCESS);
+ }
+ // retrieve the registered biometrics
+ fingerScanStatus = searchService.checkIfFingerScanExists(capture.getTemplateData());
+ if (fingerScanStatus.isRegisteredNationally() || fingerScanStatus.isRegisteredLocally()) {
+ enrollmentStatus = EnrollmentStatus.SUCCESS;
+ } else {
+ enrollmentStatus = EnrollmentStatus.ERROR;
+ }
+
+ // if (!fingerScanStatus.isRegisteredNationally() || !fingerScanStatus.isRegisteredLocally()) {
+ // Registration did not happen - queue for later sync
+ // SyncFingerprint syncFingerprint = new SyncFingerprint(subjectId.getSubjectId(), fingerprintXmlTemplate);
+ // syncFingerprintService.saveOrUpdate(syncFingerprint);
+ // }
+ subjectId = fingerScanStatus.getLocalBiometricSubject();
+ nationalSubject = fingerScanStatus.getNationalBiometricSubject();
+ }
+
+ // if (!fingerScanStatus.isRegisteredLocally()) {
+ // if (fingerScanStatus.isRegisteredNationally()) {
+ // nationalSubject = fingerScanStatus.getNationalBiometricSubject();
+ // enrollmentStatus = EnrollmentStatus.ALREADY_REGISTERED;
+ // if(localBioServerClient.isServerUrlConfigured()){
+ // registrationService.registerLocally(subjectId);
+ // log.error("Local EnrollmentStatus : "+EnrollmentStatus.SUCCESS);
+ // }else{
+ // log.error("Local Enrollment Aborted: Status - Local Server not configured!");
+ // subjectId = new BiometricSubject("");
+ // }
+ // } else {
+ //
+ //
+ // }
+ // } else {
+ // subjectId = fingerScanStatus.getLocalBiometricSubject();
+ // enrollmentStatus = EnrollmentStatus.ALREADY_REGISTERED;
+ // if (!fingerScanStatus.isRegisteredNationally()) {
+ //// Enroll nationally
+ // registrationService.registerNationally(capture);
+ // fingerScanStatus = searchService.checkIfFingerScanExists(capture.getTemplateData());
+ // if (fingerScanStatus.isRegisteredNationally()) {
+ // nationalSubject = fingerScanStatus.getNationalBiometricSubject();
+ // }else{
+ //// National registration did not happen - queue for later sync
+ // SyncFingerprint syncFingerprint = new SyncFingerprint(subjectId.getSubjectId(), fingerprintXmlTemplate);
+ //// syncFingerprintService.saveOrUpdate(syncFingerprint);
+ // }
+ //
+ // }else{
+ // nationalSubject = fingerScanStatus.getNationalBiometricSubject();
+ // }
+ // }
+ return new EnrollmentResult(subjectId, nationalSubject, enrollmentStatus);
+ }
+
+ private M2SysCaptureResponse convertXmlTemplateToCapture(String fingerprintXmlTemplate) {
+ M2SysCaptureResponse capture = new M2SysCaptureResponse();
+ capture.setTemplateData(fingerprintXmlTemplate);
+ return capture;
+ }
+
+ @Override
+ public BiometricSubject update(BiometricSubject subject) {
+ M2SysCaptureResponse fingerScan = scanDoubleFingers();
+ updateService.updateLocally(subject);
/* if (nationalBioServerClient.isServerUrlConfigured()) {
updateService.updateNationally(fingerScan);
}
*/
- Fingers fingers = fingerScan.getFingerData(jaxbContext);
- subject.setFingerprints(fingers.toTwoOpenMrsFingerprints());
-
- return subject;
- }
-
- @Override
- public BiometricSubject updateSubjectId(String oldId, String newId) {
- String response = localBioServerClient.changeId(oldId, newId);
- M2SysResults results = XmlResultUtil.parse(response);
-
- if (!results.isChangeIdSuccess()) {
- throw new M2SysBiometricsException("Unable to change ID from " + oldId
- + " to " + newId);
- }
-
- return new BiometricSubject(newId);
- }
-
- @Override
- public List search() {
- M2SysCaptureResponse fingerScan = scanDoubleFingers();
- FingerScanStatus fingerScanStatus = searchService.checkIfFingerScanExists(fingerScan.getTemplateData());
- List results = new ArrayList<>();
-
- if (fingerScanStatus.isRegisteredLocally()) {
- results = searchService.searchLocally(fingerScan.getTemplateData());
- }
-
- if (nationalBioServerClient.isServerUrlConfigured()) {
- try {
- if (fingerScanStatus.isRegisteredNationally()) {
- List nationalResults = searchService.searchNationally(fingerScan.getTemplateData());
- String biometricXml = fingerScan.getTemplateData();
- for (BiometricMatch nationalResult : nationalResults) {
- TempFingerprint fingerprint = new TempFingerprint(nationalResult.getSubjectId(), biometricXml);
- tempFingerprintService.saveOrUpdate(fingerprint);
- }
- results.addAll(nationalResults);
- }
- if (fingerScanStatus.isRegisteredLocally()) {
- registrationService.synchronizeFingerprints(fingerScan, fingerScanStatus);
- }
- } catch (RuntimeException exception) {
- getLogger().error("Connection failure to national server.", exception);
- }
- }
-
-
- return results;
- }
-
- @Override
- public BiometricSubject lookup(String subjectId) {
- String response = localBioServerClient.isRegistered(subjectId);
- M2SysResults results = XmlResultUtil.parse(response);
-
- return results.isLookupNotFound() ? null : new BiometricSubject(subjectId);
- }
-
- @Override
- public void delete(String subjectId) {
- String response = localBioServerClient.delete(subjectId);
- M2SysResults results = XmlResultUtil.parse(response);
-
- if (!results.isDeleteSuccess()) {
- throw new M2SysBiometricsException("Unable to delete fingerprints for: " + subjectId);
- }
- }
-
- private M2SysCaptureResponse scanDoubleFingers() {
- M2SysCaptureResponse response = testEnvCaptor.scanDoubleFingers();
-
- if (response == null) {
- response = cloudScanrCaptor.scanDoubleFingers();
- } else {
- getLogger().warn("Using test template from the environment, skipping capture");
- }
-
- return response;
- }
+ Fingers fingers = fingerScan.getFingerData(jaxbContext);
+ subject.setFingerprints(fingers.toTwoOpenMrsFingerprints());
+
+ return subject;
+ }
+
+ @Override
+ public BiometricSubject updateSubjectId(String oldId, String newId) {
+ String response = localBioServerClient.changeId(oldId, newId);
+ M2SysResults results = XmlResultUtil.parse(response);
+
+ if (!results.isChangeIdSuccess()) {
+ throw new M2SysBiometricsException("Unable to change ID from " + oldId
+ + " to " + newId);
+ }
+
+ return new BiometricSubject(newId);
+ }
+
+ @Override
+ public List search() {
+ M2SysCaptureResponse fingerScan = scanDoubleFingers();
+ FingerScanStatus fingerScanStatus = searchService.checkIfFingerScanExists(fingerScan.getTemplateData());
+ List results = new ArrayList<>();
+
+ if (fingerScanStatus.isRegisteredLocally()) {
+ results = searchService.searchLocally(fingerScan.getTemplateData());
+ }
+
+ if (nationalBioServerClient.isServerUrlConfigured()) {
+ try {
+ if (fingerScanStatus.isRegisteredNationally()) {
+ List nationalResults = searchService.searchNationally(fingerScan.getTemplateData());
+ String biometricXml = fingerScan.getTemplateData();
+ for (BiometricMatch nationalResult : nationalResults) {
+ TempFingerprint fingerprint = new TempFingerprint(nationalResult.getSubjectId(), biometricXml);
+ tempFingerprintService.saveOrUpdate(fingerprint);
+ }
+ results.addAll(nationalResults);
+ }
+ if (fingerScanStatus.isRegisteredLocally()) {
+ registrationService.synchronizeFingerprints(fingerScan, fingerScanStatus);
+ }
+ }
+ catch (RuntimeException exception) {
+ getLogger().error("Connection failure to national server.", exception);
+ }
+ }
+
+ return results;
+ }
+
+ @Override
+ public BiometricSubject lookup(String subjectId) {
+ String response = localBioServerClient.isRegistered(subjectId);
+ M2SysResults results = XmlResultUtil.parse(response);
+
+ return results.isLookupNotFound() ? null : new BiometricSubject(subjectId);
+ }
+
+ @Override
+ public void delete(String subjectId) {
+ String response = localBioServerClient.delete(subjectId);
+ M2SysResults results = XmlResultUtil.parse(response);
+
+ if (!results.isDeleteSuccess()) {
+ throw new M2SysBiometricsException("Unable to delete fingerprints for: " + subjectId);
+ }
+ }
+
+ private M2SysCaptureResponse scanDoubleFingers() {
+ M2SysCaptureResponse response = testEnvCaptor.scanDoubleFingers();
+
+ if (response == null) {
+ response = cloudScanrCaptor.scanDoubleFingers();
+ } else {
+ getLogger().warn("Using test template from the environment, skipping capture");
+ }
+
+ return response;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/config/AppConfig.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/config/AppConfig.java
index eb17d17..f687342 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/config/AppConfig.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/config/AppConfig.java
@@ -6,11 +6,12 @@
import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
@Configuration
-public class AppConfig {
- @Bean(name = "m2sysbiometrics.messageFactory")
- public SaajSoapMessageFactory messageFactory() {
- SaajSoapMessageFactory messageFactory = new SaajSoapMessageFactory();
- messageFactory.setSoapVersion(SoapVersion.SOAP_12);
- return messageFactory;
- }
-}
\ No newline at end of file
+public class AppConfig {
+
+ @Bean(name = "m2sysbiometrics.messageFactory")
+ public SaajSoapMessageFactory messageFactory() {
+ SaajSoapMessageFactory messageFactory = new SaajSoapMessageFactory();
+ messageFactory.setSoapVersion(SoapVersion.SOAP_12);
+ return messageFactory;
+ }
+}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/M2SysNationalSynchronizationFailureDao.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/M2SysNationalSynchronizationFailureDao.java
index 9d27ba1..d7baf92 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/M2SysNationalSynchronizationFailureDao.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/M2SysNationalSynchronizationFailureDao.java
@@ -1,16 +1,16 @@
package org.openmrs.module.m2sysbiometrics.dao;
-import org.openmrs.module.m2sysbiometrics.model.NationalSynchronizationFailure;
-
import java.util.List;
+import org.openmrs.module.m2sysbiometrics.model.NationalSynchronizationFailure;
+
public interface M2SysNationalSynchronizationFailureDao {
- NationalSynchronizationFailure save(NationalSynchronizationFailure nationalSynchronizationFailure);
+ NationalSynchronizationFailure save(NationalSynchronizationFailure nationalSynchronizationFailure);
- void delete(NationalSynchronizationFailure nationalSynchronizationFailure);
+ void delete(NationalSynchronizationFailure nationalSynchronizationFailure);
- List findAllRegistrationFailures();
+ List findAllRegistrationFailures();
- List findAllUpdateFailures();
+ List findAllUpdateFailures();
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/SyncFingerprintDao.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/SyncFingerprintDao.java
index 95f57c7..2706d16 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/SyncFingerprintDao.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/SyncFingerprintDao.java
@@ -1,18 +1,18 @@
package org.openmrs.module.m2sysbiometrics.dao;
-import org.openmrs.module.m2sysbiometrics.model.SyncFingerprint;
-
import java.util.List;
+import org.openmrs.module.m2sysbiometrics.model.SyncFingerprint;
+
public interface SyncFingerprintDao {
- SyncFingerprint saveOrUpdate(SyncFingerprint syncFingerprint);
+ SyncFingerprint saveOrUpdate(SyncFingerprint syncFingerprint);
- void delete(SyncFingerprint syncFingerprint);
+ void delete(SyncFingerprint syncFingerprint);
- SyncFingerprint findOneByBiometricId(String biometricId);
+ SyncFingerprint findOneByBiometricId(String biometricId);
- List findAllByBiometricXml(String biometricXml);
+ List findAllByBiometricXml(String biometricXml);
- List findAll();
+ List findAll();
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/TempFingerprintDao.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/TempFingerprintDao.java
index efe81bb..f8b38ce 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/TempFingerprintDao.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/TempFingerprintDao.java
@@ -1,17 +1,17 @@
package org.openmrs.module.m2sysbiometrics.dao;
-import org.openmrs.module.m2sysbiometrics.model.TempFingerprint;
-
import java.util.List;
+import org.openmrs.module.m2sysbiometrics.model.TempFingerprint;
+
public interface TempFingerprintDao {
- TempFingerprint saveOrUpdate(TempFingerprint tempFingerprint);
+ TempFingerprint saveOrUpdate(TempFingerprint tempFingerprint);
- void delete(TempFingerprint tempFingerprint);
+ void delete(TempFingerprint tempFingerprint);
- TempFingerprint findOneByBiometricId(String biometricId);
+ TempFingerprint findOneByBiometricId(String biometricId);
- List findAllByBiometricXml(String biometricXml);
+ List findAllByBiometricXml(String biometricXml);
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/impl/M2SysNationalSynchronizationFailureDaoImpl.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/impl/M2SysNationalSynchronizationFailureDaoImpl.java
index 20be1d6..0819d19 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/impl/M2SysNationalSynchronizationFailureDaoImpl.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/impl/M2SysNationalSynchronizationFailureDaoImpl.java
@@ -1,54 +1,54 @@
package org.openmrs.module.m2sysbiometrics.dao.impl;
+import java.util.List;
+
import org.openmrs.api.db.hibernate.DbSessionFactory;
import org.openmrs.module.m2sysbiometrics.dao.M2SysNationalSynchronizationFailureDao;
import org.openmrs.module.m2sysbiometrics.model.NationalSynchronizationFailure;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
-import java.util.List;
-
@Repository
public class M2SysNationalSynchronizationFailureDaoImpl implements M2SysNationalSynchronizationFailureDao {
- private static final String TABLE_NAME = "national_synchronization_failure";
-
- private static final String UPDATE = "update_failure";
-
- private static final String CREATED_DATE = "date_created";
-
- @Autowired
- private DbSessionFactory sessionFactory;
-
- @Override
- public NationalSynchronizationFailure save(NationalSynchronizationFailure nationalSynchronizationFailure) {
- sessionFactory.getCurrentSession().save(nationalSynchronizationFailure);
- return nationalSynchronizationFailure;
- }
-
- @Override
- public void delete(NationalSynchronizationFailure nationalSynchronizationFailure) {
- sessionFactory.getCurrentSession().delete(nationalSynchronizationFailure);
- }
-
- @Override
- public List findAllRegistrationFailures() {
- return findListByQuery(
- "SELECT * FROM " + TABLE_NAME + " failure "
- + "WHERE failure." + UPDATE + "=0 "
- + "ORDER BY " + CREATED_DATE);
- }
-
- @Override
- public List findAllUpdateFailures() {
- return findListByQuery(
- "SELECT * FROM " + TABLE_NAME + " failure "
- + "WHERE failure." + UPDATE + "=1 "
- + "ORDER BY " + CREATED_DATE);
- }
-
- private List findListByQuery(String query) {
- return sessionFactory.getCurrentSession().createSQLQuery(query)
- .addEntity(NationalSynchronizationFailure.class).list();
- }
+ private static final String TABLE_NAME = "national_synchronization_failure";
+
+ private static final String UPDATE = "update_failure";
+
+ private static final String CREATED_DATE = "date_created";
+
+ @Autowired
+ private DbSessionFactory sessionFactory;
+
+ @Override
+ public NationalSynchronizationFailure save(NationalSynchronizationFailure nationalSynchronizationFailure) {
+ sessionFactory.getCurrentSession().save(nationalSynchronizationFailure);
+ return nationalSynchronizationFailure;
+ }
+
+ @Override
+ public void delete(NationalSynchronizationFailure nationalSynchronizationFailure) {
+ sessionFactory.getCurrentSession().delete(nationalSynchronizationFailure);
+ }
+
+ @Override
+ public List findAllRegistrationFailures() {
+ return findListByQuery(
+ "SELECT * FROM " + TABLE_NAME + " failure "
+ + "WHERE failure." + UPDATE + "=0 "
+ + "ORDER BY " + CREATED_DATE);
+ }
+
+ @Override
+ public List findAllUpdateFailures() {
+ return findListByQuery(
+ "SELECT * FROM " + TABLE_NAME + " failure "
+ + "WHERE failure." + UPDATE + "=1 "
+ + "ORDER BY " + CREATED_DATE);
+ }
+
+ private List findListByQuery(String query) {
+ return sessionFactory.getCurrentSession().createSQLQuery(query)
+ .addEntity(NationalSynchronizationFailure.class).list();
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/impl/SyncFingerprintDaoImpl.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/impl/SyncFingerprintDaoImpl.java
index 6d7349b..f4d5f9c 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/impl/SyncFingerprintDaoImpl.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/impl/SyncFingerprintDaoImpl.java
@@ -1,71 +1,70 @@
package org.openmrs.module.m2sysbiometrics.dao.impl;
+import java.util.List;
+
import org.openmrs.api.db.hibernate.DbSessionFactory;
import org.openmrs.module.m2sysbiometrics.dao.SyncFingerprintDao;
import org.openmrs.module.m2sysbiometrics.model.SyncFingerprint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
-import java.util.List;
-
@Repository
public class SyncFingerprintDaoImpl implements SyncFingerprintDao {
- private static final String TABLE_NAME = "sync_fingerprint";
-
- private static final String BIOMETRIC_ID_COLUMN = "biometric_id";
-
- private static final String BIOMETRIC_XML_COLUMN = "biometric_xml";
-
- @Autowired
- private DbSessionFactory sessionFactory;
-
- @Override
- public SyncFingerprint saveOrUpdate(SyncFingerprint syncFingerprint) {
- SyncFingerprint existing = findOneByBiometricId(syncFingerprint.getBiometricId());
-
- if (existing == null) {
- sessionFactory.getCurrentSession().save(syncFingerprint);
- return syncFingerprint;
- } else {
- existing.setBiometricXml(syncFingerprint.getBiometricXml());
- sessionFactory.getCurrentSession().update(existing);
- return existing;
- }
-
- }
-
- @Override
- public void delete(SyncFingerprint syncFingerprint) {
- sessionFactory.getCurrentSession().delete(syncFingerprint);
- }
-
- @Override
- public SyncFingerprint findOneByBiometricId(String biometricId) {
- SyncFingerprint result = null;
- List results = findListByQuery(
- "SELECT * FROM " + TABLE_NAME + " WHERE " + BIOMETRIC_ID_COLUMN + "=\'" + biometricId + '\'');
- if (results != null && results.size() > 0) {
- result = results.get(0);
- }
- return result;
- }
-
-
- @Override
- public List findAllByBiometricXml(String biometricXml) {
- return findListByQuery(
- "SELECT * FROM " + TABLE_NAME + "WHERE " + BIOMETRIC_XML_COLUMN + "=\'" + biometricXml + '\'');
- }
-
- @Override
- public List findAll() {
- return findListByQuery(
- "SELECT * FROM " + TABLE_NAME );
- }
-
- private List findListByQuery(String query) {
- return sessionFactory.getCurrentSession().createSQLQuery(query)
- .addEntity(SyncFingerprint.class).list();
- }
+ private static final String TABLE_NAME = "sync_fingerprint";
+
+ private static final String BIOMETRIC_ID_COLUMN = "biometric_id";
+
+ private static final String BIOMETRIC_XML_COLUMN = "biometric_xml";
+
+ @Autowired
+ private DbSessionFactory sessionFactory;
+
+ @Override
+ public SyncFingerprint saveOrUpdate(SyncFingerprint syncFingerprint) {
+ SyncFingerprint existing = findOneByBiometricId(syncFingerprint.getBiometricId());
+
+ if (existing == null) {
+ sessionFactory.getCurrentSession().save(syncFingerprint);
+ return syncFingerprint;
+ } else {
+ existing.setBiometricXml(syncFingerprint.getBiometricXml());
+ sessionFactory.getCurrentSession().update(existing);
+ return existing;
+ }
+
+ }
+
+ @Override
+ public void delete(SyncFingerprint syncFingerprint) {
+ sessionFactory.getCurrentSession().delete(syncFingerprint);
+ }
+
+ @Override
+ public SyncFingerprint findOneByBiometricId(String biometricId) {
+ SyncFingerprint result = null;
+ List results = findListByQuery(
+ "SELECT * FROM " + TABLE_NAME + " WHERE " + BIOMETRIC_ID_COLUMN + "=\'" + biometricId + '\'');
+ if (results != null && results.size() > 0) {
+ result = results.get(0);
+ }
+ return result;
+ }
+
+ @Override
+ public List findAllByBiometricXml(String biometricXml) {
+ return findListByQuery(
+ "SELECT * FROM " + TABLE_NAME + "WHERE " + BIOMETRIC_XML_COLUMN + "=\'" + biometricXml + '\'');
+ }
+
+ @Override
+ public List findAll() {
+ return findListByQuery(
+ "SELECT * FROM " + TABLE_NAME);
+ }
+
+ private List findListByQuery(String query) {
+ return sessionFactory.getCurrentSession().createSQLQuery(query)
+ .addEntity(SyncFingerprint.class).list();
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/impl/TempFingerprintDaoImpl.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/impl/TempFingerprintDaoImpl.java
index 1cd4d28..6af1434 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/impl/TempFingerprintDaoImpl.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/dao/impl/TempFingerprintDaoImpl.java
@@ -1,67 +1,66 @@
package org.openmrs.module.m2sysbiometrics.dao.impl;
+import java.util.List;
+
import org.openmrs.api.db.hibernate.DbSessionFactory;
import org.openmrs.module.m2sysbiometrics.dao.TempFingerprintDao;
import org.openmrs.module.m2sysbiometrics.model.TempFingerprint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
-import java.util.List;
-
@Repository
public class TempFingerprintDaoImpl implements TempFingerprintDao {
- private static final String TABLE_NAME = "temp_fingerprint";
-
- private static final String BIOMETRIC_ID_COLUMN = "biometric_id";
+ private static final String TABLE_NAME = "temp_fingerprint";
- private static final String BIOMETRIC_XML_COLUMN = "biometric_xml";
+ private static final String BIOMETRIC_ID_COLUMN = "biometric_id";
- @Autowired
- private DbSessionFactory sessionFactory;
+ private static final String BIOMETRIC_XML_COLUMN = "biometric_xml";
- @Override
- public TempFingerprint saveOrUpdate(TempFingerprint tempFingerprint) {
- TempFingerprint existing = findOneByBiometricId(tempFingerprint.getBiometricId());
+ @Autowired
+ private DbSessionFactory sessionFactory;
- if (existing == null) {
- sessionFactory.getCurrentSession().save(tempFingerprint);
- return tempFingerprint;
- } else {
- existing.setBiometricXml(tempFingerprint.getBiometricXml());
- sessionFactory.getCurrentSession().update(existing);
- return existing;
- }
+ @Override
+ public TempFingerprint saveOrUpdate(TempFingerprint tempFingerprint) {
+ TempFingerprint existing = findOneByBiometricId(tempFingerprint.getBiometricId());
- }
+ if (existing == null) {
+ sessionFactory.getCurrentSession().save(tempFingerprint);
+ return tempFingerprint;
+ } else {
+ existing.setBiometricXml(tempFingerprint.getBiometricXml());
+ sessionFactory.getCurrentSession().update(existing);
+ return existing;
+ }
- @Override
- public void delete(TempFingerprint tempFingerprint) {
- sessionFactory.getCurrentSession().delete(tempFingerprint);
- }
+ }
- @Override
- public TempFingerprint findOneByBiometricId(String biometricId) {
- TempFingerprint result = null;
- List results = findListByQuery(
- "SELECT * FROM " + TABLE_NAME + " fp "
- + "WHERE fp." + BIOMETRIC_ID_COLUMN + "=\'" + biometricId + '\'');
- if (results != null && results.size() > 0) {
- result = results.get(0);
- }
- return result;
- }
+ @Override
+ public void delete(TempFingerprint tempFingerprint) {
+ sessionFactory.getCurrentSession().delete(tempFingerprint);
+ }
+ @Override
+ public TempFingerprint findOneByBiometricId(String biometricId) {
+ TempFingerprint result = null;
+ List results = findListByQuery(
+ "SELECT * FROM " + TABLE_NAME + " fp "
+ + "WHERE fp." + BIOMETRIC_ID_COLUMN + "=\'" + biometricId + '\'');
+ if (results != null && results.size() > 0) {
+ result = results.get(0);
+ }
+ return result;
+ }
- @Override
- public List findAllByBiometricXml(String biometricXml) {
- return findListByQuery(
- "SELECT * FROM " + TABLE_NAME + " fp "
- + "WHERE fp." + BIOMETRIC_XML_COLUMN + "=\'" + biometricXml + '\'');
- }
+ @Override
+ public List findAllByBiometricXml(String biometricXml) {
+ return findListByQuery(
+ "SELECT * FROM " + TABLE_NAME + " fp "
+ + "WHERE fp." + BIOMETRIC_XML_COLUMN + "=\'" + biometricXml + '\'');
+ }
- private List findListByQuery(String query) {
- return sessionFactory.getCurrentSession().createSQLQuery(query)
- .addEntity(TempFingerprint.class).list();
- }
+ private List findListByQuery(String query) {
+ return sessionFactory.getCurrentSession().createSQLQuery(query)
+ .addEntity(TempFingerprint.class).list();
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/exception/M2SysBiometricsException.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/exception/M2SysBiometricsException.java
index ae1b923..af02ea7 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/exception/M2SysBiometricsException.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/exception/M2SysBiometricsException.java
@@ -2,15 +2,15 @@
public class M2SysBiometricsException extends RuntimeException {
- public M2SysBiometricsException(Throwable e) {
- super(e);
- }
+ public M2SysBiometricsException(Throwable e) {
+ super(e);
+ }
- public M2SysBiometricsException(String message) {
- super(message);
- }
+ public M2SysBiometricsException(String message) {
+ super(message);
+ }
- public M2SysBiometricsException(String message, Throwable e) {
- super(message, e);
- }
+ public M2SysBiometricsException(String message, Throwable e) {
+ super(message, e);
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/http/M2SysHttpClient.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/http/M2SysHttpClient.java
index e16917d..c98c84e 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/http/M2SysHttpClient.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/http/M2SysHttpClient.java
@@ -8,14 +8,14 @@
public interface M2SysHttpClient {
- ResponseEntity getServerStatus(String url, Token token);
+ ResponseEntity getServerStatus(String url, Token token);
- M2SysResponse postRequest(String url, M2SysData request, Token token);
+ M2SysResponse postRequest(String url, M2SysData request, Token token);
- T postRequest(String url, M2SysData request, Token token,
- Class responseClass);
+ T postRequest(String url, M2SysData request, Token token,
+ Class responseClass);
- Token getToken(String host);
+ Token getToken(String host);
- Token getToken(String host, String appKey, String secretKey, String grantType);
+ Token getToken(String host, String appKey, String secretKey, String grantType);
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/http/M2SysHttpClientImpl.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/http/M2SysHttpClientImpl.java
index 550b4d1..20fc9b5 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/http/M2SysHttpClientImpl.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/http/M2SysHttpClientImpl.java
@@ -1,22 +1,24 @@
package org.openmrs.module.m2sysbiometrics.http;
-import org.apache.commons.lang.BooleanUtils;
-import org.apache.commons.lang.exception.ExceptionUtils;
+import javax.annotation.PostConstruct;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+
import org.codehaus.jackson.map.ObjectMapper;
import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
import org.openmrs.module.m2sysbiometrics.model.AbstractM2SysResponse;
-//import org.openmrs.module.m2sysbiometrics.model.LoggingMixin;
import org.openmrs.module.m2sysbiometrics.model.M2SysData;
-//import org.openmrs.module.m2sysbiometrics.model.M2SysRequest;
import org.openmrs.module.m2sysbiometrics.model.M2SysResponse;
import org.openmrs.module.m2sysbiometrics.model.Token;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
-import org.springframework.http.HttpEntity;
+import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
import org.springframework.stereotype.Component;
@@ -26,14 +28,6 @@
import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate;
-import javax.annotation.PostConstruct;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collections;
-
-import static org.openmrs.module.m2sysbiometrics.M2SysBiometricsConstants.getErrorMessage;
-
/**
* Serves as a base for all implementation of the resource interfaces. Provides method for basic
* REST operations with the M2Sys servers.
@@ -41,111 +35,113 @@
@Component
public class M2SysHttpClientImpl implements M2SysHttpClient {
- private static final Logger LOGGER = LoggerFactory.getLogger(M2SysHttpClientImpl.class);
-
- private RestOperations restOperations = new RestTemplate();
-
- private final ObjectMapper objectMapper = new ObjectMapper();
-
- @PostConstruct
- public void init() {
- // don't log customer key
- // objectMapper.getSerializationConfig().addMixInAnnotations(M2SysRequest.class, LoggingMixin.class);
- // objectMapper.getSerializationConfig().addMixInAnnotations(M2SysResponse.class, LoggingMixin.class);
-
- configureJackson((RestTemplate) restOperations);
- }
-
- @Override
- public ResponseEntity getServerStatus(String url, Token token) {
- try {
- return exchange(new URI(url), HttpMethod.GET, String.class, token);
- } catch (URISyntaxException e) {
- throw new M2SysBiometricsException(e);
- }
- }
+ private static final Logger LOGGER = LoggerFactory.getLogger(M2SysHttpClientImpl.class);
- @Override
- public M2SysResponse postRequest(String url, M2SysData request, Token token) {
- return postRequest(url, request, token, M2SysResponse.class);
- }
+ private final ObjectMapper objectMapper = new ObjectMapper();
- /**
- * Sends a post request to the M2Sys server.
- *
- * @param request the request to be sent
- * @return the response json
- */
- @Override
- public T postRequest(String url, M2SysData request, Token token,
- Class responseClass) {
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.APPLICATION_JSON);
- headers.setAccept(Collections.singletonList(MediaType.ALL));
-
- debugRequest(url, request);
-
- try {
- ResponseEntity responseEntity = exchange(new URI(url), HttpMethod.POST, request, headers,
- responseClass, token);
- T response = responseEntity.getBody();
-// checkResponse(response);
- return response;
- } catch (HttpStatusCodeException e) {
- throw new M2SysBiometricsException("Error response, status: " + e.getStatusCode() + ""
- + " " + e.getStatusText() + ". Body: " + e.getResponseBodyAsString(), e);
- } catch (Exception e) {
- throw new M2SysBiometricsException(e);
- }
- }
+ private RestOperations restOperations = new RestTemplate();
- private ResponseEntity exchange(URI url, HttpMethod method, Class responseClass, Token token) {
- return exchange(url, method, null, new HttpHeaders(), responseClass, token);
- }
+ @PostConstruct
+ public void init() {
+ // don't log customer key
+ // objectMapper.getSerializationConfig().addMixInAnnotations(M2SysRequest.class, LoggingMixin.class);
+ // objectMapper.getSerializationConfig().addMixInAnnotations(M2SysResponse.class, LoggingMixin.class);
- private ResponseEntity exchange(URI url, HttpMethod method, Object body,
- HttpHeaders headers, Class responseClass, Token token) {
+ configureJackson((RestTemplate) restOperations);
+ }
- if(token!=null){
- headers.add("Authorization", token.getTokenType() + " " + token.getAccessToken());
- }
+ @Override
+ public ResponseEntity getServerStatus(String url, Token token) {
+ try {
+ return exchange(new URI(url), HttpMethod.GET, String.class, token);
+ }
+ catch (URISyntaxException e) {
+ throw new M2SysBiometricsException(e);
+ }
+ }
- return restOperations.exchange(url, method, new HttpEntity<>(body, headers), responseClass);
- }
+ @Override
+ public M2SysResponse postRequest(String url, M2SysData request, Token token) {
+ return postRequest(url, request, token, M2SysResponse.class);
+ }
+
+ /**
+ * Sends a post request to the M2Sys server.
+ *
+ * @param request the request to be sent
+ * @return the response json
+ */
+ @Override
+ public T postRequest(String url, M2SysData request, Token token,
+ Class responseClass) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ headers.setAccept(Collections.singletonList(MediaType.ALL));
+
+ debugRequest(url, request);
+
+ try {
+ ResponseEntity responseEntity = exchange(new URI(url), HttpMethod.POST, request, headers,
+ responseClass, token);
+ T response = responseEntity.getBody();
+ // checkResponse(response);
+ return response;
+ }
+ catch (HttpStatusCodeException e) {
+ throw new M2SysBiometricsException("Error response, status: " + e.getStatusCode() + ""
+ + " " + e.getStatusText() + ". Body: " + e.getResponseBodyAsString(), e);
+ }
+ catch (Exception e) {
+ throw new M2SysBiometricsException(e);
+ }
+ }
+
+ private ResponseEntity exchange(URI url, HttpMethod method, Class responseClass, Token token) {
+ return exchange(url, method, null, new HttpHeaders(), responseClass, token);
+ }
+
+ private ResponseEntity exchange(URI url, HttpMethod method, Object body,
+ HttpHeaders headers, Class responseClass, Token token) {
+
+ if (token != null) {
+ headers.add("Authorization", token.getTokenType() + " " + token.getAccessToken());
+ }
+
+ return restOperations.exchange(url, method, new HttpEntity<>(body, headers), responseClass);
+ }
-
@Override
- public Token getToken(String host) {
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+ public Token getToken(String host) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
- MultiValueMap body = new LinkedMultiValueMap<>();
- //body.add("grant_type", "password");
- // body.add("username", username);
- // body.add("Password", password);
- // body.add("scope", customerKey);
+ MultiValueMap body = new LinkedMultiValueMap<>();
+ //body.add("grant_type", "password");
+ // body.add("username", username);
+ // body.add("Password", password);
+ // body.add("scope", customerKey);
- HttpEntity> entity = new HttpEntity<>(body, headers);
+ HttpEntity> entity = new HttpEntity<>(body, headers);
- return restOperations.exchange(host, HttpMethod.POST,entity, Token.class)
- .getBody();
- }
+ return restOperations.exchange(host, HttpMethod.POST, entity, Token.class)
+ .getBody();
+ }
- @Override
- public Token getToken(String host, String appKey, String secretKey, String grantType) {
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+ @Override
+ public Token getToken(String host, String appKey, String secretKey, String grantType) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
- MultiValueMap body = new LinkedMultiValueMap<>();
- body.add("grant_type", grantType);
- body.add("username", appKey);
- body.add("password", secretKey);
+ MultiValueMap body = new LinkedMultiValueMap<>();
+ body.add("grant_type", grantType);
+ body.add("username", appKey);
+ body.add("password", secretKey);
- HttpEntity> entity = new HttpEntity<>(body, headers);
+ HttpEntity> entity = new HttpEntity<>(body, headers);
- return restOperations.exchange(host + "/token", HttpMethod.POST, entity, Token.class)
- .getBody();
- }
+ return restOperations.exchange(host + "/token", HttpMethod.POST, entity, Token.class)
+ .getBody();
+ }
/*
@Override
@@ -165,35 +161,36 @@ public Token getToken(String host, String username, String password, String cust
.getBody();
}
*/
-// private void checkResponse(AbstractM2SysResponse response) {
-// if (BooleanUtils.isNotTrue(response.getSuccess())) {
-// String errorCode = response.getResponseCode();
-// throw new M2SysBiometricsException("Failure response: " + errorCode + " - " + getErrorMessage(errorCode));
-// }
-// }
-
- private void debugRequest(String url, Object request) {
- if (LOGGER.isDebugEnabled()) {
- if (request == null) {
- LOGGER.debug("{} called");
- } else {
- try {
- String json = objectMapper.writerWithDefaultPrettyPrinter()
- .writeValueAsString(request);
- LOGGER.debug("{} called, request body:\n {}", url, json);
- } catch (IOException e) {
- throw new M2SysBiometricsException(e);
- }
- }
- }
- }
-
- private void configureJackson(RestTemplate restTemplate) {
- MappingJacksonHttpMessageConverter messageConverter = new MappingJacksonHttpMessageConverter();
- messageConverter.setPrettyPrint(false);
-
- restTemplate.getMessageConverters().removeIf(m -> m.getClass().getName().equals(
- MappingJackson2HttpMessageConverter.class.getName()));
- restTemplate.getMessageConverters().add(messageConverter);
- }
+ // private void checkResponse(AbstractM2SysResponse response) {
+ // if (BooleanUtils.isNotTrue(response.getSuccess())) {
+ // String errorCode = response.getResponseCode();
+ // throw new M2SysBiometricsException("Failure response: " + errorCode + " - " + getErrorMessage(errorCode));
+ // }
+ // }
+
+ private void debugRequest(String url, Object request) {
+ if (LOGGER.isDebugEnabled()) {
+ if (request == null) {
+ LOGGER.debug("{} called");
+ } else {
+ try {
+ String json = objectMapper.writerWithDefaultPrettyPrinter()
+ .writeValueAsString(request);
+ LOGGER.debug("{} called, request body:\n {}", url, json);
+ }
+ catch (IOException e) {
+ throw new M2SysBiometricsException(e);
+ }
+ }
+ }
+ }
+
+ private void configureJackson(RestTemplate restTemplate) {
+ MappingJacksonHttpMessageConverter messageConverter = new MappingJacksonHttpMessageConverter();
+ messageConverter.setPrettyPrint(false);
+
+ restTemplate.getMessageConverters().removeIf(m -> m.getClass().getName().equals(
+ MappingJackson2HttpMessageConverter.class.getName()));
+ restTemplate.getMessageConverters().add(messageConverter);
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/AbstractM2SysRequest.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/AbstractM2SysRequest.java
index b35849c..74fb4fd 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/AbstractM2SysRequest.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/AbstractM2SysRequest.java
@@ -4,38 +4,39 @@
public class AbstractM2SysRequest extends M2SysData {
- private static final long serialVersionUID = -8902210266672985893L;
-
- // @JsonProperty("CustomerKey")
- // private String customerKey;
-
- // @JsonProperty("AccessPointID")
- // private String accessPointId;
-
- @JsonProperty("CaptureTimeOut")
- private Float captureTimeout;
-/*
- public String getCustomerKey() {
- return customerKey;
- }
-
- public void setCustomerKey(String customerKey) {
- this.customerKey = customerKey;
- }
-
- public String getAccessPointId() {
- return accessPointId;
- }
-
- public void setAccessPointId(String accessPointId) {
- this.accessPointId = accessPointId;
- }
-*/
- public Float getCaptureTimeout() {
- return captureTimeout;
- }
-
- public void setCaptureTimeout(Float captureTimeout) {
- this.captureTimeout = captureTimeout;
- }
+ private static final long serialVersionUID = -8902210266672985893L;
+
+ // @JsonProperty("CustomerKey")
+ // private String customerKey;
+
+ // @JsonProperty("AccessPointID")
+ // private String accessPointId;
+
+ @JsonProperty("CaptureTimeOut")
+ private Float captureTimeout;
+
+ /*
+ public String getCustomerKey() {
+ return customerKey;
+ }
+
+ public void setCustomerKey(String customerKey) {
+ this.customerKey = customerKey;
+ }
+
+ public String getAccessPointId() {
+ return accessPointId;
+ }
+
+ public void setAccessPointId(String accessPointId) {
+ this.accessPointId = accessPointId;
+ }
+ */
+ public Float getCaptureTimeout() {
+ return captureTimeout;
+ }
+
+ public void setCaptureTimeout(Float captureTimeout) {
+ this.captureTimeout = captureTimeout;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/AbstractM2SysResponse.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/AbstractM2SysResponse.java
index 06a14b7..41127f2 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/AbstractM2SysResponse.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/AbstractM2SysResponse.java
@@ -4,38 +4,38 @@
public class AbstractM2SysResponse extends M2SysData {
- private static final long serialVersionUID = 5297535433389093052L;
+ private static final long serialVersionUID = 5297535433389093052L;
- @JsonProperty("Success")
- private Boolean success;
+ @JsonProperty("Success")
+ private Boolean success;
- @JsonProperty("Message")
- private String message;
+ @JsonProperty("Message")
+ private String message;
- @JsonProperty("ResponseCode")
- private String responseCode;
+ @JsonProperty("ResponseCode")
+ private String responseCode;
- public Boolean getSuccess() {
- return success;
- }
+ public Boolean getSuccess() {
+ return success;
+ }
- public void setSuccess(Boolean success) {
- this.success = success;
- }
+ public void setSuccess(Boolean success) {
+ this.success = success;
+ }
- public String getMessage() {
- return message;
- }
+ public String getMessage() {
+ return message;
+ }
- public void setMessage(String message) {
- this.message = message;
- }
+ public void setMessage(String message) {
+ this.message = message;
+ }
- public String getResponseCode() {
- return responseCode;
- }
+ public String getResponseCode() {
+ return responseCode;
+ }
- public void setResponseCode(String responseCode) {
- this.responseCode = responseCode;
- }
+ public void setResponseCode(String responseCode) {
+ this.responseCode = responseCode;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/BiometricCaptureType.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/BiometricCaptureType.java
index 18d26a6..43bb82f 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/BiometricCaptureType.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/BiometricCaptureType.java
@@ -1,5 +1,5 @@
package org.openmrs.module.m2sysbiometrics.model;
public enum BiometricCaptureType {
- None, BiometricOnly, BothBiometricAndPicture, PictureOnly
+ None, BiometricOnly, BothBiometricAndPicture, PictureOnly
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/ChangeIdRequest.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/ChangeIdRequest.java
index 2666576..247b67b 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/ChangeIdRequest.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/ChangeIdRequest.java
@@ -4,16 +4,16 @@
public class ChangeIdRequest extends M2SysRequest {
- private static final long serialVersionUID = 6750595360135161824L;
+ private static final long serialVersionUID = 6750595360135161824L;
- @JsonProperty("NewRegistrationID")
- private String newRegistrationId;
+ @JsonProperty("NewRegistrationID")
+ private String newRegistrationId;
- public String getNewRegistrationId() {
- return newRegistrationId;
- }
+ public String getNewRegistrationId() {
+ return newRegistrationId;
+ }
- public void setNewRegistrationId(String newRegistrationId) {
- this.newRegistrationId = newRegistrationId;
- }
+ public void setNewRegistrationId(String newRegistrationId) {
+ this.newRegistrationId = newRegistrationId;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/CloudAbisResult.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/CloudAbisResult.java
index 36af231..c6d8bb8 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/CloudAbisResult.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/CloudAbisResult.java
@@ -1,93 +1,100 @@
package org.openmrs.module.m2sysbiometrics.model;
-import org.codehaus.jackson.annotate.JsonProperty;
-
import java.util.List;
+import org.codehaus.jackson.annotate.JsonProperty;
+
public class CloudAbisResult extends AbstractM2SysResponse {
- private static final long serialVersionUID = 2636478741110327810L;
- @JsonProperty("CustomerID")
- private String customerID;
- @JsonProperty("OperationName")
- private Integer operationName;
- @JsonProperty("Status")
- private String status;
- @JsonProperty("OperationResult")
- private String operationResult;
- @JsonProperty("BestResult")
- private ScoreResult bestResult;
- @JsonProperty("DetailResult")
- private List detailResult;
- @JsonProperty("MatchCount")
- private Integer matchCount;
-
-
- public String getCustomerID() {
- return customerID;
- }
-
- public void setCustomerID(String customerID) {
- this.customerID = customerID;
- }
-
- public Integer getOperationName() {
- return operationName;
- }
-
- public void setOperationName(Integer operationName) {
- this.operationName = operationName;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getOperationResult() {
- return operationResult;
- }
-
- public void setOperationResult(String operationResult) {
- this.operationResult = operationResult;
- }
-
- public ScoreResult getBestResult() {
- return bestResult;
- }
-
- public void setBestResult(ScoreResult bestResult) {
- this.bestResult = bestResult;
- }
-
- public List getDetailResult() {
- return detailResult;
- }
-
- public void setDetailResult(List detailResult) {
- this.detailResult = detailResult;
- }
-
- public Integer getMatchCount() {
- return matchCount;
- }
-
- public void setMatchCount(Integer matchCount) {
- this.matchCount = matchCount;
- }
-
- @Override
- public String toString() {
- return "CloudAbisResult{" +
- "customerID='" + customerID + '\'' +
- ", operationName=" + operationName +
- ", status='" + status + '\'' +
- ", operationResult='" + operationResult + '\'' +
- ", bestResult=" + bestResult +
- ", detailResult=" + detailResult +
- ", matchCount=" + matchCount +
- '}';
- }
+
+ private static final long serialVersionUID = 2636478741110327810L;
+
+ @JsonProperty("CustomerID")
+ private String customerID;
+
+ @JsonProperty("OperationName")
+ private Integer operationName;
+
+ @JsonProperty("Status")
+ private String status;
+
+ @JsonProperty("OperationResult")
+ private String operationResult;
+
+ @JsonProperty("BestResult")
+ private ScoreResult bestResult;
+
+ @JsonProperty("DetailResult")
+ private List detailResult;
+
+ @JsonProperty("MatchCount")
+ private Integer matchCount;
+
+ public String getCustomerID() {
+ return customerID;
+ }
+
+ public void setCustomerID(String customerID) {
+ this.customerID = customerID;
+ }
+
+ public Integer getOperationName() {
+ return operationName;
+ }
+
+ public void setOperationName(Integer operationName) {
+ this.operationName = operationName;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getOperationResult() {
+ return operationResult;
+ }
+
+ public void setOperationResult(String operationResult) {
+ this.operationResult = operationResult;
+ }
+
+ public ScoreResult getBestResult() {
+ return bestResult;
+ }
+
+ public void setBestResult(ScoreResult bestResult) {
+ this.bestResult = bestResult;
+ }
+
+ public List getDetailResult() {
+ return detailResult;
+ }
+
+ public void setDetailResult(List detailResult) {
+ this.detailResult = detailResult;
+ }
+
+ public Integer getMatchCount() {
+ return matchCount;
+ }
+
+ public void setMatchCount(Integer matchCount) {
+ this.matchCount = matchCount;
+ }
+
+ @Override
+ public String toString() {
+ return "CloudAbisResult{" +
+ "customerID='" + customerID + '\'' +
+ ", operationName=" + operationName +
+ ", status='" + status + '\'' +
+ ", operationResult='" + operationResult + '\'' +
+ ", bestResult=" + bestResult +
+ ", detailResult=" + detailResult +
+ ", matchCount=" + matchCount +
+ '}';
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/CloudScanrStatus.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/CloudScanrStatus.java
index 7039a06..b778dfc 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/CloudScanrStatus.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/CloudScanrStatus.java
@@ -4,73 +4,71 @@
public class CloudScanrStatus extends M2SysData {
- private static final long serialVersionUID = 5297535433389093032L;
+ private static final long serialVersionUID = 5297535433389093032L;
- @JsonProperty("Success")
- private Boolean success;
+ @JsonProperty("Success")
+ private Boolean success;
- @JsonProperty("Message")
- private String message;
+ @JsonProperty("Message")
+ private String message;
- @JsonProperty("ResponseCode")
- private String responseCode;
+ @JsonProperty("ResponseCode")
+ private String responseCode;
- @JsonProperty("CloudScanrAPIVersion")
- private String cloudScanrAPIVersion;
+ @JsonProperty("CloudScanrAPIVersion")
+ private String cloudScanrAPIVersion;
- @JsonProperty("CloudABISAPIVersion")
- private String cloudABISAPIVersion;
+ @JsonProperty("CloudABISAPIVersion")
+ private String cloudABISAPIVersion;
- @JsonProperty("ElapsedTimeInSeconds")
- private String elapsedTimeInSeconds;
+ @JsonProperty("ElapsedTimeInSeconds")
+ private String elapsedTimeInSeconds;
+ public Boolean getSuccess() {
+ return success;
+ }
+ public void setSuccess(Boolean success) {
+ this.success = success;
+ }
- public Boolean getSuccess() {
- return success;
- }
+ public String getMessage() {
+ return message;
+ }
- public void setSuccess(Boolean success) {
- this.success = success;
- }
+ public void setMessage(String message) {
+ this.message = message;
+ }
- public String getMessage() {
- return message;
- }
+ public String getResponseCode() {
+ return responseCode;
+ }
- public void setMessage(String message) {
- this.message = message;
- }
+ public void setResponseCode(String responseCode) {
+ this.responseCode = responseCode;
+ }
- public String getResponseCode() {
- return responseCode;
- }
+ public String getCloudScanrAPIVersion() {
+ return cloudScanrAPIVersion;
+ }
- public void setResponseCode(String responseCode) {
- this.responseCode = responseCode;
- }
+ public void setCloudScanrAPIVersion(String cloudScanrAPIVersion) {
+ this.cloudScanrAPIVersion = cloudScanrAPIVersion;
+ }
- public String getCloudScanrAPIVersion() {
- return cloudScanrAPIVersion;
- }
+ public String getCloudABISAPIVersion() {
+ return cloudABISAPIVersion;
+ }
- public void setCloudScanrAPIVersion(String cloudScanrAPIVersion) {
- this.cloudScanrAPIVersion = cloudScanrAPIVersion;
- }
+ public void setCloudABISAPIVersion(String cloudABISAPIVersion) {
+ this.cloudABISAPIVersion = cloudABISAPIVersion;
+ }
- public String getCloudABISAPIVersion() {
- return cloudABISAPIVersion;
- }
+ public String getElapsedTimeInSeconds() {
+ return elapsedTimeInSeconds;
+ }
- public void setCloudABISAPIVersion(String cloudABISAPIVersion) {
- this.cloudABISAPIVersion = cloudABISAPIVersion;
- }
-
- public String getElapsedTimeInSeconds() {
- return elapsedTimeInSeconds;
- }
-
- public void setElapsedTimeInSeconds(String elapsedTimeInSeconds) {
- this.elapsedTimeInSeconds = elapsedTimeInSeconds;
- }
+ public void setElapsedTimeInSeconds(String elapsedTimeInSeconds) {
+ this.elapsedTimeInSeconds = elapsedTimeInSeconds;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Finger.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Finger.java
index f88358c..9a5c580 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Finger.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Finger.java
@@ -1,40 +1,40 @@
package org.openmrs.module.m2sysbiometrics.model;
-import org.openmrs.module.registrationcore.api.biometrics.model.Fingerprint;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;
+import org.openmrs.module.registrationcore.api.biometrics.model.Fingerprint;
+
@XmlRootElement(name = "Finger")
@XmlAccessorType(XmlAccessType.FIELD)
public class Finger {
- @XmlAttribute(name = "POS")
- private String pos;
+ @XmlAttribute(name = "POS")
+ private String pos;
- @XmlValue
- private String templateData;
+ @XmlValue
+ private String templateData;
- public String getTemplateData() {
- return templateData;
- }
+ public String getTemplateData() {
+ return templateData;
+ }
- public void setTemplateData(String templateData) {
- this.templateData = templateData;
- }
+ public void setTemplateData(String templateData) {
+ this.templateData = templateData;
+ }
- public String getPos() {
- return pos;
- }
+ public String getPos() {
+ return pos;
+ }
- public void setPos(String pos) {
- this.pos = pos;
- }
+ public void setPos(String pos) {
+ this.pos = pos;
+ }
- public Fingerprint toOpenMRSFingerprint() {
- return new Fingerprint("ISO", "ISO", templateData);
- }
+ public Fingerprint toOpenMRSFingerprint() {
+ return new Fingerprint("ISO", "ISO", templateData);
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/FingerScanStatus.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/FingerScanStatus.java
index eade419..d9d2721 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/FingerScanStatus.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/FingerScanStatus.java
@@ -4,28 +4,28 @@
public class FingerScanStatus {
- private BiometricSubject localBiometricSubject;
+ private BiometricSubject localBiometricSubject;
- private BiometricSubject nationalBiometricSubject;
+ private BiometricSubject nationalBiometricSubject;
- public FingerScanStatus(BiometricSubject localBiometricSubject, BiometricSubject nationalBiometricSubject) {
- this.localBiometricSubject = localBiometricSubject;
- this.nationalBiometricSubject = nationalBiometricSubject;
- }
+ public FingerScanStatus(BiometricSubject localBiometricSubject, BiometricSubject nationalBiometricSubject) {
+ this.localBiometricSubject = localBiometricSubject;
+ this.nationalBiometricSubject = nationalBiometricSubject;
+ }
- public boolean isRegisteredLocally() {
- return localBiometricSubject != null;
- }
+ public boolean isRegisteredLocally() {
+ return localBiometricSubject != null;
+ }
- public boolean isRegisteredNationally() {
- return nationalBiometricSubject != null;
- }
+ public boolean isRegisteredNationally() {
+ return nationalBiometricSubject != null;
+ }
- public BiometricSubject getLocalBiometricSubject() {
- return localBiometricSubject;
- }
+ public BiometricSubject getLocalBiometricSubject() {
+ return localBiometricSubject;
+ }
- public BiometricSubject getNationalBiometricSubject() {
- return nationalBiometricSubject;
- }
+ public BiometricSubject getNationalBiometricSubject() {
+ return nationalBiometricSubject;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Fingers.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Fingers.java
index c7c1a89..cf2f81d 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Fingers.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Fingers.java
@@ -1,8 +1,5 @@
package org.openmrs.module.m2sysbiometrics.model;
-import org.apache.commons.collections.CollectionUtils;
-import org.openmrs.module.registrationcore.api.biometrics.model.Fingerprint;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -11,43 +8,46 @@
import java.util.Arrays;
import java.util.List;
+import org.apache.commons.collections.CollectionUtils;
+import org.openmrs.module.registrationcore.api.biometrics.model.Fingerprint;
+
@XmlRootElement(name = "Fingers")
@XmlAccessorType(XmlAccessType.FIELD)
public class Fingers {
- @XmlElement(name = "Finger")
- private List fingers;
+ @XmlElement(name = "Finger")
+ private List fingers;
- public List getFingers() {
- return fingers;
- }
+ public List getFingers() {
+ return fingers;
+ }
- public void setFingers(List fingers) {
- this.fingers = fingers;
- }
+ public void setFingers(List fingers) {
+ this.fingers = fingers;
+ }
- public boolean bothFingersCaptured() {
- return CollectionUtils.size(fingers) > 1;
- }
+ public boolean bothFingersCaptured() {
+ return CollectionUtils.size(fingers) > 1;
+ }
- public String getLeftFingerData() {
- return fingers.get(0).getTemplateData();
- }
+ public String getLeftFingerData() {
+ return fingers.get(0).getTemplateData();
+ }
- public String getRightFingerData() {
- return fingers.get(1).getTemplateData();
- }
+ public String getRightFingerData() {
+ return fingers.get(1).getTemplateData();
+ }
- public List toTwoOpenMrsFingerprints() {
- Finger leftFinger = fingers.get(0);
- Finger rightFinger = fingers.get(1);
+ public List toTwoOpenMrsFingerprints() {
+ Finger leftFinger = fingers.get(0);
+ Finger rightFinger = fingers.get(1);
- return new ArrayList<>(Arrays.asList(leftFinger.toOpenMRSFingerprint(),
- rightFinger.toOpenMRSFingerprint()));
- }
+ return new ArrayList<>(Arrays.asList(leftFinger.toOpenMRSFingerprint(),
+ rightFinger.toOpenMRSFingerprint()));
+ }
- public void trimData() {
- fingers.get(0).setTemplateData(fingers.get(0).getTemplateData().trim());
- fingers.get(1).setTemplateData(fingers.get(1).getTemplateData().trim());
- }
+ public void trimData() {
+ fingers.get(0).setTemplateData(fingers.get(0).getTemplateData().trim());
+ fingers.get(1).setTemplateData(fingers.get(1).getTemplateData().trim());
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysCaptureRequest.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysCaptureRequest.java
index 7dd1439..b59b0c5 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysCaptureRequest.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysCaptureRequest.java
@@ -3,104 +3,105 @@
import org.codehaus.jackson.annotate.JsonProperty;
public class M2SysCaptureRequest extends AbstractM2SysRequest {
- private static final long serialVersionUID = 1996985652532947266L;
- @JsonProperty("CaptureType")
- private Integer captureType;
+ private static final long serialVersionUID = 1996985652532947266L;
- @JsonProperty("CaptureMode")
- private Integer captureMode;
+ @JsonProperty("CaptureType")
+ private Integer captureType;
- @JsonProperty("SingleCaptureMode")
- private Integer singleCaptureMode;
+ @JsonProperty("CaptureMode")
+ private Integer captureMode;
- @JsonProperty("QuickScan")
- private Integer quickScan;
+ @JsonProperty("SingleCaptureMode")
+ private Integer singleCaptureMode;
- @JsonProperty("TemplateFormat")
- private Integer templateFormat;
+ @JsonProperty("QuickScan")
+ private Integer quickScan;
- @JsonProperty("BioMetricImageFormat")
- private Integer biometricImageFormat;
+ @JsonProperty("TemplateFormat")
+ private Integer templateFormat;
- @JsonProperty("CaptureOperationName")
- private Integer captureOperationName;
+ @JsonProperty("BioMetricImageFormat")
+ private Integer biometricImageFormat;
- @JsonProperty("FaceImage")
- private Integer faceImage;
+ @JsonProperty("CaptureOperationName")
+ private Integer captureOperationName;
- @JsonProperty("DeviceName")
- private String deviceName;
+ @JsonProperty("FaceImage")
+ private Integer faceImage;
- public Integer getCaptureType() {
- return captureType;
- }
+ @JsonProperty("DeviceName")
+ private String deviceName;
- public void setCaptureType(Integer captureType) {
- this.captureType = captureType;
- }
+ public Integer getCaptureType() {
+ return captureType;
+ }
- public Integer getCaptureMode() {
- return captureMode;
- }
+ public void setCaptureType(Integer captureType) {
+ this.captureType = captureType;
+ }
- public void setCaptureMode(Integer captureMode) {
- this.captureMode = captureMode;
- }
+ public Integer getCaptureMode() {
+ return captureMode;
+ }
- public Integer getSingleCaptureMode() {
- return singleCaptureMode;
- }
+ public void setCaptureMode(Integer captureMode) {
+ this.captureMode = captureMode;
+ }
- public void setSingleCaptureMode(Integer singleCaptureMode) {
- this.singleCaptureMode = singleCaptureMode;
- }
+ public Integer getSingleCaptureMode() {
+ return singleCaptureMode;
+ }
- public Integer getQuickScan() {
- return quickScan;
- }
+ public void setSingleCaptureMode(Integer singleCaptureMode) {
+ this.singleCaptureMode = singleCaptureMode;
+ }
- public void setQuickScan(Integer quickScan) {
- this.quickScan = quickScan;
- }
+ public Integer getQuickScan() {
+ return quickScan;
+ }
- public Integer getTemplateFormat() {
- return templateFormat;
- }
+ public void setQuickScan(Integer quickScan) {
+ this.quickScan = quickScan;
+ }
- public void setTemplateFormat(Integer templateFormat) {
- this.templateFormat = templateFormat;
- }
+ public Integer getTemplateFormat() {
+ return templateFormat;
+ }
- public Integer getBiometricImageFormat() {
- return biometricImageFormat;
- }
+ public void setTemplateFormat(Integer templateFormat) {
+ this.templateFormat = templateFormat;
+ }
- public void setBiometricImageFormat(Integer biometricImageFormat) {
- this.biometricImageFormat = biometricImageFormat;
- }
+ public Integer getBiometricImageFormat() {
+ return biometricImageFormat;
+ }
- public Integer getCaptureOperationName() {
- return captureOperationName;
- }
+ public void setBiometricImageFormat(Integer biometricImageFormat) {
+ this.biometricImageFormat = biometricImageFormat;
+ }
- public void setCaptureOperationName(Integer captureOperationName) {
- this.captureOperationName = captureOperationName;
- }
+ public Integer getCaptureOperationName() {
+ return captureOperationName;
+ }
- public Integer getFaceImage() {
- return faceImage;
- }
+ public void setCaptureOperationName(Integer captureOperationName) {
+ this.captureOperationName = captureOperationName;
+ }
- public void setFaceImage(Integer faceImage) {
- this.faceImage = faceImage;
- }
+ public Integer getFaceImage() {
+ return faceImage;
+ }
- public void setDeviceName(String deviceName) {
- this.deviceName = deviceName;
- }
+ public void setFaceImage(Integer faceImage) {
+ this.faceImage = faceImage;
+ }
- public String getDeviceName() {
- return deviceName;
- }
+ public String getDeviceName() {
+ return deviceName;
+ }
+
+ public void setDeviceName(String deviceName) {
+ this.deviceName = deviceName;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysCaptureResponse.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysCaptureResponse.java
index cd8108a..8e7a002 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysCaptureResponse.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysCaptureResponse.java
@@ -1,66 +1,68 @@
package org.openmrs.module.m2sysbiometrics.model;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
-import org.xml.sax.InputSource;
-
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.StringReader;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
+import org.xml.sax.InputSource;
+
public class M2SysCaptureResponse extends AbstractM2SysResponse {
- private static final long serialVersionUID = -3527335270475362208L;
- @JsonProperty("TemplateData")
- private String templateData;
+ private static final long serialVersionUID = -3527335270475362208L;
+
+ @JsonProperty("TemplateData")
+ private String templateData;
- @JsonProperty("BioImageData")
- private String bioImageData;
+ @JsonProperty("BioImageData")
+ private String bioImageData;
- @JsonProperty("FaceImageData")
- private String faceImageData;
+ @JsonProperty("FaceImageData")
+ private String faceImageData;
- public String getTemplateData() {
- return templateData;
- }
+ public String getTemplateData() {
+ return templateData;
+ }
- public void setTemplateData(String templateData) {
- this.templateData = templateData;
- }
+ public void setTemplateData(String templateData) {
+ this.templateData = templateData;
+ }
- public String getBioImageData() {
- return bioImageData;
- }
+ public String getBioImageData() {
+ return bioImageData;
+ }
- public void setBioImageData(String bioImageData) {
- this.bioImageData = bioImageData;
- }
+ public void setBioImageData(String bioImageData) {
+ this.bioImageData = bioImageData;
+ }
- public String getFaceImageData() {
- return faceImageData;
- }
+ public String getFaceImageData() {
+ return faceImageData;
+ }
- public void setFaceImageData(String faceImageData) {
- this.faceImageData = faceImageData;
- }
+ public void setFaceImageData(String faceImageData) {
+ this.faceImageData = faceImageData;
+ }
- @JsonIgnore
- public Fingers getFingerData(JAXBContext jaxbContext) {
- try {
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ @JsonIgnore
+ public Fingers getFingerData(JAXBContext jaxbContext) {
+ try {
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- InputSource inputSource = new InputSource(new StringReader(templateData));
+ InputSource inputSource = new InputSource(new StringReader(templateData));
- Fingers fingers = (Fingers) unmarshaller.unmarshal(inputSource);
+ Fingers fingers = (Fingers) unmarshaller.unmarshal(inputSource);
- fingers.trimData();
+ fingers.trimData();
- return fingers;
- } catch (JAXBException e) {
- throw new M2SysBiometricsException("Unable to parse template data in capture response: "
- + templateData, e);
- }
- }
+ return fingers;
+ }
+ catch (JAXBException e) {
+ throw new M2SysBiometricsException("Unable to parse template data in capture response: "
+ + templateData, e);
+ }
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysData.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysData.java
index a0044ad..56547f3 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysData.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysData.java
@@ -1,12 +1,13 @@
package org.openmrs.module.m2sysbiometrics.model;
+import java.io.Serializable;
+
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.annotate.JsonSerialize;
-import java.io.Serializable;
-
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public abstract class M2SysData implements Serializable {
- private static final long serialVersionUID = -7975830809846498434L;
+
+ private static final long serialVersionUID = -7975830809846498434L;
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysRequest.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysRequest.java
index 678a3a7..60a2d04 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysRequest.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysRequest.java
@@ -4,39 +4,39 @@
public class M2SysRequest extends AbstractM2SysRequest {
- private static final long serialVersionUID = -8902210266672985893L;
+ private static final long serialVersionUID = -8902210266672985893L;
- @JsonProperty("BioMetricWith")
- private BiometricCaptureType biometricWith;
+ @JsonProperty("BioMetricWith")
+ private BiometricCaptureType biometricWith;
- @JsonProperty("RegistrationID")
- private String registrationId;
+ @JsonProperty("RegistrationID")
+ private String registrationId;
- @JsonProperty("LocationID")
- private Integer locationId;
+ @JsonProperty("LocationID")
+ private Integer locationId;
- public BiometricCaptureType getBiometricWith() {
- return biometricWith;
- }
+ public BiometricCaptureType getBiometricWith() {
+ return biometricWith;
+ }
- public void setBiometricWith(BiometricCaptureType biometricWith) {
- this.biometricWith = biometricWith;
- }
+ public void setBiometricWith(BiometricCaptureType biometricWith) {
+ this.biometricWith = biometricWith;
+ }
- public String getRegistrationId() {
- return registrationId;
- }
+ public String getRegistrationId() {
+ return registrationId;
+ }
- public void setRegistrationId(String registrationId) {
- this.registrationId = registrationId;
- }
+ public void setRegistrationId(String registrationId) {
+ this.registrationId = registrationId;
+ }
- public Integer getLocationId() {
- return locationId;
- }
+ public Integer getLocationId() {
+ return locationId;
+ }
- public void setLocationId(Integer locationId) {
- this.locationId = locationId;
- }
+ public void setLocationId(Integer locationId) {
+ this.locationId = locationId;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysResponse.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysResponse.java
index 3743d48..b33259a 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysResponse.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysResponse.java
@@ -1,5 +1,8 @@
package org.openmrs.module.m2sysbiometrics.model;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.commons.lang3.StringUtils;
import org.codehaus.jackson.annotate.JsonProperty;
import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
@@ -7,275 +10,274 @@
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricMatch;
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricSubject;
-import java.util.ArrayList;
-import java.util.List;
-
public class M2SysResponse extends AbstractM2SysResponse {
- private static final long serialVersionUID = 5297535433389093052L;
+ private static final long serialVersionUID = 5297535433389093052L;
+
+ @JsonProperty("APIVersion")
+ private String apiVersion;
+
+ @JsonProperty("ClientPlatform")
+ private Integer clientPlatform;
+
+ @JsonProperty("ClientVersion")
+ private String clientVersion;
- @JsonProperty("APIVersion")
- private String apiVersion;
+ @JsonProperty("RegistrationID")
+ private String registrationId;
- @JsonProperty("ClientPlatform")
- private Integer clientPlatform;
+ @JsonProperty("TransactionID")
+ private String transactionId;
- @JsonProperty("ClientVersion")
- private String clientVersion;
+ // @JsonProperty("AccessPointID")
+ // private String accessPointId;
- @JsonProperty("RegistrationID")
- private String registrationId;
+ @JsonProperty("DeviceName")
+ private String deviceName;
- @JsonProperty("TransactionID")
- private String transactionId;
+ @JsonProperty("PictureData")
+ private String pictureData;
- // @JsonProperty("AccessPointID")
- // private String accessPointId;
+ @JsonProperty("TemplateData")
+ private String templateData;
- @JsonProperty("DeviceName")
- private String deviceName;
+ @JsonProperty("TemplateData2")
+ private String templateData2;
- @JsonProperty("PictureData")
- private String pictureData;
+ @JsonProperty("LeftTemplate")
+ private String leftTemplate;
- @JsonProperty("TemplateData")
- private String templateData;
+ @JsonProperty("RightTemplate")
+ private String rightTemplate;
- @JsonProperty("TemplateData2")
- private String templateData2;
+ @JsonProperty("MatchingResult")
+ private String matchingResult;
- @JsonProperty("LeftTemplate")
- private String leftTemplate;
+ // @JsonProperty("CustomerKey")
+ // private String customerKey;
- @JsonProperty("RightTemplate")
- private String rightTemplate;
+ @JsonProperty("LocationID")
+ private Integer locationId;
- @JsonProperty("MatchingResult")
- private String matchingResult;
+ @JsonProperty("ServerTime")
+ private String serverTime;
- // @JsonProperty("CustomerKey")
- // private String customerKey;
+ @JsonProperty("NewRegistrationID")
+ private String newRegistrationId;
- @JsonProperty("LocationID")
- private Integer locationId;
+ @JsonProperty("TransactionTime")
+ private String transactionTime;
- @JsonProperty("ServerTime")
- private String serverTime;
+ @JsonProperty("LeftTemplatePosition")
+ private Integer leftTemplatePosition;
- @JsonProperty("NewRegistrationID")
- private String newRegistrationId;
+ @JsonProperty("RightTemplatePosition")
+ private Integer rightTemplatePosition;
- @JsonProperty("TransactionTime")
- private String transactionTime;
+ public String getApiVersion() {
+ return apiVersion;
+ }
- @JsonProperty("LeftTemplatePosition")
- private Integer leftTemplatePosition;
+ public void setApiVersion(String apiVersion) {
+ this.apiVersion = apiVersion;
+ }
- @JsonProperty("RightTemplatePosition")
- private Integer rightTemplatePosition;
+ public Integer getClientPlatform() {
+ return clientPlatform;
+ }
- public String getApiVersion() {
- return apiVersion;
- }
+ public void setClientPlatform(Integer clientPlatform) {
+ this.clientPlatform = clientPlatform;
+ }
- public void setApiVersion(String apiVersion) {
- this.apiVersion = apiVersion;
- }
+ public String getClientVersion() {
+ return clientVersion;
+ }
- public Integer getClientPlatform() {
- return clientPlatform;
- }
+ public void setClientVersion(String clientVersion) {
+ this.clientVersion = clientVersion;
+ }
- public void setClientPlatform(Integer clientPlatform) {
- this.clientPlatform = clientPlatform;
- }
+ public String getRegistrationId() {
+ return registrationId;
+ }
- public String getClientVersion() {
- return clientVersion;
- }
+ public void setRegistrationId(String registrationId) {
+ this.registrationId = registrationId;
+ }
- public void setClientVersion(String clientVersion) {
- this.clientVersion = clientVersion;
- }
+ public String getTransactionId() {
+ return transactionId;
+ }
- public String getRegistrationId() {
- return registrationId;
- }
+ public void setTransactionId(String transactionId) {
+ this.transactionId = transactionId;
+ }
- public void setRegistrationId(String registrationId) {
- this.registrationId = registrationId;
- }
+ /*
+ public String getAccessPointId() {
+ return accessPointId;
+ }
- public String getTransactionId() {
- return transactionId;
- }
+ public void setAccessPointId(String accessPointId) {
+ this.accessPointId = accessPointId;
+ }
+ */
+ public String getDeviceName() {
+ return deviceName;
+ }
- public void setTransactionId(String transactionId) {
- this.transactionId = transactionId;
- }
-/*
- public String getAccessPointId() {
- return accessPointId;
- }
+ public void setDeviceName(String deviceName) {
+ this.deviceName = deviceName;
+ }
- public void setAccessPointId(String accessPointId) {
- this.accessPointId = accessPointId;
- }
-*/
- public String getDeviceName() {
- return deviceName;
- }
+ public String getPictureData() {
+ return pictureData;
+ }
- public void setDeviceName(String deviceName) {
- this.deviceName = deviceName;
- }
+ public void setPictureData(String pictureData) {
+ this.pictureData = pictureData;
+ }
- public String getPictureData() {
- return pictureData;
- }
+ public String getTemplateData() {
+ return templateData;
+ }
- public void setPictureData(String pictureData) {
- this.pictureData = pictureData;
- }
+ public void setTemplateData(String templateData) {
+ this.templateData = templateData;
+ }
- public String getTemplateData() {
- return templateData;
- }
-
- public void setTemplateData(String templateData) {
- this.templateData = templateData;
- }
-
- public String getTemplateData2() {
- return templateData2;
- }
-
- public void setTemplateData2(String templateData2) {
- this.templateData2 = templateData2;
- }
-
- public String getLeftTemplate() {
- return leftTemplate;
- }
-
- public void setLeftTemplate(String leftTemplate) {
- this.leftTemplate = leftTemplate;
- }
-
- public String getRightTemplate() {
- return rightTemplate;
- }
-
- public void setRightTemplate(String rightTemplate) {
- this.rightTemplate = rightTemplate;
- }
-
- public String getMatchingResult() {
- return matchingResult;
- }
-
- public void setMatchingResult(String matchingResult) {
- this.matchingResult = matchingResult;
- }
-/*
- public String getCustomerKey() {
- return customerKey;
- }
-
- public void setCustomerKey(String customerKey) {
- this.customerKey = customerKey;
- }
-*/
- public Integer getLocationId() {
- return locationId;
- }
-
- public void setLocationId(Integer locationId) {
- this.locationId = locationId;
- }
-
- public Integer getLeftTemplatePosition() {
- return leftTemplatePosition;
- }
-
- public void setLeftTemplatePosition(Integer leftTemplatePosition) {
- this.leftTemplatePosition = leftTemplatePosition;
- }
-
- public Integer getRightTemplatePosition() {
- return rightTemplatePosition;
- }
-
- public void setRightTemplatePosition(Integer rightTemplatePosition) {
- this.rightTemplatePosition = rightTemplatePosition;
- }
-
- public String getServerTime() {
- return serverTime;
- }
-
- public void setServerTime(String serverTime) {
- this.serverTime = serverTime;
- }
-
- public String getNewRegistrationId() {
- return newRegistrationId;
- }
-
- public void setNewRegistrationId(String newRegistrationId) {
- this.newRegistrationId = newRegistrationId;
- }
-
- public String getTransactionTime() {
- return transactionTime;
- }
-
- public void setTransactionTime(String transactionTime) {
- this.transactionTime = transactionTime;
- }
-
- public BiometricSubject toBiometricSubject(String subjectId) {
- BiometricSubject subject = null;
-
- if (StringUtils.isNotBlank(matchingResult)) {
- M2SysResults m2SysResults = parseMatchingResult();
-
- for (M2SysResult result : m2SysResults.getResults()) {
- result.checkCommonErrorValues();
- if (M2SysResult.FAILED.equals(result.getValue())) {
- throw new M2SysBiometricsException("Failed or was cancelled before completion");
- } else if (M2SysResult.SUCCESS.equals(result.getValue())) {
- subject = new BiometricSubject(subjectId);
- } else {
- throw new M2SysBiometricsException("Failed - biometric template already exists in system."
- + " Registration id: " + result.getValue());
- }
- }
- }
-
- return subject;
- }
-
- public List toMatchList() {
- List matches = new ArrayList<>();
-
- if (StringUtils.isNotBlank(matchingResult)) {
- M2SysResults m2SysMatches = parseMatchingResult();
-
- for (M2SysResult result : m2SysMatches.getResults()) {
- result.checkCommonErrorValues();
- if (!M2SysResult.FAILED.equals(result.getValue())) {
- BiometricMatch match = new BiometricMatch(result.getValue(),
- (double) result.getScore());
- matches.add(match);
- }
- }
- }
-
- return matches;
- }
-
- public M2SysResults parseMatchingResult() {
- return XmlResultUtil.parse(matchingResult);
- }
+ public String getTemplateData2() {
+ return templateData2;
+ }
+
+ public void setTemplateData2(String templateData2) {
+ this.templateData2 = templateData2;
+ }
+
+ public String getLeftTemplate() {
+ return leftTemplate;
+ }
+
+ public void setLeftTemplate(String leftTemplate) {
+ this.leftTemplate = leftTemplate;
+ }
+
+ public String getRightTemplate() {
+ return rightTemplate;
+ }
+
+ public void setRightTemplate(String rightTemplate) {
+ this.rightTemplate = rightTemplate;
+ }
+
+ public String getMatchingResult() {
+ return matchingResult;
+ }
+
+ public void setMatchingResult(String matchingResult) {
+ this.matchingResult = matchingResult;
+ }
+
+ /*
+ public String getCustomerKey() {
+ return customerKey;
+ }
+
+ public void setCustomerKey(String customerKey) {
+ this.customerKey = customerKey;
+ }
+ */
+ public Integer getLocationId() {
+ return locationId;
+ }
+
+ public void setLocationId(Integer locationId) {
+ this.locationId = locationId;
+ }
+
+ public Integer getLeftTemplatePosition() {
+ return leftTemplatePosition;
+ }
+
+ public void setLeftTemplatePosition(Integer leftTemplatePosition) {
+ this.leftTemplatePosition = leftTemplatePosition;
+ }
+
+ public Integer getRightTemplatePosition() {
+ return rightTemplatePosition;
+ }
+
+ public void setRightTemplatePosition(Integer rightTemplatePosition) {
+ this.rightTemplatePosition = rightTemplatePosition;
+ }
+
+ public String getServerTime() {
+ return serverTime;
+ }
+
+ public void setServerTime(String serverTime) {
+ this.serverTime = serverTime;
+ }
+
+ public String getNewRegistrationId() {
+ return newRegistrationId;
+ }
+
+ public void setNewRegistrationId(String newRegistrationId) {
+ this.newRegistrationId = newRegistrationId;
+ }
+
+ public String getTransactionTime() {
+ return transactionTime;
+ }
+
+ public void setTransactionTime(String transactionTime) {
+ this.transactionTime = transactionTime;
+ }
+
+ public BiometricSubject toBiometricSubject(String subjectId) {
+ BiometricSubject subject = null;
+
+ if (StringUtils.isNotBlank(matchingResult)) {
+ M2SysResults m2SysResults = parseMatchingResult();
+
+ for (M2SysResult result : m2SysResults.getResults()) {
+ result.checkCommonErrorValues();
+ if (M2SysResult.FAILED.equals(result.getValue())) {
+ throw new M2SysBiometricsException("Failed or was cancelled before completion");
+ } else if (M2SysResult.SUCCESS.equals(result.getValue())) {
+ subject = new BiometricSubject(subjectId);
+ } else {
+ throw new M2SysBiometricsException("Failed - biometric template already exists in system."
+ + " Registration id: " + result.getValue());
+ }
+ }
+ }
+
+ return subject;
+ }
+
+ public List toMatchList() {
+ List matches = new ArrayList<>();
+
+ if (StringUtils.isNotBlank(matchingResult)) {
+ M2SysResults m2SysMatches = parseMatchingResult();
+
+ for (M2SysResult result : m2SysMatches.getResults()) {
+ result.checkCommonErrorValues();
+ if (!M2SysResult.FAILED.equals(result.getValue())) {
+ BiometricMatch match = new BiometricMatch(result.getValue(),
+ (double) result.getScore());
+ matches.add(match);
+ }
+ }
+ }
+
+ return matches;
+ }
+
+ public M2SysResults parseMatchingResult() {
+ return XmlResultUtil.parse(matchingResult);
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysResult.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysResult.java
index 9ab38d0..4dbac29 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysResult.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysResult.java
@@ -1,72 +1,80 @@
package org.openmrs.module.m2sysbiometrics.model;
-
-import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
+import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
+
@XmlAccessorType(XmlAccessType.FIELD)
public class M2SysResult {
- public static final String EMPTY = "empty";
-
- public static final String INVALID_ENGINE = "INVALID_ENGINE";
- public static final String UPDATE_SUBJECT_ID_SUCCESS = "CS";
- public static final String UPDATE_SUBJECT_ID_FAILURE = "CF";
- public static final String DELETE_SUCCESS = "DS";
- public static final String DELETE_FAILURE = "DF";
- public static final String FAILED = "-1";
- public static final String SUCCESS = "SUCCESS";
- public static final String LICENSE_ERROR = "LICENSE_ERROR";
- public static final int SEARCH_ERROR_SCORE = 0;
- public static final String SEARCH_NOT_FOUND = "-1";
-
- @XmlAttribute
- private int score;
-
- @XmlAttribute
- private String value;
-
- @XmlAttribute(name = "Instance")
- private int instance;
-
- public int getScore() {
- return score;
- }
-
- public void setScore(int score) {
- this.score = score;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public int getInstance() {
- return instance;
- }
-
- public void setInstance(int instance) {
- this.instance = instance;
- }
-
- public void checkCommonErrorValues() {
- if (M2SysResult.INVALID_ENGINE.equals(value)) {
- throw new M2SysBiometricsException("Invalid Engine - the server is not licensed to"
- + " handle the biometric engine");
- } else if (M2SysResult.LICENSE_ERROR.equals(value)) {
- throw new M2SysBiometricsException("License error - this enrollment would have"
- + "exceeded the current server user license limit");
- }
- }
-
- public boolean isEmpty() {
- return EMPTY.equalsIgnoreCase(value);
- }
+ public static final String EMPTY = "empty";
+
+ public static final String INVALID_ENGINE = "INVALID_ENGINE";
+
+ public static final String UPDATE_SUBJECT_ID_SUCCESS = "CS";
+
+ public static final String UPDATE_SUBJECT_ID_FAILURE = "CF";
+
+ public static final String DELETE_SUCCESS = "DS";
+
+ public static final String DELETE_FAILURE = "DF";
+
+ public static final String FAILED = "-1";
+
+ public static final String SUCCESS = "SUCCESS";
+
+ public static final String LICENSE_ERROR = "LICENSE_ERROR";
+
+ public static final int SEARCH_ERROR_SCORE = 0;
+
+ public static final String SEARCH_NOT_FOUND = "-1";
+
+ @XmlAttribute
+ private int score;
+
+ @XmlAttribute
+ private String value;
+
+ @XmlAttribute(name = "Instance")
+ private int instance;
+
+ public int getScore() {
+ return score;
+ }
+
+ public void setScore(int score) {
+ this.score = score;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public int getInstance() {
+ return instance;
+ }
+
+ public void setInstance(int instance) {
+ this.instance = instance;
+ }
+
+ public void checkCommonErrorValues() {
+ if (M2SysResult.INVALID_ENGINE.equals(value)) {
+ throw new M2SysBiometricsException("Invalid Engine - the server is not licensed to"
+ + " handle the biometric engine");
+ } else if (M2SysResult.LICENSE_ERROR.equals(value)) {
+ throw new M2SysBiometricsException("License error - this enrollment would have"
+ + "exceeded the current server user license limit");
+ }
+ }
+
+ public boolean isEmpty() {
+ return EMPTY.equalsIgnoreCase(value);
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysResults.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysResults.java
index 501e179..457b080 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysResults.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/M2SysResults.java
@@ -1,8 +1,5 @@
package org.openmrs.module.m2sysbiometrics.model;
-import org.apache.commons.collections.CollectionUtils;
-import org.openmrs.module.registrationcore.api.biometrics.model.BiometricMatch;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -11,83 +8,86 @@
import java.util.List;
import java.util.Objects;
+import org.apache.commons.collections.CollectionUtils;
+import org.openmrs.module.registrationcore.api.biometrics.model.BiometricMatch;
+
@XmlRootElement(name = "Results")
@XmlAccessorType(XmlAccessType.FIELD)
public class M2SysResults {
- @XmlElement(name = "result")
- private List results = new ArrayList<>();
-
- public List getResults() {
- return results;
- }
-
- public void setResults(List results) {
- this.results = results;
- }
-
- public void addResult(M2SysResult result) {
- results.add(result);
- }
-
- public boolean isRegisterSuccess() {
- return firstValueEqualsIgnoreCase(M2SysResult.SUCCESS);
- }
-
- public boolean isUpdateSuccess() {
- return firstValueEqualsIgnoreCase(M2SysResult.SUCCESS);
- }
-
- public boolean isDeleteSuccess() {
- return firstValueEqualsIgnoreCase(M2SysResult.DELETE_SUCCESS);
- }
-
- public boolean isLookupNotFound() {
- return firstValueEqualsIgnoreCase(M2SysResult.FAILED);
- }
-
- public boolean isChangeIdSuccess() {
- return firstValueEqualsIgnoreCase(M2SysResult.UPDATE_SUBJECT_ID_SUCCESS);
- }
-
- public boolean isSearchError() {
- boolean searchError = true;
-
- if (isSearchResultWithoutErrorScore() || firstValueEqualsIgnoreCase(M2SysResult.SEARCH_NOT_FOUND)) {
- searchError = false;
- }
-
- return searchError;
- }
-
- public String firstValue() {
- if (results.isEmpty()) {
- return null;
- } else {
- return results.get(0).getValue();
- }
- }
-
- public boolean firstValueEqualsIgnoreCase(String value) {
- return Objects.equals(firstValue(), value);
- }
-
- public List toOpenMrsMatchList() {
- List matches = new ArrayList<>();
-
- for (M2SysResult result : results) {
- if (!result.getValue().equalsIgnoreCase(M2SysResult.FAILED)) {
- BiometricMatch match = new BiometricMatch(result.getValue(),
- (double) result.getScore());
-
- matches.add(match);
- }
- }
-
- return matches;
- }
-
- private boolean isSearchResultWithoutErrorScore() {
- return CollectionUtils.isNotEmpty(results) && results.get(0).getScore() != M2SysResult.SEARCH_ERROR_SCORE;
- }
+ @XmlElement(name = "result")
+ private List results = new ArrayList<>();
+
+ public List getResults() {
+ return results;
+ }
+
+ public void setResults(List results) {
+ this.results = results;
+ }
+
+ public void addResult(M2SysResult result) {
+ results.add(result);
+ }
+
+ public boolean isRegisterSuccess() {
+ return firstValueEqualsIgnoreCase(M2SysResult.SUCCESS);
+ }
+
+ public boolean isUpdateSuccess() {
+ return firstValueEqualsIgnoreCase(M2SysResult.SUCCESS);
+ }
+
+ public boolean isDeleteSuccess() {
+ return firstValueEqualsIgnoreCase(M2SysResult.DELETE_SUCCESS);
+ }
+
+ public boolean isLookupNotFound() {
+ return firstValueEqualsIgnoreCase(M2SysResult.FAILED);
+ }
+
+ public boolean isChangeIdSuccess() {
+ return firstValueEqualsIgnoreCase(M2SysResult.UPDATE_SUBJECT_ID_SUCCESS);
+ }
+
+ public boolean isSearchError() {
+ boolean searchError = true;
+
+ if (isSearchResultWithoutErrorScore() || firstValueEqualsIgnoreCase(M2SysResult.SEARCH_NOT_FOUND)) {
+ searchError = false;
+ }
+
+ return searchError;
+ }
+
+ public String firstValue() {
+ if (results.isEmpty()) {
+ return null;
+ } else {
+ return results.get(0).getValue();
+ }
+ }
+
+ public boolean firstValueEqualsIgnoreCase(String value) {
+ return Objects.equals(firstValue(), value);
+ }
+
+ public List toOpenMrsMatchList() {
+ List matches = new ArrayList<>();
+
+ for (M2SysResult result : results) {
+ if (!result.getValue().equalsIgnoreCase(M2SysResult.FAILED)) {
+ BiometricMatch match = new BiometricMatch(result.getValue(),
+ (double) result.getScore());
+
+ matches.add(match);
+ }
+ }
+
+ return matches;
+ }
+
+ private boolean isSearchResultWithoutErrorScore() {
+ return CollectionUtils.isNotEmpty(results) && results.get(0).getScore() != M2SysResult.SEARCH_ERROR_SCORE;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/NationalSynchronizationFailure.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/NationalSynchronizationFailure.java
index 7c448ea..c20f827 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/NationalSynchronizationFailure.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/NationalSynchronizationFailure.java
@@ -1,7 +1,5 @@
package org.openmrs.module.m2sysbiometrics.model;
-import org.openmrs.BaseOpenmrsData;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -10,67 +8,69 @@
import javax.persistence.Lob;
import javax.persistence.Table;
+import org.openmrs.BaseOpenmrsData;
+
@Entity
@Table(name = "national_synchronization_failure")
public class NationalSynchronizationFailure extends BaseOpenmrsData {
- private static final long serialVersionUID = -5146973328798332082L;
+ private static final long serialVersionUID = -5146973328798332082L;
- @Id
- @Column(name = "national_synchronization_failure_id")
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Integer id;
+ @Id
+ @Column(name = "national_synchronization_failure_id")
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer id;
- @Column(name = "subject_id")
- private String subjectId;
+ @Column(name = "subject_id")
+ private String subjectId;
- @Lob
- @Column(name = "biometric_xml")
- private String biometricXml;
+ @Lob
+ @Column(name = "biometric_xml")
+ private String biometricXml;
- @Column(name = "update_failure")
- private boolean update;
+ @Column(name = "update_failure")
+ private boolean update;
- public NationalSynchronizationFailure() {
- }
+ public NationalSynchronizationFailure() {
+ }
- public NationalSynchronizationFailure(String subjectId, String biometricXml, boolean update) {
- this.subjectId = subjectId;
- this.biometricXml = biometricXml;
- this.update = update;
- }
+ public NationalSynchronizationFailure(String subjectId, String biometricXml, boolean update) {
+ this.subjectId = subjectId;
+ this.biometricXml = biometricXml;
+ this.update = update;
+ }
- @Override
- public Integer getId() {
- return id;
- }
+ @Override
+ public Integer getId() {
+ return id;
+ }
- @Override
- public void setId(Integer id) {
- this.id = id;
- }
+ @Override
+ public void setId(Integer id) {
+ this.id = id;
+ }
- public String getSubjectId() {
- return subjectId;
- }
+ public String getSubjectId() {
+ return subjectId;
+ }
- public void setSubjectId(String subjectId) {
- this.subjectId = subjectId;
- }
+ public void setSubjectId(String subjectId) {
+ this.subjectId = subjectId;
+ }
- public String getBiometricXml() {
- return biometricXml;
- }
+ public String getBiometricXml() {
+ return biometricXml;
+ }
- public void setBiometricXml(String biometricXml) {
- this.biometricXml = biometricXml;
- }
+ public void setBiometricXml(String biometricXml) {
+ this.biometricXml = biometricXml;
+ }
- public boolean isUpdate() {
- return update;
- }
+ public boolean isUpdate() {
+ return update;
+ }
- public void setUpdate(boolean update) {
- this.update = update;
- }
+ public void setUpdate(boolean update) {
+ this.update = update;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Request.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Request.java
index c8d6369..8b58d16 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Request.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Request.java
@@ -3,55 +3,61 @@
import org.codehaus.jackson.annotate.JsonProperty;
public class Request extends M2SysData {
- private static final long serialVersionUID = 2642478746210327810L;
- @JsonProperty("CustomerKey")
- private String customerKey;
- @JsonProperty("EngineName")
- private String engineName;
- @JsonProperty("RegistrationId")
- private String registrationId;
- @JsonProperty("Format")
- private String format;
- @JsonProperty("BiometricXml")
- private String biometricXml;
-
- public String getCustomerKey() {
- return customerKey;
- }
-
- public void setCustomerKey(String customerKey) {
- this.customerKey = customerKey;
- }
-
- public String getEngineName() {
- return engineName;
- }
-
- public void setEngineName(String engineName) {
- this.engineName = engineName;
- }
-
- public String getRegistrationId() {
- return registrationId;
- }
-
- public void setRegistrationId(String registrationId) {
- this.registrationId = registrationId;
- }
-
- public String getFormat() {
- return format;
- }
-
- public void setFormat(String format) {
- this.format = format;
- }
-
- public String getBiometricXml() {
- return biometricXml;
- }
-
- public void setBiometricXml(String biometricXml) {
- this.biometricXml = biometricXml;
- }
+
+ private static final long serialVersionUID = 2642478746210327810L;
+
+ @JsonProperty("CustomerKey")
+ private String customerKey;
+
+ @JsonProperty("EngineName")
+ private String engineName;
+
+ @JsonProperty("RegistrationId")
+ private String registrationId;
+
+ @JsonProperty("Format")
+ private String format;
+
+ @JsonProperty("BiometricXml")
+ private String biometricXml;
+
+ public String getCustomerKey() {
+ return customerKey;
+ }
+
+ public void setCustomerKey(String customerKey) {
+ this.customerKey = customerKey;
+ }
+
+ public String getEngineName() {
+ return engineName;
+ }
+
+ public void setEngineName(String engineName) {
+ this.engineName = engineName;
+ }
+
+ public String getRegistrationId() {
+ return registrationId;
+ }
+
+ public void setRegistrationId(String registrationId) {
+ this.registrationId = registrationId;
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ public void setFormat(String format) {
+ this.format = format;
+ }
+
+ public String getBiometricXml() {
+ return biometricXml;
+ }
+
+ public void setBiometricXml(String biometricXml) {
+ this.biometricXml = biometricXml;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/ScoreResult.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/ScoreResult.java
index 1d8afb8..0ed60fb 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/ScoreResult.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/ScoreResult.java
@@ -2,38 +2,40 @@
import org.codehaus.jackson.annotate.JsonProperty;
-public class ScoreResult extends M2SysData{
- private static final long serialVersionUID = 2642478741112327810L;
- @JsonProperty("Score")
- private Integer score;
+public class ScoreResult extends M2SysData {
- @JsonProperty("ID")
- private String matchId;
+ private static final long serialVersionUID = 2642478741112327810L;
- @JsonProperty("FingerPosition")
- private Integer fingerPosition;
+ @JsonProperty("Score")
+ private Integer score;
- public Integer getScore() {
- return score;
- }
+ @JsonProperty("ID")
+ private String matchId;
- public void setScore(Integer score) {
- this.score = score;
- }
+ @JsonProperty("FingerPosition")
+ private Integer fingerPosition;
- public Integer getFingerPosition() {
- return fingerPosition;
- }
+ public Integer getScore() {
+ return score;
+ }
- public void setFingerPosition(Integer fingerPosition) {
- this.fingerPosition = fingerPosition;
- }
+ public void setScore(Integer score) {
+ this.score = score;
+ }
- public String getMatchId() {
- return matchId;
- }
+ public Integer getFingerPosition() {
+ return fingerPosition;
+ }
- public void setMatchId(String matchId) {
- this.matchId = matchId;
- }
-}
\ No newline at end of file
+ public void setFingerPosition(Integer fingerPosition) {
+ this.fingerPosition = fingerPosition;
+ }
+
+ public String getMatchId() {
+ return matchId;
+ }
+
+ public void setMatchId(String matchId) {
+ this.matchId = matchId;
+ }
+}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/SyncFingerprint.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/SyncFingerprint.java
index 22029b2..db682dc 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/SyncFingerprint.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/SyncFingerprint.java
@@ -1,58 +1,64 @@
package org.openmrs.module.m2sysbiometrics.model;
-import org.openmrs.BaseOpenmrsData;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.Table;
-import javax.persistence.*;
+import org.openmrs.BaseOpenmrsData;
@Entity
@Table(name = "sync_fingerprint")
public class SyncFingerprint extends BaseOpenmrsData {
- private static final long serialVersionUID = -6509686390029003588L;
+ private static final long serialVersionUID = -6509686390029003588L;
- @Id
- @Column(name = "sync_fingerprint_id")
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Integer id;
+ @Id
+ @Column(name = "sync_fingerprint_id")
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer id;
- @Column(name = "biometric_id", unique = true)
- private String biometricId;
+ @Column(name = "biometric_id", unique = true)
+ private String biometricId;
- @Lob
- @Column(name = "biometric_xml")
- private String biometricXml;
+ @Lob
+ @Column(name = "biometric_xml")
+ private String biometricXml;
- public SyncFingerprint() {
- }
+ public SyncFingerprint() {
+ }
- public SyncFingerprint(String biometricId, String biometricXml) {
- this.biometricId = biometricId;
- this.biometricXml = biometricXml;
- }
+ public SyncFingerprint(String biometricId, String biometricXml) {
+ this.biometricId = biometricId;
+ this.biometricXml = biometricXml;
+ }
- @Override
- public Integer getId() {
- return id;
- }
+ @Override
+ public Integer getId() {
+ return id;
+ }
- @Override
- public void setId(Integer id) {
- this.id = id;
- }
+ @Override
+ public void setId(Integer id) {
+ this.id = id;
+ }
- public String getBiometricId() {
- return biometricId;
- }
+ public String getBiometricId() {
+ return biometricId;
+ }
- public void setBiometricId(String biometricId) {
- this.biometricId = biometricId;
- }
+ public void setBiometricId(String biometricId) {
+ this.biometricId = biometricId;
+ }
- public String getBiometricXml() {
- return biometricXml;
- }
+ public String getBiometricXml() {
+ return biometricXml;
+ }
- public void setBiometricXml(String biometricXml) {
- this.biometricXml = biometricXml;
- }
+ public void setBiometricXml(String biometricXml) {
+ this.biometricXml = biometricXml;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/TempFingerprint.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/TempFingerprint.java
index 2a9ce36..7b79893 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/TempFingerprint.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/TempFingerprint.java
@@ -1,7 +1,5 @@
package org.openmrs.module.m2sysbiometrics.model;
-import org.openmrs.BaseOpenmrsData;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -10,55 +8,57 @@
import javax.persistence.Lob;
import javax.persistence.Table;
+import org.openmrs.BaseOpenmrsData;
+
@Entity
@Table(name = "temp_fingerprint")
public class TempFingerprint extends BaseOpenmrsData {
- private static final long serialVersionUID = -6509686390029003588L;
+ private static final long serialVersionUID = -6509686390029003588L;
- @Id
- @Column(name = "temp_fingerprint_id")
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Integer id;
+ @Id
+ @Column(name = "temp_fingerprint_id")
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer id;
- @Column(name = "biometric_id", unique = true)
- private String biometricId;
+ @Column(name = "biometric_id", unique = true)
+ private String biometricId;
- @Lob
- @Column(name = "biometric_xml")
- private String biometricXml;
+ @Lob
+ @Column(name = "biometric_xml")
+ private String biometricXml;
- public TempFingerprint() {
- }
+ public TempFingerprint() {
+ }
- public TempFingerprint(String biometricId, String biometricXml) {
- this.biometricId = biometricId;
- this.biometricXml = biometricXml;
- }
+ public TempFingerprint(String biometricId, String biometricXml) {
+ this.biometricId = biometricId;
+ this.biometricXml = biometricXml;
+ }
- @Override
- public Integer getId() {
- return id;
- }
+ @Override
+ public Integer getId() {
+ return id;
+ }
- @Override
- public void setId(Integer id) {
- this.id = id;
- }
+ @Override
+ public void setId(Integer id) {
+ this.id = id;
+ }
- public String getBiometricId() {
- return biometricId;
- }
+ public String getBiometricId() {
+ return biometricId;
+ }
- public void setBiometricId(String biometricId) {
- this.biometricId = biometricId;
- }
+ public void setBiometricId(String biometricId) {
+ this.biometricId = biometricId;
+ }
- public String getBiometricXml() {
- return biometricXml;
- }
+ public String getBiometricXml() {
+ return biometricXml;
+ }
- public void setBiometricXml(String biometricXml) {
- this.biometricXml = biometricXml;
- }
+ public void setBiometricXml(String biometricXml) {
+ this.biometricXml = biometricXml;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Token.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Token.java
index b8d545b..02125ba 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Token.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/model/Token.java
@@ -4,38 +4,38 @@
public class Token extends M2SysData {
- private static final long serialVersionUID = 2642478741110327810L;
+ private static final long serialVersionUID = 2642478741110327810L;
- @JsonProperty("access_token")
- private String accessToken;
+ @JsonProperty("access_token")
+ private String accessToken;
- @JsonProperty("token_type")
- private String tokenType;
+ @JsonProperty("token_type")
+ private String tokenType;
- @JsonProperty("expires_in")
- private Integer expiresIn;
+ @JsonProperty("expires_in")
+ private Integer expiresIn;
- public String getAccessToken() {
- return accessToken;
- }
+ public String getAccessToken() {
+ return accessToken;
+ }
- public Integer getExpiresIn() {
- return expiresIn;
- }
+ public void setAccessToken(String accessToken) {
+ this.accessToken = accessToken;
+ }
- public String getTokenType() {
- return tokenType;
- }
+ public Integer getExpiresIn() {
+ return expiresIn;
+ }
- public void setAccessToken(String accessToken) {
- this.accessToken = accessToken;
- }
+ public void setExpiresIn(Integer expiresIn) {
+ this.expiresIn = expiresIn;
+ }
- public void setTokenType(String tokenType) {
- this.tokenType = tokenType;
- }
+ public String getTokenType() {
+ return tokenType;
+ }
- public void setExpiresIn(Integer expiresIn) {
- this.expiresIn = expiresIn;
- }
+ public void setTokenType(String tokenType) {
+ this.tokenType = tokenType;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/scheduler/M2SysSchedulerService.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/scheduler/M2SysSchedulerService.java
index 6d453f4..f8c6970 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/scheduler/M2SysSchedulerService.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/scheduler/M2SysSchedulerService.java
@@ -2,5 +2,5 @@
public interface M2SysSchedulerService {
- void runM2SysScheduler();
+ void runM2SysScheduler();
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/scheduler/NationalSynchronizationTask.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/scheduler/NationalSynchronizationTask.java
index bc59d9a..5e46dac 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/scheduler/NationalSynchronizationTask.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/scheduler/NationalSynchronizationTask.java
@@ -2,9 +2,6 @@
import org.hibernate.cfg.NotYetImplementedException;
import org.openmrs.api.context.Context;
-//import org.openmrs.module.m2sysbiometrics.model.FingerScanStatus;
-//import org.openmrs.module.m2sysbiometrics.model.M2SysCaptureResponse;
-//import org.openmrs.module.m2sysbiometrics.model.NationalSynchronizationFailure;
import org.openmrs.module.m2sysbiometrics.model.FingerScanStatus;
import org.openmrs.module.m2sysbiometrics.model.M2SysCaptureResponse;
import org.openmrs.module.m2sysbiometrics.model.NationalSynchronizationFailure;
@@ -15,87 +12,84 @@
import org.openmrs.scheduler.tasks.AbstractTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.List;
public class NationalSynchronizationTask extends AbstractTask {
- public static final String TASK_NAME = "M2Sys Biometrics National Synchronization Task";
-
- public static final String TASK_DESCRIPTION = "M2Sys Biometrics task for retry of the national synchronization "
- + "failures.";
-
- public static final long DEFAULT_INTERVAL_SECONDS = 7200;
-
- private static final Logger LOGGER = LoggerFactory.getLogger(NationalSynchronizationTask.class);
-
- private NationalSynchronizationFailureService nationalSynchronizationFailureService;
-
- private RegistrationService registrationService;
-
- private SearchService searchService;
-
- private UpdateService updateService;
-
- @Override
- public void execute() {
- initializeBeans();
- retryRegistrationFailures();
- retryUpdateFailures();
- }
-
- private void initializeBeans() {
- nationalSynchronizationFailureService = Context.getRegisteredComponent(
- "nationalSynchronizationFailureService", NationalSynchronizationFailureService.class);
-
- registrationService = Context.getRegisteredComponent(
- "registrationService", RegistrationService.class);
-
- searchService = Context.getRegisteredComponent(
- "searchService", SearchService.class);
-
- updateService = Context.getRegisteredComponent(
- "updateService", UpdateService.class);
- }
-
- private void retryRegistrationFailures() {
- for (NationalSynchronizationFailure failure : nationalSynchronizationFailureService.findAllRegistrationFailures()) {
- retryRegistrationFailure(failure);
- }
- }
-
- private void retryUpdateFailures() {
- for (NationalSynchronizationFailure failure : nationalSynchronizationFailureService.findAllUpdateFailures()) {
- retryUpdateFailure(failure);
- }
- }
-
- private void retryRegistrationFailure(NationalSynchronizationFailure failure) {
- try {
- M2SysCaptureResponse fingerScan = new M2SysCaptureResponse();
- fingerScan.setTemplateData(failure.getBiometricXml());
- FingerScanStatus fingerScanStatus = searchService.checkIfFingerScanExists(failure.getBiometricXml());
-
- registrationService.synchronizeFingerprints(fingerScan, fingerScanStatus);
- nationalSynchronizationFailureService.delete(failure);
- } catch (Exception e) {
- LOGGER.error("Scheduled retry of registration failed", e);
- }
- }
-
-
- private void retryUpdateFailure(NationalSynchronizationFailure failure) {
-// try {
-// M2SysCaptureResponse fingerScan = new M2SysCaptureResponse();
-// fingerScan.setTemplateData(failure.getBiometricXml());
-//
-// updateService.updateNationally(fingerScan);
-// nationalSynchronizationFailureService.delete(failure);
-// } catch (Exception e) {
-// LOGGER.error("Scheduled retry of update failed", e);
-// }
- throw new NotYetImplementedException("Pending Implementation!");
- }
+ public static final String TASK_NAME = "M2Sys Biometrics National Synchronization Task";
+
+ public static final String TASK_DESCRIPTION = "M2Sys Biometrics task for retry of the national synchronization "
+ + "failures.";
+
+ public static final long DEFAULT_INTERVAL_SECONDS = 7200;
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(NationalSynchronizationTask.class);
+
+ private NationalSynchronizationFailureService nationalSynchronizationFailureService;
+
+ private RegistrationService registrationService;
+
+ private SearchService searchService;
+
+ private UpdateService updateService;
+
+ @Override
+ public void execute() {
+ initializeBeans();
+ retryRegistrationFailures();
+ retryUpdateFailures();
+ }
+
+ private void initializeBeans() {
+ nationalSynchronizationFailureService = Context.getRegisteredComponent(
+ "nationalSynchronizationFailureService", NationalSynchronizationFailureService.class);
+
+ registrationService = Context.getRegisteredComponent(
+ "registrationService", RegistrationService.class);
+
+ searchService = Context.getRegisteredComponent(
+ "searchService", SearchService.class);
+
+ updateService = Context.getRegisteredComponent(
+ "updateService", UpdateService.class);
+ }
+
+ private void retryRegistrationFailures() {
+ for (NationalSynchronizationFailure failure : nationalSynchronizationFailureService.findAllRegistrationFailures()) {
+ retryRegistrationFailure(failure);
+ }
+ }
+
+ private void retryUpdateFailures() {
+ for (NationalSynchronizationFailure failure : nationalSynchronizationFailureService.findAllUpdateFailures()) {
+ retryUpdateFailure(failure);
+ }
+ }
+
+ private void retryRegistrationFailure(NationalSynchronizationFailure failure) {
+ try {
+ M2SysCaptureResponse fingerScan = new M2SysCaptureResponse();
+ fingerScan.setTemplateData(failure.getBiometricXml());
+ FingerScanStatus fingerScanStatus = searchService.checkIfFingerScanExists(failure.getBiometricXml());
+
+ registrationService.synchronizeFingerprints(fingerScan, fingerScanStatus);
+ nationalSynchronizationFailureService.delete(failure);
+ }
+ catch (Exception e) {
+ LOGGER.error("Scheduled retry of registration failed", e);
+ }
+ }
+
+ private void retryUpdateFailure(NationalSynchronizationFailure failure) {
+ // try {
+ // M2SysCaptureResponse fingerScan = new M2SysCaptureResponse();
+ // fingerScan.setTemplateData(failure.getBiometricXml());
+ //
+ // updateService.updateNationally(fingerScan);
+ // nationalSynchronizationFailureService.delete(failure);
+ // } catch (Exception e) {
+ // LOGGER.error("Scheduled retry of update failed", e);
+ // }
+ throw new NotYetImplementedException("Pending Implementation!");
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/scheduler/impl/M2SysSchedulerServiceImpl.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/scheduler/impl/M2SysSchedulerServiceImpl.java
index f7a0e1d..8a58659 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/scheduler/impl/M2SysSchedulerServiceImpl.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/scheduler/impl/M2SysSchedulerServiceImpl.java
@@ -1,5 +1,9 @@
package org.openmrs.module.m2sysbiometrics.scheduler.impl;
+import static org.openmrs.module.m2sysbiometrics.M2SysBiometricsConstants.M2SYS_NATIONAL_REGISTRATIONS_TASK_INTERVAL;
+
+import java.sql.Timestamp;
+
import org.openmrs.api.context.Context;
import org.openmrs.api.impl.BaseOpenmrsService;
import org.openmrs.module.m2sysbiometrics.scheduler.M2SysSchedulerService;
@@ -12,71 +16,69 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.sql.Timestamp;
-
-import static org.openmrs.module.m2sysbiometrics.M2SysBiometricsConstants.M2SYS_NATIONAL_REGISTRATIONS_TASK_INTERVAL;
-
@Service("m2sysbiometrics.M2SysSchedulerServiceImpl")
public class M2SysSchedulerServiceImpl extends BaseOpenmrsService implements M2SysSchedulerService {
- private static final Logger LOGGER = LoggerFactory.getLogger(M2SysSchedulerServiceImpl.class);
-
- @Autowired
- private M2SysProperties properties;
-
- @Override
- public void runM2SysScheduler() {
- scheduleNationalRegistrationsTask();
- }
-
- private void scheduleNationalRegistrationsTask() {
- TaskDefinition nationalRegistrationsTask = createTask(NationalSynchronizationTask.TASK_NAME,
- NationalSynchronizationTask.TASK_DESCRIPTION, NationalSynchronizationTask.class.getName(),
- getNationalRegistrationInterval());
-
- scheduleTask(nationalRegistrationsTask);
- }
-
- private long getNationalRegistrationInterval() {
- if (properties.isGlobalPropertySet(M2SYS_NATIONAL_REGISTRATIONS_TASK_INTERVAL)) {
- return Long.parseLong(properties.getGlobalProperty(M2SYS_NATIONAL_REGISTRATIONS_TASK_INTERVAL));
- } else {
- return NationalSynchronizationTask.DEFAULT_INTERVAL_SECONDS;
- }
- }
-
- private void scheduleTask(TaskDefinition taskDefinition) {
- try {
- if (Context.getSchedulerService().getScheduledTasks().contains(taskDefinition)) {
- Context.getSchedulerService().rescheduleTask(taskDefinition);
- } else {
- Context.getSchedulerService().scheduleTask(taskDefinition);
- }
- } catch (SchedulerException e) {
- LOGGER.error("Error during starting " + taskDefinition.getName() + ":", e);
- }
- }
-
- private TaskDefinition createTask(String name, String description, String taskClass, Long interval) {
- TaskDefinition result = Context.getSchedulerService().getTaskByName(name);
-
- if (result == null) {
- result = new TaskDefinition();
- }
-
- result.setName(name);
- result.setDescription(description);
- result.setTaskClass(taskClass);
- result.setRepeatInterval(interval);
- result.setStartTime(new Timestamp(System.currentTimeMillis()));
- result.setStartOnStartup(true);
-
- try {
- Context.getSchedulerService().saveTaskDefinition(result);
- } catch (Exception e) {
- LOGGER.error("Error during save " + name + " definition: ", e);
- }
-
- return Context.getSchedulerService().getTaskByName(name);
- }
+ private static final Logger LOGGER = LoggerFactory.getLogger(M2SysSchedulerServiceImpl.class);
+
+ @Autowired
+ private M2SysProperties properties;
+
+ @Override
+ public void runM2SysScheduler() {
+ scheduleNationalRegistrationsTask();
+ }
+
+ private void scheduleNationalRegistrationsTask() {
+ TaskDefinition nationalRegistrationsTask = createTask(NationalSynchronizationTask.TASK_NAME,
+ NationalSynchronizationTask.TASK_DESCRIPTION, NationalSynchronizationTask.class.getName(),
+ getNationalRegistrationInterval());
+
+ scheduleTask(nationalRegistrationsTask);
+ }
+
+ private long getNationalRegistrationInterval() {
+ if (properties.isGlobalPropertySet(M2SYS_NATIONAL_REGISTRATIONS_TASK_INTERVAL)) {
+ return Long.parseLong(properties.getGlobalProperty(M2SYS_NATIONAL_REGISTRATIONS_TASK_INTERVAL));
+ } else {
+ return NationalSynchronizationTask.DEFAULT_INTERVAL_SECONDS;
+ }
+ }
+
+ private void scheduleTask(TaskDefinition taskDefinition) {
+ try {
+ if (Context.getSchedulerService().getScheduledTasks().contains(taskDefinition)) {
+ Context.getSchedulerService().rescheduleTask(taskDefinition);
+ } else {
+ Context.getSchedulerService().scheduleTask(taskDefinition);
+ }
+ }
+ catch (SchedulerException e) {
+ LOGGER.error("Error during starting " + taskDefinition.getName() + ":", e);
+ }
+ }
+
+ private TaskDefinition createTask(String name, String description, String taskClass, Long interval) {
+ TaskDefinition result = Context.getSchedulerService().getTaskByName(name);
+
+ if (result == null) {
+ result = new TaskDefinition();
+ }
+
+ result.setName(name);
+ result.setDescription(description);
+ result.setTaskClass(taskClass);
+ result.setRepeatInterval(interval);
+ result.setStartTime(new Timestamp(System.currentTimeMillis()));
+ result.setStartOnStartup(true);
+
+ try {
+ Context.getSchedulerService().saveTaskDefinition(result);
+ }
+ catch (Exception e) {
+ LOGGER.error("Error during save " + name + " definition: ", e);
+ }
+
+ return Context.getSchedulerService().getTaskByName(name);
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/NationalSynchronizationFailureService.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/NationalSynchronizationFailureService.java
index 00681dd..1907570 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/NationalSynchronizationFailureService.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/NationalSynchronizationFailureService.java
@@ -1,22 +1,22 @@
package org.openmrs.module.m2sysbiometrics.service;
-import org.openmrs.api.OpenmrsService;
-import org.openmrs.module.m2sysbiometrics.model.NationalSynchronizationFailure;
-
import javax.transaction.Transactional;
import java.util.List;
+import org.openmrs.api.OpenmrsService;
+import org.openmrs.module.m2sysbiometrics.model.NationalSynchronizationFailure;
+
public interface NationalSynchronizationFailureService extends OpenmrsService {
- @Transactional
- NationalSynchronizationFailure save(NationalSynchronizationFailure nationalSynchronizationFailure);
+ @Transactional
+ NationalSynchronizationFailure save(NationalSynchronizationFailure nationalSynchronizationFailure);
- @Transactional
- void delete(NationalSynchronizationFailure nationalSynchronizationFailure);
+ @Transactional
+ void delete(NationalSynchronizationFailure nationalSynchronizationFailure);
- @Transactional
- List findAllRegistrationFailures();
+ @Transactional
+ List findAllRegistrationFailures();
- @Transactional
- List findAllUpdateFailures();
+ @Transactional
+ List findAllUpdateFailures();
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/RegistrationService.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/RegistrationService.java
index 55d6d8b..ebfed64 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/RegistrationService.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/RegistrationService.java
@@ -6,16 +6,16 @@
public interface RegistrationService {
- void registerLocally(BiometricSubject subject, M2SysCaptureResponse capture);
+ void registerLocally(BiometricSubject subject, M2SysCaptureResponse capture);
-// void registerLocally(BiometricSubject subject);
- //void registerLocally_new(BiometricSubject subject);
+ // void registerLocally(BiometricSubject subject);
+ //void registerLocally_new(BiometricSubject subject);
- void registerNationally(M2SysCaptureResponse capture);
+ void registerNationally(M2SysCaptureResponse capture);
- void fetchFromMpiByNationalFpId(BiometricSubject nationalBiometricSubject, M2SysCaptureResponse fingerScan);
+ void fetchFromMpiByNationalFpId(BiometricSubject nationalBiometricSubject, M2SysCaptureResponse fingerScan);
- void synchronizeFingerprints(M2SysCaptureResponse fingerScan, FingerScanStatus fingerScanStatus);
+ void synchronizeFingerprints(M2SysCaptureResponse fingerScan, FingerScanStatus fingerScanStatus);
- void importCcd(BiometricSubject nationalBiometricSubject);
+ void importCcd(BiometricSubject nationalBiometricSubject);
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/SearchService.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/SearchService.java
index ec74c18..63857f7 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/SearchService.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/SearchService.java
@@ -1,20 +1,19 @@
package org.openmrs.module.m2sysbiometrics.service;
+import java.util.List;
+
import org.openmrs.module.m2sysbiometrics.model.FingerScanStatus;
-//import org.openmrs.module.m2sysbiometrics.model.M2SysCaptureResponse;
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricMatch;
-import java.util.List;
-
public interface SearchService {
- List searchLocally(String biometricXml);
+ List searchLocally(String biometricXml);
- List searchNationally(String biometricXml);
+ List searchNationally(String biometricXml);
- BiometricMatch findMostAdequateLocally(String biometricXml);
+ BiometricMatch findMostAdequateLocally(String biometricXml);
- BiometricMatch findMostAdequateNationally(String biometricXml);
+ BiometricMatch findMostAdequateNationally(String biometricXml);
- FingerScanStatus checkIfFingerScanExists(String biometricXml);
+ FingerScanStatus checkIfFingerScanExists(String biometricXml);
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/SyncFingerprintService.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/SyncFingerprintService.java
index 1f36868..d262bc0 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/SyncFingerprintService.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/SyncFingerprintService.java
@@ -1,25 +1,25 @@
package org.openmrs.module.m2sysbiometrics.service;
+import java.util.List;
+
import org.openmrs.api.OpenmrsService;
import org.openmrs.module.m2sysbiometrics.model.SyncFingerprint;
import org.springframework.transaction.annotation.Transactional;
-import java.util.List;
-
public interface SyncFingerprintService extends OpenmrsService {
- @Transactional
- SyncFingerprint saveOrUpdate(SyncFingerprint syncFingerprint);
+ @Transactional
+ SyncFingerprint saveOrUpdate(SyncFingerprint syncFingerprint);
- @Transactional
- void delete(SyncFingerprint syncFingerprint);
+ @Transactional
+ void delete(SyncFingerprint syncFingerprint);
- @Transactional(readOnly = true)
- SyncFingerprint findOneByBiometricId(String biometricId);
+ @Transactional(readOnly = true)
+ SyncFingerprint findOneByBiometricId(String biometricId);
- @Transactional(readOnly = true)
- List findAllByBiometricXml(String biometricXml);
+ @Transactional(readOnly = true)
+ List findAllByBiometricXml(String biometricXml);
- @Transactional(readOnly = true)
- List findAll();
+ @Transactional(readOnly = true)
+ List findAll();
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/TempFingerprintService.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/TempFingerprintService.java
index 692e2df..eb80144 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/TempFingerprintService.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/TempFingerprintService.java
@@ -1,22 +1,22 @@
package org.openmrs.module.m2sysbiometrics.service;
+import java.util.List;
+
import org.openmrs.api.OpenmrsService;
import org.openmrs.module.m2sysbiometrics.model.TempFingerprint;
import org.springframework.transaction.annotation.Transactional;
-import java.util.List;
-
public interface TempFingerprintService extends OpenmrsService {
- @Transactional
- TempFingerprint saveOrUpdate(TempFingerprint tempFingerprint);
+ @Transactional
+ TempFingerprint saveOrUpdate(TempFingerprint tempFingerprint);
- @Transactional
- void delete(TempFingerprint tempFingerprint);
+ @Transactional
+ void delete(TempFingerprint tempFingerprint);
- @Transactional(readOnly = true)
- TempFingerprint findOneByBiometricId(String biometricId);
+ @Transactional(readOnly = true)
+ TempFingerprint findOneByBiometricId(String biometricId);
- @Transactional(readOnly = true)
- List findAllByBiometricXml(String biometricXml);
+ @Transactional(readOnly = true)
+ List findAllByBiometricXml(String biometricXml);
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/UpdateService.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/UpdateService.java
index ef33a30..4855796 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/UpdateService.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/UpdateService.java
@@ -1,11 +1,12 @@
package org.openmrs.module.m2sysbiometrics.service;
//import org.openmrs.module.m2sysbiometrics.model.M2SysCaptureResponse;
+
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricSubject;
public interface UpdateService {
- void updateLocally(BiometricSubject subject);
+ void updateLocally(BiometricSubject subject);
- // void updateNationally(M2SysCaptureResponse fingerScan);
+ // void updateNationally(M2SysCaptureResponse fingerScan);
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/NationalSynchronizationFailureServiceImpl.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/NationalSynchronizationFailureServiceImpl.java
index eb0be66..2784f13 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/NationalSynchronizationFailureServiceImpl.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/NationalSynchronizationFailureServiceImpl.java
@@ -1,5 +1,7 @@
package org.openmrs.module.m2sysbiometrics.service.impl;
+import java.util.List;
+
import org.openmrs.api.impl.BaseOpenmrsService;
import org.openmrs.module.m2sysbiometrics.dao.M2SysNationalSynchronizationFailureDao;
import org.openmrs.module.m2sysbiometrics.model.NationalSynchronizationFailure;
@@ -7,32 +9,30 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.List;
-
@Service(value = "nationalSynchronizationFailureService")
public class NationalSynchronizationFailureServiceImpl extends BaseOpenmrsService
- implements NationalSynchronizationFailureService {
-
- @Autowired
- private M2SysNationalSynchronizationFailureDao dao;
-
- @Override
- public NationalSynchronizationFailure save(NationalSynchronizationFailure nationalSynchronizationFailure) {
- return dao.save(nationalSynchronizationFailure);
- }
-
- @Override
- public void delete(NationalSynchronizationFailure nationalSynchronizationFailure) {
- dao.delete(nationalSynchronizationFailure);
- }
-
- @Override
- public List findAllRegistrationFailures() {
- return dao.findAllRegistrationFailures();
- }
-
- @Override
- public List findAllUpdateFailures() {
- return dao.findAllUpdateFailures();
- }
+ implements NationalSynchronizationFailureService {
+
+ @Autowired
+ private M2SysNationalSynchronizationFailureDao dao;
+
+ @Override
+ public NationalSynchronizationFailure save(NationalSynchronizationFailure nationalSynchronizationFailure) {
+ return dao.save(nationalSynchronizationFailure);
+ }
+
+ @Override
+ public void delete(NationalSynchronizationFailure nationalSynchronizationFailure) {
+ dao.delete(nationalSynchronizationFailure);
+ }
+
+ @Override
+ public List findAllRegistrationFailures() {
+ return dao.findAllRegistrationFailures();
+ }
+
+ @Override
+ public List findAllUpdateFailures() {
+ return dao.findAllUpdateFailures();
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/RegistrationServiceImpl.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/RegistrationServiceImpl.java
index 864849b..bd2362a 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/RegistrationServiceImpl.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/RegistrationServiceImpl.java
@@ -1,13 +1,9 @@
package org.openmrs.module.m2sysbiometrics.service.impl;
-import java.util.List;
-
import org.apache.commons.lang3.StringUtils;
-import org.openmrs.Location;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
+import org.openmrs.Location;
import org.openmrs.Patient;
import org.openmrs.PatientIdentifier;
import org.openmrs.PatientIdentifierType;
@@ -29,7 +25,6 @@
import org.openmrs.module.m2sysbiometrics.xml.XmlResultUtil;
import org.openmrs.module.registrationcore.api.RegistrationCoreService;
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricSubject;
-import org.openmrs.module.registrationcore.api.biometrics.model.Fingerprint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,173 +35,174 @@
@Service(value = "registrationService")
public class RegistrationServiceImpl implements RegistrationService {
- private static final Logger LOGGER = LoggerFactory.getLogger(RegistrationServiceImpl.class);
- private final Log log = LogFactory.getLog(RegistrationServiceImpl.class);
-
- @Autowired
- private PatientHelper patientHelper;
-
- @Autowired
- private LocalBioServerClient localBioServerClient;
-
- @Autowired
- private NationalBioServerClient nationalBioServerClient;
-
- @Autowired
- private RegistrationCoreService registrationCoreService;
-
- @Autowired
- private M2SysProperties properties;
-
- @Autowired
- private PatientService patientService;
-
- @Autowired
- private LocationService locationService;
-
- @Autowired
- private NationalUuidGenerator nationalUuidGenerator;
-
- @Autowired
- @Qualifier("m2sysbiometrics.jax2b")
- private Jaxb2Marshaller marshaller;
-
- @Autowired
- private NationalSynchronizationFailureService nationalSynchronizationFailureService;
-
-
- @Override
- public void registerLocally(BiometricSubject subject, M2SysCaptureResponse capture) {
- String response = localBioServerClient.enroll(subject.getSubjectId(), capture.getTemplateData());
- M2SysResults results = XmlResultUtil.parse(response);
- if (!results.isRegisterSuccess()) {
- String responseValue = results.firstValue();
- LOGGER.info("Got error response from the local server: {}. Checking if tied to patient.", responseValue);
- Patient patient = patientHelper.findByLocalFpId(responseValue);
- handleLocalRegistrationError(subject, responseValue, patient);
- }
- }
-
-// @Override
-// public void registerLocally(BiometricSubject subject) {
-// log.error("before enroll.....");
-// List fingerList=subject.getFingerprints();
-// Fingerprint finger=fingerList.get(0);
-// log.error("before enroll :"+finger.getTemplate());
-// String response = localBioServerClient.enroll(subject);
-// log.error("after enroll :"+response);
-// M2SysResults results = XmlResultUtil.parse(response);
-// log.error("after enroll :"+results.toString());
-// if (!results.isRegisterSuccess()) {
-// String responseValue = results.firstValue();
-// LOGGER.info("Got error response from the local server: {}. Checking if tied to patient.", responseValue);
-// Patient patient = patientHelper.findByLocalFpId(responseValue);
-// handleLocalRegistrationError(subject, responseValue, patient);
-// }
-// }
-
- @Override
- public void registerNationally(M2SysCaptureResponse capture) {
- String nationalId = "";
- try {
- nationalId = nationalUuidGenerator.generate();
- String response = nationalBioServerClient.enroll(nationalId, capture.getTemplateData());
- M2SysResults results = XmlResultUtil.parse(response);
- if (!results.isRegisterSuccess()) {
- throw new M2SysBiometricsException("National registration failed");
- }
- } catch (Exception e) {
- LOGGER.error("Registration with the national fingerprint server failed.", e);
- handleNationalRegistrationError(nationalId, capture);
- }
- }
-
- @Override
- public void fetchFromMpiByNationalFpId(BiometricSubject nationalBiometricSubject, M2SysCaptureResponse fingerScan) {
- String nationalId = nationalBiometricSubject.getSubjectId();
- registrationCoreService.importMpiPatient(nationalId, properties.getNationalPatientIdentifierTypeUuid());
-
- Patient patient = patientHelper.findByNationalFpId(nationalId);
- if (patient == null) {
- throw new M2SysBiometricsException(String.format(
- "Error during fetching patient from MPI with national fingerprint ID %s", nationalId));
- }
-
- //registerLocally(nationalBiometricSubject, fingerScan);
- attachLocalIdToThePatient(patient, nationalId);
- }
-
- @Override
- public void synchronizeFingerprints(M2SysCaptureResponse fingerScan, FingerScanStatus fingerScanStatus) {
- if (fingerScanStatus.isRegisteredNationally()) {
- String nationalId = fingerScanStatus.getNationalBiometricSubject().getSubjectId();
- if (patientHelper.findByNationalFpId(nationalId) == null) {
- String localId = fingerScanStatus.getLocalBiometricSubject().getSubjectId();
- Patient patient = patientHelper.findByLocalFpId(localId);
- attachNationalIdToThePatient(patient, nationalId);
- }
- } else {
- registerNationally(fingerScan);
- }
- }
-
- @Override
- public void importCcd(BiometricSubject nationalBiometricSubject) {
- Patient patient = patientHelper.findByNationalFpId(nationalBiometricSubject.getSubjectId());
- Integer ccdId = registrationCoreService.importCcd(patient);
- if (ccdId == null) {
- LOGGER.debug("XDS CCD import failure");
- }
- }
-
- private void handleLocalRegistrationError(BiometricSubject subject, String responseValue, Patient patient) {
- if (patient == null) {
- LOGGER.info("No patient matching fingerprint ID: {}", responseValue);
-
- String isRegisterResponse = localBioServerClient.isRegistered(responseValue);
- M2SysResults isRegisterResults = XmlResultUtil.parse(isRegisterResponse);
-
- if (isRegisterResults.isLookupNotFound()) {
- throw new M2SysBiometricsException("No success during fingerprint registration: "
- + responseValue);
- } else {
- LOGGER.info("Fingerprints are registered with ID {} but do not match any patient, fixing.",
- responseValue);
- if (!StringUtils.equals(subject.getSubjectId(), responseValue)) {
- LOGGER.info("Changing existing fingerprint ID {} to {}",
- responseValue, subject.getSubjectId());
-
- localBioServerClient.changeId(responseValue, subject.getSubjectId());
- } else {
- LOGGER.info("User already has the same fingerprints registered under his fingerprint ID");
- }
- }
- } else {
- throw new M2SysBiometricsException("Fingerprints already match patient: "
- + patient.getPersonName().getFullName());
- }
- }
-
- private void handleNationalRegistrationError(String nationalId, M2SysCaptureResponse fingerScan) {
- NationalSynchronizationFailure nationalSynchronizationFailure =
- new NationalSynchronizationFailure(nationalId, fingerScan.getTemplateData(), false);
- nationalSynchronizationFailureService.save(nationalSynchronizationFailure);
- }
-
- private void attachIdToThePatient(Patient patient, String id, String identifierTypeUuid) {
- PatientIdentifierType patientIdentifierType = patientHelper.getPatientIdentifierTypeByUuid(identifierTypeUuid);
- Location location = locationService.getDefaultLocation();
- Context.refreshEntity(patient);
- PatientIdentifier identifier = new PatientIdentifier(id, patientIdentifierType, location);
- patient.addIdentifier(identifier);
- patientService.savePatient(patient);
- }
-
- private void attachNationalIdToThePatient(Patient patient, String nationalId) {
- attachIdToThePatient(patient, nationalId, properties.getNationalPatientIdentifierTypeUuid());
- }
-
- private void attachLocalIdToThePatient(Patient patient, String localId) {
- attachIdToThePatient(patient, localId, properties.getLocalPatientIdentifierTypeUuid());
- }
+ private static final Logger LOGGER = LoggerFactory.getLogger(RegistrationServiceImpl.class);
+
+ private final Log log = LogFactory.getLog(RegistrationServiceImpl.class);
+
+ @Autowired
+ private PatientHelper patientHelper;
+
+ @Autowired
+ private LocalBioServerClient localBioServerClient;
+
+ @Autowired
+ private NationalBioServerClient nationalBioServerClient;
+
+ @Autowired
+ private RegistrationCoreService registrationCoreService;
+
+ @Autowired
+ private M2SysProperties properties;
+
+ @Autowired
+ private PatientService patientService;
+
+ @Autowired
+ private LocationService locationService;
+
+ @Autowired
+ private NationalUuidGenerator nationalUuidGenerator;
+
+ @Autowired
+ @Qualifier("m2sysbiometrics.jax2b")
+ private Jaxb2Marshaller marshaller;
+
+ @Autowired
+ private NationalSynchronizationFailureService nationalSynchronizationFailureService;
+
+ @Override
+ public void registerLocally(BiometricSubject subject, M2SysCaptureResponse capture) {
+ String response = localBioServerClient.enroll(subject.getSubjectId(), capture.getTemplateData());
+ M2SysResults results = XmlResultUtil.parse(response);
+ if (!results.isRegisterSuccess()) {
+ String responseValue = results.firstValue();
+ LOGGER.info("Got error response from the local server: {}. Checking if tied to patient.", responseValue);
+ Patient patient = patientHelper.findByLocalFpId(responseValue);
+ handleLocalRegistrationError(subject, responseValue, patient);
+ }
+ }
+
+ // @Override
+ // public void registerLocally(BiometricSubject subject) {
+ // log.error("before enroll.....");
+ // List fingerList=subject.getFingerprints();
+ // Fingerprint finger=fingerList.get(0);
+ // log.error("before enroll :"+finger.getTemplate());
+ // String response = localBioServerClient.enroll(subject);
+ // log.error("after enroll :"+response);
+ // M2SysResults results = XmlResultUtil.parse(response);
+ // log.error("after enroll :"+results.toString());
+ // if (!results.isRegisterSuccess()) {
+ // String responseValue = results.firstValue();
+ // LOGGER.info("Got error response from the local server: {}. Checking if tied to patient.", responseValue);
+ // Patient patient = patientHelper.findByLocalFpId(responseValue);
+ // handleLocalRegistrationError(subject, responseValue, patient);
+ // }
+ // }
+
+ @Override
+ public void registerNationally(M2SysCaptureResponse capture) {
+ String nationalId = "";
+ try {
+ nationalId = nationalUuidGenerator.generate();
+ String response = nationalBioServerClient.enroll(nationalId, capture.getTemplateData());
+ M2SysResults results = XmlResultUtil.parse(response);
+ if (!results.isRegisterSuccess()) {
+ throw new M2SysBiometricsException("National registration failed");
+ }
+ }
+ catch (Exception e) {
+ LOGGER.error("Registration with the national fingerprint server failed.", e);
+ handleNationalRegistrationError(nationalId, capture);
+ }
+ }
+
+ @Override
+ public void fetchFromMpiByNationalFpId(BiometricSubject nationalBiometricSubject, M2SysCaptureResponse fingerScan) {
+ String nationalId = nationalBiometricSubject.getSubjectId();
+ registrationCoreService.importMpiPatient(nationalId, properties.getNationalPatientIdentifierTypeUuid());
+
+ Patient patient = patientHelper.findByNationalFpId(nationalId);
+ if (patient == null) {
+ throw new M2SysBiometricsException(String.format(
+ "Error during fetching patient from MPI with national fingerprint ID %s", nationalId));
+ }
+
+ //registerLocally(nationalBiometricSubject, fingerScan);
+ attachLocalIdToThePatient(patient, nationalId);
+ }
+
+ @Override
+ public void synchronizeFingerprints(M2SysCaptureResponse fingerScan, FingerScanStatus fingerScanStatus) {
+ if (fingerScanStatus.isRegisteredNationally()) {
+ String nationalId = fingerScanStatus.getNationalBiometricSubject().getSubjectId();
+ if (patientHelper.findByNationalFpId(nationalId) == null) {
+ String localId = fingerScanStatus.getLocalBiometricSubject().getSubjectId();
+ Patient patient = patientHelper.findByLocalFpId(localId);
+ attachNationalIdToThePatient(patient, nationalId);
+ }
+ } else {
+ registerNationally(fingerScan);
+ }
+ }
+
+ @Override
+ public void importCcd(BiometricSubject nationalBiometricSubject) {
+ Patient patient = patientHelper.findByNationalFpId(nationalBiometricSubject.getSubjectId());
+ Integer ccdId = registrationCoreService.importCcd(patient);
+ if (ccdId == null) {
+ LOGGER.debug("XDS CCD import failure");
+ }
+ }
+
+ private void handleLocalRegistrationError(BiometricSubject subject, String responseValue, Patient patient) {
+ if (patient == null) {
+ LOGGER.info("No patient matching fingerprint ID: {}", responseValue);
+
+ String isRegisterResponse = localBioServerClient.isRegistered(responseValue);
+ M2SysResults isRegisterResults = XmlResultUtil.parse(isRegisterResponse);
+
+ if (isRegisterResults.isLookupNotFound()) {
+ throw new M2SysBiometricsException("No success during fingerprint registration: "
+ + responseValue);
+ } else {
+ LOGGER.info("Fingerprints are registered with ID {} but do not match any patient, fixing.",
+ responseValue);
+ if (!StringUtils.equals(subject.getSubjectId(), responseValue)) {
+ LOGGER.info("Changing existing fingerprint ID {} to {}",
+ responseValue, subject.getSubjectId());
+
+ localBioServerClient.changeId(responseValue, subject.getSubjectId());
+ } else {
+ LOGGER.info("User already has the same fingerprints registered under his fingerprint ID");
+ }
+ }
+ } else {
+ throw new M2SysBiometricsException("Fingerprints already match patient: "
+ + patient.getPersonName().getFullName());
+ }
+ }
+
+ private void handleNationalRegistrationError(String nationalId, M2SysCaptureResponse fingerScan) {
+ NationalSynchronizationFailure nationalSynchronizationFailure =
+ new NationalSynchronizationFailure(nationalId, fingerScan.getTemplateData(), false);
+ nationalSynchronizationFailureService.save(nationalSynchronizationFailure);
+ }
+
+ private void attachIdToThePatient(Patient patient, String id, String identifierTypeUuid) {
+ PatientIdentifierType patientIdentifierType = patientHelper.getPatientIdentifierTypeByUuid(identifierTypeUuid);
+ Location location = locationService.getDefaultLocation();
+ Context.refreshEntity(patient);
+ PatientIdentifier identifier = new PatientIdentifier(id, patientIdentifierType, location);
+ patient.addIdentifier(identifier);
+ patientService.savePatient(patient);
+ }
+
+ private void attachNationalIdToThePatient(Patient patient, String nationalId) {
+ attachIdToThePatient(patient, nationalId, properties.getNationalPatientIdentifierTypeUuid());
+ }
+
+ private void attachLocalIdToThePatient(Patient patient, String localId) {
+ attachIdToThePatient(patient, localId, properties.getLocalPatientIdentifierTypeUuid());
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/SearchServiceImpl.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/SearchServiceImpl.java
index 097f5e0..e170771 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/SearchServiceImpl.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/SearchServiceImpl.java
@@ -1,12 +1,17 @@
package org.openmrs.module.m2sysbiometrics.service.impl;
-import groovy.json.internal.JsonParserCharArray;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
import org.apache.commons.lang.exception.ExceptionUtils;
import org.openmrs.module.m2sysbiometrics.bioplugin.LocalBioServerClient;
import org.openmrs.module.m2sysbiometrics.bioplugin.NationalBioServerClient;
import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
-import org.openmrs.module.m2sysbiometrics.model.*;
-//import org.openmrs.module.m2sysbiometrics.model.M2SysCaptureResponse;
+import org.openmrs.module.m2sysbiometrics.model.CloudAbisResult;
+import org.openmrs.module.m2sysbiometrics.model.FingerScanStatus;
+import org.openmrs.module.m2sysbiometrics.model.M2SysResults;
+import org.openmrs.module.m2sysbiometrics.model.ScoreResult;
import org.openmrs.module.m2sysbiometrics.service.SearchService;
import org.openmrs.module.m2sysbiometrics.util.PatientHelper;
import org.openmrs.module.m2sysbiometrics.xml.XmlResultUtil;
@@ -17,124 +22,123 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
@Service(value = "searchService")
public class SearchServiceImpl implements SearchService {
- private static final Logger LOGGER = LoggerFactory.getLogger(SearchServiceImpl.class);
-
- @Autowired
- private LocalBioServerClient localBioServerClient;
-
- @Autowired
- private NationalBioServerClient nationalBioServerClient;
-
- @Autowired
- private PatientHelper patientHelper;
-
- @Override
- public List searchLocally(String biometricXml) {
- String response = localBioServerClient.identify(biometricXml);
- LOGGER.error("Identify Results <><><><><><><><><> : "+response);
- M2SysResults results = XmlResultUtil.parse(response);
-
- if (results.isSearchError()) {
- throw new M2SysBiometricsException("Error occurred during local fingerprint search: " + results.firstValue());
- }
-
- return results.toOpenMrsMatchList();
- }
-
- @Override
- public List searchNationally(String biometricXml) {
- String response = nationalBioServerClient.identify(biometricXml);
- M2SysResults results = XmlResultUtil.parse(response);
-
- if (results.isSearchError()) {
- throw new M2SysBiometricsException("Error occurred during national fingerprint search: " + results.firstValue());
- }
-
- return results.toOpenMrsMatchList();
- }
-
- public List toOpenMrsMatchList(CloudAbisResult result) {
- List matches = new ArrayList<>();
- Integer matchCount = result.getMatchCount();
- if (matchCount > 0) {
- List detailResult = result.getDetailResult();
- Iterator iterator = detailResult.iterator();
- while (iterator.hasNext()) {
- ScoreResult next = iterator.next();
- String id = next.getMatchId();
- Integer score = next.getScore();
- BiometricMatch match = new BiometricMatch(id, score.doubleValue());
- matches.add(match);
- }
- }
- return matches;
- }
-
- @Override
- public BiometricMatch findMostAdequateLocally(String biometricXml) {
- return searchLocally(biometricXml)
- .stream()
- .max(BiometricMatch::compareTo)
- .orElse(null);
- }
-
- @Override
- public BiometricMatch findMostAdequateNationally(String biometricXml) {
- return searchNationally(biometricXml)
- .stream()
- .max(BiometricMatch::compareTo)
- .orElse(null);
- }
-
- @Override
- public FingerScanStatus checkIfFingerScanExists(String biometricXml) {
- LOGGER.error("SearchServiceImpl.checkIfFingerScanExists() ==================>>>>>>>>>>>>>>>" + biometricXml);
- BiometricSubject nationalBiometricSubject = null;
- BiometricSubject localBiometricSubject = null;
-
- if (localBioServerClient.isServerUrlConfigured()) {
- try {
-// TODO - Ping the local fingerprint server to see if there is a connection over and above the configurations
- localBiometricSubject = findMostAdequateSubjectLocally(biometricXml);
-// localBiometricSubject = validateLocalSubjectExistence(localBiometricSubject);
- } catch (RuntimeException exception) {
- LOGGER.error("Connection failure to local server.", exception);
- }
-
- }
- if (nationalBioServerClient.isServerUrlConfigured()) {
- try {
- nationalBiometricSubject = findMostAdequateSubjectNationally(biometricXml);
- } catch (RuntimeException exception) {
- LOGGER.error(ExceptionUtils.getFullStackTrace(exception));
- LOGGER.error("Connection failure to national server.", exception);
- }
- }
-
- LOGGER.error("SearchServiceImpl.checkIfFingerScanExists() Results ==================Local: >>>>>>>>>>>>>>>" + localBiometricSubject + "National: >>>>>>>>>>>>>>>" + nationalBiometricSubject);
- return new FingerScanStatus(localBiometricSubject, nationalBiometricSubject);
- }
-
-// private BiometricSubject validateLocalSubjectExistence(BiometricSubject localBiometricSubject) {
-// return localBiometricSubject == null || patientHelper.findByLocalFpId(localBiometricSubject.getSubjectId()) == null
-// ? null
-// : localBiometricSubject;
-// }
-
- private BiometricSubject findMostAdequateSubjectLocally(String biometricXml) {
- BiometricMatch biometricMatch = findMostAdequateLocally(biometricXml);
- return biometricMatch == null ? null : new BiometricSubject(biometricMatch.getSubjectId());
- }
-
- private BiometricSubject findMostAdequateSubjectNationally(String biometricXml) {
- BiometricMatch biometricMatch = findMostAdequateNationally(biometricXml);
- return biometricMatch == null ? null : new BiometricSubject(biometricMatch.getSubjectId());
- }
+ private static final Logger LOGGER = LoggerFactory.getLogger(SearchServiceImpl.class);
+
+ @Autowired
+ private LocalBioServerClient localBioServerClient;
+
+ @Autowired
+ private NationalBioServerClient nationalBioServerClient;
+
+ @Autowired
+ private PatientHelper patientHelper;
+
+ @Override
+ public List searchLocally(String biometricXml) {
+ String response = localBioServerClient.identify(biometricXml);
+ LOGGER.error("Identify Results <><><><><><><><><> : " + response);
+ M2SysResults results = XmlResultUtil.parse(response);
+
+ if (results.isSearchError()) {
+ throw new M2SysBiometricsException("Error occurred during local fingerprint search: " + results.firstValue());
+ }
+
+ return results.toOpenMrsMatchList();
+ }
+
+ @Override
+ public List searchNationally(String biometricXml) {
+ String response = nationalBioServerClient.identify(biometricXml);
+ M2SysResults results = XmlResultUtil.parse(response);
+
+ if (results.isSearchError()) {
+ throw new M2SysBiometricsException("Error occurred during national fingerprint search: " + results.firstValue());
+ }
+
+ return results.toOpenMrsMatchList();
+ }
+
+ public List toOpenMrsMatchList(CloudAbisResult result) {
+ List matches = new ArrayList<>();
+ Integer matchCount = result.getMatchCount();
+ if (matchCount > 0) {
+ List detailResult = result.getDetailResult();
+ Iterator iterator = detailResult.iterator();
+ while (iterator.hasNext()) {
+ ScoreResult next = iterator.next();
+ String id = next.getMatchId();
+ Integer score = next.getScore();
+ BiometricMatch match = new BiometricMatch(id, score.doubleValue());
+ matches.add(match);
+ }
+ }
+ return matches;
+ }
+
+ @Override
+ public BiometricMatch findMostAdequateLocally(String biometricXml) {
+ return searchLocally(biometricXml)
+ .stream()
+ .max(BiometricMatch::compareTo)
+ .orElse(null);
+ }
+
+ @Override
+ public BiometricMatch findMostAdequateNationally(String biometricXml) {
+ return searchNationally(biometricXml)
+ .stream()
+ .max(BiometricMatch::compareTo)
+ .orElse(null);
+ }
+
+ @Override
+ public FingerScanStatus checkIfFingerScanExists(String biometricXml) {
+ LOGGER.error("SearchServiceImpl.checkIfFingerScanExists() ==================>>>>>>>>>>>>>>>" + biometricXml);
+ BiometricSubject nationalBiometricSubject = null;
+ BiometricSubject localBiometricSubject = null;
+
+ if (localBioServerClient.isServerUrlConfigured()) {
+ try {
+ // TODO - Ping the local fingerprint server to see if there is a connection over and above the configurations
+ localBiometricSubject = findMostAdequateSubjectLocally(biometricXml);
+ // localBiometricSubject = validateLocalSubjectExistence(localBiometricSubject);
+ }
+ catch (RuntimeException exception) {
+ LOGGER.error("Connection failure to local server.", exception);
+ }
+
+ }
+ if (nationalBioServerClient.isServerUrlConfigured()) {
+ try {
+ nationalBiometricSubject = findMostAdequateSubjectNationally(biometricXml);
+ }
+ catch (RuntimeException exception) {
+ LOGGER.error(ExceptionUtils.getFullStackTrace(exception));
+ LOGGER.error("Connection failure to national server.", exception);
+ }
+ }
+
+ LOGGER.error("SearchServiceImpl.checkIfFingerScanExists() Results ==================Local: >>>>>>>>>>>>>>>"
+ + localBiometricSubject + "National: >>>>>>>>>>>>>>>" + nationalBiometricSubject);
+ return new FingerScanStatus(localBiometricSubject, nationalBiometricSubject);
+ }
+
+ // private BiometricSubject validateLocalSubjectExistence(BiometricSubject localBiometricSubject) {
+ // return localBiometricSubject == null || patientHelper.findByLocalFpId(localBiometricSubject.getSubjectId()) == null
+ // ? null
+ // : localBiometricSubject;
+ // }
+
+ private BiometricSubject findMostAdequateSubjectLocally(String biometricXml) {
+ BiometricMatch biometricMatch = findMostAdequateLocally(biometricXml);
+ return biometricMatch == null ? null : new BiometricSubject(biometricMatch.getSubjectId());
+ }
+
+ private BiometricSubject findMostAdequateSubjectNationally(String biometricXml) {
+ BiometricMatch biometricMatch = findMostAdequateNationally(biometricXml);
+ return biometricMatch == null ? null : new BiometricSubject(biometricMatch.getSubjectId());
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/SyncFingerprintServiceImpl.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/SyncFingerprintServiceImpl.java
index b455f87..792d438 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/SyncFingerprintServiceImpl.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/SyncFingerprintServiceImpl.java
@@ -1,5 +1,7 @@
package org.openmrs.module.m2sysbiometrics.service.impl;
+import java.util.List;
+
import org.openmrs.api.impl.BaseOpenmrsService;
import org.openmrs.module.m2sysbiometrics.dao.SyncFingerprintDao;
import org.openmrs.module.m2sysbiometrics.model.SyncFingerprint;
@@ -7,36 +9,35 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.List;
-
@Service(value = "syncFingerprintService")
public class SyncFingerprintServiceImpl extends BaseOpenmrsService
- implements SyncFingerprintService {
- @Autowired
- private SyncFingerprintDao dao;
-
- @Override
- public SyncFingerprint saveOrUpdate(SyncFingerprint syncFingerprint) {
- return dao.saveOrUpdate(syncFingerprint);
- }
-
- @Override
- public void delete(SyncFingerprint syncFingerprint) {
- dao.delete(syncFingerprint);
- }
-
- @Override
- public SyncFingerprint findOneByBiometricId(String biometricId) {
- return dao.findOneByBiometricId(biometricId);
- }
-
- @Override
- public List findAllByBiometricXml(String biometricXml) {
- return dao.findAllByBiometricXml(biometricXml);
- }
-
- @Override
- public List findAll() {
- return dao.findAll();
- }
+ implements SyncFingerprintService {
+
+ @Autowired
+ private SyncFingerprintDao dao;
+
+ @Override
+ public SyncFingerprint saveOrUpdate(SyncFingerprint syncFingerprint) {
+ return dao.saveOrUpdate(syncFingerprint);
+ }
+
+ @Override
+ public void delete(SyncFingerprint syncFingerprint) {
+ dao.delete(syncFingerprint);
+ }
+
+ @Override
+ public SyncFingerprint findOneByBiometricId(String biometricId) {
+ return dao.findOneByBiometricId(biometricId);
+ }
+
+ @Override
+ public List findAllByBiometricXml(String biometricXml) {
+ return dao.findAllByBiometricXml(biometricXml);
+ }
+
+ @Override
+ public List findAll() {
+ return dao.findAll();
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/TempFingerprintServiceImpl.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/TempFingerprintServiceImpl.java
index 15e88f2..d0e5ea6 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/TempFingerprintServiceImpl.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/TempFingerprintServiceImpl.java
@@ -1,5 +1,7 @@
package org.openmrs.module.m2sysbiometrics.service.impl;
+import java.util.List;
+
import org.openmrs.api.impl.BaseOpenmrsService;
import org.openmrs.module.m2sysbiometrics.dao.TempFingerprintDao;
import org.openmrs.module.m2sysbiometrics.model.TempFingerprint;
@@ -7,31 +9,30 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.List;
-
@Service(value = "tempFingerprintService")
public class TempFingerprintServiceImpl extends BaseOpenmrsService
- implements TempFingerprintService {
- @Autowired
- private TempFingerprintDao dao;
-
- @Override
- public TempFingerprint saveOrUpdate(TempFingerprint tempFingerprint) {
- return dao.saveOrUpdate(tempFingerprint);
- }
-
- @Override
- public void delete(TempFingerprint tempFingerprint) {
- dao.delete(tempFingerprint);
- }
-
- @Override
- public TempFingerprint findOneByBiometricId(String biometricId) {
- return dao.findOneByBiometricId(biometricId);
- }
-
- @Override
- public List findAllByBiometricXml(String biometricXml) {
- return dao.findAllByBiometricXml(biometricXml);
- }
+ implements TempFingerprintService {
+
+ @Autowired
+ private TempFingerprintDao dao;
+
+ @Override
+ public TempFingerprint saveOrUpdate(TempFingerprint tempFingerprint) {
+ return dao.saveOrUpdate(tempFingerprint);
+ }
+
+ @Override
+ public void delete(TempFingerprint tempFingerprint) {
+ dao.delete(tempFingerprint);
+ }
+
+ @Override
+ public TempFingerprint findOneByBiometricId(String biometricId) {
+ return dao.findOneByBiometricId(biometricId);
+ }
+
+ @Override
+ public List findAllByBiometricXml(String biometricXml) {
+ return dao.findAllByBiometricXml(biometricXml);
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/UpdateServiceImpl.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/UpdateServiceImpl.java
index 8c90a06..9c55f18 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/UpdateServiceImpl.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/service/impl/UpdateServiceImpl.java
@@ -3,58 +3,49 @@
import java.util.List;
import org.openmrs.module.m2sysbiometrics.bioplugin.LocalBioServerClient;
-//import org.openmrs.module.m2sysbiometrics.bioplugin.NationalBioServerClient;
import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
-//import org.openmrs.module.m2sysbiometrics.model.M2SysCaptureResponse;
import org.openmrs.module.m2sysbiometrics.model.M2SysResults;
-//import org.openmrs.module.m2sysbiometrics.model.NationalSynchronizationFailure;
-//import org.openmrs.module.m2sysbiometrics.service.NationalSynchronizationFailureService;
-//import org.openmrs.module.m2sysbiometrics.service.RegistrationService;
-//import org.openmrs.module.m2sysbiometrics.service.SearchService;
import org.openmrs.module.m2sysbiometrics.service.UpdateService;
import org.openmrs.module.m2sysbiometrics.xml.XmlResultUtil;
-//import org.openmrs.module.registrationcore.api.biometrics.model.BiometricMatch;
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricSubject;
import org.openmrs.module.registrationcore.api.biometrics.model.Fingerprint;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service(value = "updateService")
public class UpdateServiceImpl implements UpdateService {
- // private static final Logger LOGGER = LoggerFactory.getLogger(UpdateServiceImpl.class);
+ // private static final Logger LOGGER = LoggerFactory.getLogger(UpdateServiceImpl.class);
- // private static final String SUBJECT_NOT_NEEDED = "NOT_NEEDED";
+ // private static final String SUBJECT_NOT_NEEDED = "NOT_NEEDED";
- @Autowired
- private LocalBioServerClient localBioServerClient;
+ @Autowired
+ private LocalBioServerClient localBioServerClient;
- // @Autowired
- // private NationalBioServerClient nationalBioServerClient;
+ // @Autowired
+ // private NationalBioServerClient nationalBioServerClient;
- // @Autowired
- // private NationalSynchronizationFailureService nationalSynchronizationFailureService;
+ // @Autowired
+ // private NationalSynchronizationFailureService nationalSynchronizationFailureService;
- // @Autowired
- // private SearchService searchService;
+ // @Autowired
+ // private SearchService searchService;
- // @Autowired
- // private RegistrationService registrationService;
+ // @Autowired
+ // private RegistrationService registrationService;
- @Override
- public void updateLocally(BiometricSubject subject) {
-
- List fingerList=subject.getFingerprints();
- Fingerprint finger=fingerList.get(0);
- String response = localBioServerClient.update(subject.getSubjectId(),finger.getTemplate());
- M2SysResults results = XmlResultUtil.parse(response);
- if (!results.isUpdateSuccess()) {
- throw new M2SysBiometricsException("Unable to update fingerprints locally for: " + subject.getSubjectId()
- + ", reason: " + results.firstValue());
- }
- }
+ @Override
+ public void updateLocally(BiometricSubject subject) {
+
+ List fingerList = subject.getFingerprints();
+ Fingerprint finger = fingerList.get(0);
+ String response = localBioServerClient.update(subject.getSubjectId(), finger.getTemplate());
+ M2SysResults results = XmlResultUtil.parse(response);
+ if (!results.isUpdateSuccess()) {
+ throw new M2SysBiometricsException("Unable to update fingerprints locally for: " + subject.getSubjectId()
+ + ", reason: " + results.firstValue());
+ }
+ }
/*
@@ -86,5 +77,5 @@ private void handleNationalUpdateError(M2SysCaptureResponse fingerScan) {
new NationalSynchronizationFailure(SUBJECT_NOT_NEEDED, fingerScan.getTemplateData(), true);
nationalSynchronizationFailureService.save(nationalSynchronizationFailure);
}
- */
+ */
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/M2SysProperties.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/M2SysProperties.java
index 13fa85c..ba5406b 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/M2SysProperties.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/M2SysProperties.java
@@ -11,51 +11,52 @@
@Component
public class M2SysProperties {
- @Autowired
- private AdministrationService adminService;
-
- public String getGlobalProperty(String propertyName) {
- String propertyValue = adminService.getGlobalProperty(propertyName);
- if (StringUtils.isBlank(propertyValue)) {
- throw new APIException(String.format("Property value for '%s' is not set", propertyName));
- }
- return propertyValue;
- }
-
- public boolean isGlobalPropertySet(String propertyName) {
- return StringUtils.isNotBlank(adminService.getGlobalProperty(propertyName));
- }
-
- public String getCloudScanrUrl() {
- return getGlobalProperty(M2SysBiometricsConstants.M2SYS_CLOUD_SCANR_URL);
- }
-
- /*
- public String getCloudScanrUsername() {
- return getGlobalProperty(M2SysBiometricsConstants.M2SYS_CLOUD_SCANR_USERNAME);
- }
-
- public String getCloudScanrPassword() {
- return getGlobalProperty(M2SysBiometricsConstants.M2SYS_CLOUD_SCANR_PASSWORD);
- }
-
- public String getCustomerKey() {
- return getGlobalProperty(M2SysBiometricsConstants.M2SYS_CUSTOMER_KEY);
- }
+ @Autowired
+ private AdministrationService adminService;
+
+ public String getGlobalProperty(String propertyName) {
+ String propertyValue = adminService.getGlobalProperty(propertyName);
+ if (StringUtils.isBlank(propertyValue)) {
+ throw new APIException(String.format("Property value for '%s' is not set", propertyName));
+ }
+ return propertyValue;
+ }
+
+ public boolean isGlobalPropertySet(String propertyName) {
+ return StringUtils.isNotBlank(adminService.getGlobalProperty(propertyName));
+ }
+
+ public String getCloudScanrUrl() {
+ return getGlobalProperty(M2SysBiometricsConstants.M2SYS_CLOUD_SCANR_URL);
+ }
+
+ /*
+ public String getCloudScanrUsername() {
+ return getGlobalProperty(M2SysBiometricsConstants.M2SYS_CLOUD_SCANR_USERNAME);
+ }
+
+ public String getCloudScanrPassword() {
+ return getGlobalProperty(M2SysBiometricsConstants.M2SYS_CLOUD_SCANR_PASSWORD);
+ }
+
+ public String getCustomerKey() {
+ return getGlobalProperty(M2SysBiometricsConstants.M2SYS_CUSTOMER_KEY);
+ }
*/
- public float getCaptureTimeOut() {
- return Float.parseFloat(getGlobalProperty(M2SysBiometricsConstants.M2SYS_CAPTURE_TIMEOUT));
- }
-/*
- public String getAccessPointId() {
- return getGlobalProperty(M2SysBiometricsConstants.M2SYS_ACCESS_POINT_ID);
- }
-*/
- public String getNationalPatientIdentifierTypeUuid() {
- return getGlobalProperty(RegistrationCoreConstants.GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID);
- }
-
- public String getLocalPatientIdentifierTypeUuid() {
- return getGlobalProperty(RegistrationCoreConstants.GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID);
- }
+ public float getCaptureTimeOut() {
+ return Float.parseFloat(getGlobalProperty(M2SysBiometricsConstants.M2SYS_CAPTURE_TIMEOUT));
+ }
+
+ /*
+ public String getAccessPointId() {
+ return getGlobalProperty(M2SysBiometricsConstants.M2SYS_ACCESS_POINT_ID);
+ }
+ */
+ public String getNationalPatientIdentifierTypeUuid() {
+ return getGlobalProperty(RegistrationCoreConstants.GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID);
+ }
+
+ public String getLocalPatientIdentifierTypeUuid() {
+ return getGlobalProperty(RegistrationCoreConstants.GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID);
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/M2SysResponseUtil.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/M2SysResponseUtil.java
index bf10769..8bddb06 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/M2SysResponseUtil.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/M2SysResponseUtil.java
@@ -2,52 +2,52 @@
import org.apache.commons.lang.StringUtils;
import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
-import org.openmrs.module.m2sysbiometrics.model.M2SysResults;
import org.openmrs.module.m2sysbiometrics.model.M2SysResponse;
import org.openmrs.module.m2sysbiometrics.model.M2SysResult;
+import org.openmrs.module.m2sysbiometrics.model.M2SysResults;
public class M2SysResponseUtil {
- public static boolean checkLookupResponse(M2SysResponse response) {
- M2SysResults matchingResult = response.parseMatchingResult();
- checkIfMatchingResultIsNotEmptyList(matchingResult);
-
- M2SysResult result = matchingResult.getResults().get(0);
- result.checkCommonErrorValues();
- String value = result.getValue();
- return !(M2SysResult.FAILED.equals(value)
- || (StringUtils.isBlank(value) || value.length() != 2 || !StringUtils.isNumeric(value)));
- }
-
- public static void checkUpdateSubjectIdResponse(M2SysResponse response) {
- M2SysResults matchingResult = (response.parseMatchingResult());
- checkIfMatchingResultIsNotEmptyList(matchingResult);
-
- M2SysResult result = matchingResult.getResults().get(0);
- result.checkCommonErrorValues();
- if (M2SysResult.UPDATE_SUBJECT_ID_FAILURE.equals(result.getValue())) {
- throw new IllegalArgumentException("Changing subject id failed. Probably the old id doesn't exist");
- } else if (!M2SysResult.UPDATE_SUBJECT_ID_SUCCESS.equals(result.getValue())) {
- throw new M2SysBiometricsException("Unknown updating subjectId result");
- }
- }
-
- public static void checkDeleteResponse(M2SysResponse response) {
- M2SysResults matchingResult = (response.parseMatchingResult());
- checkIfMatchingResultIsNotEmptyList(matchingResult);
-
- M2SysResult result = matchingResult.getResults().get(0);
- result.checkCommonErrorValues();
- if (M2SysResult.DELETE_FAILURE.equals(result.getValue())) {
- throw new IllegalArgumentException("Deleting subject failed. Probably the subject doesn't exist");
- } else if (!M2SysResult.DELETE_SUCCESS.equals(result.getValue())) {
- throw new M2SysBiometricsException("Unknown deleting result");
- }
- }
-
- private static void checkIfMatchingResultIsNotEmptyList(M2SysResults matchingResult) {
- if (matchingResult == null || matchingResult.getResults().isEmpty()) {
- throw new M2SysBiometricsException("Unknown m2Sys result");
- }
- }
+ public static boolean checkLookupResponse(M2SysResponse response) {
+ M2SysResults matchingResult = response.parseMatchingResult();
+ checkIfMatchingResultIsNotEmptyList(matchingResult);
+
+ M2SysResult result = matchingResult.getResults().get(0);
+ result.checkCommonErrorValues();
+ String value = result.getValue();
+ return !(M2SysResult.FAILED.equals(value)
+ || (StringUtils.isBlank(value) || value.length() != 2 || !StringUtils.isNumeric(value)));
+ }
+
+ public static void checkUpdateSubjectIdResponse(M2SysResponse response) {
+ M2SysResults matchingResult = (response.parseMatchingResult());
+ checkIfMatchingResultIsNotEmptyList(matchingResult);
+
+ M2SysResult result = matchingResult.getResults().get(0);
+ result.checkCommonErrorValues();
+ if (M2SysResult.UPDATE_SUBJECT_ID_FAILURE.equals(result.getValue())) {
+ throw new IllegalArgumentException("Changing subject id failed. Probably the old id doesn't exist");
+ } else if (!M2SysResult.UPDATE_SUBJECT_ID_SUCCESS.equals(result.getValue())) {
+ throw new M2SysBiometricsException("Unknown updating subjectId result");
+ }
+ }
+
+ public static void checkDeleteResponse(M2SysResponse response) {
+ M2SysResults matchingResult = (response.parseMatchingResult());
+ checkIfMatchingResultIsNotEmptyList(matchingResult);
+
+ M2SysResult result = matchingResult.getResults().get(0);
+ result.checkCommonErrorValues();
+ if (M2SysResult.DELETE_FAILURE.equals(result.getValue())) {
+ throw new IllegalArgumentException("Deleting subject failed. Probably the subject doesn't exist");
+ } else if (!M2SysResult.DELETE_SUCCESS.equals(result.getValue())) {
+ throw new M2SysBiometricsException("Unknown deleting result");
+ }
+ }
+
+ private static void checkIfMatchingResultIsNotEmptyList(M2SysResults matchingResult) {
+ if (matchingResult == null || matchingResult.getResults().isEmpty()) {
+ throw new M2SysBiometricsException("Unknown m2Sys result");
+ }
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/NationalUuidGenerator.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/NationalUuidGenerator.java
index 836d2b7..544bafd 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/NationalUuidGenerator.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/NationalUuidGenerator.java
@@ -1,33 +1,32 @@
package org.openmrs.module.m2sysbiometrics.util;
+import java.util.UUID;
+
import org.openmrs.module.m2sysbiometrics.bioplugin.NationalBioServerClient;
-import org.openmrs.module.m2sysbiometrics.model.M2SysResults;
-import org.openmrs.module.m2sysbiometrics.xml.XmlResultUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import java.util.UUID;
-
@Component
public class NationalUuidGenerator {
- private static final Logger LOGGER = LoggerFactory.getLogger(NationalUuidGenerator.class);
- @Autowired
- private NationalBioServerClient nationalBioServerClient;
+ private static final Logger LOGGER = LoggerFactory.getLogger(NationalUuidGenerator.class);
+
+ @Autowired
+ private NationalBioServerClient nationalBioServerClient;
- public String generate() {
- boolean isRegistered;
- String uuid;
- LOGGER.info("About to fetch UUID");
- do {
- // unlikely it will repeat, but we must guard against it
- uuid = UUID.randomUUID().toString();
- String response = nationalBioServerClient.isRegistered(uuid);
- isRegistered = response.equals("YES");
- } while (isRegistered);
+ public String generate() {
+ boolean isRegistered;
+ String uuid;
+ LOGGER.info("About to fetch UUID");
+ do {
+ // unlikely it will repeat, but we must guard against it
+ uuid = UUID.randomUUID().toString();
+ String response = nationalBioServerClient.isRegistered(uuid);
+ isRegistered = response.equals("YES");
+ } while (isRegistered);
- return uuid;
- }
+ return uuid;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/PatientHelper.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/PatientHelper.java
index 345ac04..78ca27d 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/PatientHelper.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/PatientHelper.java
@@ -5,9 +5,9 @@
public interface PatientHelper {
- Patient findByLocalFpId(String subjectId);
+ Patient findByLocalFpId(String subjectId);
- Patient findByNationalFpId(String nationalSubjectId);
+ Patient findByNationalFpId(String nationalSubjectId);
- PatientIdentifierType getPatientIdentifierTypeByUuid(String patientIdentifierTypeUuid);
+ PatientIdentifierType getPatientIdentifierTypeByUuid(String patientIdentifierTypeUuid);
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/impl/PatientHelperImpl.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/impl/PatientHelperImpl.java
index 635b5da..11a86d6 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/impl/PatientHelperImpl.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/util/impl/PatientHelperImpl.java
@@ -16,56 +16,56 @@
@Component
public class PatientHelperImpl implements PatientHelper {
- private static final Logger LOGGER = LoggerFactory.getLogger(PatientHelperImpl.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(PatientHelperImpl.class);
- @Autowired
- private RegistrationCoreService registrationCoreService;
+ @Autowired
+ private RegistrationCoreService registrationCoreService;
- @Autowired
- private PatientService patientService;
+ @Autowired
+ private PatientService patientService;
- @Autowired
- private M2SysProperties properties;
+ @Autowired
+ private M2SysProperties properties;
- @Override
- public Patient findByLocalFpId(String subjectId) {
- return findByIdType(subjectId,
- RegistrationCoreConstants.GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID);
- }
+ @Override
+ public Patient findByLocalFpId(String subjectId) {
+ return findByIdType(subjectId,
+ RegistrationCoreConstants.GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID);
+ }
- @Override
- public Patient findByNationalFpId(String nationalSubjectId) {
- return findByIdType(nationalSubjectId,
- RegistrationCoreConstants.GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID);
- }
+ @Override
+ public Patient findByNationalFpId(String nationalSubjectId) {
+ return findByIdType(nationalSubjectId,
+ RegistrationCoreConstants.GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID);
+ }
- @Override
- public PatientIdentifierType getPatientIdentifierTypeByUuid(String patientIdentifierTypeUuid) {
- PatientIdentifierType patientIdentifierType = patientService
- .getPatientIdentifierTypeByUuid(patientIdentifierTypeUuid);
- if (patientIdentifierType != null) {
- Context.refreshEntity(patientIdentifierType);
- }
- return patientIdentifierType;
- }
+ @Override
+ public PatientIdentifierType getPatientIdentifierTypeByUuid(String patientIdentifierTypeUuid) {
+ PatientIdentifierType patientIdentifierType = patientService
+ .getPatientIdentifierTypeByUuid(patientIdentifierTypeUuid);
+ if (patientIdentifierType != null) {
+ Context.refreshEntity(patientIdentifierType);
+ }
+ return patientIdentifierType;
+ }
- private Patient findByIdType(String subjectId, String idTypeProp) {
- Patient patient = null;
- if (properties.isGlobalPropertySet(idTypeProp)) {
- String identifierUuid = properties.getGlobalProperty(idTypeProp);
- if (patientIdentifierTypeExists(identifierUuid)) {
- patient = registrationCoreService.findByPatientIdentifier(subjectId, identifierUuid);
- if (patient != null) {
- Context.refreshEntity(patient);
- }
- } else {
- LOGGER.warn("Identifier type defined by prop {} is missing: {}", idTypeProp, identifierUuid);
- }
- }
- return patient;
- }
+ private Patient findByIdType(String subjectId, String idTypeProp) {
+ Patient patient = null;
+ if (properties.isGlobalPropertySet(idTypeProp)) {
+ String identifierUuid = properties.getGlobalProperty(idTypeProp);
+ if (patientIdentifierTypeExists(identifierUuid)) {
+ patient = registrationCoreService.findByPatientIdentifier(subjectId, identifierUuid);
+ if (patient != null) {
+ Context.refreshEntity(patient);
+ }
+ } else {
+ LOGGER.warn("Identifier type defined by prop {} is missing: {}", idTypeProp, identifierUuid);
+ }
+ }
+ return patient;
+ }
- private boolean patientIdentifierTypeExists(String patientIdentifierTypeUuid) {
- return getPatientIdentifierTypeByUuid(patientIdentifierTypeUuid) != null;
- }
+ private boolean patientIdentifierTypeExists(String patientIdentifierTypeUuid) {
+ return getPatientIdentifierTypeByUuid(patientIdentifierTypeUuid) != null;
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/xml/M2SysXmlErrorHandler.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/xml/M2SysXmlErrorHandler.java
index 08c1ba0..e8aff7a 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/xml/M2SysXmlErrorHandler.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/xml/M2SysXmlErrorHandler.java
@@ -8,10 +8,10 @@
public class M2SysXmlErrorHandler extends DefaultHandler {
- private static final Logger LOGGER = LoggerFactory.getLogger(M2SysXmlErrorHandler.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(M2SysXmlErrorHandler.class);
- @Override
- public void fatalError(SAXParseException ex) throws SAXException {
- LOGGER.warn("Invalid XML coming from M2Sys, still processing. Error: {}", ex.getMessage());
- }
+ @Override
+ public void fatalError(SAXParseException ex) throws SAXException {
+ LOGGER.warn("Invalid XML coming from M2Sys, still processing. Error: {}", ex.getMessage());
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/xml/ResultContentHandler.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/xml/ResultContentHandler.java
index 51d6f80..0f8ced5 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/xml/ResultContentHandler.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/xml/ResultContentHandler.java
@@ -1,43 +1,43 @@
package org.openmrs.module.m2sysbiometrics.xml;
import org.apache.commons.lang3.StringUtils;
-import org.openmrs.module.m2sysbiometrics.model.M2SysResults;
import org.openmrs.module.m2sysbiometrics.model.M2SysResult;
+import org.openmrs.module.m2sysbiometrics.model.M2SysResults;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class ResultContentHandler extends DefaultHandler {
- private final M2SysResults results;
-
- public ResultContentHandler(M2SysResults results) {
- this.results = results;
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes)
- throws SAXException {
- if (qName.equalsIgnoreCase("result")) {
- M2SysResult result = new M2SysResult();
-
- result.setValue(attributes.getValue("value"));
-
- String score = attributes.getValue("score");
- if (StringUtils.isNotBlank(score)) {
- result.setScore(Integer.parseInt(score));
- }
-
- String instance = attributes.getValue("Instance");
- if (StringUtils.isNotBlank(instance)) {
- result.setInstance(Integer.parseInt(instance));
- }
-
- if (!result.isEmpty()) {
- results.addResult(result);
- }
- } else {
- super.startElement(uri, localName, qName, attributes);
- }
- }
+ private final M2SysResults results;
+
+ public ResultContentHandler(M2SysResults results) {
+ this.results = results;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attributes)
+ throws SAXException {
+ if (qName.equalsIgnoreCase("result")) {
+ M2SysResult result = new M2SysResult();
+
+ result.setValue(attributes.getValue("value"));
+
+ String score = attributes.getValue("score");
+ if (StringUtils.isNotBlank(score)) {
+ result.setScore(Integer.parseInt(score));
+ }
+
+ String instance = attributes.getValue("Instance");
+ if (StringUtils.isNotBlank(instance)) {
+ result.setInstance(Integer.parseInt(instance));
+ }
+
+ if (!result.isEmpty()) {
+ results.addResult(result);
+ }
+ } else {
+ super.startElement(uri, localName, qName, attributes);
+ }
+ }
}
diff --git a/api/src/main/java/org/openmrs/module/m2sysbiometrics/xml/XmlResultUtil.java b/api/src/main/java/org/openmrs/module/m2sysbiometrics/xml/XmlResultUtil.java
index ed41697..07d8bbb 100644
--- a/api/src/main/java/org/openmrs/module/m2sysbiometrics/xml/XmlResultUtil.java
+++ b/api/src/main/java/org/openmrs/module/m2sysbiometrics/xml/XmlResultUtil.java
@@ -1,43 +1,44 @@
package org.openmrs.module.m2sysbiometrics.xml;
-import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
-import org.openmrs.module.m2sysbiometrics.model.M2SysResults;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.IOException;
import java.io.StringReader;
+import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
+import org.openmrs.module.m2sysbiometrics.model.M2SysResults;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
public final class XmlResultUtil {
- public static M2SysResults parse(String resultsXml) {
- try {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SAXParser saxParser = factory.newSAXParser();
+ private XmlResultUtil() {
+ }
- XMLReader xmlReader = saxParser.getXMLReader();
+ public static M2SysResults parse(String resultsXml) {
+ try {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ SAXParser saxParser = factory.newSAXParser();
- xmlReader.setFeature(
- "http://apache.org/xml/features/continue-after-fatal-error",
- true);
- xmlReader.setErrorHandler(new M2SysXmlErrorHandler());
+ XMLReader xmlReader = saxParser.getXMLReader();
- final M2SysResults results = new M2SysResults();
- xmlReader.setContentHandler(new ResultContentHandler(results));
+ xmlReader.setFeature(
+ "http://apache.org/xml/features/continue-after-fatal-error",
+ true);
+ xmlReader.setErrorHandler(new M2SysXmlErrorHandler());
- InputSource inputSource = new InputSource(new StringReader(resultsXml));
- xmlReader.parse(inputSource);
+ final M2SysResults results = new M2SysResults();
+ xmlReader.setContentHandler(new ResultContentHandler(results));
- return results;
- } catch (SAXException | IOException | ParserConfigurationException e) {
- throw new M2SysBiometricsException("Matching result parse error", e);
- }
- }
+ InputSource inputSource = new InputSource(new StringReader(resultsXml));
+ xmlReader.parse(inputSource);
- private XmlResultUtil() {
- }
+ return results;
+ }
+ catch (SAXException | IOException | ParserConfigurationException e) {
+ throw new M2SysBiometricsException("Matching result parse error", e);
+ }
+ }
}
diff --git a/api/src/main/resources/MessageBundle.properties b/api/src/main/resources/MessageBundle.properties
index dce03bb..5a8b858 100644
--- a/api/src/main/resources/MessageBundle.properties
+++ b/api/src/main/resources/MessageBundle.properties
@@ -50,7 +50,6 @@ m2sys.response.error.CS077="Picture capture not permitted by Biometric api";
m2sys.response.error.CS078="BioMetricWith: Default value not permitted.";
m2sys.response.error.CS079="BiometricImage license not available"
m2sys.response.error.CS036="Capture data not found"
-
// BiometricEngineStatus status code descriptions
m2sys.getStatus.decription.200="Everything works fine"
m2sys.getStatus.decription.default="Server doesn't work properly"
diff --git a/api/src/main/resources/MessageBundle_es.properties b/api/src/main/resources/MessageBundle_es.properties
index dce03bb..5a8b858 100644
--- a/api/src/main/resources/MessageBundle_es.properties
+++ b/api/src/main/resources/MessageBundle_es.properties
@@ -50,7 +50,6 @@ m2sys.response.error.CS077="Picture capture not permitted by Biometric api";
m2sys.response.error.CS078="BioMetricWith: Default value not permitted.";
m2sys.response.error.CS079="BiometricImage license not available"
m2sys.response.error.CS036="Capture data not found"
-
// BiometricEngineStatus status code descriptions
m2sys.getStatus.decription.200="Everything works fine"
m2sys.getStatus.decription.default="Server doesn't work properly"
diff --git a/api/src/main/resources/MessageBundle_fr.properties b/api/src/main/resources/MessageBundle_fr.properties
index dce03bb..5a8b858 100644
--- a/api/src/main/resources/MessageBundle_fr.properties
+++ b/api/src/main/resources/MessageBundle_fr.properties
@@ -50,7 +50,6 @@ m2sys.response.error.CS077="Picture capture not permitted by Biometric api";
m2sys.response.error.CS078="BioMetricWith: Default value not permitted.";
m2sys.response.error.CS079="BiometricImage license not available"
m2sys.response.error.CS036="Capture data not found"
-
// BiometricEngineStatus status code descriptions
m2sys.getStatus.decription.200="Everything works fine"
m2sys.getStatus.decription.default="Server doesn't work properly"
diff --git a/api/src/main/resources/liquibase.xml b/api/src/main/resources/liquibase.xml
index 85a921e..329a4b6 100644
--- a/api/src/main/resources/liquibase.xml
+++ b/api/src/main/resources/liquibase.xml
@@ -1,81 +1,85 @@
-
-
-
-
-
-
- Creating the table for failures in synchronization with national server.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ Creating the table for failures in synchronization with national server.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- Creating the table for temporary fingerprints, with the assignment of biometric id with biometric xml (scan result).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ Creating the table for temporary fingerprints, with the assignment of biometric id with biometric xml (scan result).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/api/src/main/resources/moduleApplicationContext.xml b/api/src/main/resources/moduleApplicationContext.xml
index aa9dd82..51c6756 100644
--- a/api/src/main/resources/moduleApplicationContext.xml
+++ b/api/src/main/resources/moduleApplicationContext.xml
@@ -2,118 +2,105 @@
-
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
+
-
-
-
+
+
+
-
-
-
-
-
- org.openmrs.module.m2sysbiometrics.service.RegistrationService
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.openmrs.module.m2sysbiometrics.service.UpdateService
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.openmrs.module.m2sysbiometrics.service.SearchService
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ org.openmrs.module.m2sysbiometrics.service.RegistrationService
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.openmrs.module.m2sysbiometrics.service.UpdateService
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.openmrs.module.m2sysbiometrics.service.SearchService
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/api/src/main/resources/wsdl/BioPluginServiceV81.wsdl b/api/src/main/resources/wsdl/BioPluginServiceV81.wsdl
index 453e8b3..d0f10b6 100644
--- a/api/src/main/resources/wsdl/BioPluginServiceV81.wsdl
+++ b/api/src/main/resources/wsdl/BioPluginServiceV81.wsdl
@@ -1,516 +1,519 @@
-
+
-
+
-
+
-
-
+
+
-
+
-
-
-
+
+
+
-
+
-
-
+
+
-
+
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
+
-
-
+
+
-
+
-
-
-
+
+
+
-
+
-
-
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/api/src/test/java/org/openmrs/module/m2sysbiometrics/M2SysBiometricSensitiveTestBase.java b/api/src/test/java/org/openmrs/module/m2sysbiometrics/M2SysBiometricSensitiveTestBase.java
index f7a6a34..1034413 100644
--- a/api/src/test/java/org/openmrs/module/m2sysbiometrics/M2SysBiometricSensitiveTestBase.java
+++ b/api/src/test/java/org/openmrs/module/m2sysbiometrics/M2SysBiometricSensitiveTestBase.java
@@ -3,8 +3,8 @@
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.springframework.test.context.ContextConfiguration;
-@ContextConfiguration(locations = {"classpath*:applicationContext-service.xml", "classpath*:moduleApplicationContext.xml",
- "classpath:m2sys-biometric-test-applicationContext.xml"}, inheritLocations = false)
+@ContextConfiguration(locations = { "classpath*:applicationContext-service.xml", "classpath*:moduleApplicationContext.xml",
+ "classpath:m2sys-biometric-test-applicationContext.xml" }, inheritLocations = false)
public class M2SysBiometricSensitiveTestBase extends BaseModuleContextSensitiveTest {
}
diff --git a/api/src/test/java/org/openmrs/module/m2sysbiometrics/http/M2SysHttpClientTest.java b/api/src/test/java/org/openmrs/module/m2sysbiometrics/http/M2SysHttpClientTest.java
index a7c26a7..55a8ba8 100644
--- a/api/src/test/java/org/openmrs/module/m2sysbiometrics/http/M2SysHttpClientTest.java
+++ b/api/src/test/java/org/openmrs/module/m2sysbiometrics/http/M2SysHttpClientTest.java
@@ -1,5 +1,17 @@
package org.openmrs.module.m2sysbiometrics.http;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.io.IOUtils;
@@ -17,125 +29,116 @@
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.client.RestTemplate;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
public class M2SysHttpClientTest {
- private static final int SERVER_PORT = 8034;
- private static final int LOCATION_ID = 13;
- private static final int LEFT_TEMPLATE_POSITION = 14;
- private static final int RIGHT_TEMPLATE_POSITION = 15;
-
- private static final String SERVER_URL = "http://localhost:" + SERVER_PORT;
-
- private M2SysHttpClient httpClient = new M2SysHttpClientImpl();
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(SERVER_PORT);
-
- private ObjectMapper objectMapper = new ObjectMapper();
-
- @Before
- public void setUp() {
- replaceJacksonMessageConverter();
- }
-
- @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
- @Test
- public void shouldPostAndGetM2SysResponse() throws IOException {
- stubFor(post(M2SysBiometricsConstants.M2SYS_REGISTER_ENDPOINT)
- .withHeader("Content-Type", equalTo("application/json"))
- .withHeader("Authorization", equalTo("Bearer XXX"))
- .withRequestBody(equalToJson(readFile("sampleRequest.json")))
- .willReturn(
- aResponse().withStatus(HttpStatus.SC_OK).withHeader("Content-Type", "application/json")
- .withBody(readFile("sampleResponse.json"))));
- M2SysRequest request = objectMapper.readValue(readFile("sampleRequest.json"), M2SysRequest.class);
-
- M2SysResponse response = httpClient.postRequest(SERVER_URL + M2SysBiometricsConstants.M2SYS_REGISTER_ENDPOINT,
- request, token());
-
- assertNotNull(response);
- assertEquals(Integer.valueOf(1), response.getClientPlatform());
- assertEquals("sample string 2", response.getApiVersion());
- assertEquals("sample string 3", response.getClientVersion());
- assertTrue(response.getSuccess());
- assertEquals("sample string 5", response.getMessage());
- assertEquals("sample string 6", response.getResponseCode());
- assertEquals("2017-08-02T05:47:22.3014417-07:00", response.getServerTime());
- assertEquals("sample string 1", response.getRegistrationId());
- assertEquals("sample string 2", response.getNewRegistrationId());
- assertEquals("sample string 3", response.getTransactionId());
- //assertEquals("sample string 4", response.getAccessPointId());
- assertEquals("sample string 5", response.getDeviceName());
- assertEquals("sample string 6", response.getPictureData());
- assertEquals("sample string 7", response.getTemplateData());
- assertEquals("sample string 8", response.getTemplateData2());
- assertEquals("sample string 9", response.getLeftTemplate());
- assertEquals("sample string 10", response.getRightTemplate());
- assertEquals("sample string 11", response.getMatchingResult());
- assertEquals("2017-08-02T05:47:22.3014417-07:00", response.getTransactionTime());
- //assertEquals("sample string 12", response.getCustomerKey());
- assertEquals(Integer.valueOf(LOCATION_ID), response.getLocationId());
- assertEquals(Integer.valueOf(LEFT_TEMPLATE_POSITION), response.getLeftTemplatePosition());
- assertEquals(Integer.valueOf(RIGHT_TEMPLATE_POSITION), response.getRightTemplatePosition());
- }
-
- @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
- @Test
- public void shouldGetToken() throws IOException {
- stubFor(post("/cstoken")
- .withHeader("Content-Type", equalTo("application/x-www-form-urlencoded"))
- .withRequestBody(equalTo("grant_type=password&username=username&Password=password&scope=custKey"))
- .willReturn(
- aResponse().withStatus(HttpStatus.SC_OK)
- .withHeader("Content-Type", "application/json;charset=UTF-8")
- .withBody(readFile("token.json"))));
-
- Token token = httpClient.getToken(SERVER_URL);
-
- // Token token = httpClient.getToken(SERVER_URL,"username", "password", "custKey");
- assertNotNull(token);
- assertEquals("This is a token", token.getAccessToken());
- assertEquals("bearer", token.getTokenType());
- assertEquals(Integer.valueOf(10799), token.getExpiresIn());
- }
-
- private String readFile(String file) throws IOException {
- try (InputStream in = getClass().getClassLoader().getResourceAsStream(file)) {
- return IOUtils.toString(in);
- }
- }
-
- private Token token() {
- Token token = new Token();
- token.setAccessToken("XXX");
- token.setTokenType("Bearer");
- return token;
- }
-
- // hack to make RestTemplate use old Jackson libs
- // even though we have newer ones on the classpath, because of Wiremock
- private void replaceJacksonMessageConverter() {
- MappingJacksonHttpMessageConverter messageConverter = new MappingJacksonHttpMessageConverter();
- messageConverter.setPrettyPrint(false);
- messageConverter.setObjectMapper(objectMapper);
-
- RestTemplate restTemplate = (RestTemplate) ReflectionTestUtils.getField(httpClient,
- "restOperations");
-
- restTemplate.getMessageConverters().removeIf(m -> m.getClass().getName().equals(
- MappingJackson2HttpMessageConverter.class.getName()));
- restTemplate.getMessageConverters().add(messageConverter);
- }
+ private static final int SERVER_PORT = 8034;
+
+ private static final int LOCATION_ID = 13;
+
+ private static final int LEFT_TEMPLATE_POSITION = 14;
+
+ private static final int RIGHT_TEMPLATE_POSITION = 15;
+
+ private static final String SERVER_URL = "http://localhost:" + SERVER_PORT;
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(SERVER_PORT);
+
+ private M2SysHttpClient httpClient = new M2SysHttpClientImpl();
+
+ private ObjectMapper objectMapper = new ObjectMapper();
+
+ @Before
+ public void setUp() {
+ replaceJacksonMessageConverter();
+ }
+
+ @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
+ @Test
+ public void shouldPostAndGetM2SysResponse() throws IOException {
+ stubFor(post(M2SysBiometricsConstants.M2SYS_REGISTER_ENDPOINT)
+ .withHeader("Content-Type", equalTo("application/json"))
+ .withHeader("Authorization", equalTo("Bearer XXX"))
+ .withRequestBody(equalToJson(readFile("sampleRequest.json")))
+ .willReturn(
+ aResponse().withStatus(HttpStatus.SC_OK).withHeader("Content-Type", "application/json")
+ .withBody(readFile("sampleResponse.json"))));
+ M2SysRequest request = objectMapper.readValue(readFile("sampleRequest.json"), M2SysRequest.class);
+
+ M2SysResponse response = httpClient.postRequest(SERVER_URL + M2SysBiometricsConstants.M2SYS_REGISTER_ENDPOINT,
+ request, token());
+
+ assertNotNull(response);
+ assertEquals(Integer.valueOf(1), response.getClientPlatform());
+ assertEquals("sample string 2", response.getApiVersion());
+ assertEquals("sample string 3", response.getClientVersion());
+ assertTrue(response.getSuccess());
+ assertEquals("sample string 5", response.getMessage());
+ assertEquals("sample string 6", response.getResponseCode());
+ assertEquals("2017-08-02T05:47:22.3014417-07:00", response.getServerTime());
+ assertEquals("sample string 1", response.getRegistrationId());
+ assertEquals("sample string 2", response.getNewRegistrationId());
+ assertEquals("sample string 3", response.getTransactionId());
+ //assertEquals("sample string 4", response.getAccessPointId());
+ assertEquals("sample string 5", response.getDeviceName());
+ assertEquals("sample string 6", response.getPictureData());
+ assertEquals("sample string 7", response.getTemplateData());
+ assertEquals("sample string 8", response.getTemplateData2());
+ assertEquals("sample string 9", response.getLeftTemplate());
+ assertEquals("sample string 10", response.getRightTemplate());
+ assertEquals("sample string 11", response.getMatchingResult());
+ assertEquals("2017-08-02T05:47:22.3014417-07:00", response.getTransactionTime());
+ //assertEquals("sample string 12", response.getCustomerKey());
+ assertEquals(Integer.valueOf(LOCATION_ID), response.getLocationId());
+ assertEquals(Integer.valueOf(LEFT_TEMPLATE_POSITION), response.getLeftTemplatePosition());
+ assertEquals(Integer.valueOf(RIGHT_TEMPLATE_POSITION), response.getRightTemplatePosition());
+ }
+
+ @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
+ @Test
+ public void shouldGetToken() throws IOException {
+ stubFor(post("/cstoken")
+ .withHeader("Content-Type", equalTo("application/x-www-form-urlencoded"))
+ .withRequestBody(equalTo("grant_type=password&username=username&Password=password&scope=custKey"))
+ .willReturn(
+ aResponse().withStatus(HttpStatus.SC_OK)
+ .withHeader("Content-Type", "application/json;charset=UTF-8")
+ .withBody(readFile("token.json"))));
+
+ Token token = httpClient.getToken(SERVER_URL);
+
+ // Token token = httpClient.getToken(SERVER_URL,"username", "password", "custKey");
+ assertNotNull(token);
+ assertEquals("This is a token", token.getAccessToken());
+ assertEquals("bearer", token.getTokenType());
+ assertEquals(Integer.valueOf(10799), token.getExpiresIn());
+ }
+
+ private String readFile(String file) throws IOException {
+ try (InputStream in = getClass().getClassLoader().getResourceAsStream(file)) {
+ return IOUtils.toString(in);
+ }
+ }
+
+ private Token token() {
+ Token token = new Token();
+ token.setAccessToken("XXX");
+ token.setTokenType("Bearer");
+ return token;
+ }
+
+ // hack to make RestTemplate use old Jackson libs
+ // even though we have newer ones on the classpath, because of Wiremock
+ private void replaceJacksonMessageConverter() {
+ MappingJacksonHttpMessageConverter messageConverter = new MappingJacksonHttpMessageConverter();
+ messageConverter.setPrettyPrint(false);
+ messageConverter.setObjectMapper(objectMapper);
+
+ RestTemplate restTemplate = (RestTemplate) ReflectionTestUtils.getField(httpClient,
+ "restOperations");
+
+ restTemplate.getMessageConverters().removeIf(m -> m.getClass().getName().equals(
+ MappingJackson2HttpMessageConverter.class.getName()));
+ restTemplate.getMessageConverters().add(messageConverter);
+ }
}
diff --git a/api/src/test/java/org/openmrs/module/m2sysbiometrics/it/M2SysIT.java b/api/src/test/java/org/openmrs/module/m2sysbiometrics/it/M2SysIT.java
index 89ababa..11d9414 100644
--- a/api/src/test/java/org/openmrs/module/m2sysbiometrics/it/M2SysIT.java
+++ b/api/src/test/java/org/openmrs/module/m2sysbiometrics/it/M2SysIT.java
@@ -15,82 +15,82 @@
public class M2SysIT extends M2SysBiometricSensitiveTestBase {
- private static final int CAPTURE_TIMEOUT = 120;
- private static final int LOCATION_ID = 1;
-
- @Autowired
- private M2SysHttpClient m2SysHttpClient;
-
- @Autowired
- private M2SysV105Client client;
-
- @Autowired
- private AdministrationService adminService;
-
- @Autowired
- private NationalBioServerClient nationalBioServerClient;
-
- @Autowired
- private LocalBioServerClient localBioServerClient;
-
- @Autowired
- private PatientService patientService;
-
- @Before
- public void setUp() {
- String custKey = System.getenv("m2sys-biometrics.customKey");
- String password = System.getenv("m2sys-biometrics.server.password");
- String username = System.getenv("m2sys-biometrics.server.user");
- String accessPointId = System.getenv("m2sys-biometrics.accessPointID");
- String apiUrl = System.getenv("m2sys-biometrics.server.url");
-
- String localServiceUrl = System.getenv("m2sys-biometrics.local-service.url");
- String nationalServiceUrl = System.getenv("m2sys.biometrics.national-service.url");
- String nationalServiceUsername = System.getenv("m2sys.biometrics.national-service.username");
- String nationalServicePassword = System.getenv("m2sys.biometrics.national-service.password");
-
- //adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_CUSTOMER_KEY, custKey);
- // adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_CLOUD_SCANR_PASSWORD, password);
- //adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_CLOUD_SCANR_USERNAME, username);
- adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_CLOUD_SCANR_URL, apiUrl);
- // adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_ACCESS_POINT_ID, accessPointId);
- adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_CAPTURE_TIMEOUT,
- String.valueOf(CAPTURE_TIMEOUT));
- adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_LOCATION_ID,
- String.valueOf(LOCATION_ID));
-
- adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_LOCAL_SERVICE_URL,
- localServiceUrl);
- adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_NATIONAL_SERVICE_URL,
- nationalServiceUrl);
- adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_NATIONAL_USERNAME,
- nationalServiceUsername);
- adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_NATIONAL_PASSWORD,
- nationalServicePassword);
- }
-
- @Test
- //@Ignore
- public void test() {
- BiometricSubject subject = new BiometricSubject("SEARCH_TEST2");
- //engine.delete(subject.getSubjectId());
- //engine.enroll(subject);
-
- //engine.delete(subject.getSubjectId());
- //engine.enroll(subject);
-
- localBioServerClient.delete("0da5aa64-1cbf-490f-9053-ca4076609f07");
- nationalBioServerClient.delete("NFP_TEST");
- localBioServerClient.delete("SEARCH_TEST2");
- nationalBioServerClient.delete("SEARCH_TEST2");
-
-
- //String response = nationalBioServerClient.identify(biometricXml);
- //response = localBioServerClient.identify(biometricXml);
-
- // local 0da5aa64-1cbf-490f-9053-ca4076609f07
- // national NFP_TEST
-
- client.enroll(subject);
- }
+ private static final int CAPTURE_TIMEOUT = 120;
+
+ private static final int LOCATION_ID = 1;
+
+ @Autowired
+ private M2SysHttpClient m2SysHttpClient;
+
+ @Autowired
+ private M2SysV105Client client;
+
+ @Autowired
+ private AdministrationService adminService;
+
+ @Autowired
+ private NationalBioServerClient nationalBioServerClient;
+
+ @Autowired
+ private LocalBioServerClient localBioServerClient;
+
+ @Autowired
+ private PatientService patientService;
+
+ @Before
+ public void setUp() {
+ String custKey = System.getenv("m2sys-biometrics.customKey");
+ String password = System.getenv("m2sys-biometrics.server.password");
+ String username = System.getenv("m2sys-biometrics.server.user");
+ String accessPointId = System.getenv("m2sys-biometrics.accessPointID");
+ String apiUrl = System.getenv("m2sys-biometrics.server.url");
+
+ String localServiceUrl = System.getenv("m2sys-biometrics.local-service.url");
+ String nationalServiceUrl = System.getenv("m2sys.biometrics.national-service.url");
+ String nationalServiceUsername = System.getenv("m2sys.biometrics.national-service.username");
+ String nationalServicePassword = System.getenv("m2sys.biometrics.national-service.password");
+
+ //adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_CUSTOMER_KEY, custKey);
+ // adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_CLOUD_SCANR_PASSWORD, password);
+ //adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_CLOUD_SCANR_USERNAME, username);
+ adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_CLOUD_SCANR_URL, apiUrl);
+ // adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_ACCESS_POINT_ID, accessPointId);
+ adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_CAPTURE_TIMEOUT,
+ String.valueOf(CAPTURE_TIMEOUT));
+ adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_LOCATION_ID,
+ String.valueOf(LOCATION_ID));
+
+ adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_LOCAL_SERVICE_URL,
+ localServiceUrl);
+ adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_NATIONAL_SERVICE_URL,
+ nationalServiceUrl);
+ adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_NATIONAL_USERNAME,
+ nationalServiceUsername);
+ adminService.setGlobalProperty(M2SysBiometricsConstants.M2SYS_NATIONAL_PASSWORD,
+ nationalServicePassword);
+ }
+
+ @Test
+ //@Ignore
+ public void test() {
+ BiometricSubject subject = new BiometricSubject("SEARCH_TEST2");
+ //engine.delete(subject.getSubjectId());
+ //engine.enroll(subject);
+
+ //engine.delete(subject.getSubjectId());
+ //engine.enroll(subject);
+
+ localBioServerClient.delete("0da5aa64-1cbf-490f-9053-ca4076609f07");
+ nationalBioServerClient.delete("NFP_TEST");
+ localBioServerClient.delete("SEARCH_TEST2");
+ nationalBioServerClient.delete("SEARCH_TEST2");
+
+ //String response = nationalBioServerClient.identify(biometricXml);
+ //response = localBioServerClient.identify(biometricXml);
+
+ // local 0da5aa64-1cbf-490f-9053-ca4076609f07
+ // national NFP_TEST
+
+ client.enroll(subject);
+ }
}
diff --git a/api/src/test/java/org/openmrs/module/m2sysbiometrics/model/M2SysResponseTest.java b/api/src/test/java/org/openmrs/module/m2sysbiometrics/model/M2SysResponseTest.java
index 0926a1b..caf120b 100644
--- a/api/src/test/java/org/openmrs/module/m2sysbiometrics/model/M2SysResponseTest.java
+++ b/api/src/test/java/org/openmrs/module/m2sysbiometrics/model/M2SysResponseTest.java
@@ -1,108 +1,108 @@
package org.openmrs.module.m2sysbiometrics.model;
-import org.apache.commons.io.IOUtils;
-import org.junit.Test;
-import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
-import org.openmrs.module.registrationcore.api.biometrics.model.BiometricMatch;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
+import org.openmrs.module.registrationcore.api.biometrics.model.BiometricMatch;
public class M2SysResponseTest {
- @Test
- public void shouldParseMatchingResult() throws Exception {
- M2SysResponse response = new M2SysResponse();
- response.setMatchingResult(readFile("sampleMatchingResult.xml"));
-
- M2SysResults matchingResult = response.parseMatchingResult();
- M2SysResult result = matchingResult.getResults().get(0);
-
- assertNotNull(matchingResult);
- assertEquals(0, result.getScore());
- assertEquals("27", result.getValue());
- assertEquals(1, result.getInstance());
- }
-
- @Test
- public void shouldParseListOfMatches() throws IOException {
- M2SysResponse response = new M2SysResponse();
- response.setMatchingResult(readFile("resultList.xml"));
-
- List matches = response.toMatchList();
-
- assertNotNull(matches);
- assertEquals(3, matches.size());
- assertEquals("10000X", matches.get(0).getSubjectId());
- assertEquals(22.0, matches.get(0).getMatchScore() , 0.1);
- assertEquals("10001X", matches.get(1).getSubjectId());
- assertEquals(1.0, matches.get(1).getMatchScore() , 0.1);
- assertEquals("10002X", matches.get(2).getSubjectId());
- assertEquals(102.0, matches.get(2).getMatchScore() , 0.1);
- }
-
- @Test
- public void shouldReturnEmptyListForNonMatchResult() throws IOException {
- M2SysResponse response = new M2SysResponse();
- response.setMatchingResult(readFile("noMatches.xml"));
-
- List matches = response.toMatchList();
-
- assertNotNull(matches);
- assertTrue(matches.isEmpty());
- }
-
- @Test
- public void shouldReturnEmptyListForEmptyResult() throws IOException {
- M2SysResponse response = new M2SysResponse();
- response.setMatchingResult("");
-
- List matches = response.toMatchList();
-
- assertNotNull(matches);
- assertTrue(matches.isEmpty());
- }
-
- @Test
- public void shouldReturnEmptyListForNullResult() throws IOException {
- M2SysResponse response = new M2SysResponse();
- response.setMatchingResult(null);
-
- List matches = response.toMatchList();
-
- assertNotNull(matches);
- assertTrue(matches.isEmpty());
- }
-
- @Test
- public void shouldParseInvalidResultXmlWithEmpty() throws IOException {
- M2SysResponse response = new M2SysResponse();
- response.setMatchingResult(readFile("invalidResultXml.xml"));
-
- List matches = response.toMatchList();
-
- assertNotNull(matches);
- assertEquals(1, matches.size());
- assertEquals(75.0, matches.get(0).getMatchScore(), 0.0);
- assertEquals("test", matches.get(0).getSubjectId());
- }
-
- @Test(expected = M2SysBiometricsException.class)
- public void shouldThrowExceptionForInvalidEngineResult() throws IOException {
- M2SysResponse response = new M2SysResponse();
- response.setMatchingResult(readFile("invalidEngine.xml"));
-
- response.toMatchList();
- }
-
- private String readFile(String file) throws IOException {
- try (InputStream in = getClass().getClassLoader().getResourceAsStream(file)) {
- return IOUtils.toString(in);
- }
- }
+ @Test
+ public void shouldParseMatchingResult() throws Exception {
+ M2SysResponse response = new M2SysResponse();
+ response.setMatchingResult(readFile("sampleMatchingResult.xml"));
+
+ M2SysResults matchingResult = response.parseMatchingResult();
+ M2SysResult result = matchingResult.getResults().get(0);
+
+ assertNotNull(matchingResult);
+ assertEquals(0, result.getScore());
+ assertEquals("27", result.getValue());
+ assertEquals(1, result.getInstance());
+ }
+
+ @Test
+ public void shouldParseListOfMatches() throws IOException {
+ M2SysResponse response = new M2SysResponse();
+ response.setMatchingResult(readFile("resultList.xml"));
+
+ List matches = response.toMatchList();
+
+ assertNotNull(matches);
+ assertEquals(3, matches.size());
+ assertEquals("10000X", matches.get(0).getSubjectId());
+ assertEquals(22.0, matches.get(0).getMatchScore(), 0.1);
+ assertEquals("10001X", matches.get(1).getSubjectId());
+ assertEquals(1.0, matches.get(1).getMatchScore(), 0.1);
+ assertEquals("10002X", matches.get(2).getSubjectId());
+ assertEquals(102.0, matches.get(2).getMatchScore(), 0.1);
+ }
+
+ @Test
+ public void shouldReturnEmptyListForNonMatchResult() throws IOException {
+ M2SysResponse response = new M2SysResponse();
+ response.setMatchingResult(readFile("noMatches.xml"));
+
+ List matches = response.toMatchList();
+
+ assertNotNull(matches);
+ assertTrue(matches.isEmpty());
+ }
+
+ @Test
+ public void shouldReturnEmptyListForEmptyResult() throws IOException {
+ M2SysResponse response = new M2SysResponse();
+ response.setMatchingResult("");
+
+ List matches = response.toMatchList();
+
+ assertNotNull(matches);
+ assertTrue(matches.isEmpty());
+ }
+
+ @Test
+ public void shouldReturnEmptyListForNullResult() throws IOException {
+ M2SysResponse response = new M2SysResponse();
+ response.setMatchingResult(null);
+
+ List matches = response.toMatchList();
+
+ assertNotNull(matches);
+ assertTrue(matches.isEmpty());
+ }
+
+ @Test
+ public void shouldParseInvalidResultXmlWithEmpty() throws IOException {
+ M2SysResponse response = new M2SysResponse();
+ response.setMatchingResult(readFile("invalidResultXml.xml"));
+
+ List matches = response.toMatchList();
+
+ assertNotNull(matches);
+ assertEquals(1, matches.size());
+ assertEquals(75.0, matches.get(0).getMatchScore(), 0.0);
+ assertEquals("test", matches.get(0).getSubjectId());
+ }
+
+ @Test(expected = M2SysBiometricsException.class)
+ public void shouldThrowExceptionForInvalidEngineResult() throws IOException {
+ M2SysResponse response = new M2SysResponse();
+ response.setMatchingResult(readFile("invalidEngine.xml"));
+
+ response.toMatchList();
+ }
+
+ private String readFile(String file) throws IOException {
+ try (InputStream in = getClass().getClassLoader().getResourceAsStream(file)) {
+ return IOUtils.toString(in);
+ }
+ }
}
diff --git a/api/src/test/java/org/openmrs/module/m2sysbiometrics/service/RegistrationServiceTest.java b/api/src/test/java/org/openmrs/module/m2sysbiometrics/service/RegistrationServiceTest.java
index 0208785..cc320f2 100644
--- a/api/src/test/java/org/openmrs/module/m2sysbiometrics/service/RegistrationServiceTest.java
+++ b/api/src/test/java/org/openmrs/module/m2sysbiometrics/service/RegistrationServiceTest.java
@@ -1,6 +1,12 @@
package org.openmrs.module.m2sysbiometrics.service;
-import org.junit.Ignore;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.UUID;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@@ -11,82 +17,75 @@
import org.openmrs.module.m2sysbiometrics.bioplugin.NationalBioServerClient;
import org.openmrs.module.m2sysbiometrics.exception.M2SysBiometricsException;
import org.openmrs.module.m2sysbiometrics.model.M2SysCaptureResponse;
+import org.openmrs.module.m2sysbiometrics.service.impl.RegistrationServiceImpl;
import org.openmrs.module.m2sysbiometrics.testdata.BiometricSubjectMother;
import org.openmrs.module.m2sysbiometrics.testdata.M2SysCaptureResponseMother;
import org.openmrs.module.m2sysbiometrics.testdata.PatientMother;
-import org.openmrs.module.m2sysbiometrics.service.impl.RegistrationServiceImpl;
import org.openmrs.module.m2sysbiometrics.util.NationalUuidGenerator;
import org.openmrs.module.m2sysbiometrics.util.PatientHelper;
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricSubject;
-import java.util.UUID;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
@RunWith(MockitoJUnitRunner.class)
public class RegistrationServiceTest {
- private static final String EXISTING_RESULT_XML = "";
+ private static final String EXISTING_RESULT_XML = "";
- private static final String EMPTY_RESULT_XML = "";
+ private static final String EMPTY_RESULT_XML = "";
- @Mock
- private LocalBioServerClient localBioServerClient;
+ @Mock
+ private LocalBioServerClient localBioServerClient;
- @Mock
- private NationalBioServerClient nationalBioServerClient;
+ @Mock
+ private NationalBioServerClient nationalBioServerClient;
- @Mock
- private PatientHelper patientHelper;
+ @Mock
+ private PatientHelper patientHelper;
- @Mock
- private NationalUuidGenerator nationalUuidGenerator;
+ @Mock
+ private NationalUuidGenerator nationalUuidGenerator;
- @InjectMocks
- private RegistrationService registrationService = new RegistrationServiceImpl();
+ @InjectMocks
+ private RegistrationService registrationService = new RegistrationServiceImpl();
- private BiometricSubject subject = BiometricSubjectMother.withSubjectId("subject");
+ private BiometricSubject subject = BiometricSubjectMother.withSubjectId("subject");
- private M2SysCaptureResponse capture = M2SysCaptureResponseMother.withTemplateData("templateData");
+ private M2SysCaptureResponse capture = M2SysCaptureResponseMother.withTemplateData("templateData");
- private Patient existingPatient = PatientMother.withName("Jose", "Arcadio", "Morales");
+ private Patient existingPatient = PatientMother.withName("Jose", "Arcadio", "Morales");
- @Test
- public void shouldRegisterLocally() throws Exception {
- //given
- when(localBioServerClient.enroll(subject.getSubjectId(), capture.getTemplateData())).thenReturn(EXISTING_RESULT_XML);
+ @Test
+ public void shouldRegisterLocally() throws Exception {
+ //given
+ when(localBioServerClient.enroll(subject.getSubjectId(), capture.getTemplateData())).thenReturn(EXISTING_RESULT_XML);
- //when
- registrationService.registerLocally(subject,capture);
+ //when
+ registrationService.registerLocally(subject, capture);
- //then
- verify(patientHelper, times(0)).findByLocalFpId(any());
- }
+ //then
+ verify(patientHelper, times(0)).findByLocalFpId(any());
+ }
- @Test
- public void shouldTryToRegisterNationallyWithoutException() throws Exception {
- //given
- String nationalId = UUID.randomUUID().toString();
- when(nationalBioServerClient.enroll(nationalId, capture.getTemplateData())).thenReturn(EXISTING_RESULT_XML);
- when(nationalUuidGenerator.generate()).thenReturn(nationalId);
+ @Test
+ public void shouldTryToRegisterNationallyWithoutException() throws Exception {
+ //given
+ String nationalId = UUID.randomUUID().toString();
+ when(nationalBioServerClient.enroll(nationalId, capture.getTemplateData())).thenReturn(EXISTING_RESULT_XML);
+ when(nationalUuidGenerator.generate()).thenReturn(nationalId);
- //when
- registrationService.registerNationally(capture);
- }
+ //when
+ registrationService.registerNationally(capture);
+ }
- @Test(expected = M2SysBiometricsException.class)
- public void shouldNotRegisterLocallyWithException() throws Exception {
- //given
- when(patientHelper.findByLocalFpId(any())).thenReturn(existingPatient);
- when(localBioServerClient.enroll(subject.getSubjectId(), capture.getTemplateData())).thenReturn(EMPTY_RESULT_XML);
+ @Test(expected = M2SysBiometricsException.class)
+ public void shouldNotRegisterLocallyWithException() throws Exception {
+ //given
+ when(patientHelper.findByLocalFpId(any())).thenReturn(existingPatient);
+ when(localBioServerClient.enroll(subject.getSubjectId(), capture.getTemplateData())).thenReturn(EMPTY_RESULT_XML);
- //when
- registrationService.registerLocally(subject,capture);
+ //when
+ registrationService.registerLocally(subject, capture);
- //then
- verify(patientHelper, times(1)).findByNationalFpId(any());
- }
+ //then
+ verify(patientHelper, times(1)).findByNationalFpId(any());
+ }
}
diff --git a/api/src/test/java/org/openmrs/module/m2sysbiometrics/service/SearchServiceTest.java b/api/src/test/java/org/openmrs/module/m2sysbiometrics/service/SearchServiceTest.java
index f29e2db..43e2fe9 100644
--- a/api/src/test/java/org/openmrs/module/m2sysbiometrics/service/SearchServiceTest.java
+++ b/api/src/test/java/org/openmrs/module/m2sysbiometrics/service/SearchServiceTest.java
@@ -1,5 +1,9 @@
package org.openmrs.module.m2sysbiometrics.service;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
+
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
@@ -15,117 +19,113 @@
import org.openmrs.module.m2sysbiometrics.testdata.M2SysCaptureResponseMother;
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricMatch;
-import java.util.List;
-
-import static org.mockito.Mockito.when;
-
@RunWith(MockitoJUnitRunner.class)
public class SearchServiceTest {
- private static final String EXISTING_SUBJECT_ID = "ExistingSubjectId";
+ private static final String EXISTING_SUBJECT_ID = "ExistingSubjectId";
- private static final String EXISTING_RESULT_XML = "";
+ private static final String EXISTING_RESULT_XML = "";
- private static final String ERROR_RESULT_XML = "";
+ private static final String ERROR_RESULT_XML = "";
- private static final String NOT_FOUND_RESULT_XML = "";
+ private static final String NOT_FOUND_RESULT_XML = "";
- @Mock
- private LocalBioServerClient localBioServerClient;
+ @Mock
+ private LocalBioServerClient localBioServerClient;
- @Mock
- private NationalBioServerClient nationalBioServerClient;
+ @Mock
+ private NationalBioServerClient nationalBioServerClient;
- @InjectMocks
- private SearchService searchService = new SearchServiceImpl();
+ @InjectMocks
+ private SearchService searchService = new SearchServiceImpl();
- private M2SysCaptureResponse goodFingerScan = M2SysCaptureResponseMother.withTemplateData("good fingerprint");
+ private M2SysCaptureResponse goodFingerScan = M2SysCaptureResponseMother.withTemplateData("good fingerprint");
- private M2SysCaptureResponse notExistingFingerScan = M2SysCaptureResponseMother.withTemplateData(
- "not existing good fingerprint");
+ private M2SysCaptureResponse notExistingFingerScan = M2SysCaptureResponseMother.withTemplateData(
+ "not existing good fingerprint");
- private M2SysCaptureResponse badFingerScan = M2SysCaptureResponseMother.withTemplateData("bad fingerprint");
+ private M2SysCaptureResponse badFingerScan = M2SysCaptureResponseMother.withTemplateData("bad fingerprint");
- @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
- @Test
- public void shouldSearchLocallyWithSuccess() throws Exception {
- //given
- when(localBioServerClient.identify(goodFingerScan.getTemplateData()))
- .thenReturn(EXISTING_RESULT_XML);
+ @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
+ @Test
+ public void shouldSearchLocallyWithSuccess() throws Exception {
+ //given
+ when(localBioServerClient.identify(goodFingerScan.getTemplateData()))
+ .thenReturn(EXISTING_RESULT_XML);
- //when
- List results = searchService.searchLocally(goodFingerScan.toString());
+ //when
+ List results = searchService.searchLocally(goodFingerScan.toString());
- //then
- Assert.assertEquals(EXISTING_SUBJECT_ID, results.get(0).getSubjectId());
- }
+ //then
+ Assert.assertEquals(EXISTING_SUBJECT_ID, results.get(0).getSubjectId());
+ }
- @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
- @Test(expected = M2SysBiometricsException.class)
- public void shouldSearchLocallyWithException() throws Exception {
- //given
- when(localBioServerClient.identify(badFingerScan.getTemplateData()))
- .thenReturn(ERROR_RESULT_XML);
+ @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
+ @Test(expected = M2SysBiometricsException.class)
+ public void shouldSearchLocallyWithException() throws Exception {
+ //given
+ when(localBioServerClient.identify(badFingerScan.getTemplateData()))
+ .thenReturn(ERROR_RESULT_XML);
- //when
- searchService.searchLocally(badFingerScan.toString());
- }
+ //when
+ searchService.searchLocally(badFingerScan.toString());
+ }
- @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
- @Test
- public void shouldSearchNationallyWithSuccess() throws Exception {
- //given
- when(nationalBioServerClient.identify(goodFingerScan.getTemplateData()))
- .thenReturn(EXISTING_RESULT_XML);
+ @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
+ @Test
+ public void shouldSearchNationallyWithSuccess() throws Exception {
+ //given
+ when(nationalBioServerClient.identify(goodFingerScan.getTemplateData()))
+ .thenReturn(EXISTING_RESULT_XML);
- //when
- List results = searchService.searchNationally(goodFingerScan.toString());
+ //when
+ List results = searchService.searchNationally(goodFingerScan.toString());
- //then
- Assert.assertEquals(results.size(), 1);
- Assert.assertEquals(EXISTING_SUBJECT_ID, results.get(0).getSubjectId());
- }
+ //then
+ Assert.assertEquals(results.size(), 1);
+ Assert.assertEquals(EXISTING_SUBJECT_ID, results.get(0).getSubjectId());
+ }
- @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
- @Test
- public void shouldSearchNationallyWithoutException() throws Exception {
- //given
- when(nationalBioServerClient.identify(badFingerScan.getTemplateData()))
- .thenReturn(ERROR_RESULT_XML);
+ @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
+ @Test
+ public void shouldSearchNationallyWithoutException() throws Exception {
+ //given
+ when(nationalBioServerClient.identify(badFingerScan.getTemplateData()))
+ .thenReturn(ERROR_RESULT_XML);
- //when
- List results = searchService.searchNationally(badFingerScan.toString());
+ //when
+ List results = searchService.searchNationally(badFingerScan.toString());
- //then
- Assert.assertTrue(results.isEmpty());
- }
+ //then
+ Assert.assertTrue(results.isEmpty());
+ }
- @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
- @Test
- public void shouldSearchLocallyWithEmptyResult() throws Exception {
- //given
- when(localBioServerClient.identify(notExistingFingerScan.getTemplateData()))
- .thenReturn(NOT_FOUND_RESULT_XML);
+ @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
+ @Test
+ public void shouldSearchLocallyWithEmptyResult() throws Exception {
+ //given
+ when(localBioServerClient.identify(notExistingFingerScan.getTemplateData()))
+ .thenReturn(NOT_FOUND_RESULT_XML);
- //when
- List results = searchService.searchLocally(notExistingFingerScan.toString());
+ //when
+ List results = searchService.searchLocally(notExistingFingerScan.toString());
- //then
- Assert.assertTrue(results.isEmpty());
- }
+ //then
+ Assert.assertTrue(results.isEmpty());
+ }
- @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
- @Test
- public void shouldSearchNationallyWithEmptyResult() throws Exception {
- //given
- when(nationalBioServerClient.identify(notExistingFingerScan.getTemplateData()))
- .thenReturn(NOT_FOUND_RESULT_XML);
+ @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
+ @Test
+ public void shouldSearchNationallyWithEmptyResult() throws Exception {
+ //given
+ when(nationalBioServerClient.identify(notExistingFingerScan.getTemplateData()))
+ .thenReturn(NOT_FOUND_RESULT_XML);
- //when
- List results = searchService.searchNationally(notExistingFingerScan.toString());
-
- //then
- Assert.assertTrue(results.isEmpty());
- }
+ //when
+ List results = searchService.searchNationally(notExistingFingerScan.toString());
+
+ //then
+ Assert.assertTrue(results.isEmpty());
+ }
}
diff --git a/api/src/test/java/org/openmrs/module/m2sysbiometrics/service/UpdateServiceTest.java b/api/src/test/java/org/openmrs/module/m2sysbiometrics/service/UpdateServiceTest.java
index 81cd126..dbf3016 100644
--- a/api/src/test/java/org/openmrs/module/m2sysbiometrics/service/UpdateServiceTest.java
+++ b/api/src/test/java/org/openmrs/module/m2sysbiometrics/service/UpdateServiceTest.java
@@ -1,5 +1,10 @@
package org.openmrs.module.m2sysbiometrics.service;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -16,89 +21,84 @@
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricMatch;
import org.openmrs.module.registrationcore.api.biometrics.model.BiometricSubject;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
@RunWith(MockitoJUnitRunner.class)
public class UpdateServiceTest {
- private static final String UPDATE_SUCCESS_RESULT_XML = "";
+ private static final String UPDATE_SUCCESS_RESULT_XML = "";
- private static final String ALREADY_EXISTS_RESULT_XML = "";
+ private static final String ALREADY_EXISTS_RESULT_XML = "";
- @Mock
- private LocalBioServerClient localBioServerClient;
+ @Mock
+ private LocalBioServerClient localBioServerClient;
- @Mock
- private SearchService searchService;
+ @Mock
+ private SearchService searchService;
- @Mock
- private NationalBioServerClient nationalBioServerClient;
+ @Mock
+ private NationalBioServerClient nationalBioServerClient;
- @Mock
- private NationalSynchronizationFailureService nationalSynchronizationFailureService;
+ @Mock
+ private NationalSynchronizationFailureService nationalSynchronizationFailureService;
- @InjectMocks
- private UpdateService updateService = new UpdateServiceImpl();
+ @InjectMocks
+ private UpdateService updateService = new UpdateServiceImpl();
- private BiometricSubject subject = BiometricSubjectMother.withSubjectId("subject");
+ private BiometricSubject subject = BiometricSubjectMother.withSubjectId("subject");
- private BiometricSubject nationalSubject = BiometricSubjectMother.withSubjectId("nationalSubject");
+ private BiometricSubject nationalSubject = BiometricSubjectMother.withSubjectId("nationalSubject");
- private BiometricMatch biometricMatch = new BiometricMatch(nationalSubject.getSubjectId(), 99.0);
+ private BiometricMatch biometricMatch = new BiometricMatch(nationalSubject.getSubjectId(), 99.0);
- private M2SysCaptureResponse fingerScan = M2SysCaptureResponseMother.withTemplateData("templateData");
+ private M2SysCaptureResponse fingerScan = M2SysCaptureResponseMother.withTemplateData("templateData");
- @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
- @Test
- public void shouldUpdateLocally() throws Exception {
- //given
- when(localBioServerClient.update(subject.getSubjectId(), fingerScan.getTemplateData()))
- .thenReturn(UPDATE_SUCCESS_RESULT_XML);
+ @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
+ @Test
+ public void shouldUpdateLocally() throws Exception {
+ //given
+ when(localBioServerClient.update(subject.getSubjectId(), fingerScan.getTemplateData()))
+ .thenReturn(UPDATE_SUCCESS_RESULT_XML);
- //when
- updateService.updateLocally(subject);
- }
+ //when
+ updateService.updateLocally(subject);
+ }
- @Test
- public void shouldUpdateNationally() throws Exception {
- //given
- when(searchService.findMostAdequateNationally(fingerScan.toString())).thenReturn(biometricMatch);
- when(nationalBioServerClient.update(nationalSubject.getSubjectId(), fingerScan.getTemplateData()))
- .thenReturn(UPDATE_SUCCESS_RESULT_XML);
+ @Test
+ public void shouldUpdateNationally() throws Exception {
+ //given
+ when(searchService.findMostAdequateNationally(fingerScan.toString())).thenReturn(biometricMatch);
+ when(nationalBioServerClient.update(nationalSubject.getSubjectId(), fingerScan.getTemplateData()))
+ .thenReturn(UPDATE_SUCCESS_RESULT_XML);
- //when
- // updateService.updateNationally(fingerScan);
- }
+ //when
+ // updateService.updateNationally(fingerScan);
+ }
- @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
- @Test(expected = M2SysBiometricsException.class)
- public void shouldUpdateLocallyWithException() throws Exception {
- //given
- when(localBioServerClient.update(subject.getSubjectId(), fingerScan.getTemplateData()))
- .thenReturn(ALREADY_EXISTS_RESULT_XML);
+ @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
+ @Test(expected = M2SysBiometricsException.class)
+ public void shouldUpdateLocallyWithException() throws Exception {
+ //given
+ when(localBioServerClient.update(subject.getSubjectId(), fingerScan.getTemplateData()))
+ .thenReturn(ALREADY_EXISTS_RESULT_XML);
- //when
- updateService.updateLocally(subject);
- }
+ //when
+ updateService.updateLocally(subject);
+ }
- @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
- @Test
- public void shouldTryToUpdateNationallyWithoutException() throws Exception {
- //given
+ @Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
+ @Test
+ public void shouldTryToUpdateNationallyWithoutException() throws Exception {
+ //given
- when(nationalBioServerClient.update(nationalSubject.getSubjectId(), fingerScan.getTemplateData()))
- .thenReturn(ALREADY_EXISTS_RESULT_XML);
- when(searchService.findMostAdequateNationally(fingerScan.toString())).thenReturn(biometricMatch);
- when(searchService.findMostAdequateLocally(fingerScan.toString())).thenReturn(biometricMatch);
- when(nationalSynchronizationFailureService.save(any())).thenReturn(null);
+ when(nationalBioServerClient.update(nationalSubject.getSubjectId(), fingerScan.getTemplateData()))
+ .thenReturn(ALREADY_EXISTS_RESULT_XML);
+ when(searchService.findMostAdequateNationally(fingerScan.toString())).thenReturn(biometricMatch);
+ when(searchService.findMostAdequateLocally(fingerScan.toString())).thenReturn(biometricMatch);
+ when(nationalSynchronizationFailureService.save(any())).thenReturn(null);
- //when
- //updateService.updateNationally(fingerScan);
+ //when
+ //updateService.updateNationally(fingerScan);
- //then
- verify(nationalSynchronizationFailureService, times(1)).save(any());
- }
+ //then
+ verify(nationalSynchronizationFailureService, times(1)).save(any());
+ }
}
diff --git a/api/src/test/java/org/openmrs/module/m2sysbiometrics/testdata/BiometricSubjectMother.java b/api/src/test/java/org/openmrs/module/m2sysbiometrics/testdata/BiometricSubjectMother.java
index c34cd12..ccb532d 100644
--- a/api/src/test/java/org/openmrs/module/m2sysbiometrics/testdata/BiometricSubjectMother.java
+++ b/api/src/test/java/org/openmrs/module/m2sysbiometrics/testdata/BiometricSubjectMother.java
@@ -4,15 +4,16 @@
public final class BiometricSubjectMother {
- public static BiometricSubject validInstance() {
- return new BiometricSubject();
- }
+ private BiometricSubjectMother() {
+ }
- public static BiometricSubject withSubjectId(String subjectId) {
- BiometricSubject biometricSubject = validInstance();
- biometricSubject.setSubjectId(subjectId);
- return biometricSubject;
- }
+ public static BiometricSubject validInstance() {
+ return new BiometricSubject();
+ }
- private BiometricSubjectMother() {}
+ public static BiometricSubject withSubjectId(String subjectId) {
+ BiometricSubject biometricSubject = validInstance();
+ biometricSubject.setSubjectId(subjectId);
+ return biometricSubject;
+ }
}
diff --git a/api/src/test/java/org/openmrs/module/m2sysbiometrics/testdata/M2SysCaptureResponseMother.java b/api/src/test/java/org/openmrs/module/m2sysbiometrics/testdata/M2SysCaptureResponseMother.java
index 396a5f4..cb8c291 100644
--- a/api/src/test/java/org/openmrs/module/m2sysbiometrics/testdata/M2SysCaptureResponseMother.java
+++ b/api/src/test/java/org/openmrs/module/m2sysbiometrics/testdata/M2SysCaptureResponseMother.java
@@ -4,15 +4,16 @@
public final class M2SysCaptureResponseMother {
- public static M2SysCaptureResponse validInstance() {
- return new M2SysCaptureResponse();
- }
+ private M2SysCaptureResponseMother() {
+ }
- public static M2SysCaptureResponse withTemplateData(String templateData) {
- M2SysCaptureResponse m2SysCaptureResponse = validInstance();
- m2SysCaptureResponse.setTemplateData(templateData);
- return m2SysCaptureResponse;
- }
+ public static M2SysCaptureResponse validInstance() {
+ return new M2SysCaptureResponse();
+ }
- private M2SysCaptureResponseMother() {}
+ public static M2SysCaptureResponse withTemplateData(String templateData) {
+ M2SysCaptureResponse m2SysCaptureResponse = validInstance();
+ m2SysCaptureResponse.setTemplateData(templateData);
+ return m2SysCaptureResponse;
+ }
}
diff --git a/api/src/test/java/org/openmrs/module/m2sysbiometrics/testdata/PatientMother.java b/api/src/test/java/org/openmrs/module/m2sysbiometrics/testdata/PatientMother.java
index d672e84..80d8a13 100644
--- a/api/src/test/java/org/openmrs/module/m2sysbiometrics/testdata/PatientMother.java
+++ b/api/src/test/java/org/openmrs/module/m2sysbiometrics/testdata/PatientMother.java
@@ -1,23 +1,24 @@
package org.openmrs.module.m2sysbiometrics.testdata;
+import java.util.Collections;
+
import org.openmrs.Patient;
import org.openmrs.Person;
import org.openmrs.PersonName;
-import java.util.Collections;
-
public final class PatientMother {
- public static Patient validInstance() {
- return new Patient();
- }
+ private PatientMother() {
+ }
- public static Patient withName(String givenName, String middleName, String familyName) {
- PersonName personName = new PersonName(givenName, middleName, familyName);
- Person person = new Person();
- person.setNames(Collections.singleton(personName));
- return new Patient(person);
- }
+ public static Patient validInstance() {
+ return new Patient();
+ }
- private PatientMother() {}
+ public static Patient withName(String givenName, String middleName, String familyName) {
+ PersonName personName = new PersonName(givenName, middleName, familyName);
+ Person person = new Person();
+ person.setNames(Collections.singleton(personName));
+ return new Patient(person);
+ }
}
diff --git a/api/src/test/java/org/openmrs/module/m2sysbiometrics/util/NationalUuidGeneratorTest.java b/api/src/test/java/org/openmrs/module/m2sysbiometrics/util/NationalUuidGeneratorTest.java
index ad3ab72..6810a0f 100644
--- a/api/src/test/java/org/openmrs/module/m2sysbiometrics/util/NationalUuidGeneratorTest.java
+++ b/api/src/test/java/org/openmrs/module/m2sysbiometrics/util/NationalUuidGeneratorTest.java
@@ -1,5 +1,10 @@
package org.openmrs.module.m2sysbiometrics.util;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@@ -10,50 +15,46 @@
import org.mockito.stubbing.Answer;
import org.openmrs.module.m2sysbiometrics.bioplugin.NationalBioServerClient;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
@RunWith(MockitoJUnitRunner.class)
public class NationalUuidGeneratorTest {
- @InjectMocks
- private NationalUuidGenerator nationalUuidGenerator;
+ @InjectMocks
+ private NationalUuidGenerator nationalUuidGenerator;
+
+ @Mock
+ private NationalBioServerClient nationalBioServerClient;
- @Mock
- private NationalBioServerClient nationalBioServerClient;
+ @Test
+ public void shouldGenerateUuid() {
+ String response = "";
+ Mockito.when(nationalBioServerClient.isRegistered(anyString())).thenReturn(response);
- @Test
- public void shouldGenerateUuid() {
- String response = "";
- Mockito.when(nationalBioServerClient.isRegistered(anyString())).thenReturn(response);
+ String uuid = nationalUuidGenerator.generate();
- String uuid = nationalUuidGenerator.generate();
+ assertNotNull(uuid);
+ verify(nationalBioServerClient).isRegistered(uuid);
+ }
- assertNotNull(uuid);
- verify(nationalBioServerClient).isRegistered(uuid);
- }
+ @Test
+ public void shouldKeepGeneratingUuidIfAlreadyRegistered() {
+ Mockito.when(nationalBioServerClient.isRegistered(anyString())).thenAnswer(new Answer() {
- @Test
- public void shouldKeepGeneratingUuidIfAlreadyRegistered() {
- Mockito.when(nationalBioServerClient.isRegistered(anyString())).thenAnswer(new Answer() {
- private int i = 0;
+ private int i = 0;
- @Override
- public String answer(InvocationOnMock invocationOnMock) throws Throwable {
- if (i == 0) {
- i++;
- return "";
- } else {
- return "";
- }
- }
- });
+ @Override
+ public String answer(InvocationOnMock invocationOnMock) throws Throwable {
+ if (i == 0) {
+ i++;
+ return "";
+ } else {
+ return "";
+ }
+ }
+ });
- String uuid = nationalUuidGenerator.generate();
+ String uuid = nationalUuidGenerator.generate();
- assertNotNull(uuid);
- verify(nationalBioServerClient, times(1)).isRegistered(anyString());
- }
+ assertNotNull(uuid);
+ verify(nationalBioServerClient, times(1)).isRegistered(anyString());
+ }
}
diff --git a/api/src/test/java/org/openmrs/module/m2sysbiometrics/util/PatientHelperTest.java b/api/src/test/java/org/openmrs/module/m2sysbiometrics/util/PatientHelperTest.java
index b97aea0..d89b7b0 100644
--- a/api/src/test/java/org/openmrs/module/m2sysbiometrics/util/PatientHelperTest.java
+++ b/api/src/test/java/org/openmrs/module/m2sysbiometrics/util/PatientHelperTest.java
@@ -1,8 +1,22 @@
package org.openmrs.module.m2sysbiometrics.util;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.openmrs.module.registrationcore.RegistrationCoreConstants.GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID;
+import static org.openmrs.module.registrationcore.RegistrationCoreConstants.GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID;
+import static org.powermock.api.mockito.PowerMockito.mockStatic;
+
+import java.util.Collections;
+import java.util.UUID;
+
import org.junit.Ignore;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.openmrs.Patient;
@@ -13,156 +27,142 @@
import org.openmrs.module.m2sysbiometrics.util.impl.PatientHelperImpl;
import org.openmrs.module.registrationcore.api.RegistrationCoreService;
import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import java.util.Collections;
-import java.util.UUID;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyBoolean;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.openmrs.module.registrationcore.RegistrationCoreConstants.GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID;
-import static org.openmrs.module.registrationcore.RegistrationCoreConstants.GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID;
-import static org.powermock.api.mockito.PowerMockito.mockStatic;
@Ignore("Skipping failing tests for now. See https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/issues/56")
// @RunWith(PowerMockRunner.class)
-@PrepareForTest({Context.class})
+@PrepareForTest({ Context.class })
public class PatientHelperTest {
- private static final String LOCAL_ID_TYPE_UUID = UUID.randomUUID().toString();
- private static final String NATIONAL_ID_TYPE_UUID = UUID.randomUUID().toString();
- private static final String SUBJECT_ID = "xxxx-234";
-
- @InjectMocks
- private PatientHelper patientHelper = new PatientHelperImpl();
-
- @Mock
- private PatientService patientService;
+ private static final String LOCAL_ID_TYPE_UUID = UUID.randomUUID().toString();
+
+ private static final String NATIONAL_ID_TYPE_UUID = UUID.randomUUID().toString();
+
+ private static final String SUBJECT_ID = "xxxx-234";
+
+ @InjectMocks
+ private PatientHelper patientHelper = new PatientHelperImpl();
+
+ @Mock
+ private PatientService patientService;
+
+ @Mock
+ private RegistrationCoreService registrationCoreService;
+
+ @Mock
+ private M2SysProperties properties;
+
+ @Mock
+ private PatientIdentifierType idType;
- @Mock
- private RegistrationCoreService registrationCoreService;
-
- @Mock
- private M2SysProperties properties;
-
- @Mock
- private PatientIdentifierType idType;
-
- @Mock
- private Patient patient;
+ @Mock
+ private Patient patient;
- @Test
- public void shouldReturnNullIfLocalFpIdNotDefined() {
- // given
- when(properties.getGlobalProperty(GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID))
- .thenReturn(null);
+ @Test
+ public void shouldReturnNullIfLocalFpIdNotDefined() {
+ // given
+ when(properties.getGlobalProperty(GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID))
+ .thenReturn(null);
- // when
- Patient result = patientHelper.findByLocalFpId(SUBJECT_ID);
+ // when
+ Patient result = patientHelper.findByLocalFpId(SUBJECT_ID);
- // then
- assertNull(result);
- verify(patientService, never()).getPatients(anyString(), anyString(), any(), anyBoolean());
- }
+ // then
+ assertNull(result);
+ verify(patientService, never()).getPatients(anyString(), anyString(), any(), anyBoolean());
+ }
- @Test
- public void shouldReturnNullIfLocalIdTypeMissing() {
- // given
- when(properties.getGlobalProperty(GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID))
- .thenReturn(LOCAL_ID_TYPE_UUID);
- when(patientService.getPatientIdentifierTypeByUuid(LOCAL_ID_TYPE_UUID)).thenReturn(null);
+ @Test
+ public void shouldReturnNullIfLocalIdTypeMissing() {
+ // given
+ when(properties.getGlobalProperty(GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID))
+ .thenReturn(LOCAL_ID_TYPE_UUID);
+ when(patientService.getPatientIdentifierTypeByUuid(LOCAL_ID_TYPE_UUID)).thenReturn(null);
- // when
- Patient result = patientHelper.findByLocalFpId(SUBJECT_ID);
+ // when
+ Patient result = patientHelper.findByLocalFpId(SUBJECT_ID);
- // then
- assertNull(result);
- verify(patientService, never()).getPatients(anyString(), anyString(), any(), anyBoolean());
- }
+ // then
+ assertNull(result);
+ verify(patientService, never()).getPatients(anyString(), anyString(), any(), anyBoolean());
+ }
- @Test
- public void shouldFindPatientByLocalId() {
- // given
- when(properties.isGlobalPropertySet(GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID))
- .thenReturn(true);
- when(properties.getGlobalProperty(GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID))
- .thenReturn(LOCAL_ID_TYPE_UUID);
+ @Test
+ public void shouldFindPatientByLocalId() {
+ // given
+ when(properties.isGlobalPropertySet(GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID))
+ .thenReturn(true);
+ when(properties.getGlobalProperty(GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID))
+ .thenReturn(LOCAL_ID_TYPE_UUID);
- when(registrationCoreService.findByPatientIdentifier(SUBJECT_ID, LOCAL_ID_TYPE_UUID))
- .thenReturn(patient);
- when(patientService.getPatientIdentifierTypeByUuid(LOCAL_ID_TYPE_UUID)).thenReturn(idType);
+ when(registrationCoreService.findByPatientIdentifier(SUBJECT_ID, LOCAL_ID_TYPE_UUID))
+ .thenReturn(patient);
+ when(patientService.getPatientIdentifierTypeByUuid(LOCAL_ID_TYPE_UUID)).thenReturn(idType);
- PatientIdentifier pi = new PatientIdentifier();
- pi.setIdentifierType(idType);
- when(patient.getIdentifiers()).thenReturn(Collections.singleton(pi));
+ PatientIdentifier pi = new PatientIdentifier();
+ pi.setIdentifierType(idType);
+ when(patient.getIdentifiers()).thenReturn(Collections.singleton(pi));
- mockStatic(Context.class);
+ mockStatic(Context.class);
- // when
- Patient result = patientHelper.findByLocalFpId(SUBJECT_ID);
+ // when
+ Patient result = patientHelper.findByLocalFpId(SUBJECT_ID);
- // then
- assertEquals(patient, result);
- }
+ // then
+ assertEquals(patient, result);
+ }
- @Test
- public void shouldReturnNullIfNationalFpIdNotDefined() {
- // given
- when(properties.getGlobalProperty(GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID))
- .thenReturn(null);
+ @Test
+ public void shouldReturnNullIfNationalFpIdNotDefined() {
+ // given
+ when(properties.getGlobalProperty(GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID))
+ .thenReturn(null);
- // when
- Patient result = patientHelper.findByNationalFpId(SUBJECT_ID);
+ // when
+ Patient result = patientHelper.findByNationalFpId(SUBJECT_ID);
- // then
- assertNull(result);
- verify(patientService, never()).getPatients(anyString(), anyString(), any(), anyBoolean());
- }
+ // then
+ assertNull(result);
+ verify(patientService, never()).getPatients(anyString(), anyString(), any(), anyBoolean());
+ }
- @Test
- public void shouldReturnNullIfNationalIdTypeMissing() {
- // given
- when(properties.getGlobalProperty(GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID))
- .thenReturn(NATIONAL_ID_TYPE_UUID);
- when(patientService.getPatientIdentifierTypeByUuid(NATIONAL_ID_TYPE_UUID)).thenReturn(null);
+ @Test
+ public void shouldReturnNullIfNationalIdTypeMissing() {
+ // given
+ when(properties.getGlobalProperty(GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID))
+ .thenReturn(NATIONAL_ID_TYPE_UUID);
+ when(patientService.getPatientIdentifierTypeByUuid(NATIONAL_ID_TYPE_UUID)).thenReturn(null);
- // when
- Patient result = patientHelper.findByNationalFpId(SUBJECT_ID);
+ // when
+ Patient result = patientHelper.findByNationalFpId(SUBJECT_ID);
- // then
- assertNull(result);
- verify(patientService, never()).getPatients(anyString(), anyString(), any(), anyBoolean());
- }
-
- @Test
- public void shouldFindPatientByNationalId() {
-
- // given
- when(properties.isGlobalPropertySet(GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID))
- .thenReturn(true);
- when(properties.getGlobalProperty(GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID))
- .thenReturn(NATIONAL_ID_TYPE_UUID);
-
- when(patientService.getPatientIdentifierTypeByUuid(NATIONAL_ID_TYPE_UUID)).thenReturn(idType);
- when(registrationCoreService.findByPatientIdentifier(SUBJECT_ID, NATIONAL_ID_TYPE_UUID))
- .thenReturn(patient);
-
- PatientIdentifier pi = new PatientIdentifier();
- pi.setIdentifierType(idType);
- when(patient.getIdentifiers()).thenReturn(Collections.singleton(pi));
-
- mockStatic(Context.class);
-
- // when
- Patient result = patientHelper.findByNationalFpId(SUBJECT_ID);
-
- // then
- assertEquals(patient, result);
- }
+ // then
+ assertNull(result);
+ verify(patientService, never()).getPatients(anyString(), anyString(), any(), anyBoolean());
+ }
+
+ @Test
+ public void shouldFindPatientByNationalId() {
+
+ // given
+ when(properties.isGlobalPropertySet(GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID))
+ .thenReturn(true);
+ when(properties.getGlobalProperty(GP_BIOMETRICS_NATIONAL_PERSON_IDENTIFIER_TYPE_UUID))
+ .thenReturn(NATIONAL_ID_TYPE_UUID);
+
+ when(patientService.getPatientIdentifierTypeByUuid(NATIONAL_ID_TYPE_UUID)).thenReturn(idType);
+ when(registrationCoreService.findByPatientIdentifier(SUBJECT_ID, NATIONAL_ID_TYPE_UUID))
+ .thenReturn(patient);
+
+ PatientIdentifier pi = new PatientIdentifier();
+ pi.setIdentifierType(idType);
+ when(patient.getIdentifiers()).thenReturn(Collections.singleton(pi));
+
+ mockStatic(Context.class);
+
+ // when
+ Patient result = patientHelper.findByNationalFpId(SUBJECT_ID);
+
+ // then
+ assertEquals(patient, result);
+ }
}
diff --git a/api/src/test/resources/invalidEngine.xml b/api/src/test/resources/invalidEngine.xml
index 4d01b59..08f289d 100644
--- a/api/src/test/resources/invalidEngine.xml
+++ b/api/src/test/resources/invalidEngine.xml
@@ -1,3 +1,3 @@
-
-
\ No newline at end of file
+
+
diff --git a/api/src/test/resources/invalidResultXml.xml b/api/src/test/resources/invalidResultXml.xml
index 5ad2ee7..5ce18e8 100644
--- a/api/src/test/resources/invalidResultXml.xml
+++ b/api/src/test/resources/invalidResultXml.xml
@@ -1 +1,4 @@
-
\ No newline at end of file
+
+
+
+
diff --git a/api/src/test/resources/m2sys-biometric-test-applicationContext.xml b/api/src/test/resources/m2sys-biometric-test-applicationContext.xml
index 8293b6f..1906cc8 100644
--- a/api/src/test/resources/m2sys-biometric-test-applicationContext.xml
+++ b/api/src/test/resources/m2sys-biometric-test-applicationContext.xml
@@ -2,25 +2,9 @@
-
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
diff --git a/api/src/test/resources/noMatches.xml b/api/src/test/resources/noMatches.xml
index ee263ca..673a71a 100644
--- a/api/src/test/resources/noMatches.xml
+++ b/api/src/test/resources/noMatches.xml
@@ -1,3 +1,3 @@
-
-
\ No newline at end of file
+
+
diff --git a/api/src/test/resources/resultList.xml b/api/src/test/resources/resultList.xml
index 128bf92..713aeb9 100644
--- a/api/src/test/resources/resultList.xml
+++ b/api/src/test/resources/resultList.xml
@@ -1,5 +1,5 @@
-
-
-
-
\ No newline at end of file
+
+
+
+
diff --git a/api/src/test/resources/sampleMatchingResult.xml b/api/src/test/resources/sampleMatchingResult.xml
index fc134d8..3441185 100644
--- a/api/src/test/resources/sampleMatchingResult.xml
+++ b/api/src/test/resources/sampleMatchingResult.xml
@@ -1,3 +1,3 @@
-
-
\ No newline at end of file
+
+
diff --git a/build-tools/src/main/resources/pmd.xml b/build-tools/src/main/resources/pmd.xml
index e82968c..ddfd494 100644
--- a/build-tools/src/main/resources/pmd.xml
+++ b/build-tools/src/main/resources/pmd.xml
@@ -1,35 +1,35 @@
- iSantePlus m2Sys Biometrics Module PMD ruleset
-
-
+ iSantePlus m2Sys Biometrics Module PMD ruleset
-
+
-
+
-
+
-
-
+
-
-
+
+
-
+
+
-
+
-
-
+
-
-
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
diff --git a/checkstyle.xml b/checkstyle.xml
index e5a6448..ecaac7c 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -1,7 +1,7 @@
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+ "http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/liquibase.xml b/liquibase.xml
index 26787a9..58d153a 100644
--- a/liquibase.xml
+++ b/liquibase.xml
@@ -1,115 +1,122 @@
-
-
-
-
-
-
- Creating the table for failures in synchronization with national server.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ Creating the table for failures in synchronization with national server.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- Creating the table for temporary fingerprints, with the assignment of biometric id with biometric xml (scan result).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Creating the table for sync fingerprint workflow, with the assignment of biometric id and biometric xml (scan result). Scheduled task to try sync with National FP every 12 hours
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ Creating the table for temporary fingerprints, with the assignment of biometric id with biometric xml (scan result).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Creating the table for sync fingerprint workflow, with the assignment of biometric id and biometric xml (scan result).
+ Scheduled task to try sync with National FP every 12 hours
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/omod/pom.xml b/omod/pom.xml
index 517123d..150ef91 100644
--- a/omod/pom.xml
+++ b/omod/pom.xml
@@ -1,159 +1,159 @@
-
- 4.0.0
-
- org.openmrs.module
- m2sys-biometrics
- 1.2.0-SNAPSHOT
-
+ 4.0.0
+
+ org.openmrs.module
+ m2sys-biometrics
+ 1.2.0-SNAPSHOT
+
- m2sys-biometrics-omod
- jar
- m2sys Biometrics Module OMOD
- OMOD project for m2SysBiometrics
+ m2sys-biometrics-omod
+ jar
+ m2sys Biometrics Module OMOD
+ OMOD project for m2SysBiometrics
-
-
- ${project.parent.groupId}
- ${project.parent.artifactId}-api
- ${project.parent.version}
-
+
+
+ ${project.parent.groupId}
+ ${project.parent.artifactId}-api
+ ${project.parent.version}
+
-
- org.openmrs.api
- openmrs-api
- jar
-
+
+ org.openmrs.api
+ openmrs-api
+ jar
+
-
- org.openmrs.api
- openmrs-api
- test-jar
- test
-
-
+
+ org.openmrs.api
+ openmrs-api
+ test-jar
+ test
+
+
-
- ${project.parent.artifactId}-${project.parent.version}
-
-
- src/main/resources
- true
-
-
- src/main/webapp
- false
-
- resources
-
- web/module
-
-
+
+ ${project.parent.artifactId}-${project.parent.version}
+
+
+ src/main/resources
+ true
+
+
+ src/main/webapp
+ false
+
+ resources
+
+ web/module
+
+
-
-
- src/test/resources
- true
-
-
+
+
+ src/test/resources
+ true
+
+
-
-
-
- org.eclipse.m2e
- lifecycle-mapping
- 1.0.0
-
-
-
-
-
- org.openmrs.maven.plugins
- maven-openmrs-plugin
- [1.0.1,)
-
- initialize-module
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
- [2.4,)
-
- unpack-dependencies
-
-
-
-
-
-
-
-
- org.jvnet.jaxb2.maven2
- maven-jaxb2-plugin
-
- generate
-
-
+
+
+
+ org.eclipse.m2e
+ lifecycle-mapping
+ 1.0.0
+
+
+
+
+
+ org.openmrs.maven.plugins
+ maven-openmrs-plugin
+ [1.0.1,)
+
+ initialize-module
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ [2.4,)
+
+ unpack-dependencies
+
+
+
+
+
+
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin
+
+ generate
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin
+
+
+ org.openmrs.maven.plugins
+ maven-openmrs-plugin
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+
+
+
+ github-packages
+
-
- org.jvnet.jaxb2.maven2
- maven-jaxb2-plugin
-
-
- org.openmrs.maven.plugins
- maven-openmrs-plugin
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
-
+
+ maven-deploy-plugin
+
+
+
+ deploy-file
+ deploy
+
+ deploy-file
+
+
+ https://maven.pkg.github.com/isanteplus/isanteplus-packages
+ target/${project.parent.artifactId}-${project.version}.omod
+ github-packages
+ omod
+ false
+ ${project.parent.artifactId}
+ ${project.version}
+ ${groupId}
+
+
+
+
-
-
-
- github-packages
-
-
-
- maven-deploy-plugin
-
-
-
- deploy-file
- deploy
-
- deploy-file
-
-
- https://maven.pkg.github.com/isanteplus/isanteplus-packages
- target/${project.parent.artifactId}-${project.version}.omod
- github-packages
- omod
- false
- ${project.parent.artifactId}
- ${project.version}
- ${groupId}
-
-
-
-
-
-
-
-
+
+
+
diff --git a/omod/src/main/resources/config.xml b/omod/src/main/resources/config.xml
index 765ad40..10cecb6 100644
--- a/omod/src/main/resources/config.xml
+++ b/omod/src/main/resources/config.xml
@@ -2,285 +2,285 @@
-
- ${project.parent.artifactId}
- ${project.parent.name}
- ${project.parent.version}
- ${project.parent.groupId}.${project.parent.artifactId}
- SolDevelo
- ${project.parent.description}
- org.openmrs.module.m2sysbiometrics.M2SysBiometricsActivator
-
-
-
- ${openmrsPlatformVersion}
-
-
-
- org.openmrs.admin.list
-
-
-
-
- org.openmrs.module.registrationcore
-
-
-
-
- org.openmrs.module.registrationcore
-
-
-
-
- org.apache.commons.httpclient
-
-
-
-
- org.apache.commons.httpclient
-
-
-
-
- org.springframework.web.client
-
-
-
-
- org.springframework.web.client
-
-
-
-
-
-
-
-
-
- ${project.parent.artifactId}.server.url
-
-
- The m2sys CloudScanr url.
-
-
-
-
- ${project.parent.artifactId}.server.user
-
-
- The m2sys CloudScanr username.
-
-
-
-
- ${project.parent.artifactId}.server.national.user
-
-
- The m2sys national server username.
-
-
-
-
- ${project.parent.artifactId}.server.password
-
-
- The m2sys CloudScanr password.
-
-
-
-
- ${project.parent.artifactId}.server.national.password
-
-
- The m2sys national server password.
-
-
-
-
- ${project.parent.artifactId}.locationID
-
-
- The m2sys server location ID.
-
-
-
-
- ${project.parent.artifactId}.customKey
-
-
- The m2sys server CustomKey.
-
-
-
-
- ${project.parent.artifactId}.accessPointID
-
-
- The m2sys server AccessPointID. This is used by default unless a mapping that matches the callers IP
- is found in the accessPointMap property.
-
-
-
-
- ${project.parent.artifactId}.captureTimeout
-
-
- The m2sys server CaptureTimeout.
-
-
-
-
- ${project.parent.artifactId}.device.name
- DigitalPersona
-
- The m2sys fingerprint scanning device name.
-
-
-
-
- ${project.parent.artifactId}.local-service.url
-
-
- The URL to the SOAP service of the local (local to the clinic) M2Sys BioPlugin Server.
-
-
-
-
- ${project.parent.artifactId}.national-service.url
-
-
- The URL to the SOAP service of the national M2Sys BioPlugin Server.
-
-
-
-
- ${project.parent.artifactId}.server.constTestTemplate
-
-
- A default test fingerprint template for instances when the fingerprint scanner is not available.
-
-
-
- ${project.parent.artifactId}.cloudabis.app.key
-
-
- Client assigned CLOUDABIS APP KEY for access to the cloud fingerprint matching engine API endpoints.
-
-
-
- ${project.parent.artifactId}.cloudabis.secret.key
-
-
- Client assigned SECRET KEY for access to the cloud fingerprint matching engine API endpoints.
-
-
-
- ${project.parent.artifactId}.cloudabis.grant.type
-
-
- Client preferred grant type for access to the cloud fingerprint matching engine API endpoints.
-
-
-
- ${project.parent.artifactId}.cloudabis.api.url
-
-
- Base URL to the cloud fingerprint matching engine API endpoints.
-
-
-
- ${project.parent.artifactId}.cloudabis.customer.key
-
-
- User assigned customer key for grouping different CLOUDABIS Apps.
-
-
-
- ${project.parent.artifactId}.cloudabis.engine.name
-
-
- User preffered engine for processing CLOUDABIS requests.
-
-
-
- ${project.parent.artifactId}.cloudabis.template.format
- ISO
-
- Preferred template format - Usually tied to the capabilities of the user-procured fingerprint scanner.
-
-
-
-
- ${project.parent.artifactId}.accessPointMap
-
-
- A map of IP addresses to Access Point IDs. Has format of IP1:AccessPointID1;IP2:AccessPointID2;...
- For example 127.0.0.1:APID1;8.8.8.8:APID2... The IPs must match the IPs of the clients calling the
- server.
-
-
-
-
- ${project.parent.artifactId}.nationalRegistrationTaskInterval
-
- Interval time (in seconds) to execute retry of national registration failures task.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- en
- messages.properties
-
-
- fr
- messages_fr.properties
-
-
- es
- messages_es.properties
-
-
-
-
\ No newline at end of file
+
+ ${project.parent.artifactId}
+ ${project.parent.name}
+ ${project.parent.version}
+ ${project.parent.groupId}.${project.parent.artifactId}
+ SolDevelo
+ ${project.parent.description}
+ org.openmrs.module.m2sysbiometrics.M2SysBiometricsActivator
+
+
+
+ ${openmrsPlatformVersion}
+
+
+
+ org.openmrs.admin.list
+
+
+
+
+ org.openmrs.module.registrationcore
+
+
+
+
+ org.openmrs.module.registrationcore
+
+
+
+
+ org.apache.commons.httpclient
+
+
+
+
+ org.apache.commons.httpclient
+
+
+
+
+ org.springframework.web.client
+
+
+
+
+ org.springframework.web.client
+
+
+
+
+
+
+
+
+
+ ${project.parent.artifactId}.server.url
+
+
+ The m2sys CloudScanr url.
+
+
+
+
+ ${project.parent.artifactId}.server.user
+
+
+ The m2sys CloudScanr username.
+
+
+
+
+ ${project.parent.artifactId}.server.national.user
+
+
+ The m2sys national server username.
+
+
+
+
+ ${project.parent.artifactId}.server.password
+
+
+ The m2sys CloudScanr password.
+
+
+
+
+ ${project.parent.artifactId}.server.national.password
+
+
+ The m2sys national server password.
+
+
+
+
+ ${project.parent.artifactId}.locationID
+
+
+ The m2sys server location ID.
+
+
+
+
+ ${project.parent.artifactId}.customKey
+
+
+ The m2sys server CustomKey.
+
+
+
+
+ ${project.parent.artifactId}.accessPointID
+
+
+ The m2sys server AccessPointID. This is used by default unless a mapping that matches the callers IP
+ is found in the accessPointMap property.
+
+
+
+
+ ${project.parent.artifactId}.captureTimeout
+
+
+ The m2sys server CaptureTimeout.
+
+
+
+
+ ${project.parent.artifactId}.device.name
+ DigitalPersona
+
+ The m2sys fingerprint scanning device name.
+
+
+
+
+ ${project.parent.artifactId}.local-service.url
+
+
+ The URL to the SOAP service of the local (local to the clinic) M2Sys BioPlugin Server.
+
+
+
+
+ ${project.parent.artifactId}.national-service.url
+
+
+ The URL to the SOAP service of the national M2Sys BioPlugin Server.
+
+
+
+
+ ${project.parent.artifactId}.server.constTestTemplate
+
+
+ A default test fingerprint template for instances when the fingerprint scanner is not available.
+
+
+
+ ${project.parent.artifactId}.cloudabis.app.key
+
+
+ Client assigned CLOUDABIS APP KEY for access to the cloud fingerprint matching engine API endpoints.
+
+
+
+ ${project.parent.artifactId}.cloudabis.secret.key
+
+
+ Client assigned SECRET KEY for access to the cloud fingerprint matching engine API endpoints.
+
+
+
+ ${project.parent.artifactId}.cloudabis.grant.type
+
+
+ Client preferred grant type for access to the cloud fingerprint matching engine API endpoints.
+
+
+
+ ${project.parent.artifactId}.cloudabis.api.url
+
+
+ Base URL to the cloud fingerprint matching engine API endpoints.
+
+
+
+ ${project.parent.artifactId}.cloudabis.customer.key
+
+
+ User assigned customer key for grouping different CLOUDABIS Apps.
+
+
+
+ ${project.parent.artifactId}.cloudabis.engine.name
+
+
+ User preffered engine for processing CLOUDABIS requests.
+
+
+
+ ${project.parent.artifactId}.cloudabis.template.format
+ ISO
+
+ Preferred template format - Usually tied to the capabilities of the user-procured fingerprint scanner.
+
+
+
+
+ ${project.parent.artifactId}.accessPointMap
+
+
+ A map of IP addresses to Access Point IDs. Has format of IP1:AccessPointID1;IP2:AccessPointID2;...
+ For example 127.0.0.1:APID1;8.8.8.8:APID2... The IPs must match the IPs of the clients calling the
+ server.
+
+
+
+
+ ${project.parent.artifactId}.nationalRegistrationTaskInterval
+
+ Interval time (in seconds) to execute retry of national registration failures task.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ en
+ messages.properties
+
+
+ fr
+ messages_fr.properties
+
+
+ es
+ messages_es.properties
+
+
+
+
diff --git a/pom.xml b/pom.xml
index e27a007..55204eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,377 +1,377 @@
-
- 4.0.0
-
- org.openmrs.maven.parents
- maven-parent-openmrs-module
- 1.1.1
-
+ 4.0.0
+
+ org.openmrs.maven.parents
+ maven-parent-openmrs-module
+ 1.1.1
+
- org.openmrs.module
- m2sys-biometrics
- 1.2.0-SNAPSHOT
- pom
- m2sys Biometrics Module
- Module for iSantePlus m2sys Biometrics
+ org.openmrs.module
+ m2sys-biometrics
+ 1.2.0-SNAPSHOT
+ pom
+ m2sys Biometrics Module
+ Module for iSantePlus m2sys Biometrics
-
-
- SolDevelo Developers
-
-
+
+
+ SolDevelo Developers
+
+
-
- SolDevelo
- https://www.soldevelo.com
-
+
+ SolDevelo
+ https://www.soldevelo.com
+
-
- 2.0.5
- 1.8
+
+ 2.0.5
+ 1.8
- 1.9.5
- 2.2.0-SNAPSHOT
- 4.3
- 2.3
+ 1.9.5
+ 2.2.0-SNAPSHOT
+ 4.3
+ 2.3
- 3.1
- 3.2.16.RELEASE_1
-
+ 3.1
+ 3.2.16.RELEASE_1
+
-
- scm:git:git@github.com:IsantePlus/openmrs-module-m2sys-biometrics.git
- scm:git:git@github.com:IsantePlus/openmrs-module-m2sys-biometrics.git
- https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/
-
+
+ scm:git:git@github.com:IsantePlus/openmrs-module-m2sys-biometrics.git
+ scm:git:git@github.com:IsantePlus/openmrs-module-m2sys-biometrics.git
+ https://github.com/IsantePlus/openmrs-module-m2sys-biometrics/
+
-
- api
- omod
- build-tools
-
+
+ api
+ omod
+ build-tools
+
-
-
-
- org.openmrs.module
- idgen-api
- ${idgenVersion}
- jar
- test
-
-
- org.openmrs
- event-api-2.x
- ${eventVersion}
- jar
- test
-
-
- org.openmrs.api
- openmrs-api
- ${openmrsPlatformVersion}
- jar
- provided
-
-
- org.openmrs.api
- openmrs-api
- ${openmrsPlatformVersion}
- test-jar
- test
-
-
- org.mockito
- mockito-all
- ${mockitoVersion}
- test
-
+
+
+
+ org.openmrs.module
+ idgen-api
+ ${idgenVersion}
+ jar
+ test
+
+
+ org.openmrs
+ event-api-2.x
+ ${eventVersion}
+ jar
+ test
+
+
+ org.openmrs.api
+ openmrs-api
+ ${openmrsPlatformVersion}
+ jar
+ provided
+
+
+ org.openmrs.api
+ openmrs-api
+ ${openmrsPlatformVersion}
+ test-jar
+ test
+
+
+ org.mockito
+ mockito-all
+ ${mockitoVersion}
+ test
+
-
- commons-httpclient
- commons-httpclient
- ${httpClientCommonsVersion}
- provided
-
-
- org.apache.servicemix.bundles
- org.apache.servicemix.bundles.spring-web
- ${springWebVersion}
- provided
-
-
- org.apache.servicemix.bundles
- org.apache.servicemix.bundles.spring-webmvc
- ${springWebVersion}
- provided
-
-
-
- org.springframework.ws
- spring-ws-core
- 3.0.3.RELEASE
-
+
+ commons-httpclient
+ commons-httpclient
+ ${httpClientCommonsVersion}
+ provided
+
+
+ org.apache.servicemix.bundles
+ org.apache.servicemix.bundles.spring-web
+ ${springWebVersion}
+ provided
+
+
+ org.apache.servicemix.bundles
+ org.apache.servicemix.bundles.spring-webmvc
+ ${springWebVersion}
+ provided
+
-
- org.springframework
- spring-expression
- provided
-
-
- org.springframework
- spring-context
- provided
-
-
- org.springframework
- spring-beans
- provided
-
-
- org.springframework
- spring-aop
- provided
-
-
- org.springframework
- spring-core
- provided
-
-
- org.springframework
- spring-web
- provided
-
-
- org.springframework
- spring-webmvc
- provided
-
-
- org.springframework
- spring-oxm
- provided
-
-
- commons-io
- commons-io
- provided
-
-
- commons-logging
- commons-logging
- provided
-
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- provided
-
-
-
+
+ org.springframework.ws
+ spring-ws-core
+ 3.0.3.RELEASE
+
+
+
+ org.springframework
+ spring-expression
+ provided
+
+
+ org.springframework
+ spring-context
+ provided
+
+
+ org.springframework
+ spring-beans
+ provided
+
+
+ org.springframework
+ spring-aop
+ provided
+
+
+ org.springframework
+ spring-core
+ provided
+
+
+ org.springframework
+ spring-web
+ provided
+
+
+ org.springframework
+ spring-webmvc
+ provided
+
+
+ org.springframework
+ spring-oxm
+ provided
+
+
+ commons-io
+ commons-io
+ provided
+
+
+ commons-logging
+ commons-logging
+ provided
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.1.0
+ provided
+
+
+
-
+
+
+ openmrs-repo
+ OpenMRS Nexus Repository
+ https://mavenrepo.openmrs.org/nexus/content/repositories/public
+
+ false
+
+
+
+ central
+ Maven Repository Switchboard
+ default
+ https://repo1.maven.org/maven2
+
+
+
+
+
+ openmrs-repo
+ OpenMRS Nexus Repository
+ https://mavenrepo.openmrs.org/nexus/content/repositories/public
+
+ false
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ ${javaCompilerVersion}
+ ${javaCompilerVersion}
+
+
+
+ org.openmrs.maven.plugins
+ maven-openmrs-plugin
+ 1.0.1
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 2.8
+
+
+
+
+
+ com.googlecode.maven-java-formatter-plugin
+ maven-java-formatter-plugin
+
+
+ none
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 2.17
+
+
+ validate
+ validate
+
+ checkstyle.xml
+ UTF-8
+ true
+ false
+ false
+ false
+ false
+
+
+ check
+
+
+
+
+
+ org.codehaus.mojo
+ findbugs-maven-plugin
+ 3.0.5
+
+ Max
+ Low
+ true
+
+
+
+ verify
+
+ check
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ 3.8
+
+
+ pmd.xml
+
+ true
+ UTF-8
+ 100
+ ${javaCompilerVersion}
+ true
+
+
+
+ org.openmrs.maven.parents
+ build-tools
+ 1.0
+
+
+
+
+ validate
+ validate
+
+ check
+ cpd-check
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ 3.8
+
+
+ pmd.xml
+
+
+
+
+
+
+
+
+ github-packages
+
+
- openmrs-repo
- OpenMRS Nexus Repository
- https://mavenrepo.openmrs.org/nexus/content/repositories/public
-
- false
-
+ github-packages
+ Github iSantePlus Packages
+ https://maven.pkg.github.com/isanteplus/isanteplus-packages
+ false
+
+ github-packages
+ Github iSantePlus Packages
+ https://maven.pkg.github.com/isanteplus/isanteplus-packages
+ true
+
+
+
+
- central
- Maven Repository Switchboard
- default
- https://repo1.maven.org/maven2
+ github-packages
+ Github iSantePlus Packages
+ https://maven.pkg.github.com/isanteplus/isanteplus-packages
-
-
-
-
- openmrs-repo
- OpenMRS Nexus Repository
- https://mavenrepo.openmrs.org/nexus/content/repositories/public
-
- false
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- ${javaCompilerVersion}
- ${javaCompilerVersion}
-
-
-
- org.openmrs.maven.plugins
- maven-openmrs-plugin
- 1.0.1
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
- 2.8
-
-
-
-
-
- com.googlecode.maven-java-formatter-plugin
- maven-java-formatter-plugin
-
-
- none
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
- 2.17
-
-
- validate
- validate
-
- checkstyle.xml
- UTF-8
- true
- false
- false
- false
- false
-
-
- check
-
-
-
-
-
- org.codehaus.mojo
- findbugs-maven-plugin
- 3.0.5
-
- Max
- Low
- true
-
-
-
- verify
-
- check
-
-
-
-
-
- org.apache.maven.plugins
- maven-pmd-plugin
- 3.8
-
-
- pmd.xml
-
- true
- UTF-8
- 100
- ${javaCompilerVersion}
- true
-
-
-
- org.openmrs.maven.parents
- build-tools
- 1.0
-
-
-
-
- validate
- validate
-
- check
- cpd-check
-
-
-
-
-
-
-
+
+
-
- org.apache.maven.plugins
- maven-pmd-plugin
- 3.8
-
-
- pmd.xml
-
-
-
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ none
+
+
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+
+
+ validate
+ none
+
+
+
-
-
-
-
- github-packages
-
-
-
- github-packages
- Github iSantePlus Packages
- https://maven.pkg.github.com/isanteplus/isanteplus-packages
- false
-
-
- github-packages
- Github iSantePlus Packages
- https://maven.pkg.github.com/isanteplus/isanteplus-packages
- true
-
-
-
-
-
- github-packages
- Github iSantePlus Packages
- https://maven.pkg.github.com/isanteplus/isanteplus-packages
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
- none
-
-
-
-
- org.apache.maven.plugins
- maven-pmd-plugin
-
-
- validate
- none
-
-
-
-
-
-
-
+
+
+