Adding an extension point into the PaginationRequest class

This allows other APIs which has additional parameters to be passed into
the backend DAOs
revert-70aa11f8
Rasika Perera 7 years ago
parent 93422ae12d
commit e996f1f9f0

@ -19,6 +19,8 @@
package org.wso2.carbon.device.mgt.common; package org.wso2.carbon.device.mgt.common;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/** /**
* This class holds required parameters for a querying a paginated device response. * This class holds required parameters for a querying a paginated device response.
@ -35,6 +37,7 @@ public class PaginationRequest {
private String deviceName; private String deviceName;
private String ownership; private String ownership;
private String ownerRole; private String ownerRole;
private Map<String, Object> property = new HashMap<>();
private Date since; private Date since;
public PaginationRequest(int start, int rowCount) { public PaginationRequest(int start, int rowCount) {
@ -130,6 +133,24 @@ public class PaginationRequest {
this.ownerPattern = ownerPattern; this.ownerPattern = ownerPattern;
} }
public void setProperty(String key, Object value) {
this.property.put(key, value);
}
public void setProperties(Map<String, Object> parameters) {
this.property.putAll(parameters);
}
public void getProperty(String key) {
this.property.get(key);
}
public Map<String, Object> getProperties() {
Map<String, Object> temp = new HashMap<>();
temp.putAll(property);
return temp;
}
@Override @Override
public String toString() { public String toString() {
return "Device type '" + this.deviceType + "' Device Name '" + this.deviceName + "' row count: " + this.rowCount return "Device type '" + this.deviceType + "' Device Name '" + this.deviceName + "' row count: " + this.rowCount

Loading…
Cancel
Save