Skip to content

Commit

Permalink
merged nira code
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishch22 committed Aug 22, 2024
1 parent cc25d4d commit c9e500d
Show file tree
Hide file tree
Showing 125 changed files with 3,265 additions and 518 deletions.
1 change: 1 addition & 0 deletions registration/SCHEMA_3.3.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions registration/SCHEMA_3.8.json

Large diffs are not rendered by default.

192 changes: 192 additions & 0 deletions registration/applicanttype.mvel
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.Period;
import java.util.List;
import java.time.ZoneId;
import java.time.temporal.ValueRange;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

String CHILD = "INFANT";
String ADULT = "ADULT";
String MINOR = "MINOR";
String MALE = 'MLE';
String FEMALE = 'FLE';
String NonResident = "FR";
String Resident = "NFR";
String Others = "OTH";
String DATE_PATTERN = "yyyy/MM/dd";
String regex = "^\\d{4}(\\/)(((0)[1-9])|((1)[0-2]))(\\/)([0-2][0-9]|(3)[0-1])$";
Pattern pattern = Pattern.compile(regex);

def isUpdateFlow(identity) {
Object val = identity.getOrDefault('_flow', null);
return (val == 'Update') ? true : false;
}

def getResidenceStatus(identity) {
if(identity.containsKey('residenceStatusCode')) {
return identity.getOrDefault('residenceStatusCode', null);
}

if(identity.containsKey('residenceStatus')) {
Object val = identity.getOrDefault('residenceStatus', null);
return val == null ? null :
(val instanceof String ? ; (String)val : (String) ((List)val).get(0).value);
}

return null;
}

def getGenderType(identity) {
if(identity.containsKey('genderCode')) {
return identity.getOrDefault('genderCode', null);
}

if(identity.containsKey('gender')) {
Object val = identity.getOrDefault('gender', null);
return val == null ? null :
(val instanceof String ? ; (String)val : (String) ((List)val).get(0).value);
}

return null;
}

def getAgeCode(identity) {
if(ageGroups == null || !identity.containsKey('dateOfBirth'))
return null;

String dob = identity.get('dateOfBirth');
if(!pattern.matcher(dob).matches())
return null;

LocalDate date = LocalDate.parse(dob, DateTimeFormatter.ofPattern(DATE_PATTERN));
LocalDate currentDate = LocalDate.now(ZoneId.of("UTC"));

if(date.isAfter(currentDate)) { return 'KER-MSD-151'; }

int ageInYears = Period.between(date, currentDate).getYears();

String ageGroup = null;
for(String groupName : ageGroups.keySet()) {
String[] range = ((String)ageGroups.get(groupName)).split('-');
if(ValueRange.of(Long.valueOf(range[0]), Long.valueOf(range[1])).isValidIntValue(ageInYears)) {
ageGroup = groupName;
}
}

return ageGroup == null ? null : ageGroup;
}


def getBioExceptionFlag(identity) {
if(!identity.containsKey('isBioException')) { return false; }
Object val = identity.getOrDefault('isBioException', null);
return (val == 'true') ? true : (( val == 'false' ) ? false : null);
}

