use of com.redhat.qute.project.datamodel.ExtendedDataModelProject in project quarkus-ls by redhat-developer.
the class QuteProjectRegistry method getNamespaceResolvers.
/**
* Returns namespace resolvers from the given Qute project Uri.
*
* @param projectUri the Qute project Uri
*
* @return namespace resolvers from the given Qute project Uri.
*/
public List<ValueResolver> getNamespaceResolvers(String namespace, String projectUri) {
if (StringUtils.isEmpty(projectUri)) {
return Collections.emptyList();
}
QuteProject project = getProject(projectUri);
if (project == null) {
return Collections.emptyList();
}
ExtendedDataModelProject dataModel = project.getDataModelProject().getNow(null);
if (dataModel == null) {
return Collections.emptyList();
}
List<ValueResolver> namespaceResolvers = new ArrayList<>();
List<TypeValueResolver> allTypeResolvers = dataModel.getTypeValueResolvers();
if (allTypeResolvers != null) {
for (ValueResolver resolver : allTypeResolvers) {
if (isMatchNamespace(resolver, namespace, dataModel)) {
namespaceResolvers.add(resolver);
}
}
}
List<MethodValueResolver> allMethodResolvers = dataModel.getMethodValueResolvers();
if (allMethodResolvers != null) {
for (ValueResolver resolver : allMethodResolvers) {
if (isMatchNamespace(resolver, namespace, dataModel)) {
namespaceResolvers.add(resolver);
}
}
}
List<FieldValueResolver> allFieldResolvers = dataModel.getFieldValueResolvers();
if (allFieldResolvers != null) {
for (ValueResolver resolver : allFieldResolvers) {
if (isMatchNamespace(resolver, namespace, dataModel)) {
namespaceResolvers.add(resolver);
}
}
}
return namespaceResolvers;
}
use of com.redhat.qute.project.datamodel.ExtendedDataModelProject in project quarkus-ls by redhat-developer.
the class MockQuteProject method loadDataModelProject.
@Override
protected synchronized CompletableFuture<ExtendedDataModelProject> loadDataModelProject() {
DataModelProject<DataModelTemplate<DataModelParameter>> project = new DataModelProject<DataModelTemplate<DataModelParameter>>();
project.setTemplates(templates);
project.setValueResolvers(valueResolvers);
project.setNamespaceResolverInfos(namespaceResolverInfos);
return CompletableFuture.completedFuture(new ExtendedDataModelProject(project));
}
use of com.redhat.qute.project.datamodel.ExtendedDataModelProject in project quarkus-ls by redhat-developer.
the class QuteProject method loadDataModelProject.
protected synchronized CompletableFuture<ExtendedDataModelProject> loadDataModelProject() {
if (dataModelProjectFuture != null) {
return dataModelProjectFuture;
}
QuteDataModelProjectParams params = new QuteDataModelProjectParams();
params.setProjectUri(getUri());
return //
getDataModelProject(params).thenApply(project -> {
if (project == null) {
return null;
}
return new ExtendedDataModelProject(project);
});
}
use of com.redhat.qute.project.datamodel.ExtendedDataModelProject in project quarkus-ls by redhat-developer.
the class QuteProjectRegistry method getAllNamespaces.
private Set<String> getAllNamespaces(String projectUri) {
if (StringUtils.isEmpty(projectUri)) {
return Collections.emptySet();
}
QuteProject project = getProject(projectUri);
if (project == null) {
return Collections.emptySet();
}
ExtendedDataModelProject dataModel = project.getDataModelProject().getNow(null);
return dataModel != null ? dataModel.getAllNamespaces() : Collections.emptySet();
}
Aggregations