use (new) INeutronCRUD.Result instead of boolean in update()
[neutron.git] / northbound-api / src / main / java / org / opendaylight / neutron / northbound / api / AbstractNeutronNorthbound.java
index 506bbadd9377e07fa83974749ab11223c3ff8fc1..a1a647a1aa78cbf9ce1031549387478f1b05a297 100644 (file)
@@ -1,14 +1,14 @@
 /*
- * Copyright (c) 2015 Intel Corporation and others.  All rights reserved.
+ * Copyright (c) 2018 Intel Corporation and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.neutron.northbound.api;
 
 import static org.opendaylight.neutron.spi.INeutronCRUD.Result.DependencyMissing;
+import static org.opendaylight.neutron.spi.INeutronCRUD.Result.DoesNotExist;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
@@ -18,6 +18,7 @@ import java.util.List;
 import java.util.Objects;
 import javax.ws.rs.core.Response;
 import org.opendaylight.neutron.spi.INeutronCRUD;
+import org.opendaylight.neutron.spi.INeutronCRUD.Result;
 import org.opendaylight.neutron.spi.INeutronObject;
 
 public abstract class AbstractNeutronNorthbound<T extends INeutronObject<T>, R extends INeutronRequest<T>,
@@ -152,7 +153,8 @@ public abstract class AbstractNeutronNorthbound<T extends INeutronObject<T>, R e
         /*
          * update the object and return it
          */
-        if (!neutronCRUD.update(uuid, delta)) {
+        Result updateResult = neutronCRUD.update(uuid, delta);
+        if (updateResult.equals(DoesNotExist)) {
             throw new ResourceNotFoundException(uuidNoExist());
         }
         T updated = neutronCRUD.get(uuid);