use of com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager in project azure-tools-for-java by Microsoft.
the class WebAppConfiguration method saveArtifact.
public void saveArtifact(AzureArtifact azureArtifact) {
final AzureArtifactManager azureArtifactManager = AzureArtifactManager.getInstance(getProject());
webAppSettingModel.setArtifactIdentifier(azureArtifact == null ? null : azureArtifactManager.getArtifactIdentifier(azureArtifact));
webAppSettingModel.setAzureArtifactType(azureArtifact == null ? null : azureArtifact.getType());
webAppSettingModel.setPackaging(azureArtifact == null ? null : azureArtifactManager.getPackaging(azureArtifact));
}
use of com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager in project azure-tools-for-java by Microsoft.
the class SpringCloudDeploymentConfiguration method readExternal.
@Override
public void readExternal(Element element) throws InvalidDataException {
super.readExternal(element);
final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.getProject());
this.appConfig = Optional.ofNullable(element.getChild("SpringCloudAppConfig")).map(e -> XmlSerializer.deserialize(e, SpringCloudAppConfig.class)).orElse(SpringCloudAppConfig.builder().deployment(SpringCloudDeploymentConfig.builder().build()).build());
Optional.ofNullable(element.getChild("Artifact")).map(e -> e.getAttributeValue("identifier")).map(manager::getAzureArtifactById).map(a -> new WrappedAzureArtifact(a, this.getProject())).ifPresent(a -> this.appConfig.getDeployment().setArtifact(a));
}
use of com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager in project azure-tools-for-java by Microsoft.
the class AppServiceInfoBasicPanel method getData.
@SneakyThrows
@Override
public T getData() {
final String name = this.textName.getValue();
final Runtime platform = this.selectorRuntime.getValue();
final AzureArtifact artifact = this.selectorApplication.getValue();
final T result = (T) (this.config == null ? initConfig() : this.config).toBuilder().build();
result.setName(name);
result.setRuntime(platform);
if (Objects.nonNull(artifact)) {
final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
final String path = manager.getFileForDeployment(this.selectorApplication.getValue());
result.setApplication(Paths.get(path));
}
this.config = result;
return result;
}
use of com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager in project azure-tools-for-java by Microsoft.
the class AppServiceInfoAdvancedPanel method getData.
@Override
public T getData() {
final Subscription subscription = this.selectorSubscription.getValue();
final ResourceGroup resourceGroup = this.selectorGroup.getValue();
final String name = this.textName.getValue();
final Runtime runtime = this.selectorRuntime.getValue();
final Region region = this.selectorRegion.getValue();
final AppServicePlanEntity servicePlan = this.selectorServicePlan.getValue();
final AzureArtifact artifact = this.selectorApplication.getValue();
final T config = supplier.get();
config.setSubscription(subscription);
config.setResourceGroup(resourceGroup);
config.setName(name);
config.setRuntime(runtime);
config.setRegion(region);
config.setServicePlan(servicePlan);
if (Objects.nonNull(artifact)) {
final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
final String path = manager.getFileForDeployment(this.selectorApplication.getValue());
config.setApplication(Paths.get(path));
}
return config;
}
use of com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager in project azure-tools-for-java by Microsoft.
the class SpringCloudDeploymentConfiguration method writeExternal.
@Override
public void writeExternal(Element element) throws WriteExternalException {
super.writeExternal(element);
final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.getProject());
final Element appConfigElement = XmlSerializer.serialize(this.appConfig, (accessor, o) -> !"artifact".equalsIgnoreCase(accessor.getName()));
final IArtifact artifact = this.appConfig.getDeployment().getArtifact();
Optional.ofNullable(this.appConfig).map(config -> XmlSerializer.serialize(config, (accessor, o) -> !"artifact".equalsIgnoreCase(accessor.getName()))).ifPresent(element::addContent);
Optional.ofNullable(this.appConfig).map(config -> (WrappedAzureArtifact) config.getDeployment().getArtifact()).map((a) -> manager.getArtifactIdentifier(a.getArtifact())).map(id -> new Element("Artifact").setAttribute("identifier", id)).ifPresent(element::addContent);
}
Aggregations