def getApplicantType() {
String itc = getResidenceStatus(identity);
String genderType = getGenderType(identity);
String ageCode = getAgeCode(identity);
boolean isBioExPresent = getBioExceptionFlag(identity);

if( ageCode == 'KER-MSD-151' ) { return "KER-MSD-151"; }

if(itc == null || genderType == null || ageCode == null || isBioExPresent == null ) {
return isUpdateFlow(identity) ? "000" : "KER-MSD-147";
}

System.out.println(itc + " - " + genderType + " - " + ageCode + " - " + isBioExPresent);

if (itc == NonResident && genderType == MALE && ageCode == CHILD && !isBioExPresent) {
return "001";
} else if (itc == NonResident && genderType == MALE && ageCode == ADULT && !isBioExPresent) {
return "002";
} else if (itc == Resident && genderType == MALE && ageCode == CHILD && !isBioExPresent) {
return "003";
} else if (itc == Resident && genderType == MALE && ageCode == ADULT && !isBioExPresent) {
return "004";
} else if (itc == NonResident && genderType == FEMALE && ageCode == CHILD && !isBioExPresent) {
return "005";
} else if (itc == NonResident && genderType == FEMALE && ageCode == ADULT && !isBioExPresent) {
return "006";
} else if (itc == Resident && genderType == FEMALE && ageCode == CHILD && !isBioExPresent) {
return "007";
} else if (itc == Resident && genderType == FEMALE && ageCode == ADULT && !isBioExPresent) {
return "008";
} else if (itc == NonResident && genderType == Others && ageCode == CHILD && !isBioExPresent) {
return "005";
} else if (itc == NonResident && genderType == Others && ageCode == ADULT && !isBioExPresent) {
return "006";
} else if (itc == Resident && genderType == Others && ageCode == CHILD && !isBioExPresent) {
return "007";
} else if (itc == Resident && genderType == Others && ageCode == ADULT && !isBioExPresent) {
return "008";
} else if (itc == NonResident && genderType == MALE && ageCode == CHILD && isBioExPresent) {
return "009";
} else if (itc == NonResident && genderType == MALE && ageCode == ADULT && isBioExPresent) {
return "010";
} else if (itc == Resident && genderType == MALE && ageCode == CHILD && isBioExPresent) {
return "011";
} else if (itc == Resident && genderType == MALE && ageCode == ADULT && isBioExPresent) {
return "012";
} else if (itc == NonResident && genderType == FEMALE && ageCode == CHILD && isBioExPresent) {
return "013";
} else if (itc == NonResident && genderType == FEMALE && ageCode == ADULT && isBioExPresent) {
return "014";
} else if (itc == Resident && genderType == FEMALE && ageCode == CHILD && isBioExPresent) {
return "015";
} else if (itc == Resident && genderType == FEMALE && ageCode == ADULT && isBioExPresent) {
return "016";
} else if (itc == NonResident && genderType == Others && ageCode == CHILD && isBioExPresent) {
return "013";
} else if (itc == NonResident && genderType == Others && ageCode == ADULT && isBioExPresent) {
return "014";
} else if (itc == Resident && genderType == Others && ageCode == CHILD && isBioExPresent) {
return "015";
} else if (itc == Resident && genderType == Others && ageCode == ADULT && isBioExPresent) {
return "016";
}

else if (itc == NonResident && genderType == MALE && ageCode == MINOR && isBioExPresent) {
return "014";
} else if (itc == Resident && genderType == MALE && ageCode == MINOR && isBioExPresent) {
return "015";
}

else if (itc == NonResident && genderType == FEMALE && ageCode == MINOR && isBioExPresent) {
return "014";
} else if (itc == Resident && genderType == FEMALE && ageCode == MINOR && isBioExPresent) {
return "015";
}

else if (itc == NonResident && genderType == Others && ageCode == MINOR && isBioExPresent) {
return "014";
} else if (itc == Resident && genderType == Others && ageCode == MINOR && isBioExPresent) {
return "015";
}

else if (itc == NonResident && genderType == MALE && ageCode == MINOR && !isBioExPresent) {
return "014";
} else if (itc == Resident && genderType == MALE && ageCode == MINOR && !isBioExPresent) {
return "015";
}

else if (itc == NonResident && genderType == FEMALE && ageCode == MINOR && !isBioExPresent) {
return "014";
} else if (itc == Resident && genderType == FEMALE && ageCode == MINOR && !isBioExPresent) {
return "015";
}

else if (itc == NonResident && genderType == Others && ageCode == MINOR && !isBioExPresent) {
return "014";
} else if (itc == Resident && genderType == Others && ageCode == MINOR && !isBioExPresent) {
return "015";
}


return "000";
}
1 change: 1 addition & 0 deletions registration/lostProcess.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions registration/newProcess.json

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions registration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>-->

<groupId>io.mosip.registration</groupId>
<version>1.2.0.2</version>
<version>1.2.0.2-SNAPSHOT</version>
<artifactId>registration-client-parent</artifactId>
<packaging>pom</packaging>
<name>MOSIP Registration Client</name>
Expand Down Expand Up @@ -172,7 +172,6 @@
<!--<module>ref-impl/ref-document-scanner</module>
<module>ref-impl/ref-geoposition-rxtx</module>-->
<module>registration-test</module>

</modules>

<dependencyManagement>
Expand Down Expand Up @@ -440,6 +439,9 @@
<artifactId>cglib-nodep</artifactId>
<version>3.2.7</version>
</dependency>



</dependencies>
</dependencyManagement>

Expand All @@ -450,6 +452,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
<configuration>
<!--suppress UnresolvedMavenProperty -->
<skipTests>${skipTests}</skipTests>
<skip>false</skip>
<argLine>
Expand Down
2 changes: 1 addition & 1 deletion registration/ref-impl/ref-document-scanner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.mosip.registration</groupId>
<artifactId>ref-document-scanner</artifactId>
<version>1.2.0.2</version>
<version>1.2.0.2-SNAPSHOT</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import java.util.List;
import java.util.Optional;

import io.mosip.registration.dto.DeviceType;
import io.mosip.registration.dto.ScanDevice;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
Expand All @@ -14,9 +16,7 @@
import eu.gnome.morena.Device;
import eu.gnome.morena.Manager;
import eu.gnome.morena.Scanner;
import io.mosip.registration.api.docscanner.DeviceType;
import io.mosip.registration.api.docscanner.DocScannerService;
import io.mosip.registration.api.docscanner.dto.DocScanDevice;

