Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-35465, MOSIP-34925 : Update holiday fix #1099

Open
wants to merge 4 commits into
base: release-1.3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
package io.mosip.kernel.masterdata.entity;

import java.io.Serializable;
import java.time.LocalDate;

import io.mosip.kernel.masterdata.entity.id.HolidayID;
import jakarta.persistence.AttributeOverride;
import jakarta.persistence.AttributeOverrides;

//github.com/mosip/mosip.git

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.Table;

import io.mosip.kernel.masterdata.entity.id.HolidayID;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDate;

/**
*
* @author Abhishek Kumar
Expand All @@ -43,13 +39,11 @@ public class Holiday extends BaseEntity implements Serializable {
@AttributeOverride(name = "holidayDate", column = @Column(name = "holiday_date", nullable = false)),
@AttributeOverride(name = "locationCode", column = @Column(name = "location_code", nullable = false, length = 36)),
@AttributeOverride(name = "langCode", column = @Column(name = "lang_code", nullable = false, length = 3)) })
@Column(name = "holiday_date", nullable = false)

private LocalDate holidayDate;

@Column(name = "location_code", nullable = false, length = 36)
private String locationCode;

@Column(name = "lang_code", nullable = false, length = 3)
private String langCode;

@Column(name = "holiday_name", nullable = false, length = 64)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
package io.mosip.kernel.masterdata.service.impl;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;

import io.mosip.kernel.masterdata.dto.response.*;
import io.mosip.kernel.masterdata.service.LocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.stereotype.Service;

import io.mosip.kernel.core.dataaccess.exception.DataAccessLayerException;
import io.mosip.kernel.core.http.RequestWrapper;
import io.mosip.kernel.core.util.EmptyCheckUtils;
import io.mosip.kernel.masterdata.constant.HolidayErrorCode;
import io.mosip.kernel.masterdata.constant.LocationErrorCode;
Expand All @@ -36,6 +20,11 @@
import io.mosip.kernel.masterdata.dto.request.SearchDto;
import io.mosip.kernel.masterdata.dto.request.SearchFilter;
import io.mosip.kernel.masterdata.dto.request.SearchSort;
import io.mosip.kernel.masterdata.dto.response.HolidaySearchDto;
import io.mosip.kernel.masterdata.dto.response.PageResponseDto;
import io.mosip.kernel.masterdata.dto.response.FilterResponseCodeDto;
import io.mosip.kernel.masterdata.dto.response.FilterResult;
import io.mosip.kernel.masterdata.dto.response.ColumnCodeValue;
import io.mosip.kernel.masterdata.entity.Holiday;
import io.mosip.kernel.masterdata.entity.Location;
import io.mosip.kernel.masterdata.exception.DataNotFoundException;
Expand All @@ -44,6 +33,7 @@
import io.mosip.kernel.masterdata.repository.HolidayRepository;
import io.mosip.kernel.masterdata.repository.LocationRepository;
import io.mosip.kernel.masterdata.service.HolidayService;
import io.mosip.kernel.masterdata.service.LocationService;
import io.mosip.kernel.masterdata.utils.AuditUtil;
import io.mosip.kernel.masterdata.utils.ExceptionUtils;
import io.mosip.kernel.masterdata.utils.MapperUtils;
Expand All @@ -56,6 +46,26 @@
import io.mosip.kernel.masterdata.validator.FilterColumnValidator;
import io.mosip.kernel.masterdata.validator.FilterTypeEnum;
import io.mosip.kernel.masterdata.validator.FilterTypeValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Set;
import java.util.Optional;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* Service Impl class for Holiday Data
Expand Down Expand Up @@ -89,7 +99,7 @@ public class HolidayServiceImpl implements HolidayService {
@Autowired
private AuditUtil auditUtil;

private static final String UPDATE_HOLIDAY_QUERY = "UPDATE Holiday h SET h.updatedBy = :updatedBy , h.updatedDateTime = :updatedDateTime, h.holidayDesc = :holidayDesc,h.holidayId.holidayDate=:holidayDate,h.holidayId.holidayName = :holidayName WHERE h.holidayId.locationCode = :locationCode and h.holidayId.holidayId = :holidayId and h.holidayId.langCode = :langCode and (h.isDeleted is null or h.isDeleted = false)";
private static final String UPDATE_HOLIDAY_QUERY = "UPDATE Holiday h SET h.updatedBy = :updatedBy , h.updatedDateTime = :updatedDateTime, h.holidayDesc = :holidayDesc, h.holidayDate= :holidayDate, h.holidayName = :holidayName WHERE h.locationCode = :locationCode and h.holidayId = :holidayId and h.langCode = :langCode and (h.isDeleted is null or h.isDeleted = false)";
private static final int DEFAULT_HOLIDAY_ID = 2000001;

/*
Expand Down