Merge pull request #458 from ruwany/release-2.0.x

Adding content-type to descriptor
merge-requests/7/head
Rasika Perera 8 years ago committed by GitHub
commit 2cfff85ee2

@ -40,6 +40,7 @@ import javax.xml.bind.annotation.XmlType;
* </sequence>
* <attribute name="context" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="method" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
@ -62,6 +63,32 @@ public class Operation {
protected String context;
@XmlAttribute(name = "method")
protected String method;
@XmlAttribute(name = "type")
protected String type;
/**
* Gets the value of the Content Type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
return type;
}
/**
* Sets the value of the Content Type property.
*
* @param type
* allowed object is
* {@link String }
*
*/
public void setType(String type) {
this.type = type;
}
/**
* Gets the value of the queryParameters property.

@ -38,6 +38,7 @@ public class ConfigurationBasedFeatureManager implements FeatureManager {
private List<Feature> features = new ArrayList<>();
private static final String METHOD = "method";
private static final String URI = "uri";
private static final String CONTENT_TYPE = "contentType";
private static final String PATH_PARAMS = "pathParams";
private static final String QUERY_PARAMS = "queryParams";
private static final String FORM_PARAMS = "formParams";
@ -55,6 +56,7 @@ public class ConfigurationBasedFeatureManager implements FeatureManager {
Map<String, Object> apiParams = new HashMap<>();
apiParams.put(METHOD, operation.getMethod().toUpperCase());
apiParams.put(URI, operation.getContext());
apiParams.put(CONTENT_TYPE, operation.getType());
List<String> pathParams = new ArrayList<>();
List<String> queryParams = new ArrayList<>();
List<String> formParams = new ArrayList<>();

@ -25,7 +25,7 @@
<Feature code="abc">
<Name>abc</Name>
<Description>this is a feature</Description>
<Operation context="/bulb/{state}" method="PUT">
<Operation context="/bulb/{state}" method="PUT" type="application/json">
<QueryParameters>
<Parameter>deviceId</Parameter>
</QueryParameters>

@ -48,6 +48,7 @@ var operationModule = function () {
feature["operation"] = features[i].code;
feature["name"] = features[i].name;
feature["description"] = features[i].description;
feature["contentType"] = features[i].contentType;
feature["deviceType"] = deviceType;
feature["params"] = [];
var metaData = features[i].metadataEntries;
@ -81,6 +82,10 @@ var operationModule = function () {
var iconPath = utility.getOperationIcon(deviceType, iconIdentifier);
operations[op]["icon"] = iconPath;
}
var formParams = features[iconIdentifier].formParams;
if (formParams) {
operations[op]["uiParams"] = formParams;
}
}
}
return operations;

Loading…
Cancel
Save