@Test public void testQueryToFindRoles() { ActionSearchCriteria criteria = ActionSearchCriteria.builder().tenantId("ap.public") .roleCodes(Arrays.asList("CITIZEN", "EMPLOYEE")).build(); ActionFinderQueryBuilder builder = new ActionFinderQueryBuilder(criteria); String expectedQuery = "SELECT distinct a.id AS a_id, a.name AS a_name, a.url AS " + "a_url, a.servicecode AS a_servicecode, a.queryparams AS a_queryparams, a.parentmodule AS a_parentmodule, a.displayname AS a_displayname, a.enabled AS a_enabled, " + " a.createdby AS a_createdby, a.createddate AS a_createddate, a.lastmodifiedby" + " AS a_lastmodifiedby, a.lastmodifieddate AS a_lastmodifieddate,a.ordernumber AS a_ordernumber, ra.tenantid AS ra_tenantid, " + "ra.actionid AS ra_action, ra.rolecode AS ra_rolecode FROM eg_action AS a JOIN eg_roleaction AS ra ON a.id = ra.actionid" + " WHERE ra.tenantid = 'ap.public' AND ra.rolecode in ('CITIZEN','EMPLOYEE') ORDER BY a.name"; assertEquals(expectedQuery, builder.build()); }
@Override public String build() { filterTenantId(); filterRoleCodes(); String filterQuery = filters.isEmpty() ? "" : " WHERE " + String.join(" AND ", filters); return BASE_QUERY + filterQuery + " ORDER BY a.name"; }
ActionFinderQueryBuilder implements BaseQueryBuilder { @Override public String build() { filterTenantId(); filterRoleCodes(); String filterQuery = filters.isEmpty() ? "" : " WHERE " + String.join(" AND ", filters); return BASE_QUERY + filterQuery + " ORDER BY a.name"; } }
ActionFinderQueryBuilder implements BaseQueryBuilder { @Override public String build() { filterTenantId(); filterRoleCodes(); String filterQuery = filters.isEmpty() ? "" : " WHERE " + String.join(" AND ", filters); return BASE_QUERY + filterQuery + " ORDER BY a.name"; } ActionFinderQueryBuilder(ActionSearchCriteria criteria); }
ActionFinderQueryBuilder implements BaseQueryBuilder { @Override public String build() { filterTenantId(); filterRoleCodes(); String filterQuery = filters.isEmpty() ? "" : " WHERE " + String.join(" AND ", filters); return BASE_QUERY + filterQuery + " ORDER BY a.name"; } ActionFinderQueryBuilder(ActionSearchCriteria criteria); @Override String build(); }
ActionFinderQueryBuilder implements BaseQueryBuilder { @Override public String build() { filterTenantId(); filterRoleCodes(); String filterQuery = filters.isEmpty() ? "" : " WHERE " + String.join(" AND ", filters); return BASE_QUERY + filterQuery + " ORDER BY a.name"; } ActionFinderQueryBuilder(ActionSearchCriteria criteria); @Override String build();  }