Aggiornato PersonWorkingTime

This commit is contained in:
Giancarlo Panichi 2022-10-12 19:31:45 +02:00
parent 7b81ef8be3
commit 1f1d15f15a
24 changed files with 596 additions and 143 deletions

View File

@ -52,7 +52,7 @@ public class EPASLeavesClient {
ResponseEntity<List<EPASLeaves>> responseEntity = rt.exchange(
appProps.getDatasourceEpasRest().getRestUrl()
+ "/v2/leaves/byPersonAndYear?fiscalCode={fc}&year={year}",
+ "/v2/leaves/byPersonAndYear?fiscalCode={fc}&year={year}&includeDetails=true",
HttpMethod.GET, null, new ParameterizedTypeReference<List<EPASLeaves>>() {
}, uriVariables);
List<EPASLeaves> listEPASLeaves = responseEntity.getBody();

View File

@ -0,0 +1,34 @@
package it.cnr.isti.epasmed.epas.dto;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EPASPersonWorkingTimeDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
private String idPersona;
private String cf;
private String dal;
private String al;
private String descrizione;
private int lun;
private int mar;
private int mer;
private int gio;
private int ven;
private int sab;
private int percentuale;
private String turno;
private int ore_turno;
private String festivo;
private String notturno;
}

View File

