Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
package gov.va.med.ars.dao.ars;
import java.awt.print.Pageable;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import gov.va.med.domain.ars.ArsRole;
import gov.va.med.domain.ars.ArsUser;
import gov.va.med.domain.ars.ArsUserRoleUsages;
import gov.va.med.domain.ars.ArsUserRoleUsagesId;
@Repository
public interface IArsUserRoleUsages extends JpaRepository<ArsUserRoleUsages, ArsUserRoleUsagesId>, JpaSpecificationExecutor<ArsUserRoleUsages>, PagingAndSortingRepository<ArsUserRoleUsages, ArsUserRoleUsagesId> {
@SuppressWarnings("unchecked")
ArsUserRoleUsages save(ArsUserRoleUsages persisted);
void delete(ArsUserRoleUsages entity);
List<ArsUserRoleUsages> findAllByarsUser(ArsUser arsUser);
@Transactional
@Modifying
@Query("delete from aarsUserRoleUsages au where au.arsUser =:arsUser and au.arsRole in :rolesListBySystem ")
void deleteUserRoles(@Param("arsUser") ArsUser arsUser, @Param("rolesListBySystem") List<ArsRole> rolesListBySystem);
/*@Transactional
@Modifying
@Query("delete from (select au from aarsUserRoleUsages au JOIN au.arsUser ar where au.arsUser =:arsUser and au.arsRole not in :rolesListBySystem and ar.system =:system)")
void deleteInValidUserRoles(@Param("arsUser") ArsUser arsUser, @Param("rolesListBySystem") List<ArsRole> rolesListBySystem, @Param("system") String system);*/
@Transactional
@Modifying
@Query(value = "delete from (select au.* from ARS_OWNER.ARS_USER_ROLE_USAGES au join ARS_OWNER.ARS_ROLE ar on au.ars_role_id = ar.ars_role_id where au.ARS_USER_ID =:arsUserId and au.ARS_ROLE_ID not in :rolesListBySystem and ar.system = :system)", nativeQuery = true)
void deleteInValidUserRoles(@Param("arsUserId") Long arsUserId, @Param("rolesListBySystem") List<ArsRole> rolesListBySystem, @Param("system") String system);
@Transactional
@Modifying
@Query(value = "delete from (select au.* from ARS_OWNER.ARS_USER_ROLE_USAGES au join ARS_OWNER.ARS_ROLE ar on au.ars_role_id = ar.ars_role_id where au.ARS_USER_ID =:arsUserId and au.ARS_ROLE_ID in :rolesListBySystem and ar.system = :system)", nativeQuery = true)
void deleteInValidUserRolesFromUserRolesUsages(@Param("arsUserId") Long arsUserId, @Param("rolesListBySystem") List<ArsRole> rolesListBySystem, @Param("system") String system);
void deleteByArsRole(List<ArsRole> arsRolestoBeDeleted);
}