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;
}
}
- /**
- *
- */
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) {
}
}
- /**
- *
- */
public static final class Post extends Put {
public static final String METHOD_NAME = "POST";
super(nodeName, description);
this.dataNodeContainer = dataNodeContainer;
spec.setType(CONFIG + nodeName + METHOD_NAME);
+ spec.setConsumes(CONSUMES_PUT_POST);
}
@Override
}
}
- /**
- *
- */
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);