Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.vtnweb.resources; |
| 17 | |
Jian Li | c2a542b | 2016-05-10 11:48:19 -0700 | [diff] [blame] | 18 | import com.fasterxml.jackson.databind.JsonNode; |
| 19 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 20 | import com.fasterxml.jackson.databind.node.ObjectNode; |
| 21 | import com.google.common.collect.Maps; |
| 22 | import org.onlab.util.ItemNotFoundException; |
| 23 | import org.onosproject.rest.AbstractWebResource; |
| 24 | import org.onosproject.vtnrsc.DefaultTenantNetwork; |
| 25 | import org.onosproject.vtnrsc.PhysicalNetwork; |
| 26 | import org.onosproject.vtnrsc.SegmentationId; |
| 27 | import org.onosproject.vtnrsc.TenantId; |
| 28 | import org.onosproject.vtnrsc.TenantNetwork; |
| 29 | import org.onosproject.vtnrsc.TenantNetwork.State; |
| 30 | import org.onosproject.vtnrsc.TenantNetwork.Type; |
| 31 | import org.onosproject.vtnrsc.TenantNetworkId; |
lishuai | 38eeac4 | 2016-05-19 15:34:30 +0800 | [diff] [blame^] | 32 | import org.onosproject.vtnrsc.service.VtnRscService; |
Jian Li | c2a542b | 2016-05-10 11:48:19 -0700 | [diff] [blame] | 33 | import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; |
| 34 | import org.onosproject.vtnweb.web.TenantNetworkCodec; |
| 35 | import org.slf4j.Logger; |
| 36 | import org.slf4j.LoggerFactory; |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 37 | |
| 38 | import javax.ws.rs.Consumes; |
| 39 | import javax.ws.rs.DELETE; |
| 40 | import javax.ws.rs.GET; |
| 41 | import javax.ws.rs.POST; |
| 42 | import javax.ws.rs.PUT; |
| 43 | import javax.ws.rs.Path; |
| 44 | import javax.ws.rs.PathParam; |
| 45 | import javax.ws.rs.Produces; |
| 46 | import javax.ws.rs.QueryParam; |
| 47 | import javax.ws.rs.core.MediaType; |
| 48 | import javax.ws.rs.core.Response; |
Jian Li | c2a542b | 2016-05-10 11:48:19 -0700 | [diff] [blame] | 49 | import java.io.InputStream; |
| 50 | import java.util.Collections; |
| 51 | import java.util.HashSet; |
| 52 | import java.util.Iterator; |
| 53 | import java.util.Set; |
| 54 | import java.util.concurrent.ConcurrentMap; |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 55 | |
Jian Li | c2a542b | 2016-05-10 11:48:19 -0700 | [diff] [blame] | 56 | import static com.google.common.base.Preconditions.checkArgument; |
| 57 | import static com.google.common.base.Preconditions.checkNotNull; |
| 58 | import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; |
| 59 | import static javax.ws.rs.core.Response.Status.NOT_FOUND; |
| 60 | import static javax.ws.rs.core.Response.Status.OK; |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 61 | |
| 62 | /** |
| 63 | * REST resource for interacting with the inventory of networks. |
| 64 | */ |
| 65 | @Path("networks") |
| 66 | public class TenantNetworkWebResource extends AbstractWebResource { |
| 67 | public static final String NETWORK_NOT_FOUND = "Network is not found"; |
| 68 | public static final String NETWORK_ID_EXIST = "Network id is existed"; |
| 69 | public static final String NETWORK_ID_NOT_EXIST = "Network id is not existed"; |
| 70 | public static final String CREATE_NETWORK = "create network"; |
| 71 | public static final String UPDATE_NETWORK = "update network"; |
| 72 | public static final String DELETE_NETWORK = "delete network"; |
| 73 | public static final String JSON_NOT_NULL = "JsonNode can not be null"; |
| 74 | |
| 75 | protected static final Logger log = LoggerFactory |
| 76 | .getLogger(TenantNetworkWebResource.class); |
| 77 | private final ConcurrentMap<TenantNetworkId, TenantNetwork> networksMap = Maps |
| 78 | .newConcurrentMap(); |
| 79 | |
| 80 | @GET |
Wu wenbin | d0b119f | 2016-05-11 18:03:41 +0800 | [diff] [blame] | 81 | @Produces(MediaType.APPLICATION_JSON) |
| 82 | @Consumes(MediaType.APPLICATION_JSON) |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 83 | public Response getNetworks(@QueryParam("id") String queryId, |
| 84 | @QueryParam("name") String queryName, |
| 85 | @QueryParam("admin_state_up") String queryadminStateUp, |
| 86 | @QueryParam("status") String querystate, |
| 87 | @QueryParam("shared") String queryshared, |
| 88 | @QueryParam("tenant_id") String querytenantId, |
| 89 | @QueryParam("router:external") String routerExternal, |
| 90 | @QueryParam("provider:network_type") String type, |
| 91 | @QueryParam("provider:physical_network") String physicalNetwork, |
| 92 | @QueryParam("provider:segmentation_id") String segmentationId) { |
| 93 | Iterable<TenantNetwork> networks = get(TenantNetworkService.class) |
| 94 | .getNetworks(); |
| 95 | Iterator<TenantNetwork> networkors = networks.iterator(); |
| 96 | while (networkors.hasNext()) { |
| 97 | TenantNetwork network = networkors.next(); |
| 98 | if ((queryId == null || queryId.equals(network.id().toString())) |
| 99 | && (queryName == null || queryName.equals(network.name())) |
| 100 | && (queryadminStateUp == null || queryadminStateUp |
Satish K | 3203557 | 2015-11-22 14:49:14 +0530 | [diff] [blame] | 101 | .equals(Boolean.toString(network.adminStateUp()))) |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 102 | && (querystate == null || querystate.equals(network.state() |
| 103 | .toString())) |
Satish K | 3203557 | 2015-11-22 14:49:14 +0530 | [diff] [blame] | 104 | && (queryshared == null || queryshared.equals(Boolean.toString(network |
| 105 | .shared()))) |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 106 | && (querytenantId == null || querytenantId.equals(network |
| 107 | .tenantId().toString())) |
Satish K | 3203557 | 2015-11-22 14:49:14 +0530 | [diff] [blame] | 108 | && (routerExternal == null || routerExternal.equals(Boolean.toString(network |
| 109 | .routerExternal()))) |
| 110 | && (type == null || type.equals(network.type().toString())) |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 111 | && (physicalNetwork == null || physicalNetwork |
Satish K | 3203557 | 2015-11-22 14:49:14 +0530 | [diff] [blame] | 112 | .equals(network.physicalNetwork().toString())) |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 113 | && (segmentationId == null || segmentationId.equals(network |
Satish K | 3203557 | 2015-11-22 14:49:14 +0530 | [diff] [blame] | 114 | .segmentationId().toString()))) { |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 115 | networksMap.putIfAbsent(network.id(), network); |
| 116 | } |
| 117 | } |
| 118 | networks = Collections.unmodifiableCollection(networksMap.values()); |
| 119 | ObjectNode result = new ObjectMapper().createObjectNode(); |
| 120 | result.set("networks", new TenantNetworkCodec().encode(networks, this)); |
| 121 | |
| 122 | return ok(result.toString()).build(); |
| 123 | } |
| 124 | |
| 125 | private State isState(String state) { |
| 126 | if (state.equals("ACTIVE")) { |
| 127 | return TenantNetwork.State.ACTIVE; |
| 128 | } else if (state.equals("BUILD")) { |
| 129 | return TenantNetwork.State.BUILD; |
| 130 | } else if (state.equals("DOWN")) { |
| 131 | return TenantNetwork.State.DOWN; |
| 132 | } else if (state.equals("ERROR")) { |
| 133 | return TenantNetwork.State.ERROR; |
| 134 | } else { |
| 135 | return null; |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | private Type isType(String type) { |
| 140 | if (type.equals("LOCAL")) { |
| 141 | return TenantNetwork.Type.LOCAL; |
| 142 | } else { |
| 143 | return null; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | @GET |
| 148 | @Path("{id}") |
Wu wenbin | d0b119f | 2016-05-11 18:03:41 +0800 | [diff] [blame] | 149 | @Produces(MediaType.APPLICATION_JSON) |
| 150 | @Consumes(MediaType.APPLICATION_JSON) |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 151 | public Response getNetwork(@PathParam("id") String id) { |
| 152 | |
| 153 | if (!get(TenantNetworkService.class).exists(TenantNetworkId |
| 154 | .networkId(id))) { |
lishuai | 0f47f34 | 2015-09-16 11:38:48 +0800 | [diff] [blame] | 155 | return Response.status(NOT_FOUND) |
| 156 | .entity(NETWORK_NOT_FOUND).build(); |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 157 | } |
| 158 | TenantNetwork network = nullIsNotFound(get(TenantNetworkService.class) |
| 159 | .getNetwork(TenantNetworkId.networkId(id)), NETWORK_NOT_FOUND); |
| 160 | ObjectNode result = new ObjectMapper().createObjectNode(); |
| 161 | result.set("network", new TenantNetworkCodec().encode(network, this)); |
| 162 | |
| 163 | return ok(result.toString()).build(); |
| 164 | |
| 165 | } |
| 166 | |
| 167 | @POST |
| 168 | @Produces(MediaType.APPLICATION_JSON) |
| 169 | @Consumes(MediaType.APPLICATION_JSON) |
| 170 | public Response createNetworks(InputStream input) { |
| 171 | try { |
| 172 | ObjectMapper mapper = new ObjectMapper(); |
| 173 | JsonNode cfg = mapper.readTree(input); |
| 174 | JsonNode nodes = null; |
| 175 | Iterable<TenantNetwork> networks = null; |
| 176 | if (cfg.get("network") != null) { |
| 177 | nodes = cfg.get("network"); |
| 178 | if (nodes.isArray()) { |
| 179 | networks = changeJson2objs(nodes); |
| 180 | } else { |
| 181 | networks = changeJson2obj(CREATE_NETWORK, null, nodes); |
| 182 | } |
| 183 | } else if (cfg.get("networks") != null) { |
| 184 | nodes = cfg.get("networks"); |
| 185 | networks = changeJson2objs(nodes); |
| 186 | } |
| 187 | Boolean issuccess = nullIsNotFound((get(TenantNetworkService.class) |
| 188 | .createNetworks(networks)), |
| 189 | NETWORK_NOT_FOUND); |
| 190 | |
| 191 | if (!issuccess) { |
| 192 | return Response.status(INTERNAL_SERVER_ERROR) |
| 193 | .entity(NETWORK_ID_EXIST).build(); |
| 194 | } |
| 195 | return Response.status(OK).entity(issuccess.toString()).build(); |
| 196 | } catch (Exception e) { |
| 197 | log.error("Creates tenantNetwork exception {}.", e.toString()); |
| 198 | return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString()) |
| 199 | .build(); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | @PUT |
| 204 | @Path("{id}") |
| 205 | @Produces(MediaType.APPLICATION_JSON) |
| 206 | @Consumes(MediaType.APPLICATION_JSON) |
| 207 | public Response updateNetworks(@PathParam("id") String id, InputStream input) { |
| 208 | try { |
| 209 | ObjectMapper mapper = new ObjectMapper(); |
| 210 | JsonNode cfg = mapper.readTree(input); |
| 211 | JsonNode nodes = null; |
| 212 | Iterable<TenantNetwork> networks = null; |
| 213 | if (cfg.get("network") != null) { |
| 214 | nodes = cfg.get("network"); |
| 215 | if (nodes.isArray()) { |
| 216 | networks = changeJson2objs(nodes); |
| 217 | } else { |
| 218 | networks = changeJson2obj(UPDATE_NETWORK, |
| 219 | TenantNetworkId.networkId(id), |
| 220 | nodes); |
| 221 | } |
| 222 | } else if (cfg.get("networks") != null) { |
| 223 | nodes = cfg.get("networks"); |
| 224 | networks = changeJson2objs(nodes); |
| 225 | } |
| 226 | Boolean issuccess = nullIsNotFound((get(TenantNetworkService.class) |
| 227 | .updateNetworks(networks)), |
| 228 | NETWORK_NOT_FOUND); |
| 229 | if (!issuccess) { |
| 230 | return Response.status(INTERNAL_SERVER_ERROR) |
| 231 | .entity(NETWORK_ID_NOT_EXIST).build(); |
| 232 | } |
| 233 | return Response.status(OK).entity(issuccess.toString()).build(); |
| 234 | } catch (Exception e) { |
| 235 | log.error("Updates tenantNetwork failed because of exception {}.", |
| 236 | e.toString()); |
| 237 | return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString()) |
| 238 | .build(); |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | @DELETE |
| 243 | @Path("{id}") |
Wu wenbin | b0bd613 | 2016-05-10 19:20:23 +0800 | [diff] [blame] | 244 | @Consumes(MediaType.APPLICATION_JSON) |
| 245 | @Produces(MediaType.APPLICATION_JSON) |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 246 | public Response deleteNetworks(@PathParam("id") String id) { |
| 247 | log.debug("Deletes network by identifier {}.", id); |
| 248 | Set<TenantNetworkId> networkSet = new HashSet<>(); |
| 249 | networkSet.add(TenantNetworkId.networkId(id)); |
| 250 | Boolean issuccess = nullIsNotFound(get(TenantNetworkService.class) |
| 251 | .removeNetworks(networkSet), NETWORK_NOT_FOUND); |
| 252 | if (!issuccess) { |
| 253 | log.debug("Network identifier {} is not existed", id); |
| 254 | return Response.status(INTERNAL_SERVER_ERROR) |
| 255 | .entity(NETWORK_ID_NOT_EXIST).build(); |
| 256 | } |
Jian Li | c2a542b | 2016-05-10 11:48:19 -0700 | [diff] [blame] | 257 | return ok(issuccess.toString()).build(); |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | /** |
| 261 | * Returns a collection of tenantNetworks. |
| 262 | * |
| 263 | * @param flag the flag |
| 264 | * @param networkId network identifier |
| 265 | * @param node the network json node |
| 266 | * @return a collection of tenantNetworks |
| 267 | */ |
| 268 | public Iterable<TenantNetwork> changeJson2obj(String flag, |
| 269 | TenantNetworkId networkId, |
| 270 | JsonNode node) { |
| 271 | checkNotNull(node, JSON_NOT_NULL); |
| 272 | TenantNetwork network = null; |
| 273 | ConcurrentMap<TenantNetworkId, TenantNetwork> networksMap = Maps |
| 274 | .newConcurrentMap(); |
Satish K | ab54ffa | 2015-11-27 14:19:42 +0530 | [diff] [blame] | 275 | checkArgument(node.get("admin_state_up").isBoolean(), "admin_state_up should be boolean"); |
| 276 | checkArgument(node.get("shared").isBoolean(), "shared should be boolean"); |
| 277 | checkArgument(node.get("router:external").isBoolean(), "router:external should be boolean"); |
| 278 | String name = node.get("name").asText(); |
| 279 | boolean adminStateUp = node.get("admin_state_up").asBoolean(); |
| 280 | String state = node.get("status").asText(); |
| 281 | boolean shared = node.get("shared").asBoolean(); |
lishuai | 38eeac4 | 2016-05-19 15:34:30 +0800 | [diff] [blame^] | 282 | String tenantIdStr = node.get("tenant_id").asText(); |
Satish K | ab54ffa | 2015-11-27 14:19:42 +0530 | [diff] [blame] | 283 | boolean routerExternal = node.get("router:external").asBoolean(); |
| 284 | String type = node.get("provider:network_type").asText(); |
| 285 | String physicalNetwork = node.get("provider:physical_network").asText(); |
lishuai | 38eeac4 | 2016-05-19 15:34:30 +0800 | [diff] [blame^] | 286 | String segmentationIdStr = node.get("provider:segmentation_id").asText(); |
| 287 | SegmentationId segmentationId = SegmentationId.segmentationId(segmentationIdStr); |
| 288 | TenantId tenantId = TenantId.tenantId(tenantIdStr); |
| 289 | if (segmentationIdStr == null || segmentationIdStr.equals("null")) { |
| 290 | segmentationId = get(VtnRscService.class).getL3vni(tenantId); |
| 291 | } |
Satish K | ab54ffa | 2015-11-27 14:19:42 +0530 | [diff] [blame] | 292 | TenantNetworkId id = null; |
| 293 | if (flag.equals(CREATE_NETWORK)) { |
| 294 | id = TenantNetworkId.networkId(node.get("id").asText()); |
| 295 | } else if (flag.equals(UPDATE_NETWORK)) { |
| 296 | id = networkId; |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 297 | } |
Satish K | ab54ffa | 2015-11-27 14:19:42 +0530 | [diff] [blame] | 298 | network = new DefaultTenantNetwork( |
| 299 | id, |
| 300 | name, |
| 301 | adminStateUp, |
| 302 | isState(state), |
| 303 | shared, |
lishuai | 38eeac4 | 2016-05-19 15:34:30 +0800 | [diff] [blame^] | 304 | tenantId, |
Satish K | ab54ffa | 2015-11-27 14:19:42 +0530 | [diff] [blame] | 305 | routerExternal, |
| 306 | isType(type), |
| 307 | PhysicalNetwork |
| 308 | .physicalNetwork(physicalNetwork), |
lishuai | 38eeac4 | 2016-05-19 15:34:30 +0800 | [diff] [blame^] | 309 | segmentationId); |
Satish K | ab54ffa | 2015-11-27 14:19:42 +0530 | [diff] [blame] | 310 | networksMap.putIfAbsent(id, network); |
| 311 | |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 312 | return Collections.unmodifiableCollection(networksMap.values()); |
| 313 | } |
| 314 | |
| 315 | /** |
| 316 | * Returns a collection of tenantNetworks. |
| 317 | * |
| 318 | * @param nodes the network jsonnodes |
| 319 | * @return a collection of tenantNetworks |
| 320 | */ |
| 321 | public Iterable<TenantNetwork> changeJson2objs(JsonNode nodes) { |
| 322 | checkNotNull(nodes, JSON_NOT_NULL); |
| 323 | TenantNetwork network = null; |
| 324 | ConcurrentMap<TenantNetworkId, TenantNetwork> networksMap = Maps |
| 325 | .newConcurrentMap(); |
Satish K | ab54ffa | 2015-11-27 14:19:42 +0530 | [diff] [blame] | 326 | for (JsonNode node : nodes) { |
| 327 | String id = node.get("id").asText(); |
| 328 | String name = node.get("name").asText(); |
| 329 | boolean adminStateUp = node.get("admin_state_up").asBoolean(); |
| 330 | String state = node.get("status").asText(); |
| 331 | boolean shared = node.get("shared").asBoolean(); |
lishuai | 38eeac4 | 2016-05-19 15:34:30 +0800 | [diff] [blame^] | 332 | String tenantIdStr = node.get("tenant_id").asText(); |
Satish K | ab54ffa | 2015-11-27 14:19:42 +0530 | [diff] [blame] | 333 | boolean routerExternal = node.get("router:external") |
| 334 | .asBoolean(); |
| 335 | String type = node.get("provider:network_type").asText(); |
| 336 | String physicalNetwork = node.get("provider:physical_network").asText(); |
lishuai | 38eeac4 | 2016-05-19 15:34:30 +0800 | [diff] [blame^] | 337 | String segmentationIdStr = node.get("provider:segmentation_id").asText(); |
| 338 | SegmentationId segmentationId = SegmentationId.segmentationId(segmentationIdStr); |
| 339 | TenantId tenantId = TenantId.tenantId(tenantIdStr); |
| 340 | if (segmentationIdStr == null || segmentationIdStr.equals("null")) { |
| 341 | segmentationId = get(VtnRscService.class).getL3vni(tenantId); |
| 342 | } |
Satish K | ab54ffa | 2015-11-27 14:19:42 +0530 | [diff] [blame] | 343 | network = new DefaultTenantNetwork( |
| 344 | TenantNetworkId.networkId(id), |
| 345 | name, |
| 346 | adminStateUp, |
| 347 | isState(state), |
| 348 | shared, |
lishuai | 38eeac4 | 2016-05-19 15:34:30 +0800 | [diff] [blame^] | 349 | tenantId, |
Satish K | ab54ffa | 2015-11-27 14:19:42 +0530 | [diff] [blame] | 350 | routerExternal, |
| 351 | isType(type), |
| 352 | PhysicalNetwork.physicalNetwork(physicalNetwork), |
lishuai | 38eeac4 | 2016-05-19 15:34:30 +0800 | [diff] [blame^] | 353 | segmentationId); |
Satish K | ab54ffa | 2015-11-27 14:19:42 +0530 | [diff] [blame] | 354 | networksMap.putIfAbsent(TenantNetworkId.networkId(id), network); |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 355 | } |
Satish K | ab54ffa | 2015-11-27 14:19:42 +0530 | [diff] [blame] | 356 | |
Madan Jampani | 38a8821 | 2015-09-15 11:21:27 -0700 | [diff] [blame] | 357 | return Collections.unmodifiableCollection(networksMap.values()); |
| 358 | } |
| 359 | |
| 360 | /** |
| 361 | * Returns the specified item if that items is null; otherwise throws not |
| 362 | * found exception. |
| 363 | * |
| 364 | * @param item item to check |
| 365 | * @param <T> item type |
| 366 | * @param message not found message |
| 367 | * @return item if not null |
| 368 | * @throws org.onlab.util.ItemNotFoundException if item is null |
| 369 | */ |
| 370 | protected <T> T nullIsNotFound(T item, String message) { |
| 371 | if (item == null) { |
| 372 | throw new ItemNotFoundException(message); |
| 373 | } |
| 374 | return item; |
| 375 | } |
| 376 | } |