}
public AutocompletionsInfo getAutocompletionInfo() throws SQLException {
AutocompletionsInfo completionsInfo = new AutocompletionsInfo();
HashMultimap<String, FetchMethod> endpointsWithCompletions = getEndpointsWithAutocompletions(FetchType.PROPERTIES);
for (String endpoint: endpointsWithCompletions.keySet()) {
for (FetchMethod method: endpointsWithCompletions.get(endpoint)) {
completionsInfo.getOrCreateEndpointInfo(endpoint).getPropertyInfo().setHasCompletions(method, true);
}
}
endpointsWithCompletions = getEndpointsWithAutocompletions(FetchType.CLASSES);
for (String endpoint: endpointsWithCompletions.keySet()) {
for (FetchMethod method: endpointsWithCompletions.get(endpoint)) {
completionsInfo.getOrCreateEndpointInfo(endpoint).getClassInfo().setHasCompletions(method, true);
}
}
for (Entry<String, Integer> entry: getFailCountForEndpoints(FetchType.PROPERTIES).entrySet()) {
completionsInfo.getOrCreateEndpointInfo(entry.getKey()).getPropertyInfo().setFetchFailCount(entry.getValue());
}
for (Entry<String, Integer> entry: getFailCountForEndpoints(FetchType.CLASSES).entrySet()) {
completionsInfo.getOrCreateEndpointInfo(entry.getKey()).getClassInfo().setFetchFailCount(entry.getValue());
}
HashMultimap<String, FetchMethod> disabledPropEndpoints = getDisabledEndpointsForCompletionsFetching(FetchType.PROPERTIES);
for (String endpoint: disabledPropEndpoints.keySet()) {
for (FetchMethod method: disabledPropEndpoints.get(endpoint)) {
if (method == FetchMethod.QUERY_ANALYSIS) {
completionsInfo.getOrCreateEndpointInfo(endpoint).getPropertyInfo().setQueryAnalysisEnabled(false);
} else if (method == FetchMethod.QUERY_RESULTS) {
completionsInfo.getOrCreateEndpointInfo(endpoint).getPropertyInfo().setQueryResultsFetchingEnabled(false);
}
}
}
HashMultimap<String, FetchMethod> disabledClassEndpoints = getDisabledEndpointsForCompletionsFetching(FetchType.CLASSES);
for (String endpoint: disabledClassEndpoints.keySet()) {
for (FetchMethod method: disabledClassEndpoints.get(endpoint)) {
if (method == FetchMethod.QUERY_ANALYSIS) {
completionsInfo.getOrCreateEndpointInfo(endpoint).getClassInfo().setQueryAnalysisEnabled(false);
} else if (method == FetchMethod.QUERY_RESULTS) {
completionsInfo.getOrCreateEndpointInfo(endpoint).getClassInfo().setQueryResultsFetchingEnabled(false);
}
}
}
return completionsInfo;
}