55
66package com .microsoft .azuretools .core .mvp .model .webapp ;
77
8- import com .azure .resourcemanager .appservice .models .JavaVersion ;
98import com .azure .resourcemanager .appservice .models .LogLevel ;
10- import com .azure .resourcemanager . appservice .models . OperatingSystem ;
11- import com .azure .resourcemanager . appservice .models . RuntimeStack ;
9+ import com .microsoft . azure .toolkit . lib . appservice .model . JavaVersion ;
10+ import com .microsoft . azure .toolkit . lib . appservice .model . OperatingSystem ;
1211import com .microsoft .azure .toolkit .lib .appservice .model .Runtime ;
1312import com .microsoft .azure .toolkit .lib .appservice .model .WebContainer ;
1413import com .microsoft .azuretools .telemetry .TelemetryConstants ;
@@ -46,16 +45,6 @@ public class WebAppSettingModel {
4645 private String appServicePlanId = "" ;
4746 private String region = "" ;
4847 private String pricing = "" ;
49- @ Deprecated
50- private String webContainer = "" ;
51- @ Deprecated
52- private OperatingSystem os = OperatingSystem .LINUX ;
53- @ Deprecated
54- private JavaVersion jdkVersion = JavaVersion .JAVA_8_NEWEST ;
55- @ Deprecated
56- private String stack = "TOMCAT" ;
57- @ Deprecated
58- private String version = "8.5-jre8" ;
5948
6049 // todo: change string values to app service library model
6150 private String operatingSystem ;
@@ -72,24 +61,9 @@ public class WebAppSettingModel {
7261 private boolean enableApplicationLog = false ;
7362 private String applicationLogLevel = LogLevel .ERROR .toString ();
7463
75- @ Deprecated
76- public RuntimeStack getLinuxRuntime () {
77- return new RuntimeStack (this .stack , this .version );
78- }
79-
80- @ Deprecated
81- public OperatingSystem getOS () {
82- return this .os ;
83- }
84-
85- @ Deprecated
86- public void setOS (OperatingSystem os ) {
87- this .os = os ;
88- }
89-
9064 public Runtime getRuntime () {
9165 if (StringUtils .isAllEmpty (operatingSystem , webAppContainer , webAppJavaVersion )) {
92- return parseRuntimeFromDeprecatedConfiguration () ;
66+ return null ;
9367 }
9468 final com .microsoft .azure .toolkit .lib .appservice .model .OperatingSystem system =
9569 com .microsoft .azure .toolkit .lib .appservice .model .OperatingSystem .fromString (operatingSystem );
@@ -100,22 +74,9 @@ public Runtime getRuntime() {
10074 }
10175
10276 public void saveRuntime (Runtime runtime ) {
103- this .operatingSystem = runtime .getOperatingSystem ().getValue ();
104- this .webAppContainer = runtime .getWebContainer ().getValue ();
105- this .webAppJavaVersion = runtime .getJavaVersion ().getValue ();
106- }
107-
108- private Runtime parseRuntimeFromDeprecatedConfiguration () {
109- final com .microsoft .azure .toolkit .lib .appservice .model .OperatingSystem system =
110- com .microsoft .azure .toolkit .lib .appservice .model .OperatingSystem .fromString (this .os .name ());
111- if (system == com .microsoft .azure .toolkit .lib .appservice .model .OperatingSystem .LINUX ) {
112- return Runtime .getRuntimeFromLinuxFxVersion (getLinuxRuntime ().toString ());
113- }
114- final com .microsoft .azure .toolkit .lib .appservice .model .JavaVersion javaVersion =
115- com .microsoft .azure .toolkit .lib .appservice .model .JavaVersion .fromString (getJdkVersion ().toString ());
116- final com .microsoft .azure .toolkit .lib .appservice .model .WebContainer container =
117- com .microsoft .azure .toolkit .lib .appservice .model .WebContainer .fromString (getWebContainer ());
118- return Runtime .getRuntime (com .microsoft .azure .toolkit .lib .appservice .model .OperatingSystem .WINDOWS , container , javaVersion );
77+ this .operatingSystem = Optional .ofNullable (runtime ).map (Runtime ::getOperatingSystem ).map (OperatingSystem ::getValue ).orElse (null );
78+ this .webAppContainer = Optional .ofNullable (runtime ).map (Runtime ::getWebContainer ).map (WebContainer ::getValue ).orElse (null );
79+ this .webAppJavaVersion = Optional .ofNullable (runtime ).map (Runtime ::getJavaVersion ).map (JavaVersion ::getValue ).orElse (null );
11980 }
12081
12182 public Map <String , String > getTelemetryProperties (Map <String , String > properties ) {
0 commit comments