Code Review
/
neutron.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Bump to odlparent 3.1.3
[neutron.git]
/
northbound-api
/
src
/
main
/
java
/
org
/
opendaylight
/
neutron
/
northbound
/
api
/
AbstractNeutronNorthbound.java
diff --git
a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/AbstractNeutronNorthbound.java
b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/AbstractNeutronNorthbound.java
index c1c1dd794cf628df21ba65a6fb73cec4d903d226..2ebd7960e75f8c68879c18f2325de28f223335c2 100644
(file)
--- a/
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/AbstractNeutronNorthbound.java
+++ b/
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/AbstractNeutronNorthbound.java
@@
-7,6
+7,7
@@
*/
package org.opendaylight.neutron.northbound.api;
*/
package org.opendaylight.neutron.northbound.api;
+import static org.opendaylight.neutron.spi.INeutronCRUD.Result.AlreadyExists;
import static org.opendaylight.neutron.spi.INeutronCRUD.Result.DependencyMissing;
import static org.opendaylight.neutron.spi.INeutronCRUD.Result.DoesNotExist;
import static org.opendaylight.neutron.spi.INeutronCRUD.Result.DependencyMissing;
import static org.opendaylight.neutron.spi.INeutronCRUD.Result.DoesNotExist;
@@
-112,8
+113,12
@@
public abstract class AbstractNeutronNorthbound<T extends INeutronObject<T>, R e
T singleton = input.getSingleton();
singleton.initDefaults();
T singleton = input.getSingleton();
singleton.initDefaults();
- if (neutronCRUD.add(singleton).equals(DependencyMissing)) {
+ Result result = neutronCRUD.add(singleton);
+ if (result.equals(DependencyMissing)) {
+ LOG.warn("create failed due to input missing dependencies: {}", input);
return Response.status(HTTP_MISSING_DEPENDENCY).entity(input).build();
return Response.status(HTTP_MISSING_DEPENDENCY).entity(input).build();
+ } else if (result.equals(AlreadyExists)) {
+ return Response.status(HttpURLConnection.HTTP_CONFLICT).entity(input).build();
}
} else {
if (input.getBulk() == null) {
}
} else {
if (input.getBulk() == null) {
@@
-121,9
+126,12
@@
public abstract class AbstractNeutronNorthbound<T extends INeutronObject<T>, R e
}
for (T test : input.getBulk()) {
test.initDefaults();
}
for (T test : input.getBulk()) {
test.initDefaults();
- if (neutronCRUD.add(test).equals(DependencyMissing)) {
+ Result result = neutronCRUD.add(test);
+ if (result.equals(DependencyMissing)) {
LOG.warn("create failed due to input missing dependencies: {}", input);
return Response.status(HTTP_MISSING_DEPENDENCY).entity(input).build();
LOG.warn("create failed due to input missing dependencies: {}", input);
return Response.status(HTTP_MISSING_DEPENDENCY).entity(input).build();
+ } else if (result.equals(AlreadyExists)) {
+ return Response.status(HttpURLConnection.HTTP_CONFLICT).entity(input).build();
}
}
}
}
}
}