@@ -108,12 +108,7 @@ public String addRestartVersionToMS(String domainCRD, String managedServerName,
108
108
* @return - spec node entry from Domain CRD JSON tree
109
109
*/
110
110
private JsonNode getSpecNode (JsonNode root ) {
111
- JsonNode items = root .get ("items" );
112
- JsonNode spec = null ;
113
- for (JsonNode item : items ) {
114
- spec = item .path ("spec" );
115
- }
116
- return spec ;
111
+ return root .path ("spec" );
117
112
}
118
113
119
114
/**
@@ -123,12 +118,7 @@ private JsonNode getSpecNode(JsonNode root) {
123
118
* @return - administration server node entry from Domain CRD JSON tree
124
119
*/
125
120
private JsonNode getAdminServerNode (JsonNode root ) {
126
- JsonNode items = root .get ("items" );
127
- JsonNode adminServer = null ;
128
- for (JsonNode item : items ) {
129
- adminServer = item .path ("spec" ).path ("adminServer" );
130
- }
131
- return adminServer ;
121
+ return root .path ("spec" ).path ("adminServer" );
132
122
}
133
123
134
124
/**
@@ -139,15 +129,11 @@ private JsonNode getAdminServerNode(JsonNode root) {
139
129
* @return - cluster node entry from Domain CRD JSON tree
140
130
*/
141
131
private JsonNode getClusterNode (JsonNode root , String clusterName ) {
142
- ArrayNode items = (ArrayNode ) root .get ("items" );
143
- ArrayNode clusters ;
132
+ ArrayNode clusters = (ArrayNode ) root .path ("spec" ).path ("clusters" );
144
133
JsonNode clusterNode = null ;
145
- for (JsonNode item : items ) {
146
- clusters = (ArrayNode ) item .path ("spec" ).path ("clusters" );
147
- for (JsonNode cluster : clusters ) {
148
- if (cluster .get ("clusterName" ).asText ().equals (clusterName )) {
149
- clusterNode = cluster ;
150
- }
134
+ for (JsonNode cluster : clusters ) {
135
+ if (cluster .get ("clusterName" ).asText ().equals (clusterName )) {
136
+ clusterNode = cluster ;
151
137
}
152
138
}
153
139
return clusterNode ;
@@ -163,23 +149,20 @@ private JsonNode getClusterNode(JsonNode root, String clusterName) {
163
149
*/
164
150
private JsonNode getManagedServerNode (
165
151
ObjectMapper objectMapper , JsonNode root , String managedServerName ) {
166
- ArrayNode items = (ArrayNode ) root .get ("items" );
167
152
ArrayNode managedservers = null ;
168
153
JsonNode managedserverNode = null ;
169
- for (JsonNode item : items ) {
170
- managedservers = (ArrayNode ) item .path ("spec" ).path ("managedServers" );
171
- if (managedservers .size () != 0 ) {
172
- for (JsonNode managedserver : managedservers ) {
173
- if (managedserver .get ("serverName" ).equals (managedServerName )) {
174
- managedserverNode = managedserver ;
175
- }
154
+ managedservers = (ArrayNode ) root .path ("spec" ).path ("managedServers" );
155
+ if (managedservers .size () != 0 ) {
156
+ for (JsonNode managedserver : managedservers ) {
157
+ if (managedserver .get ("serverName" ).equals (managedServerName )) {
158
+ managedserverNode = managedserver ;
176
159
}
177
- } else {
178
- ObjectNode managedserver = objectMapper .createObjectNode ();
179
- managedserver .put ("serverName" , managedServerName );
180
- managedservers .add (managedserver );
181
- managedserverNode = managedserver ;
182
160
}
161
+ } else {
162
+ ObjectNode managedserver = objectMapper .createObjectNode ();
163
+ managedserver .put ("serverName" , managedServerName );
164
+ managedservers .add (managedserver );
165
+ managedserverNode = managedserver ;
183
166
}
184
167
return managedserverNode ;
185
168
}
0 commit comments