diff --git a/package-lock.json b/package-lock.json
index 4345746..8bb4f21 100755
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "epasmed",
- "version": "0.0.1-SNAPSHOT",
+ "version": "1.0.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/pom.xml b/pom.xml
index 0e8cd39..db42f53 100755
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
it.cnr.isti.epasmed
epasmed
- 1.0.5
+ 1.0.6
jar
epasmed
diff --git a/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java b/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java
index 9242231..6e73c84 100755
--- a/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java
+++ b/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java
@@ -197,7 +197,7 @@ public class SyncService {
borario = false;
bpers_orario = false;
blavoro_fuori_sede = false;
- baspettative=false;
+ baspettative = false;
}
public void executeReads() throws Exception {
@@ -359,7 +359,7 @@ public class SyncService {
logger.info("EPAS Created Person: {}", epasPerson);
} catch (Exception e) {
logger.error("Error creating person: {}", epasPersonsDTO);
- logger.error(e.getLocalizedMessage(),e);
+ logger.error(e.getLocalizedMessage(), e);
}
} else {
EPASPersonsDTO epasPersonsDTO = epasPersonsMapper.epasPersonsToEPASPersonsDTO(epasPerson);
@@ -386,24 +386,24 @@ public class SyncService {
private String createCNREmail(SIAnagrafico sia) {
StringBuilder cnrEmail = new StringBuilder();
if (sia.getNome() != null && !sia.getNome().isEmpty()) {
- String nome=sia.getNome();
- if(!Normalizer.isNormalized(sia.getNome(), Normalizer.Form.NFKD)){
- nome=Normalizer.normalize(sia.getNome(), Normalizer.Form.NFKD).replaceAll("\\p{M}", "");
+ String nome = sia.getNome();
+ if (!Normalizer.isNormalized(sia.getNome(), Normalizer.Form.NFKD)) {
+ nome = Normalizer.normalize(sia.getNome(), Normalizer.Form.NFKD).replaceAll("\\p{M}", "");
}
cnrEmail.append(nome.toLowerCase());
if (sia.getCognome() != null && !sia.getCognome().isEmpty()) {
- String cognome=sia.getCognome();
- if(!Normalizer.isNormalized(sia.getCognome(), Normalizer.Form.NFKD)){
- cognome=Normalizer.normalize(sia.getCognome(), Normalizer.Form.NFKD).replaceAll("\\p{M}", "");
+ String cognome = sia.getCognome();
+ if (!Normalizer.isNormalized(sia.getCognome(), Normalizer.Form.NFKD)) {
+ cognome = Normalizer.normalize(sia.getCognome(), Normalizer.Form.NFKD).replaceAll("\\p{M}", "");
}
cnrEmail.append(".");
cnrEmail.append(cognome.toLowerCase().trim());
}
} else {
if (sia.getCognome() != null && !sia.getCognome().isEmpty()) {
- String cognome=sia.getCognome();
- if(!Normalizer.isNormalized(sia.getCognome(), Normalizer.Form.NFKD)){
- cognome=Normalizer.normalize(sia.getCognome(), Normalizer.Form.NFKD).replaceAll("\\p{M}", "");
+ String cognome = sia.getCognome();
+ if (!Normalizer.isNormalized(sia.getCognome(), Normalizer.Form.NFKD)) {
+ cognome = Normalizer.normalize(sia.getCognome(), Normalizer.Form.NFKD).replaceAll("\\p{M}", "");
}
cnrEmail.append(cognome.toLowerCase().trim());
} else {
@@ -558,9 +558,17 @@ public class SyncService {
if (epasGroups != null) {
EPASGroups groupPresent = null;
for (EPASGroups g : epasGroups) {
- if (Integer.valueOf(g.getExternalId()).compareTo(sig.getId()) == 0) {
- groupPresent = g;
- break;
+ if (g.getExternalId() != null && !g.getExternalId().isEmpty()) {
+ Integer gExternalId=null;
+ try {
+ gExternalId=Integer.valueOf(g.getExternalId());
+ } catch (NumberFormatException e) {
+ logger.error("EPAS Group has invalid External Id: {}", g);
+ }
+ if (gExternalId!=null&&gExternalId.compareTo(sig.getId()) == 0) {
+ groupPresent = g;
+ break;
+ }
}
}
diff --git a/src/main/java/it/cnr/isti/epasmed/web/rest/sync/SyncResource.java b/src/main/java/it/cnr/isti/epasmed/web/rest/sync/SyncResource.java
index c75198b..e7487d6 100755
--- a/src/main/java/it/cnr/isti/epasmed/web/rest/sync/SyncResource.java
+++ b/src/main/java/it/cnr/isti/epasmed/web/rest/sync/SyncResource.java
@@ -1,5 +1,8 @@
package it.cnr.isti.epasmed.web.rest.sync;
+//import java.security.SecureRandom;
+//import java.util.concurrent.TimeUnit;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -131,7 +134,7 @@ public class SyncResource {
public ResponseEntity syncTest(@RequestParam("year") String year, @RequestParam("month") String month)
throws Exception {
logger.info("REST request syncTest");
-
+ //delayTest();
ResponseEntity res;
logger.info("Selezionato {} - {} ", year, month);
String msg = "Test eseguito correttamente.";
@@ -148,6 +151,21 @@ public class SyncResource {
return res;
}
+/* private void delayTest() {
+ SecureRandom rand = new SecureRandom();
+ int upperbound = 1000;
+ // Generating random values from 0 - 999
+ // using nextInt()
+ int random1 = rand.nextInt(upperbound);
+ logger.debug("Test: "+random1);
+
+ try {
+ TimeUnit.SECONDS.sleep(5);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+*/
/**
* {@code GET /sync/writesOrario} : Report Orario from ePAS and update
* SistemaInformativo.