mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Adding content-type to descriptor
This commit is contained in:
parent
228b24ca79
commit
7eaee141e0
@ -40,6 +40,7 @@ import javax.xml.bind.annotation.XmlType;
|
|||||||
* </sequence>
|
* </sequence>
|
||||||
* <attribute name="context" type="{http://www.w3.org/2001/XMLSchema}string" />
|
* <attribute name="context" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||||
* <attribute name="method" 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>
|
* </restriction>
|
||||||
* </complexContent>
|
* </complexContent>
|
||||||
* </complexType>
|
* </complexType>
|
||||||
@ -62,6 +63,32 @@ public class Operation {
|
|||||||
protected String context;
|
protected String context;
|
||||||
@XmlAttribute(name = "method")
|
@XmlAttribute(name = "method")
|
||||||
protected String 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.
|
* Gets the value of the queryParameters property.
|
||||||
|
|||||||
@ -38,6 +38,7 @@ public class ConfigurationBasedFeatureManager implements FeatureManager {
|
|||||||
private List<Feature> features = new ArrayList<>();
|
private List<Feature> features = new ArrayList<>();
|
||||||
private static final String METHOD = "method";
|
private static final String METHOD = "method";
|
||||||
private static final String URI = "uri";
|
private static final String URI = "uri";
|
||||||
|
private static final String CONTENT_TYPE = "contentType";
|
||||||
private static final String PATH_PARAMS = "pathParams";
|
private static final String PATH_PARAMS = "pathParams";
|
||||||
private static final String QUERY_PARAMS = "queryParams";
|
private static final String QUERY_PARAMS = "queryParams";
|
||||||
private static final String FORM_PARAMS = "formParams";
|
private static final String FORM_PARAMS = "formParams";
|
||||||
@ -55,6 +56,7 @@ public class ConfigurationBasedFeatureManager implements FeatureManager {
|
|||||||
Map<String, Object> apiParams = new HashMap<>();
|
Map<String, Object> apiParams = new HashMap<>();
|
||||||
apiParams.put(METHOD, operation.getMethod().toUpperCase());
|
apiParams.put(METHOD, operation.getMethod().toUpperCase());
|
||||||
apiParams.put(URI, operation.getContext());
|
apiParams.put(URI, operation.getContext());
|
||||||
|
apiParams.put(CONTENT_TYPE, operation.getType());
|
||||||
List<String> pathParams = new ArrayList<>();
|
List<String> pathParams = new ArrayList<>();
|
||||||
List<String> queryParams = new ArrayList<>();
|
List<String> queryParams = new ArrayList<>();
|
||||||
List<String> formParams = new ArrayList<>();
|
List<String> formParams = new ArrayList<>();
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
<Feature code="abc">
|
<Feature code="abc">
|
||||||
<Name>abc</Name>
|
<Name>abc</Name>
|
||||||
<Description>this is a feature</Description>
|
<Description>this is a feature</Description>
|
||||||
<Operation context="/bulb/{state}" method="PUT">
|
<Operation context="/bulb/{state}" method="PUT" type="application/json">
|
||||||
<QueryParameters>
|
<QueryParameters>
|
||||||
<Parameter>deviceId</Parameter>
|
<Parameter>deviceId</Parameter>
|
||||||
</QueryParameters>
|
</QueryParameters>
|
||||||
|
|||||||
@ -48,6 +48,7 @@ var operationModule = function () {
|
|||||||
feature["operation"] = features[i].code;
|
feature["operation"] = features[i].code;
|
||||||
feature["name"] = features[i].name;
|
feature["name"] = features[i].name;
|
||||||
feature["description"] = features[i].description;
|
feature["description"] = features[i].description;
|
||||||
|
feature["contentType"] = features[i].contentType;
|
||||||
feature["deviceType"] = deviceType;
|
feature["deviceType"] = deviceType;
|
||||||
feature["params"] = [];
|
feature["params"] = [];
|
||||||
var metaData = features[i].metadataEntries;
|
var metaData = features[i].metadataEntries;
|
||||||
@ -81,6 +82,10 @@ var operationModule = function () {
|
|||||||
var iconPath = utility.getOperationIcon(deviceType, iconIdentifier);
|
var iconPath = utility.getOperationIcon(deviceType, iconIdentifier);
|
||||||
operations[op]["icon"] = iconPath;
|
operations[op]["icon"] = iconPath;
|
||||||
}
|
}
|
||||||
|
var formParams = features[iconIdentifier].formParams;
|
||||||
|
if (formParams) {
|
||||||
|
operations[op]["uiParams"] = formParams;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return operations;
|
return operations;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user