use of com.microsoft.azure.toolkit.intellij.azuresdk.model.AzureSdkFeatureEntity in project azure-tools-for-java by Microsoft.
the class AzureSdkLibraryService method addClientLibs.
private static void addClientLibs(Map<String, AzureSdkServiceEntity> services) {
getClientLibs().stream().sorted(Comparator.comparing(AzureJavaSdkEntity::getServiceName)).forEachOrdered(raw -> {
final AzureSdkServiceEntity service = getOrCreateService(services, raw);
for (final AzureSdkFeatureEntity feature : service.getContent()) {
final boolean specified = Optional.ofNullable(feature.getClientSource()).filter(s -> s.getGroupId().equals(raw.getGroupId()) && s.getArtifactId().equals(raw.getArtifactId())).isPresent();
final boolean sameFeatureName = trim(feature.getName()).equals(trim(raw.getDisplayName()));
if (specified || sameFeatureName) {
feature.getArtifacts().add(toSdkArtifactEntity(raw));
return;
}
}
// if no mapping feature found.
final AzureSdkFeatureEntity feature = AzureSdkFeatureEntity.builder().name(raw.getDisplayName()).msdocs(raw.getMsdocsUrl()).artifacts(new ArrayList<>(Collections.singletonList(toSdkArtifactEntity(raw)))).build();
service.getContent().add(feature);
});
}
use of com.microsoft.azure.toolkit.intellij.azuresdk.model.AzureSdkFeatureEntity in project azure-tools-for-java by Microsoft.
the class AzureSdkLibraryService method addManagementLibs.
private static void addManagementLibs(Map<String, AzureSdkServiceEntity> services) {
getManagementLibs().stream().sorted(Comparator.comparing(AzureJavaSdkEntity::getServiceName)).forEachOrdered(raw -> {
final AzureSdkServiceEntity service = getOrCreateService(services, raw);
for (final AzureSdkFeatureEntity feature : service.getContent()) {
feature.setName(feature.getName().replace("Resource Management - ", "").trim());
feature.getArtifacts().add(toSdkArtifactEntity(raw));
}
});
}
use of com.microsoft.azure.toolkit.intellij.azuresdk.model.AzureSdkFeatureEntity in project azure-tools-for-java by Microsoft.
the class AzureSdkTreePanel method fillDescriptionFromCategoryIfMissing.
private void fillDescriptionFromCategoryIfMissing(final Map<String, List<AzureSdkCategoryEntity>> categoryToServiceMap, final List<? extends AzureSdkServiceEntity> services) {
final Map<String, AzureSdkServiceEntity> serviceMap = services.stream().collect(Collectors.toMap(e -> getServiceKeyByName(e.getName()), e -> e));
categoryToServiceMap.forEach((category, categoryServices) -> categoryServices.forEach(categoryService -> Optional.ofNullable(serviceMap.get(getServiceKeyByName(categoryService.getServiceName()))).ifPresent(service -> {
for (final AzureSdkFeatureEntity feature : service.getContent()) {
if (StringUtils.isBlank(feature.getDescription()) && StringUtils.isNotBlank(categoryService.getDescription())) {
feature.setDescription(categoryService.getDescription());
}
}
})));
}
use of com.microsoft.azure.toolkit.intellij.azuresdk.model.AzureSdkFeatureEntity in project azure-tools-for-java by Microsoft.
the class AzureSdkTreePanel method initEventListeners.
private void initEventListeners() {
this.searchBox.addDocumentListener(this);
this.tree.addTreeSelectionListener(e -> {
final DefaultMutableTreeNode node = (DefaultMutableTreeNode) this.tree.getLastSelectedPathComponent();
if (Objects.nonNull(node) && node.isLeaf() && node.getUserObject() instanceof AzureSdkFeatureEntity) {
this.lastNodePath = TreeUtil.getPathFromRoot(node);
selectFeature((AzureSdkFeatureEntity) node.getUserObject());
}
});
}
use of com.microsoft.azure.toolkit.intellij.azuresdk.model.AzureSdkFeatureEntity in project azure-tools-for-java by Microsoft.
the class AzureSdkTreePanel method loadServiceData.
private void loadServiceData(AzureSdkServiceEntity service, AzureSdkCategoryEntity categoryService, MutableTreeNode categoryNode, String... filters) {
if (Objects.isNull(service) || CollectionUtils.isEmpty(service.getContent())) {
return;
}
final boolean categoryMatched = this.isMatchedFilters(categoryService.getCategory(), filters);
if (CollectionUtils.size(service.getContent()) == 1 && StringUtils.equals(service.getName(), service.getContent().get(0).getName())) {
final AzureSdkFeatureEntity feature = service.getContent().get(0);
final boolean featureMatched = this.isMatchedFilters(feature.getName(), filters);
if (ArrayUtils.isEmpty(filters) || categoryMatched || featureMatched) {
final DefaultMutableTreeNode featureNode = new DefaultMutableTreeNode(feature);
this.model.insertNodeInto(featureNode, categoryNode, categoryNode.getChildCount());
}
return;
}
final MutableTreeNode serviceNode = new DefaultMutableTreeNode(service);
final boolean serviceMatched = this.isMatchedFilters(service.getName(), filters);
for (final AzureSdkFeatureEntity feature : service.getContent()) {
final boolean featureMatched = this.isMatchedFilters(feature.getName(), filters);
if (ArrayUtils.isEmpty(filters) || categoryMatched || serviceMatched || featureMatched) {
final DefaultMutableTreeNode featureNode = new DefaultMutableTreeNode(feature);
this.model.insertNodeInto(featureNode, serviceNode, serviceNode.getChildCount());
}
}
if (ArrayUtils.isEmpty(filters) || categoryMatched || serviceMatched || serviceNode.getChildCount() > 0) {
this.model.insertNodeInto(serviceNode, categoryNode, categoryNode.getChildCount());
}
}
Aggregations