Delete netconf
[controller.git] / opendaylight / md-sal / sal-rest-docgen / src / main / java / org / opendaylight / controller / sal / rest / doc / model / builder / OperationBuilder.java
index 7e27b505413bb795f4ec51dff41927237c7679d5..88ca3bcd018c150a9c795fe7abbc7e5335a19526 100644 (file)
@@ -16,22 +16,22 @@ import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 
-/**
- *
- */
 public final class OperationBuilder {
 
     public static final String OPERATIONAL = "(operational)";
     public static final String CONFIG = "(config)";
 
-    /**
-   *
-   */
+    public static final List<String> CONSUMES_PUT_POST = new ArrayList<>();
+    static {
+        CONSUMES_PUT_POST.add("application/json");
+        CONSUMES_PUT_POST.add("application/xml");
+    }
+
     public static class Get {
 
         protected Operation spec;
         protected DataSchemaNode schemaNode;
-        private final String METHOD_NAME = "GET";
+        private static final String METHOD_NAME = "GET";
 
         public Get(DataSchemaNode node, boolean isConfig) {
             this.schemaNode = node;
@@ -53,19 +53,17 @@ public final class OperationBuilder {
         }
     }
 
-    /**
-   *
-   */
     public static class Put {
         protected Operation spec;
         protected String nodeName;
-        private final String METHOD_NAME = "PUT";
+        private static final String METHOD_NAME = "PUT";
 
         public Put(String nodeName, final String description) {
             this.nodeName = nodeName;
             spec = new Operation();
             spec.setType(CONFIG + nodeName);
             spec.setNotes(description);
+            spec.setConsumes(CONSUMES_PUT_POST);
         }
 
         public Put pathParams(List<Parameter> params) {
@@ -85,9 +83,6 @@ public final class OperationBuilder {
         }
     }
 
-    /**
-   *
-   */
     public static final class Post extends Put {
 
         public static final String METHOD_NAME = "POST";
@@ -97,6 +92,7 @@ public final class OperationBuilder {
             super(nodeName, description);
             this.dataNodeContainer = dataNodeContainer;
             spec.setType(CONFIG + nodeName + METHOD_NAME);
+            spec.setConsumes(CONSUMES_PUT_POST);
         }
 
         @Override
@@ -129,11 +125,8 @@ public final class OperationBuilder {
         }
     }
 
-    /**
-   *
-   */
     public static final class Delete extends Get {
-        private final String METHOD_NAME = "DELETE";
+        private static final String METHOD_NAME = "DELETE";
 
         public Delete(DataSchemaNode node) {
             super(node, false);