public void writeScopesForService(String appIdentifier, List<GemoScopeBean> scopes) throws JsonParseException, JsonMappingException, IOException { List<String> scopeIds = scopeClient.getScopeIdsForScopes(scopes); for (String scopeId : scopeIds) { MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>(); map.add("tableName", table); map.add("service_name", appIdentifier); map.add("scope_pkey", scopeId); insert(map); } }
public boolean checkScopeforService(String scope, String serviceName) throws JsonParseException, JsonMappingException, IOException { String scopeId = scopeClient.getScopeIdForScopeName(scope); String serviceScopeEntry = select( "select * from " + table + " where service_name LIKE " + "\'" + serviceName + "%" + "\'" + "and scope_pkey= " + "\'" + scopeId + "\'"); log.debug( "query to storage" + "select * from " + table + " where service_name LIKE " + "\'" + serviceName + "%" + "\'" + "and scope_pkey= " + "\'" + scopeId + "\'"); log.debug("response from storage" + serviceScopeEntry); ObjectMapper mapper = new ObjectMapper(); ServiceScopeEntry[] resultSet = mapper.readValue(serviceScopeEntry, ServiceScopeEntry[].class); if (resultSet.length > 0) { return true; } return false; }