From e996f1f9f01dbf3667b88e0d38c1f4c76975da32 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Wed, 14 Mar 2018 13:20:11 +0530 Subject: [PATCH] Adding an extension point into the PaginationRequest class This allows other APIs which has additional parameters to be passed into the backend DAOs --- .../device/mgt/common/PaginationRequest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/PaginationRequest.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/PaginationRequest.java index e71ba71773..0aa18b3aaa 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/PaginationRequest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/PaginationRequest.java @@ -19,6 +19,8 @@ package org.wso2.carbon.device.mgt.common; import java.util.Date; +import java.util.HashMap; +import java.util.Map; /** * This class holds required parameters for a querying a paginated device response. @@ -35,6 +37,7 @@ public class PaginationRequest { private String deviceName; private String ownership; private String ownerRole; + private Map property = new HashMap<>(); private Date since; public PaginationRequest(int start, int rowCount) { @@ -130,6 +133,24 @@ public class PaginationRequest { this.ownerPattern = ownerPattern; } + public void setProperty(String key, Object value) { + this.property.put(key, value); + } + + public void setProperties(Map parameters) { + this.property.putAll(parameters); + } + + public void getProperty(String key) { + this.property.get(key); + } + + public Map getProperties() { + Map temp = new HashMap<>(); + temp.putAll(property); + return temp; + } + @Override public String toString() { return "Device type '" + this.deviceType + "' Device Name '" + this.deviceName + "' row count: " + this.rowCount