@Component
public class MorenaDocScanServiceImpl implements DocScannerService {
Expand All @@ -30,7 +30,7 @@ public String getServiceName() {
}

@Override
public BufferedImage scan(DocScanDevice docScanDevice, String deviceType) {
public BufferedImage scan(ScanDevice docScanDevice, String deviceType) {
if (deviceType != null) {
Configuration.addDeviceType(deviceType, true);
}
Expand Down Expand Up @@ -63,14 +63,14 @@ public BufferedImage scan(DocScanDevice docScanDevice, String deviceType) {
}

@Override
public List<DocScanDevice> getConnectedDevices() {
public List<ScanDevice> getConnectedDevices() {
Manager manager = Manager.getInstance();
List<Device> connectedDevices = manager.listDevices();
LOGGER.info("connectedDevices >>> {}", connectedDevices);

List<DocScanDevice> devices = new ArrayList<>();
List<ScanDevice> devices = new ArrayList<>();
connectedDevices.forEach(device -> {
DocScanDevice docScanDevice = new DocScanDevice();
ScanDevice docScanDevice = new ScanDevice();
docScanDevice.setId(SERVICE_NAME+":"+device.toString());
docScanDevice.setName(device.toString());
docScanDevice.setServiceName(getServiceName());
Expand All @@ -82,7 +82,7 @@ public List<DocScanDevice> getConnectedDevices() {
}

@Override
public void stop(DocScanDevice docScanDevice) {
public void stop(ScanDevice docScanDevice) {

}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.mosip.registration.ref.sarxos;

import com.github.sarxos.webcam.Webcam;
import io.mosip.registration.api.docscanner.DeviceType;
import io.mosip.registration.api.docscanner.DocScannerService;
import io.mosip.registration.api.docscanner.dto.DocScanDevice;
import io.mosip.registration.dto.DeviceType;
import io.mosip.registration.dto.ScanDevice;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
Expand All @@ -28,7 +28,7 @@ public String getServiceName() {
}

@Override
public BufferedImage scan(DocScanDevice docScanDevice, String deviceType) {
public BufferedImage scan(ScanDevice docScanDevice, String deviceType) {
Optional<Webcam> result = Webcam.getWebcams().stream()
.filter(c -> c.getName().equals(docScanDevice.getName()))
.findFirst();
Expand Down Expand Up @@ -60,10 +60,10 @@ private void openDevice(@NotNull Webcam webcam, int width, int height) {
}

@Override
public List<DocScanDevice> getConnectedDevices() {
List<DocScanDevice> devices = new ArrayList<>();
public List<ScanDevice> getConnectedDevices() {
List<ScanDevice> devices = new ArrayList<>();
for(Webcam webcam : Webcam.getWebcams()) {
DocScanDevice docScanDevice = new DocScanDevice();
ScanDevice docScanDevice = new ScanDevice();
docScanDevice.setDeviceType(DeviceType.CAMERA);
docScanDevice.setName(webcam.getName());
docScanDevice.setServiceName(getServiceName());
Expand All @@ -74,7 +74,7 @@ public List<DocScanDevice> getConnectedDevices() {
}

@Override
public void stop(DocScanDevice docScanDevice) {
public void stop(ScanDevice docScanDevice) {
Optional<Webcam> result = Webcam.getWebcams().stream()
.filter(c -> c.getName().equals(docScanDevice.getName()))
.findFirst();
Expand Down
2 changes: 1 addition & 1 deletion registration/ref-impl/ref-geoposition-rxtx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.mosip.registration</groupId>
<artifactId>ref-geoposition-rxtx</artifactId>
<version>1.2.0.2</version>
<version>1.2.0.2-SNAPSHOT</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down
4 changes: 4 additions & 0 deletions registration/ref-impl/ref-signature-scanner/maven-build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
call mvn install:install-file -Dfile=${project.basedir}/lib/stpad-lib-9.4.1.jar -DgroupId=de.signotec.stpad -DartifactId=stpad-lib -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
call mvn install:install-file -Dfile=${project.basedir}/lib/stpad-native-8.0.41.3.jar -DgroupId=de.signotec.stpad -DartifactId=stpad-native -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
call mvn install:install-file -Dfile=${project.basedir}/lib/stlic-lib-2.1.0.jar -DgroupId=de.signotec.stlic -DartifactId=stlic-lib -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
call mvn clean install -Dgpg.skip=true -Dmaven.test.skip=true
Loading

0 comments on commit c9e500d

Please sign in to comment.