@ -1,22 +1,34 @@
package it.cnr.isti.epasmed.epas.service;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.LinkedHashMap;
import java.util.List;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import it.cnr.isti.epasmed.epas.client.EPASContractsClient;
import it.cnr.isti.epasmed.epas.dto.EPASContractsDTO;
import it.cnr.isti.epasmed.epas.model.EPASContracts;
import it.cnr.isti.epasmed.epas.model.EPASPersons;
@Service
public class EPASContractsService {
private static final Logger logger = LoggerFactory.getLogger(EPASContractsService.class);
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@Autowired
EPASContractsClient epasContractsClient;
@Autowired
EPASPersonsService epasPersonsService;
public EPASContracts getById(String id) {
return epasContractsClient.getById(id);
}
@ -28,7 +40,7 @@ public class EPASContractsService {
public List<EPASContracts> getByPersonFiscalcode(String fc) {
return epasContractsClient.getByPersonFiscalcode(fc);
}
public List<EPASContracts> getByPersonEmail(String email) {
return epasContractsClient.getByPersonEmail(email);
}
@ -53,4 +65,55 @@ public class EPASContractsService {
epasContractsClient.deleteById(id);
}
public LinkedHashMap<String, EPASContracts> getMap(String officeId) {
List<EPASPersons> epasPersonsList = epasPersonsService.getList(officeId);
LinkedHashMap<String, EPASContracts> lastContractsMap = new LinkedHashMap<>();
for (EPASPersons epasPerson : epasPersonsList) {
logger.debug("EPASPerson: {}", epasPerson);
List<EPASContracts> listContracts = null;
try {
listContracts = getByPersonId(epasPerson.getId());
} catch (Exception e) {
logger.error("Error retrieving contracts list for person: {}", epasPerson.getId());
}
if (listContracts == null || listContracts.isEmpty()) {
logger.error("There is no contract for this person Id: {}", epasPerson.getId());
lastContractsMap.put(epasPerson.getId(), null);
continue;
}
String lastContractId = null;
LocalDate lastContractDate = null;
LocalDate currentContractDate = null;
for (EPASContracts contract : listContracts) {
currentContractDate = LocalDate.parse(contract.getBeginDate(), formatter);
if (lastContractDate == null || currentContractDate.isAfter(lastContractDate)) {
lastContractDate = currentContractDate;
lastContractId = contract.getId();
}
}
if (lastContractId == null || lastContractId.isEmpty()) {
logger.error("There is no last contract for this person id: {}", epasPerson.getId());
lastContractsMap.put(epasPerson.getId(), null);
continue;
}
logger.debug("Found Last Contract Id: {}", lastContractId);
EPASContracts lastContract = getById(lastContractId);
if (lastContract == null) {
logger.error("There is no last contract by Id: {}", lastContractId);
lastContractsMap.put(epasPerson.getId(), null);
continue;
}
lastContractsMap.put(epasPerson.getId(), lastContract);
}
return lastContractsMap;
}
}

View File

@ -0,0 +1,156 @@
package it.cnr.isti.epasmed.epas.service;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.LinkedHashMap;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import it.cnr.isti.epasmed.epas.dto.EPASPersonWorkingTimeDTO;
import it.cnr.isti.epasmed.epas.model.EPASContracts;
import it.cnr.isti.epasmed.epas.model.EPASPersons;
import it.cnr.isti.epasmed.epas.model.EPASWorkingTimeForPerson;
import it.cnr.isti.epasmed.epas.model.EPASWorkingTimeTypeDays;
import it.cnr.isti.epasmed.epas.model.EPASWorkingTimeTypes;
@Service
public class EPASPersonWorkingTimeService {
private static final Logger logger = LoggerFactory.getLogger(EPASPersonWorkingTimeService.class);
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@Autowired
EPASWorkingTimeTypesService epasWorkingTimeTypesService;
@Autowired
EPASPersonsService epasPersonService;
@Autowired
EPASContractsService epasContranctsService;
public EPASPersonWorkingTimeDTO getByPersonId(String personId) {
List<EPASContracts> listContracts = epasContranctsService.getByPersonId(personId);
if (listContracts == null || listContracts.isEmpty()) {
logger.error("There is no contract for this person Id: {}", personId);
return null;
}
EPASPersonWorkingTimeDTO pwtDTO = getPersonWorkingTimeDTO(personId, listContracts);
return pwtDTO;
}
public EPASPersonWorkingTimeDTO getByPersonFiscalCode(String fc) {
EPASPersons epasPerson=epasPersonService.getByFiscalCode(fc);
if(epasPerson==null||epasPerson.getId()==null||epasPerson.getId().isEmpty()) {
logger.error("There is no Person for fiscal code: {}", fc);
return null;
}
logger.debug("EPASPerson: {}",epasPerson);
List<EPASContracts> listContracts = epasContranctsService.getByPersonFiscalcode(fc);
if (listContracts == null || listContracts.isEmpty()) {
logger.error("There is no contract for this person Id: {}", epasPerson.getId());
return null;
}
EPASPersonWorkingTimeDTO pwtDTO = getPersonWorkingTimeDTO(epasPerson.getId(), listContracts);
return pwtDTO;
}
private EPASPersonWorkingTimeDTO getPersonWorkingTimeDTO(String personId, List<EPASContracts> listContracts) {
String lastContractId = null;
LocalDate lastContractDate = null;
LocalDate currentContractDate = null;
for (EPASContracts contract : listContracts) {
currentContractDate = LocalDate.parse(contract.getBeginDate(), formatter);
if (lastContractDate == null || currentContractDate.isAfter(lastContractDate)) {
lastContractDate = currentContractDate;
lastContractId = contract.getId();
}
}
if (lastContractId == null || lastContractId.isEmpty()) {
logger.error("There is no last contract for this person id: {}",personId);
return null;
}
logger.debug("Found Last Contract Id: {}", lastContractId);
EPASContracts lastContract = epasContranctsService.getById(lastContractId);
if (lastContract == null) {
logger.error("There is no last contract by Id: {}", lastContractId);
return null;
}
if (lastContract.getWorkingTimeTypes() == null || lastContract.getWorkingTimeTypes().length < 0) {
logger.error("There is no last Working Time Type for this Contract Id: {}", lastContractId);
return null;
}
String lastWTPId = null;
LocalDate lastWTPBeginDate = null;
String lastWTPBeginDateS = null;
String lastWTPEndDate = null;
LocalDate currentWTPBeginDate = null;
for (EPASWorkingTimeForPerson wtp : lastContract.getWorkingTimeTypes()) {
currentWTPBeginDate = LocalDate.parse(wtp.getBeginDate(), formatter);
if (lastWTPBeginDate == null || currentWTPBeginDate.isAfter(lastWTPBeginDate)) {
lastWTPBeginDate = currentWTPBeginDate;
lastWTPBeginDateS = wtp.getBeginDate();
lastWTPEndDate = wtp.getEndDate();
lastWTPId = wtp.getWorkingTimeType().getId();
}
}
if (lastWTPId == null) {
logger.error("There is no last Working Time Type by Id: {}", lastWTPId);
return null;
}
logger.debug("Retrieving Working Time Type by Id: {}", lastWTPId);
EPASWorkingTimeTypes wtt = epasWorkingTimeTypesService.getById(lastWTPId);
if (wtt == null) {
logger.error("There is no Working Time Type by Id: {}", lastWTPId);
return null;
}
if (wtt.getWorkingTimeTypeDays().length < 1) {
logger.error("There is no last Working Time Type Days by Id: {}", lastWTPId);
return null;
}
LinkedHashMap<Integer, Integer> workingTimeByDays = new LinkedHashMap<Integer, Integer>();
for (EPASWorkingTimeTypeDays wtd : wtt.getWorkingTimeTypeDays()) {
boolean isHoliday = Boolean.parseBoolean(wtd.getHoliday());
try {
int dayOfWeek = Integer.parseInt(wtd.getDayOfWeek());
if (isHoliday) {
workingTimeByDays.put(dayOfWeek, 0);
} else {
int workingTime = Integer.parseInt(wtd.getWorkingTime());
workingTimeByDays.put(dayOfWeek, workingTime);
}
} catch (NumberFormatException e) {
logger.error("Invalid working time by days: "+e.getLocalizedMessage(),e);
}
}
//TODO
// Recuperare la percentuale, turno e le ore turno.
EPASPersonWorkingTimeDTO pwtDTO = new EPASPersonWorkingTimeDTO(lastContractId, personId,
lastContract.getPerson().getFiscalCode(), lastWTPBeginDateS, lastWTPEndDate, wtt.getDescription(),
workingTimeByDays.get(DayOfWeek.MONDAY.getValue()), workingTimeByDays.get(DayOfWeek.TUESDAY.getValue()),
workingTimeByDays.get(DayOfWeek.WEDNESDAY.getValue()),
workingTimeByDays.get(DayOfWeek.THURSDAY.getValue()),
workingTimeByDays.get(DayOfWeek.FRIDAY.getValue()),
workingTimeByDays.get(DayOfWeek.SATURDAY.getValue()),
100, "NO", 0, "SI", "NO");
return pwtDTO;
}
}

View File

@ -20,7 +20,7 @@ import it.cnr.isti.epasmed.epas.service.EPASAbsenceTypesService;
@RequestMapping("/api/epas")
public class EPASAbsenceTypesResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -41,7 +41,7 @@ public class EPASAbsenceTypesResource {
*/
@GetMapping("/absenceTypes")
public ResponseEntity<List<EPASAbsenceTypes>> getEPASAbsencesTypes() {
log.debug("REST request GET EPAS Absences Types");
logger.debug("REST request GET EPAS Absences Types");
List<EPASAbsenceTypes> epasAbsenceTypesList = null;
epasAbsenceTypesList = epasAbsenceTypesService.getAbsenceTypes();
@ -58,7 +58,7 @@ public class EPASAbsenceTypesResource {
*/
@GetMapping("/absenceTypesMap")
public ResponseEntity<LinkedHashMap<String, String>> getEPASAbsencesTypesMap() {
log.debug("REST request GET EPAS Absences Types Map");
logger.debug("REST request GET EPAS Absences Types Map");
LinkedHashMap<String, String> epasAbsenceTypesMap = null;
epasAbsenceTypesMap = epasAbsenceTypesService.getAbsenceTypesMap();

View File

@ -34,7 +34,7 @@ import it.cnr.isti.epasmed.web.rest.errors.BadRequestAlertException;
@RequestMapping("/api/epas")
public class EPASAffiliationsResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -55,9 +55,9 @@ public class EPASAffiliationsResource {
*/
@GetMapping("/affiliations/{id}")
public ResponseEntity<EPASAffiliations> getEPASAffiliationsById(@PathVariable String id) {
log.info("REST request to get ePAS Affiliations by Id: {}", id);
logger.info("REST request to get ePAS Affiliations by Id: {}", id);
EPASAffiliations epasAffiliations = epasAffiliationsService.getById(id);
log.info("Retrieved Affiliations: {}", epasAffiliations);
logger.info("Retrieved Affiliations: {}", epasAffiliations);
return ResponseUtil.wrapOrNotFound(Optional.of(epasAffiliations));
}
@ -74,10 +74,10 @@ public class EPASAffiliationsResource {
@GetMapping("/affiliations/byGroup")
public ResponseEntity<List<EPASAffiliations>> getEPASAffiliationsByGroup(@RequestParam("id") String id,
@RequestParam("includeInactive") Optional<Boolean> includeInactive) {
log.info("REST request to get ePAS Affiliations list by Group Id: {}", id);
logger.info("REST request to get ePAS Affiliations list by Group Id: {}", id);
boolean includeInctv=false;
if (includeInactive.isPresent()) {
log.info("Include Inactive: {}", includeInactive.get());
logger.info("Include Inactive: {}", includeInactive.get());
includeInctv=includeInactive.get();
}
List<EPASAffiliations> epasAffiliationsList = epasAffiliationsService.getByGroup(id, includeInctv);
@ -99,11 +99,11 @@ public class EPASAffiliationsResource {
List<EPASAffiliations> epasAffiliationsList = null;
if (id.isPresent()) {
log.info("REST request to get ePAS Affiliations by Person id: {}", id.get());
logger.info("REST request to get ePAS Affiliations by Person id: {}", id.get());
epasAffiliationsList = epasAffiliationsService.getByPersonId(id.get());
} else {
if (fiscalCode.isPresent()) {
log.info("REST request to get ePAS Affiliations by Person fiscal code: {}", fiscalCode.get());
logger.info("REST request to get ePAS Affiliations by Person fiscal code: {}", fiscalCode.get());
epasAffiliationsList = epasAffiliationsService.getByPersonFiscalcode(fiscalCode.get());
}
}
@ -127,7 +127,7 @@ public class EPASAffiliationsResource {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<EPASAffiliations> createEPASAffiliations(
@Valid @RequestBody EPASAffiliationsDTO epasAffiliationsDTO) throws URISyntaxException {
log.debug("REST request to create EPAS Affiliation: {}", epasAffiliationsDTO);
logger.debug("REST request to create EPAS Affiliation: {}", epasAffiliationsDTO);
if (epasAffiliationsDTO.getId() != null) {
throw new BadRequestAlertException("A new ePAS Affiliation already have an ID", "EPASAffiliations",
@ -155,7 +155,7 @@ public class EPASAffiliationsResource {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<EPASAffiliations> updateEPASAffiliationsById(@PathVariable String id,
@Valid @RequestBody EPASAffiliationsDTO epasAffiliationsDTO) {
log.debug("REST request to update ePAS Affiliations : {} by {}", id, epasAffiliationsDTO);
logger.debug("REST request to update ePAS Affiliations : {} by {}", id, epasAffiliationsDTO);
epasAffiliationsService.updateById(id, epasAffiliationsDTO);
EPASAffiliations updatedEPASAffiliations = epasAffiliationsService.getById(id);
Optional<EPASAffiliations> oEPASAffiliations = Optional.of(updatedEPASAffiliations);
@ -175,7 +175,7 @@ public class EPASAffiliationsResource {
@DeleteMapping("/affiliations/{id}")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Void> deleteEPASAffiliationById(@PathVariable String id) {
log.debug("REST request to delete ePAS Affiliation by id: {}", id);
logger.debug("REST request to delete ePAS Affiliation by id: {}", id);
epasAffiliationsService.deleteById(id);
return ResponseEntity.noContent()
.headers(HeaderUtil.createAlert(applicationName, "A Affiliation is deleted with identifier " + id, id))

View File

@ -21,7 +21,7 @@ import it.cnr.isti.epasmed.epas.service.EPASCertificationsService;
@RequestMapping("/api/epas")
public class EPASCertificationsResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -53,15 +53,15 @@ public class EPASCertificationsResource {
EPASCertifications epasCertifications = null;
if (id.isPresent()) {
log.info("REST request to get ePAS Certification by Person: {}", id.get());
logger.info("REST request to get ePAS Certification by Person: {}", id.get());
epasCertifications = epasCertificationsService.getCertificationsByPersonId(id.get(), year, month);
} else {
if (fiscalCode.isPresent()) {
log.info("REST request to get ePAS Certification by Person fiscal code: {}", fiscalCode.get());
logger.info("REST request to get ePAS Certification by Person fiscal code: {}", fiscalCode.get());
epasCertifications = epasCertificationsService.getCertificationsByPersonFiscalCode(fiscalCode.get(), year, month);
} else {
if (email.isPresent()) {
log.info("REST request to get ePAS Certification by Person email: {}", email.get());
logger.info("REST request to get ePAS Certification by Person email: {}", email.get());
epasCertifications = epasCertificationsService.getCertificationsByPersonEmail(email.get(), year, month);
} else {
return ResponseUtil.wrapOrNotFound(Optional.of(epasCertifications), HeaderUtil.createFailureAlert(applicationName,false,
@ -70,7 +70,7 @@ public class EPASCertificationsResource {
}
}
}
log.info("Retrieved Certification: {}", epasCertifications);
logger.info("Retrieved Certification: {}", epasCertifications);
return ResponseUtil.wrapOrNotFound(Optional.of(epasCertifications));
}
@ -87,9 +87,9 @@ public class EPASCertificationsResource {
@GetMapping("/certifications/getMonthSituationByOffice")
public ResponseEntity<List<EPASCertifications>> getEPASCertificationByOfficeCodeId(@RequestParam("officeCodeId") String officeCodeId,
@RequestParam("year") String year, @RequestParam("month") String month) {
log.info("REST request to get ePAS Certification by office: codeId={}, year={}, month={}", officeCodeId, year, month);
logger.info("REST request to get ePAS Certification by office: codeId={}, year={}, month={}", officeCodeId, year, month);
List<EPASCertifications> epasCertificationsList = epasCertificationsService.getCertificationsByOfficeCodeId(officeCodeId, year, month);
log.info("Retrieved Certification: {}", epasCertificationsList);
logger.info("Retrieved Certification: {}", epasCertificationsList);
return ResponseUtil.wrapOrNotFound(Optional.of(epasCertificationsList));
}

View File

@ -34,7 +34,7 @@ import it.cnr.isti.epasmed.web.rest.errors.BadRequestAlertException;
@RequestMapping("/api/epas")
public class EPASChildrenResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -55,9 +55,9 @@ public class EPASChildrenResource {
*/
@GetMapping("/child/{id}")
public ResponseEntity<EPASChildren> getEPASChildrenById(@PathVariable String id) {
log.info("REST request to get ePAS Children by Id: {}", id);
logger.info("REST request to get ePAS Children by Id: {}", id);
EPASChildren epasChildren = epasChildrenService.getById(id);
log.info("Retrieved Children: {}", epasChildren);
logger.info("Retrieved Children: {}", epasChildren);
return ResponseUtil.wrapOrNotFound(Optional.of(epasChildren));
}
@ -79,15 +79,15 @@ public class EPASChildrenResource {
List<EPASChildren> listEpasChildren = null;
if (id.isPresent()) {
log.info("REST request to get ePAS Children by Person id: {}", id.get());
logger.info("REST request to get ePAS Children by Person id: {}", id.get());
listEpasChildren = epasChildrenService.getByPersonId(id.get());
} else {
if (fiscalCode.isPresent()) {
log.info("REST request to get ePAS Children by Person fiscalcode: {}", fiscalCode.get());
logger.info("REST request to get ePAS Children by Person fiscalcode: {}", fiscalCode.get());
listEpasChildren = epasChildrenService.getByPersonFiscalCode(fiscalCode.get());
} else {
if (email.isPresent()) {
log.info("REST request to get ePAS Children by Person email: {}", email.get());
logger.info("REST request to get ePAS Children by Person email: {}", email.get());
listEpasChildren = epasChildrenService.getByPersonEmail(email.get());
} else {
return ResponseUtil.wrapOrNotFound(Optional.of(listEpasChildren), HeaderUtil.createFailureAlert(applicationName,false,
@ -96,7 +96,7 @@ public class EPASChildrenResource {
}
}
}
log.info("Retrieved Certification: {}", listEpasChildren);
logger.info("Retrieved Certification: {}", listEpasChildren);
return ResponseUtil.wrapOrNotFound(Optional.of(listEpasChildren));
}
@ -117,7 +117,7 @@ public class EPASChildrenResource {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<EPASChildren> createEPASChildren(@Valid @RequestBody EPASChildrenDTO epasChildrenDTO)
throws URISyntaxException {
log.debug("REST request to create EPAS Child: {}", epasChildrenDTO);
logger.debug("REST request to create EPAS Child: {}", epasChildrenDTO);
EPASChildren createdEPASChildren = epasChildrenService.create(epasChildrenDTO);
StringBuilder sb = new StringBuilder();
@ -146,7 +146,7 @@ public class EPASChildrenResource {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<EPASChildren> updateEPASChildrenById(@PathVariable String id,
@Valid @RequestBody EPASChildrenDTO epasChildrenDTO) {
log.debug("REST request to update ePAS Children : {} by {}", id, epasChildrenDTO);
logger.debug("REST request to update ePAS Children : {} by {}", id, epasChildrenDTO);
epasChildrenService.updateById(id, epasChildrenDTO);
EPASChildren updatedEPASChildren = epasChildrenService.getById(id);
Optional<EPASChildren> oEPASChildren = Optional.of(updatedEPASChildren);
@ -168,7 +168,7 @@ public class EPASChildrenResource {
@DeleteMapping("/child/{id}")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Void> deleteEPASChildrenById(@PathVariable String id) {
log.debug("REST request to delete ePAS Children by id: {}", id);
logger.debug("REST request to delete ePAS Children by id: {}", id);
epasChildrenService.deleteById(id);
return ResponseEntity.noContent()
.headers(HeaderUtil.createAlert(applicationName, "A Child is deleted with identifier " + id, id))

View File

@ -2,6 +2,7 @@ package it.cnr.isti.epasmed.web.rest.epas;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Optional;
@ -34,7 +35,7 @@ import it.cnr.isti.epasmed.web.rest.errors.BadRequestAlertException;
@RequestMapping("/api/epas")
public class EPASContractsResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -55,12 +56,30 @@ public class EPASContractsResource {
*/
@GetMapping("/contracts/{id}")
public ResponseEntity<EPASContracts> getEPASContractsById(@PathVariable String id) {
log.info("REST request to get ePAS Contracts by Id: {}", id);
logger.info("REST request to get ePAS Contracts by Id: {}", id);
EPASContracts epasContracts = epasContractsService.getById(id);
log.info("Retrieved Contracts: {}", epasContracts);
logger.info("Retrieved Contracts: {}", epasContracts);
return ResponseUtil.wrapOrNotFound(Optional.of(epasContracts));
}
/**
* {@code GET /contracts/map} : get contracts map.
*
* @param officeId the office Id.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body
* the EPAS Contracts Map, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/contracts/map")
public ResponseEntity<LinkedHashMap<String,EPASContracts>> getEPASContractsMap(@RequestParam("officeId") String officeId) {
logger.info("REST request to get ePAS Contracts Map by officeId: {}", officeId);
LinkedHashMap<String,EPASContracts> epasContractsMap = epasContractsService.getMap(officeId);
logger.info("Retrieved Contracts Map: {}", epasContractsMap);
return ResponseUtil.wrapOrNotFound(Optional.of(epasContractsMap));
}
/**
* {@code GET /contracts/byPerson} : get contracts by Person
@ -77,15 +96,15 @@ public class EPASContractsResource {
@RequestParam("email") Optional<String> email) {
List<EPASContracts> epasContractsList = null;
if (id.isPresent()) {
log.info("REST request to get ePAS Contracts by Person: {}", id.get());
logger.info("REST request to get ePAS Contracts by Person: {}", id.get());
epasContractsList = epasContractsService.getByPersonId(id.get());
} else {
if (fiscalCode.isPresent()) {
log.info("REST request to get ePAS Contracts by Person fiscal code: {}", fiscalCode.get());
logger.info("REST request to get ePAS Contracts by Person fiscal code: {}", fiscalCode.get());
epasContractsList = epasContractsService.getByPersonFiscalcode(fiscalCode.get());
} else {
if (email.isPresent()) {
log.info("REST request to get ePAS Contracts by Person email: {}", email.get());
logger.info("REST request to get ePAS Contracts by Person email: {}", email.get());
epasContractsList = epasContractsService.getByPersonEmail(email.get());
} else {
return ResponseUtil.wrapOrNotFound(Optional.of(epasContractsList), HeaderUtil.createFailureAlert(applicationName,false,
@ -94,7 +113,7 @@ public class EPASContractsResource {
}
}
}
log.info("Retrieved List of Contracts: {}", epasContractsList);
logger.info("Retrieved List of Contracts: {}", epasContractsList);
return ResponseUtil.wrapOrNotFound(Optional.of(epasContractsList));
}
@ -116,7 +135,7 @@ public class EPASContractsResource {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<EPASContracts> createEPASContracts(@Valid @RequestBody EPASContractsDTO epasContractsDTO)
throws URISyntaxException {
log.debug("REST request to create EPAS Contract: {}", epasContractsDTO);
logger.debug("REST request to create EPAS Contract: {}", epasContractsDTO);
if (epasContractsDTO.getId() != null) {
throw new BadRequestAlertException("A new ePAS Contract already have an ID", "EPASContracts", "idexists");
@ -142,7 +161,7 @@ public class EPASContractsResource {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<EPASContracts> updateEPASContractsById(@PathVariable String id,
@Valid @RequestBody EPASContractsDTO epasContractsDTO) {
log.debug("REST request to update ePAS Contracts : {} by {}", id, epasContractsDTO);
logger.debug("REST request to update ePAS Contracts : {} by {}", id, epasContractsDTO);
epasContractsService.updateById(id, epasContractsDTO);
EPASContracts updatedEPASContracts = epasContractsService.getById(id);
Optional<EPASContracts> oEPASContracts = Optional.of(updatedEPASContracts);
@ -162,7 +181,7 @@ public class EPASContractsResource {
@DeleteMapping("/contracts/setPreviousContract")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Void> setEPASContractPrevious(@RequestParam("id") String id) {
log.debug("REST request Set Previous Contract ePAS by id: {}", id);
logger.debug("REST request Set Previous Contract ePAS by id: {}", id);
epasContractsService.setPreviousContract(id);
return ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
"Setted to previous the EPAS Contract with identifier " + id, id)).build();
@ -178,7 +197,7 @@ public class EPASContractsResource {
@DeleteMapping("/contracts/unsetPreviousContract")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Void> setEPASContractUnsetPrevious(@RequestParam("id") String id) {
log.debug("REST request Unset Previous Contract ePAS by id: {}", id);
logger.debug("REST request Unset Previous Contract ePAS by id: {}", id);
epasContractsService.setUnsetPreviousContract(id);
return ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
"Unsetted to previous the EPAS Contract with identifier " + id, id)).build();
@ -193,7 +212,7 @@ public class EPASContractsResource {
@DeleteMapping("/contracts/{id}")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Void> deleteEPASContractById(@PathVariable String id) {
log.debug("REST request to delete ePAS Contract by id: {}", id);
logger.debug("REST request to delete ePAS Contract by id: {}", id);
epasContractsService.deleteById(id);
return ResponseEntity.noContent()
.headers(HeaderUtil.createAlert(applicationName, "A Contract is deleted with identifier " + id, id))

View File

@ -34,7 +34,7 @@ import it.cnr.isti.epasmed.web.rest.errors.BadRequestAlertException;
@RequestMapping("/api/epas")
public class EPASGroupsResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -55,9 +55,9 @@ public class EPASGroupsResource {
*/
@GetMapping("/groups/{id}")
public ResponseEntity<EPASGroups> getEPASGroupsById(@PathVariable String id) {
log.info("REST request to get ePAS Groups by Id: {}", id);
logger.info("REST request to get ePAS Groups by Id: {}", id);
EPASGroups epasGroups = epasGroupsService.getById(id);
log.info("Retrieved Groups: {}", epasGroups);
logger.info("Retrieved Groups: {}", epasGroups);
return ResponseUtil.wrapOrNotFound(Optional.of(epasGroups));
}
@ -73,7 +73,7 @@ public class EPASGroupsResource {
*/
@GetMapping("/groups")
public ResponseEntity<List<EPASGroups>> getEPASGroups(@RequestParam("officeId") String id) {
log.info("REST request to get ePAS Groups list for Office: {}",id);
logger.info("REST request to get ePAS Groups list for Office: {}",id);
List<EPASGroups> epasGroupsList = epasGroupsService.getList(id);
return ResponseUtil.wrapOrNotFound(Optional.of(epasGroupsList));
@ -96,7 +96,7 @@ public class EPASGroupsResource {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<EPASGroups> createEPASGroups(@Valid @RequestBody EPASGroupsDTO epasGroupsDTO)
throws URISyntaxException {
log.debug("REST request to create EPAS Group: {}", epasGroupsDTO);
logger.debug("REST request to create EPAS Group: {}", epasGroupsDTO);
if (epasGroupsDTO.getId() != null) {
throw new BadRequestAlertException("A new ePAS Group already have an ID", "EPASGroups", "idexists");
@ -122,7 +122,7 @@ public class EPASGroupsResource {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<EPASGroups> updateEPASGroupsById(@PathVariable String id,
@Valid @RequestBody EPASGroupsDTO epasGroupsDTO) {
log.debug("REST request to update ePAS Groups : {} by {}", id, epasGroupsDTO);
logger.debug("REST request to update ePAS Groups : {} by {}", id, epasGroupsDTO);
epasGroupsService.updateById(id,epasGroupsDTO);
EPASGroups updatedEPASGroups=epasGroupsService.getById(id);
Optional<EPASGroups> oEPASGroups = Optional.of(updatedEPASGroups);
@ -144,7 +144,7 @@ public class EPASGroupsResource {
@DeleteMapping("/groups/{id}")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Void> deleteEPASGroupById(@PathVariable String id) {
log.debug("REST request to delete ePAS Group by id: {}", id);
logger.debug("REST request to delete ePAS Group by id: {}", id);
epasGroupsService.deleteById(id);
return ResponseEntity.noContent()
.headers(HeaderUtil.createAlert(applicationName, "A Group is deleted with identifier " + id, id))

View File

@ -21,7 +21,7 @@ import it.cnr.isti.epasmed.epas.service.EPASLeavesService;
@RequestMapping("/api/epas")
public class EPASLeavesResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -49,15 +49,15 @@ public class EPASLeavesResource {
@RequestParam("year") String year) {
List<EPASLeaves> epasLeavesList = null;
if (id.isPresent()) {
log.info("REST request to get ePAS Leaves by Person: {}", id.get());
logger.info("REST request to get ePAS Leaves by Person: {}", id.get());
epasLeavesList = epasLeavesService.getLeavesByPersonId(id.get(),year);
} else {
if (fiscalCode.isPresent()) {
log.info("REST request to get ePAS Leaves by Person fiscal code: {}", fiscalCode.get());
logger.info("REST request to get ePAS Leaves by Person fiscal code: {}", fiscalCode.get());
epasLeavesList = epasLeavesService.getLeavesByPersonFiscalcode(fiscalCode.get(), year);
} else {
if (email.isPresent()) {
log.info("REST request to get ePAS Leaves by Person email: {}", email.get());
logger.info("REST request to get ePAS Leaves by Person email: {}", email.get());
epasLeavesList = epasLeavesService.getLeavesByPersonEmail(email.get(), year);
} else {
return ResponseUtil.wrapOrNotFound(Optional.of(epasLeavesList), HeaderUtil.createFailureAlert(applicationName,false,
@ -66,7 +66,7 @@ public class EPASLeavesResource {
}
}
}
log.info("Retrieved List of Leaves: {}", epasLeavesList);
logger.info("Retrieved List of Leaves: {}", epasLeavesList);
return ResponseUtil.wrapOrNotFound(Optional.of(epasLeavesList));
}
@ -82,7 +82,7 @@ public class EPASLeavesResource {
@GetMapping("/leaves/byOfficeAndYear")
public ResponseEntity<List<EPASLeaves>> getEPASLeavesByOfficeCodeId(@RequestParam("officeCodeId") String officeCodeId,
@RequestParam("year") String year) {
log.info("REST request to get ePAS Leaves by office: codeId={}, year={}", officeCodeId, year);
logger.info("REST request to get ePAS Leaves by office: codeId={}, year={}", officeCodeId, year);
List<EPASLeaves> epasLeavesList = epasLeavesService.getLeavesByOfficeCodeId(officeCodeId, year);
return ResponseUtil.wrapOrNotFound(Optional.of(epasLeavesList));

View File

@ -22,7 +22,7 @@ import it.cnr.isti.epasmed.epas.service.EPASOffSiteWorksService;
@RequestMapping("/api/epas")
public class EPASOffSiteWorksResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -54,15 +54,15 @@ public class EPASOffSiteWorksResource {
List<EPASPersonDays> epasOffSiteWorksList = null;
if (id.isPresent()) {
log.info("REST request to get ePAS Off Site Works list by Person id: {}", id.get());
logger.info("REST request to get ePAS Off Site Works list by Person id: {}", id.get());
epasOffSiteWorksList = epasOffSiteWorksService.getListByPersonId(id.get(), year, month);
} else {
if (fiscalCode.isPresent()) {
log.info("REST request to get ePAS Off Site Works list by Person fiscalcode: {}", fiscalCode.get());
logger.info("REST request to get ePAS Off Site Works list by Person fiscalcode: {}", fiscalCode.get());
epasOffSiteWorksList = epasOffSiteWorksService.getListByPersonFiscalCode(fiscalCode.get(), year, month);
} else {
if (email.isPresent()) {
log.info("REST request to get ePAS Off Site Works list by Person email: {}", email.get());
logger.info("REST request to get ePAS Off Site Works list by Person email: {}", email.get());
epasOffSiteWorksList = epasOffSiteWorksService.getListByPersonEmail(email.get(), year, month);
} else {
return ResponseUtil.wrapOrNotFound(Optional.of(epasOffSiteWorksList), HeaderUtil.createFailureAlert(applicationName,false,
@ -71,7 +71,7 @@ public class EPASOffSiteWorksResource {
}
}
}
log.info("Retrieved Off Site Works list: {}", epasOffSiteWorksList);
logger.info("Retrieved Off Site Works list: {}", epasOffSiteWorksList);
return ResponseUtil.wrapOrNotFound(Optional.of(epasOffSiteWorksList));
}
@ -90,7 +90,7 @@ public class EPASOffSiteWorksResource {
@GetMapping("/offsiteworks/byOffice")
public ResponseEntity<List<EPASOffSiteWorks>> getOffSiteWorksByOffice(@RequestParam("codeId") String id,
@RequestParam("year") String year, @RequestParam("month") String month) {
log.info("REST request to get ePAS Off Site Works list: officeCodeId={}, year={}, month={}", id,year,month);
logger.info("REST request to get ePAS Off Site Works list: officeCodeId={}, year={}, month={}", id,year,month);
List<EPASOffSiteWorks> epasOffSiteWorksList = epasOffSiteWorksService.getListByOfficeCodeId(id, year, month);
return ResponseUtil.wrapOrNotFound(Optional.of(epasOffSiteWorksList));

View File

@ -0,0 +1,64 @@
package it.cnr.isti.epasmed.web.rest.epas;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.github.jhipster.web.util.HeaderUtil;
import io.github.jhipster.web.util.ResponseUtil;
import it.cnr.isti.epasmed.epas.dto.EPASPersonWorkingTimeDTO;
import it.cnr.isti.epasmed.epas.service.EPASPersonWorkingTimeService;
@RestController
@RequestMapping("/api/epas")
public class EPASPersonWorkingTimeResource {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
private final EPASPersonWorkingTimeService epasPersonWorkingTimeService;
public EPASPersonWorkingTimeResource(EPASPersonWorkingTimeService epasWorkingTimeByPersonService) {
this.epasPersonWorkingTimeService = epasWorkingTimeByPersonService;
}
/**
* {@code GET /personworkingtime/byPerson} : get personworkingtime by person
*
* @param id the id of the person.
* @param fiscalCode the fiscal code of the person.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body
* the EPAS Person Working Time, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/personworkingtime/byPerson")
public ResponseEntity<EPASPersonWorkingTimeDTO> getEPASChildrenByPerson(@RequestParam("id") Optional<String> id,
@RequestParam("fiscalCode") Optional<String> fiscalCode) {
EPASPersonWorkingTimeDTO epasPersonWorkingTime = null;
if (id.isPresent()) {
logger.info("REST request to get ePAS Person Working Time by Person id: {}", id.get());
epasPersonWorkingTime = epasPersonWorkingTimeService.getByPersonId(id.get());
} else {
if (fiscalCode.isPresent()) {
logger.info("REST request to get ePAS Person Working Time by Person fiscalcode: {}", fiscalCode.get());
epasPersonWorkingTime = epasPersonWorkingTimeService.getByPersonFiscalCode(fiscalCode.get());
} else {
return ResponseUtil.wrapOrNotFound(Optional.of(epasPersonWorkingTime),
HeaderUtil.createFailureAlert(applicationName, false, "", "", "Invalid parameter in call"));
}
}
logger.info("Retrieved EPAS Person Working Time: {}", epasPersonWorkingTime);
return ResponseUtil.wrapOrNotFound(Optional.of(epasPersonWorkingTime));
}
}

View File

@ -34,7 +34,7 @@ import it.cnr.isti.epasmed.web.rest.errors.BadRequestAlertException;
@RequestMapping("/api/epas")
public class EPASPersonsResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -55,9 +55,9 @@ public class EPASPersonsResource {
*/
@GetMapping("/persons/{id}")
public ResponseEntity<EPASPersons> getEPASPersonsById(@PathVariable String id) {
log.info("REST request to get ePAS Persons by Id: {}", id);
logger.info("REST request to get ePAS Persons by Id: {}", id);
EPASPersons epasPersons = epasPersonsService.getById(id);
log.info("Retrieved Persons: {}", epasPersons);
logger.info("Retrieved Persons: {}", epasPersons);
return ResponseUtil.wrapOrNotFound(Optional.of(epasPersons));
}
@ -71,9 +71,9 @@ public class EPASPersonsResource {
*/
@GetMapping("/persons/show")
public ResponseEntity<EPASPersons> getEPASPersonsByFiscalCode(@RequestParam("fiscalCode") String fc) {
log.info("REST request to get ePAS Persons by fiscal code: {}", fc);
logger.info("REST request to get ePAS Persons by fiscal code: {}", fc);
EPASPersons epasPersons = epasPersonsService.getByFiscalCode(fc);
log.info("Retrieved Persons: {}", epasPersons);
logger.info("Retrieved Persons: {}", epasPersons);
return ResponseUtil.wrapOrNotFound(Optional.of(epasPersons));
}
@ -87,7 +87,7 @@ public class EPASPersonsResource {
*/
@GetMapping("/persons")
public ResponseEntity<List<EPASPersons>> getEPASPersons(@RequestParam("officeId") String id) {
log.info("REST request to get ePAS Persons list for Office: {}", id);
logger.info("REST request to get ePAS Persons list for Office: {}", id);
List<EPASPersons> epasPersonsList = epasPersonsService.getList(id);
return ResponseUtil.wrapOrNotFound(Optional.of(epasPersonsList));
@ -110,7 +110,7 @@ public class EPASPersonsResource {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<EPASPersons> createEPASPersons(@Valid @RequestBody EPASPersonsDTO epasPersonsDTO)
throws URISyntaxException {
log.debug("REST request to create EPAS Person: {}", epasPersonsDTO);
logger.debug("REST request to create EPAS Person: {}", epasPersonsDTO);
if (epasPersonsDTO.getId() != null) {
throw new BadRequestAlertException("A new ePAS Person already have an ID", "EPASPersons", "idexists");
@ -136,7 +136,7 @@ public class EPASPersonsResource {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<EPASPersons> updateEPASPersonsById(@PathVariable String id,
@Valid @RequestBody EPASPersonsDTO epasPersonsDTO) {
log.debug("REST request to update ePAS Persons : {} by {}", id, epasPersonsDTO);
logger.debug("REST request to update ePAS Persons : {} by {}", id, epasPersonsDTO);
epasPersonsService.updateById(id, epasPersonsDTO);
EPASPersons updatedEPASPersons=epasPersonsService.getById(id);
Optional<EPASPersons> oEPASPersons = Optional.of(updatedEPASPersons);
@ -158,7 +158,7 @@ public class EPASPersonsResource {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<EPASPersons> updateEPASPersons(@RequestParam("fiscalCode") String fc,
@Valid @RequestBody EPASPersonsDTO epasPersonsDTO) {
log.debug("REST request to update ePAS Persons : {}", epasPersonsDTO);
logger.debug("REST request to update ePAS Persons : {}", epasPersonsDTO);
epasPersonsService.updateByFiscalCode(fc, epasPersonsDTO);
EPASPersons updatedEPASPersons=epasPersonsService.getByFiscalCode(fc);
Optional<EPASPersons> oEPASPersons = Optional.of(updatedEPASPersons);
@ -176,7 +176,7 @@ public class EPASPersonsResource {
@DeleteMapping("/persons/{id}")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Void> deleteEPASPersonById(@PathVariable String id) {
log.debug("REST request to delete ePAS Person by id: {}", id);
logger.debug("REST request to delete ePAS Person by id: {}", id);
epasPersonsService.deleteById(id);
return ResponseEntity.noContent()
.headers(HeaderUtil.createAlert(applicationName, "A Person is deleted with identifier " + id, id))
@ -192,7 +192,7 @@ public class EPASPersonsResource {
@DeleteMapping("/persons/delete")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Void> deleteEPASPersonByFiscalCode(@RequestParam("fiscalCode") String fc) {
log.debug("REST request to delete ePAS Person by fiscal code: {}", fc);
logger.debug("REST request to delete ePAS Person by fiscal code: {}", fc);
epasPersonsService.deleteByFiscalCode(fc);
return ResponseEntity.noContent()
.headers(HeaderUtil.createAlert(applicationName, "A Person is deleted with fiscal code " + fc, fc))

View File

@ -30,7 +30,7 @@ import it.cnr.isti.epasmed.web.rest.errors.BadRequestAlertException;
@RequestMapping("/api/epas")
public class EPASStampingsResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -51,9 +51,9 @@ public class EPASStampingsResource {
*/
@GetMapping("/stampings/{id}")
public ResponseEntity<EPASStampings> getEPASStampingsById(@PathVariable String id) {
log.info("REST request to get ePAS Stampings by Id: {}", id);
logger.info("REST request to get ePAS Stampings by Id: {}", id);
EPASStampings epasStampings = epasStampingsService.getById(id);
log.info("Retrieved Stampings: {}", epasStampings);
logger.info("Retrieved Stampings: {}", epasStampings);
return ResponseUtil.wrapOrNotFound(Optional.of(epasStampings));
}
@ -75,7 +75,7 @@ public class EPASStampingsResource {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<EPASStampings> createEPASStampings(@Valid @RequestBody EPASStampingsDTO epasStampingsDTO)
throws URISyntaxException {
log.debug("REST request to create EPAS Stamping: {}", epasStampingsDTO);
logger.debug("REST request to create EPAS Stamping: {}", epasStampingsDTO);
EPASStampings createdEPASStampings = epasStampingsService.create(epasStampingsDTO);
return ResponseEntity.created(new URI("/api/epas/stampings/" + createdEPASStampings.getId()))

View File

@ -21,7 +21,7 @@ import it.cnr.isti.epasmed.epas.service.EPASTimeCardsService;
@RequestMapping("/api/epas")
public class EPASTimeCardsResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -53,15 +53,15 @@ public class EPASTimeCardsResource {
EPASTimeCards epasTimeCards = null;
if (id.isPresent()) {
log.info("REST request to get ePAS TimeCards by Person id: {}", id.get());
logger.info("REST request to get ePAS TimeCards by Person id: {}", id.get());
epasTimeCards = epasTimeCardsService.getTimeCardByPersonId(id.get(), year, month);
} else {
if (fiscalCode.isPresent()) {
log.info("REST request to get ePAS TimeCards by Person fiscalcode: {}", fiscalCode.get());
logger.info("REST request to get ePAS TimeCards by Person fiscalcode: {}", fiscalCode.get());
epasTimeCards = epasTimeCardsService.getTimeCardByPersonFiscalCode(fiscalCode.get(), year, month);
} else {
if (email.isPresent()) {
log.info("REST request to get ePAS TimeCards by Person email: {}", email.get());
logger.info("REST request to get ePAS TimeCards by Person email: {}", email.get());
epasTimeCards = epasTimeCardsService.getTimeCardByPersonEmail(email.get(), year, month);
} else {
return ResponseUtil.wrapOrNotFound(Optional.of(epasTimeCards), HeaderUtil.createFailureAlert(applicationName,false,
@ -70,7 +70,7 @@ public class EPASTimeCardsResource {
}
}
}
log.info("Retrieved Certification: {}", epasTimeCards);
logger.info("Retrieved Certification: {}", epasTimeCards);
return ResponseUtil.wrapOrNotFound(Optional.of(epasTimeCards));
}
@ -89,7 +89,7 @@ public class EPASTimeCardsResource {
@GetMapping("/timecards/byOffice")
public ResponseEntity<List<EPASTimeCards>> getEPASTimeCardByOffice(@RequestParam("codeId") String id,
@RequestParam("year") String year, @RequestParam("month") String month) {
log.info("REST request to get ePAS TimeCard list: officeCodeId={}, year={}, month={}", id,year,month);
logger.info("REST request to get ePAS TimeCard list: officeCodeId={}, year={}, month={}", id,year,month);
List<EPASTimeCards> epasTimeCardsList = epasTimeCardsService.getTimeCardByOfficeCodeId(id, year, month);
return ResponseUtil.wrapOrNotFound(Optional.of(epasTimeCardsList));

View File

@ -19,7 +19,7 @@ import it.cnr.isti.epasmed.epas.service.EPASValidatesService;
@RequestMapping("/api/epas")
public class EPASValidatesResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -43,9 +43,9 @@ public class EPASValidatesResource {
@GetMapping("/validates/is")
public ResponseEntity<String> isValidatesByPersonEmail(@RequestParam("email") String email,
@RequestParam("year") String year, @RequestParam("month") String month) {
log.info("REST request to ePAS if is Validates by Person Email: email={}, year={}, month={}", email,year,month);
logger.info("REST request to ePAS if is Validates by Person Email: email={}, year={}, month={}", email,year,month);
String validates = epasValidatesService.isValidatesByPersonEmail(email, year, month);
log.info("Retrieved Validates: {}", validates);
logger.info("Retrieved Validates: {}", validates);
return ResponseUtil.wrapOrNotFound(Optional.of(validates));
}
@ -63,7 +63,7 @@ public class EPASValidatesResource {
@GetMapping("/validates")
public ResponseEntity<EPASValidates> getEPASValidatesByOfficeCodeId(@RequestParam("officeCodeId") String officeCodeId,
@RequestParam("year") String year, @RequestParam("month") String month) {
log.info("REST request to get ePAS TimeCard list: officeCodeId={}, year={}, month={}", officeCodeId,year,month);
logger.info("REST request to get ePAS TimeCard list: officeCodeId={}, year={}, month={}", officeCodeId,year,month);
EPASValidates epasValidates = epasValidatesService.getValidatesByOfficeCodeId(officeCodeId, year, month);
return ResponseUtil.wrapOrNotFound(Optional.of(epasValidates));

View File

@ -21,7 +21,7 @@ import it.cnr.isti.epasmed.epas.service.EPASWorkingTimeTypesService;
@RequestMapping("/api/epas")
public class EPASWorkingTimeTypesResource {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
@Value("${jhipster.clientApp.name}")
private String applicationName;
@ -42,9 +42,9 @@ public class EPASWorkingTimeTypesResource {
*/
@GetMapping("/workingtimetypes/{id}")
public ResponseEntity<EPASWorkingTimeTypes> getEPASWorkingTimeTypesById(@PathVariable String id) {
log.info("REST request to get ePAS WorkingTimeTypes by Id: {}", id);
logger.info("REST request to get ePAS WorkingTimeTypes by Id: {}", id);
EPASWorkingTimeTypes epasWorkingTimeTypes = epasWorkingTimeTypesService.getById(id);
log.info("Retrieved WorkingTimeTypes: {}", epasWorkingTimeTypes);
logger.info("Retrieved WorkingTimeTypes: {}", epasWorkingTimeTypes);
return ResponseUtil.wrapOrNotFound(Optional.of(epasWorkingTimeTypes));
}
@ -58,7 +58,7 @@ public class EPASWorkingTimeTypesResource {
*/
@GetMapping("/workingtimetypes")
public ResponseEntity<List<EPASWorkingTimeTypes>> getEPASWorkingTimeTypes(@RequestParam("officeCodeId") String officeCodeId) {
log.info("REST request to get ePAS WorkingTimeTypes list for Office: {}", officeCodeId);
logger.info("REST request to get ePAS WorkingTimeTypes list for Office: {}", officeCodeId);
List<EPASWorkingTimeTypes> epasWorkingTimeTypesList = epasWorkingTimeTypesService.getListByOfficeCodeId(officeCodeId);
return ResponseUtil.wrapOrNotFound(Optional.of(epasWorkingTimeTypesList));

View File

@ -11,6 +11,7 @@ import java.io.UnsupportedEncodingException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -49,25 +50,30 @@ import it.cnr.isti.epasmed.web.rest.TestUtil;
@AutoConfigureMockMvc
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
@SpringBootTest(classes = EpasmedApp.class)
@EnabledIf("false")
@EnabledIf("true")
public class EPASContractsResourceIT {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());
private static final String OFFICE_DEFAULT_ID = "1";
//private static final String OFFICE_DEFAULT_CODEID = "225200";
private static final String PERSON_DEFAULT_ID = "1";
private static final String PERSON_DEFAULT_NAME = "Giancarlo";
private static final String PERSON_DEFAULT_SURNAME = "Panichi";
private static final String PERSON_DEFAULT_FISCAL_CODE = "PNCGCR75S04L103G";
private static final String PERSON_DEFAULT_FISCAL_CODE = "MTAGPP68D15D976W"; // "MROGLI68H29E625F";
// //"PNCGCR75S04L103G";
private static final String PERSON_DEFAULT_EMAIL = "giancarlo.panichi@cnr.it";
private static final String PERSON_DEFAULT_QUALIFICATION = "6";
private static final String CONTRACT_DEFAULT_ID = "175";
private static final String CONTRACT_DEFAULT_ID = "113";
private static final String CONTRACT_DEFAULT_BEGINDATE = "2018-12-27";
private static final String CONTRACT_DEFAUL_ENDDATE = null;
private static final String CONTRACT_DEFAULT_ENDCONTRACT = null;
private static final boolean CONTRACT_DEFAULT_ONCERTIFICATE = true;
private static final String CONTRACT_DEFAULT_PREVIOUSCONTRACT = null;
private static final String CONTRACT_DEFAULT_EXTERNALID="2496";
private static final String CONTRACT_DEFAULT_EXTERNALID = "2496";
private static final String CONTRACT_UPDATE_ENDATE = "2021-12-31";
@ -120,7 +126,7 @@ public class EPASContractsResourceIT {
@BeforeEach
public void initTest() {
for (String profileName : environment.getActiveProfiles()) {
log.info("Currently active profile - " + profileName);
logger.info("Currently active profile - " + profileName);
}
epasContracts = createEPASContracts();
epasContractsDTO = epasContractsMapper.epasContractsToEPASContractsDTO(epasContracts);
@ -142,13 +148,32 @@ public class EPASContractsResourceIT {
restEPASContractsMockMvc.perform(get("/api/epas/contracts/byPerson?fiscalCode=" + PERSON_DEFAULT_FISCAL_CODE))
.andExpect(status().isOk());
}
@Test
public void getContractByPersonEmail() throws Exception {
restEPASContractsMockMvc.perform(get("/api/epas/contracts/byPerson?email=" + PERSON_DEFAULT_EMAIL))
.andExpect(status().isOk());
}
@Test
public void getContractMap() throws Exception {
MvcResult result = restEPASContractsMockMvc
.perform(get("/api/epas/contracts/map?officeId=" + OFFICE_DEFAULT_ID))
.andExpect(status().isOk()).andReturn();
ObjectMapper mapper = new ObjectMapper();
LinkedHashMap<String, EPASContracts> map = mapper.readValue(result.getResponse().getContentAsString(),
new TypeReference<LinkedHashMap<String, EPASContracts>>() {
});
for (String key : map.keySet()) {
EPASContracts contract = map.get(key);
if (contract == null) {
logger.info("PersonId: {} has last contract null.", key);
}
}
}
@Test
public void createContract() throws Exception {
restEPASContractsMockMvc
@ -168,7 +193,7 @@ public class EPASContractsResourceIT {
EPASContracts epasContracts = mapper.readValue(mvcResult.getResponse().getContentAsByteArray(),
EPASContracts.class);
log.info("Updated EPAS Contract by id: " + epasContracts);
logger.info("Updated EPAS Contract by id: " + epasContracts);
}
@Test
@ -176,7 +201,7 @@ public class EPASContractsResourceIT {
restEPASContractsMockMvc
.perform(delete("/api/epas/contracts/setPreviousContract?id=" + CONTRACT_DEFAULT_ID).with(csrf()))
.andExpect(status().is2xxSuccessful());
log.info("Set to Previous EPAS Contract by id: " + CONTRACT_DEFAULT_ID);
logger.info("Set to Previous EPAS Contract by id: " + CONTRACT_DEFAULT_ID);
}
@Test
@ -184,32 +209,32 @@ public class EPASContractsResourceIT {
restEPASContractsMockMvc
.perform(delete("/api/epas/contracts/unsetPreviousContract?id=" + CONTRACT_DEFAULT_ID).with(csrf()))
.andExpect(status().is2xxSuccessful());
log.info("Set to Previous EPAS Contract by id: " + CONTRACT_DEFAULT_ID);
logger.info("Set to Previous EPAS Contract by id: " + CONTRACT_DEFAULT_ID);
}
@Test
public void deleteContractById() throws Exception {
restEPASContractsMockMvc.perform(delete("/api/epas/contracts/" + CONTRACT_DEFAULT_ID).with(csrf()))
.andExpect(status().is2xxSuccessful());
log.info("Deleted EPAS Contract by id: " + CONTRACT_DEFAULT_ID);
logger.info("Deleted EPAS Contract by id: " + CONTRACT_DEFAULT_ID);
}
@Test
public void istiUpdateContract() throws Exception {
String userDirectory = System.getProperty("user.dir");
log.info(userDirectory);
logger.info(userDirectory);
List<EPASContracts> istiContracts = null;
try (Stream<String> stream = Files
.lines(Paths.get("src/test/resources/it/cnr/isti/epasmed/web/rest/epas/posizioniISTI.csv"))) {
istiContracts = stream.skip(1).map(istiMapToContract).collect(Collectors.toList());
} catch (Exception e) {
log.error(e.getLocalizedMessage(), e);
logger.error(e.getLocalizedMessage(), e);
return;
}
log.info("ISTI Contracts loaded");
logger.info("ISTI Contracts loaded");
for (EPASContracts c : istiContracts) {
log.info("Contract: {}", c);
logger.info("Contract: {}", c);
}
List<EPASContracts> enrichedISTIContracts = new ArrayList<>();
@ -221,15 +246,15 @@ public class EPASContractsResourceIT {
}
}
log.info("ISTI enriched contracts with persons");
logger.info("ISTI enriched contracts with persons");
List<EPASContracts> updatableContracts=new ArrayList<>();
List<EPASContracts> updatableContracts = new ArrayList<>();
for (EPASContracts ec : enrichedISTIContracts) {
if (ec.getPerson() != null && ec.getPerson().getFiscalCode() != null
&& !ec.getPerson().getFiscalCode().isEmpty()) {
List<EPASContracts> personContract=retrieveContractsByFiscalCode(ec);
for(EPASContracts persCont:personContract) {
if(persCont.getBeginDate().compareTo(ec.getBeginDate())==0) {
List<EPASContracts> personContract = retrieveContractsByFiscalCode(ec);
for (EPASContracts persCont : personContract) {
if (persCont.getBeginDate().compareTo(ec.getBeginDate()) == 0) {
persCont.setExternalId(ec.getExternalId());
updatableContracts.add(persCont);
break;
@ -238,26 +263,26 @@ public class EPASContractsResourceIT {
}
}
log.info("ISTI Updateble contracts created");
List<EPASContractsDTO> updatableContractsDTO=epasContractsMapper.epasContractsToEPASContractsDTOs(updatableContracts);
for(EPASContractsDTO u: updatableContractsDTO) {
log.info("Contract Updatable: {}",u);
restEPASContractsMockMvc
.perform(put("/api/epas/contracts/" + u.getId()).contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(u)).with(csrf()))
logger.info("ISTI Updateble contracts created");
List<EPASContractsDTO> updatableContractsDTO = epasContractsMapper
.epasContractsToEPASContractsDTOs(updatableContracts);
for (EPASContractsDTO u : updatableContractsDTO) {
logger.info("Contract Updatable: {}", u);
restEPASContractsMockMvc.perform(put("/api/epas/contracts/" + u.getId())
.contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(u)).with(csrf()))
.andExpect(status().isOk());
}
log.info("ISTI Update contracts end");
logger.info("ISTI Update contracts end");
}
private List<EPASContracts> retrieveContractsByFiscalCode(EPASContracts ec)
throws Exception, JsonProcessingException, JsonMappingException, UnsupportedEncodingException {
MvcResult result=restEPASContractsMockMvc
MvcResult result = restEPASContractsMockMvc
.perform(get("/api/epas/contracts/byPerson?fiscalCode=" + ec.getPerson().getFiscalCode()))
.andExpect(status().isOk()).andReturn();
ObjectMapper mapper = new ObjectMapper();

View File

@ -33,13 +33,14 @@ public class EPASLeavesResourceIT {
// private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa";
// private static final String OFFICE_DEFAULT_CODE = "074000";
private static final String OFFICE_DEFAULT_CODEID = "225200";
private static final String PERSON_DEFAULT_ID = "113";
//private static final String PERSON_DEFAULT_NAME = "Giuseppe";
//private static final String PERSON_DEFAULT_SURNAME = "Amato";
private static final String PERSON_DEFAULT_FISCAL_CODE = "MTAGPP68D15D976W";
private static final String PERSON_DEFAULT_EMAIL = "giuseppe.amato@cnr.it";
//private static final String PERSON_DEFAULT_QUALIFICATION = "2";
private static final String YEAR_DEFAULT="2022";
private static final String PERSON_DEFAULT_ID = "xxx";
//private static final String PERSON_DEFAULT_NAME = "Giulio";
//private static final String PERSON_DEFAULT_SURNAME = "Mori";
private static final String PERSON_DEFAULT_FISCAL_CODE = "MROGLI68H29E625F";
private static final String PERSON_DEFAULT_EMAIL = "giulio.mori@cnr.it";
@Autowired
@ -59,7 +60,7 @@ public class EPASLeavesResourceIT {
@Test
public void getEPASLeavesByPersonId() throws Exception {
restEPASLeavesMockMvc.perform(get("/api/epas/leaves/byPersonAndYear?id=" + PERSON_DEFAULT_ID + "&year=2021"))
restEPASLeavesMockMvc.perform(get("/api/epas/leaves/byPersonAndYear?id=" + PERSON_DEFAULT_ID + "&year="+YEAR_DEFAULT))
.andExpect(status().isOk());
}
@ -67,21 +68,21 @@ public class EPASLeavesResourceIT {
public void getEPASLeaveByPersonFiscalcode() throws Exception {
restEPASLeavesMockMvc
.perform(
get("/api/epas/leaves/byPersonAndYear?fiscalCode=" + PERSON_DEFAULT_FISCAL_CODE + "&year=2021"))
get("/api/epas/leaves/byPersonAndYear?fiscalCode=" + PERSON_DEFAULT_FISCAL_CODE + "&year="+YEAR_DEFAULT))
.andExpect(status().isOk());
}
@Test
public void getEPASLeavesByPersonEmail() throws Exception {
restEPASLeavesMockMvc
.perform(get("/api/epas/leaves/byPersonAndYear?email=" + PERSON_DEFAULT_EMAIL + "&year=2021"))
.perform(get("/api/epas/leaves/byPersonAndYear?email=" + PERSON_DEFAULT_EMAIL + "&year="+YEAR_DEFAULT))
.andExpect(status().isOk());
}
@Test
public void getEPASLeavesByOfficeCodeId() throws Exception {
restEPASLeavesMockMvc
.perform(get("/api/epas/leaves/byOfficeAndYear?officeCodeId=" + OFFICE_DEFAULT_CODEID + "&year=2021"))
.perform(get("/api/epas/leaves/byOfficeAndYear?officeCodeId=" + OFFICE_DEFAULT_CODEID + "&year="+YEAR_DEFAULT))
.andExpect(status().isOk());
}

View File

@ -24,7 +24,7 @@ import it.cnr.isti.epasmed.security.AuthoritiesConstants;
@AutoConfigureMockMvc
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
@SpringBootTest(classes = EpasmedApp.class)
@EnabledIf("true")
@EnabledIf("false")
public class EPASOffSiteWorksResourceIT {
private final Logger log = LoggerFactory.getLogger(getClass());

View File

@ -0,0 +1,88 @@
package it.cnr.isti.epasmed.web.rest.epas;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.Environment;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit.jupiter.EnabledIf;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import it.cnr.isti.epasmed.EpasmedApp;
import it.cnr.isti.epasmed.epas.dto.EPASPersonWorkingTimeDTO;
import it.cnr.isti.epasmed.security.AuthoritiesConstants;
/**
* Integration tests for the {@link EPASPersonWorkingTimeResource} REST
* controller.
*/
@AutoConfigureMockMvc
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
@SpringBootTest(classes = EpasmedApp.class)
@EnabledIf("false")
public class EPASPersonWorkingTimeIT {
private static final Logger logger = LoggerFactory.getLogger(EPASPersonWorkingTimeIT.class);
// private static final String OFFICE_DEFAULT_ID = "1";
// private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa";
// private static final String OFFICE_DEFAULT_CODE = "074000";
// private static final String OFFICE_DEFAULT_CODEID = "225200";
private static final String PERSON_DEFAULT_ID = "78";
//private static final String PERSON_DEFAULT_FISCAL_CODE = "MROGLI68H29E625F";
private static final String PERSON_DEFAULT_FISCAL_CODE = "PNCGCR75S04L103G";
@Autowired
private MockMvc restEPASPersonWorkingTimeMockMvc;
@Autowired
private Environment environment;
@BeforeEach
public void initTest() {
for (String profileName : environment.getActiveProfiles()) {
logger.info("Currently active profile - " + profileName);
}
}
@Test
public void getPersonWorkingTimeByPersonId() throws Exception {
MvcResult result = restEPASPersonWorkingTimeMockMvc
.perform(get("/api/epas/personworkingtime/byPerson?id=" + PERSON_DEFAULT_ID)).andExpect(status().isOk())
.andReturn();
ObjectMapper mapper = new ObjectMapper();
EPASPersonWorkingTimeDTO epasWTT = mapper.readValue(result.getResponse().getContentAsString(),
new TypeReference<EPASPersonWorkingTimeDTO>() {
});
logger.info("EPASPersonWorkingTime: {}", epasWTT);
}
@Test
public void getPersonWorkingTimeByPersonFiscalCode() throws Exception {
MvcResult result = restEPASPersonWorkingTimeMockMvc
.perform(get("/api/epas/personworkingtime/byPerson?fiscalCode=" + PERSON_DEFAULT_FISCAL_CODE))
.andExpect(status().isOk()).andReturn();
ObjectMapper mapper = new ObjectMapper();
EPASPersonWorkingTimeDTO epasWTT = mapper.readValue(result.getResponse().getContentAsString(),
new TypeReference<EPASPersonWorkingTimeDTO>() {
});
logger.info("EPASPersonWorkingTime: {}", epasWTT);
}
}

View File

@ -121,7 +121,7 @@ public class EPASPersonsResourceIT {
@Test
public void getPersonByFiscalCode() throws Exception {
restEPASPersonsMockMvc.perform(get("/api/epas/persons/show?fiscalCode=MTAGPP68D15D976W")).andExpect(status().isOk());
restEPASPersonsMockMvc.perform(get("/api/epas/persons/show?fiscalCode="+PERSON_DEFAULT_FISCAL_CODE)).andExpect(status().isOk());
}
@Test

View File

@ -38,11 +38,13 @@ public class EPASWorkingTimeTypesResourceIT {
private static final Logger logger = LoggerFactory.getLogger(EPASWorkingTimeTypesResourceIT.class);
//private static final String OFFICE_DEFAULT_ID = "1";
// private static final String OFFICE_DEFAULT_ID = "1";
// private static final String OFFICE_DEFAULT_NAME = "ISTI - Pisa";
// private static final String OFFICE_DEFAULT_CODE = "074000";
private static final String OFFICE_DEFAULT_CODEID = "225200";
private static final String DEFAULT_WORKING_TIME_TYPE_ID = "1";
@Autowired
private MockMvc restEPASWorkingTimeTypesMockMvc;
@ -58,8 +60,9 @@ public class EPASWorkingTimeTypesResourceIT {
@Test
public void getWorkingTimeTypesById() throws Exception {
MvcResult result = restEPASWorkingTimeTypesMockMvc.perform(get("/api/epas/workingtimetypes/" + 1))
.andExpect(status().isOk()).andReturn();
MvcResult result = restEPASWorkingTimeTypesMockMvc
.perform(get("/api/epas/workingtimetypes/" + DEFAULT_WORKING_TIME_TYPE_ID)).andExpect(status().isOk())
.andReturn();
ObjectMapper mapper = new ObjectMapper();
EPASWorkingTimeTypes epasWTT = mapper.readValue(result.getResponse().getContentAsString(),
new TypeReference<EPASWorkingTimeTypes>() {
@ -73,8 +76,8 @@ public class EPASWorkingTimeTypesResourceIT {
@Test
public void getWorkingTimeTypesList() throws Exception {
MvcResult result = restEPASWorkingTimeTypesMockMvc
.perform(get("/api/epas/workingtimetypes?officeCodeId=" + OFFICE_DEFAULT_CODEID)).andExpect(status().isOk())
.andReturn();
.perform(get("/api/epas/workingtimetypes?officeCodeId=" + OFFICE_DEFAULT_CODEID))
.andExpect(status().isOk()).andReturn();
ObjectMapper mapper = new ObjectMapper();
List<EPASWorkingTimeTypes> epasWTTList = mapper.readValue(result.getResponse().getContentAsString(),