Use well-known Status enumeration
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / rests / services / impl / RestconfDataServiceImpl.java
index b8eebc06faa17b27ef40a0ccbd2a1d6f02cfd5d5..7b4e67a0278f9dea8994c464d49ef81dacd68fa6 100644 (file)
@@ -31,6 +31,7 @@ import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import javax.ws.rs.Path;
 import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
 import javax.ws.rs.core.UriInfo;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
@@ -176,7 +177,7 @@ public class RestconfDataServiceImpl implements RestconfDataService {
         if (parameters.getContent().equals(RestconfDataServiceConstant.ReadData.ALL)
                     || parameters.getContent().equals(RestconfDataServiceConstant.ReadData.CONFIG)) {
             final QName type = node.getIdentifier().getNodeType();
-            return Response.status(200)
+            return Response.status(Status.OK)
                     .entity(new NormalizedNodeContext(instanceIdentifier, node, parameters))
                     .header("ETag", '"' + type.getModule().getRevision().map(Revision::toString).orElse(null)
                         + "-" + type.getLocalName() + '"')
@@ -184,7 +185,9 @@ public class RestconfDataServiceImpl implements RestconfDataService {
                     .build();
         }
 
-        return Response.status(200).entity(new NormalizedNodeContext(instanceIdentifier, node, parameters)).build();
+        return Response.status(Status.OK)
+            .entity(new NormalizedNodeContext(instanceIdentifier, node, parameters))
+            .build();
     }
 
     private void createAllYangNotificationStreams(final EffectiveModelContext schemaContext, final UriInfo uriInfo) {
@@ -412,11 +415,14 @@ public class RestconfDataServiceImpl implements RestconfDataService {
         }
 
         if (resultData != null && resultData.isEmpty()) {
-            return Response.status(Response.Status.NO_CONTENT).build();
+            return Response.status(Status.NO_CONTENT).build();
         }
 
-        return Response.status(200).entity(new NormalizedNodeContext(new InstanceIdentifierContext<>(yangIIdContext,
-                resultNodeSchema, mountPoint, schemaContextRef), resultData)).build();
+        return Response.status(Status.OK)
+            .entity(new NormalizedNodeContext(
+                new InstanceIdentifierContext<>(yangIIdContext, resultNodeSchema, mountPoint, schemaContextRef),
+                resultData))
+            .build();
     }
 
     /**