X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=portal-BE%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fportal%2Fservice%2FLocalRoleService.java;fp=portal-BE%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fportal%2Fservice%2FLocalRoleService.java;h=e16bb32f91b6a85140e6d154e6f03134b1fed48a;hb=ca3d9f4b725774763f12488940033a294b778244;hp=0000000000000000000000000000000000000000;hpb=4c6f6a443cb2e6effa995e77d56689c1c2dab4ad;p=portal.git diff --git a/portal-BE/src/main/java/org/onap/portal/service/LocalRoleService.java b/portal-BE/src/main/java/org/onap/portal/service/LocalRoleService.java new file mode 100644 index 00000000..e16bb32f --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/LocalRoleService.java @@ -0,0 +1,26 @@ +package org.onap.portal.service; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.transaction.Transactional; +import org.onap.portal.domain.dto.transport.LocalRole; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +@Transactional +public class LocalRoleService { + + private final EntityManager entityManager; + + @Autowired + public LocalRoleService(EntityManager entityManager) { + this.entityManager = entityManager; + } + + public List getCurrentAppRoleFunctions(final long appId, final String functionCd){ + final String query = "select distinct fr.role_id, fr.role_name from fn_role fr, ep_app_function ef, ep_app_role_function epr where fr.role_id = epr.role_id and epr.function_cd = ef.function_cd\n" + + " and ef.function_cd =:functionCd and epr.app_id =:appId"; + return entityManager.createNamedQuery(query).setParameter("appId", appId).setParameter("functionCd", functionCd).getResultList(); + } +}