From 300d9b9002b5616139347ba9645ea9fd00f2c0fd Mon Sep 17 00:00:00 2001 From: Shamalka Navod Date: Tue, 28 Jan 2020 16:50:22 +0000 Subject: [PATCH] Add device name and owner to response Add device name and owner to getAllComplianceDevices response which gives compliance status of all devices --- .../Reports/Templates/DeviceStatusReport.js | 18 ++++--- .../Reports/Templates/EnrollmentTypeReport.js | 18 ++++--- .../EnrollmentsVsUnenrollmentsReport.js | 18 ++++--- .../Reports/Templates/PolicyReport.js | 22 ++++++--- .../Reports/Widgets/SelectPolicyDropDown.js | 2 +- .../impl/PolicyManagementServiceImpl.java | 7 ++- .../carbon/device/mgt/core/dao/DeviceDAO.java | 8 ++- .../dao/impl/device/GenericDeviceDAOImpl.java | 49 ++++++++++--------- .../dao/impl/device/OracleDeviceDAOImpl.java | 46 ++++++++--------- .../impl/device/PostgreSQLDeviceDAOImpl.java | 46 ++++++++--------- .../impl/device/SQLServerDeviceDAOImpl.java | 46 ++++++++--------- .../mgt/ReportManagementServiceImpl.java | 2 +- 12 files changed, 159 insertions(+), 123 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/DeviceStatusReport.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/DeviceStatusReport.js index 71ce345f85..5e15835078 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/DeviceStatusReport.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/DeviceStatusReport.js @@ -37,9 +37,11 @@ class DeviceStatusReport extends React.Component { this.state = { paramsObject: { from: moment() - .subtract(7, 'days') + .subtract(6, 'days') + .format('YYYY-MM-DD'), + to: moment() + .add(1, 'days') .format('YYYY-MM-DD'), - to: moment().format('YYYY-MM-DD'), }, data: [], fields: [], @@ -62,17 +64,21 @@ class DeviceStatusReport extends React.Component { case 'weekly': this.updateDurationValue( moment() - .subtract(7, 'days') + .subtract(6, 'days') + .format('YYYY-MM-DD'), + moment() + .add(1, 'days') .format('YYYY-MM-DD'), - moment().format('YYYY-MM-DD'), ); break; case 'monthly': this.updateDurationValue( moment() - .subtract(30, 'days') + .subtract(29, 'days') + .format('YYYY-MM-DD'), + moment() + .add(1, 'days') .format('YYYY-MM-DD'), - moment().format('YYYY-MM-DD'), ); break; } diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/EnrollmentTypeReport.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/EnrollmentTypeReport.js index a9eb43c1b1..3a936a26ae 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/EnrollmentTypeReport.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/EnrollmentTypeReport.js @@ -37,9 +37,11 @@ class EnrollmentTypeReport extends React.Component { this.state = { paramsObject: { from: moment() - .subtract(7, 'days') + .subtract(6, 'days') + .format('YYYY-MM-DD'), + to: moment() + .add(1, 'days') .format('YYYY-MM-DD'), - to: moment().format('YYYY-MM-DD'), }, data: [], fields: [], @@ -66,17 +68,21 @@ class EnrollmentTypeReport extends React.Component { case 'weekly': this.updateDurationValue( moment() - .subtract(7, 'days') + .subtract(6, 'days') + .format('YYYY-MM-DD'), + moment() + .add(1, 'days') .format('YYYY-MM-DD'), - moment().format('YYYY-MM-DD'), ); break; case 'monthly': this.updateDurationValue( moment() - .subtract(30, 'days') + .subtract(29, 'days') + .format('YYYY-MM-DD'), + moment() + .add(1, 'days') .format('YYYY-MM-DD'), - moment().format('YYYY-MM-DD'), ); break; } diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/EnrollmentsVsUnenrollmentsReport.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/EnrollmentsVsUnenrollmentsReport.js index 54f07a2a48..983c6fc021 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/EnrollmentsVsUnenrollmentsReport.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/EnrollmentsVsUnenrollmentsReport.js @@ -37,9 +37,11 @@ class EnrollmentsVsUnenrollmentsReport extends React.Component { this.state = { paramsObject: { from: moment() - .subtract(7, 'days') + .subtract(6, 'days') + .format('YYYY-MM-DD'), + to: moment() + .add(1, 'days') .format('YYYY-MM-DD'), - to: moment().format('YYYY-MM-DD'), }, data: [], fields: [], @@ -66,17 +68,21 @@ class EnrollmentsVsUnenrollmentsReport extends React.Component { case 'weekly': this.updateDurationValue( moment() - .subtract(7, 'days') + .subtract(6, 'days') + .format('YYYY-MM-DD'), + moment() + .add(1, 'days') .format('YYYY-MM-DD'), - moment().format('YYYY-MM-DD'), ); break; case 'monthly': this.updateDurationValue( moment() - .subtract(30, 'days') + .subtract(29, 'days') + .format('YYYY-MM-DD'), + moment() + .add(1, 'days') .format('YYYY-MM-DD'), - moment().format('YYYY-MM-DD'), ); break; } diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/PolicyReport.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/PolicyReport.js index 5368318d7c..2e3e859308 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/PolicyReport.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Templates/PolicyReport.js @@ -42,9 +42,11 @@ class PolicyReport extends React.Component { // This object contains parameters which pass into API endpoint policyReportData: { from: moment() - .subtract(7, 'days') + .subtract(6, 'days') + .format('YYYY-MM-DD'), + to: moment() + .add(1, 'days') .format('YYYY-MM-DD'), - to: moment().format('YYYY-MM-DD'), }, visible: false, }; @@ -60,26 +62,30 @@ class PolicyReport extends React.Component { switch (durationMode) { case 'daily': this.updateDurationValue( + moment().format('YYYY-MM-DD'), moment() - .subtract(1, 'days') + .add(1, 'days') .format('YYYY-MM-DD'), - moment().format('YYYY-MM-DD'), ); break; case 'weekly': this.updateDurationValue( moment() - .subtract(7, 'days') + .subtract(6, 'days') + .format('YYYY-MM-DD'), + moment() + .add(1, 'days') .format('YYYY-MM-DD'), - moment().format('YYYY-MM-DD'), ); break; case 'monthly': this.updateDurationValue( moment() - .subtract(30, 'days') + .subtract(29, 'days') + .format('YYYY-MM-DD'), + moment() + .add(1, 'days') .format('YYYY-MM-DD'), - moment().format('YYYY-MM-DD'), ); break; } diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Widgets/SelectPolicyDropDown.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Widgets/SelectPolicyDropDown.js index 2ad089269c..d9f7baba25 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Widgets/SelectPolicyDropDown.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Reports/Widgets/SelectPolicyDropDown.js @@ -60,7 +60,7 @@ class SelectPolicyDropDown extends React.Component { if (res.status === 200) { this.setState({ loading: false, - data: JSON.parse(res.data.data), + data: res.data.data.policies, }); } }) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java index d971a766db..e196c5ddd4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java @@ -170,12 +170,12 @@ public class PolicyManagementServiceImpl implements PolicyManagementService { PolicyAdministratorPoint policyAdministratorPoint = policyManagementService.getPAP(); policies = policyAdministratorPoint.getPolicies(); if(offset == 0 && limit == 0){ - return Response.status(Response.Status.OK).entity(policies).build(); + targetPolicies.setCount(policies.size()); + targetPolicies.setList(policies); }else{ targetPolicies.setCount(policies.size()); filteredPolicies = FilteringUtil.getFilteredList(policies, offset, limit); targetPolicies.setList(filteredPolicies); - return Response.status(Response.Status.OK).entity(targetPolicies).build(); } } catch (PolicyManagementException e) { String msg = "Error occurred while retrieving all available policies"; @@ -183,8 +183,7 @@ public class PolicyManagementServiceImpl implements PolicyManagementService { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); } - - + return Response.status(Response.Status.OK).entity(targetPolicies).build(); } @GET diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java index b755a4c68e..95d7420eed 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java @@ -35,8 +35,12 @@ package org.wso2.carbon.device.mgt.core.dao; -import org.wso2.carbon.device.mgt.common.*; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo.Status; +import org.wso2.carbon.device.mgt.common.PaginationRequest; +import org.wso2.carbon.device.mgt.common.Count; import org.wso2.carbon.device.mgt.common.device.details.DeviceLocationHistory; import org.wso2.carbon.device.mgt.common.configuration.mgt.DevicePropertyInfo; import org.wso2.carbon.device.mgt.common.device.details.DeviceData; @@ -250,7 +254,7 @@ public interface DeviceDAO { * @return returns the device object. * @throws DeviceManagementDAOException */ - Device getDevice(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status status,int tenantId) + Device getDevice(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status status, int tenantId) throws DeviceManagementDAOException; /** diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java index c984d6a77e..ea1df72909 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java @@ -605,31 +605,33 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { sql = sql + " AND e.OWNERSHIP = ?"; } - sql = sql + " GROUP BY SUBSTRING(e.DATE_OF_ENROLMENT, 1, 10) LIMIT ?,?"; + sql = sql + " GROUP BY SUBSTRING(e.DATE_OF_ENROLMENT, 1, 10) LIMIT ? OFFSET ?"; - try (Connection conn = this.getConnection(); - PreparedStatement stmt = conn.prepareStatement(sql)) { - int paramIdx = 1; - stmt.setInt(paramIdx++, tenantId); - stmt.setString(paramIdx++, fromDate); - stmt.setString(paramIdx++, toDate); - if (isStatusProvided) { - for (String status : statusList) { - stmt.setString(paramIdx++, status); + try { + Connection conn = this.getConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + int paramIdx = 1; + stmt.setInt(paramIdx++, tenantId); + stmt.setString(paramIdx++, fromDate); + stmt.setString(paramIdx++, toDate); + if (isStatusProvided) { + for (String status : statusList) { + stmt.setString(paramIdx++, status); + } } - } - if (ownership != null) { - stmt.setString(paramIdx++, ownership); - } - stmt.setInt(paramIdx++, request.getStartIndex()); - stmt.setInt(paramIdx, request.getRowCount()); - try (ResultSet rs = stmt.executeQuery()) { - while (rs.next()) { - Count count = new Count( - rs.getString("ENROLMENT_DATE"), - rs.getInt("ENROLMENT_COUNT") - ); - countList.add(count); + if (ownership != null) { + stmt.setString(paramIdx++, ownership); + } + stmt.setInt(paramIdx++, request.getRowCount()); + stmt.setInt(paramIdx, request.getStartIndex()); + try (ResultSet rs = stmt.executeQuery()) { + while (rs.next()) { + Count count = new Count( + rs.getString("ENROLMENT_DATE"), + rs.getInt("ENROLMENT_COUNT") + ); + countList.add(count); + } } } } catch (SQLException e) { @@ -638,6 +640,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { log.error(msg, e); throw new DeviceManagementDAOException(msg, e); } + return countList; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java index d706af806d..718c187530 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java @@ -557,29 +557,31 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl { sql = sql + " GROUP BY SUBSTRING(e.DATE_OF_ENROLMENT, 1, 10) OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; - try (Connection conn = this.getConnection(); - PreparedStatement stmt = conn.prepareStatement(sql)) { - int paramIdx = 1; - stmt.setInt(paramIdx++, tenantId); - stmt.setString(paramIdx++, fromDate); - stmt.setString(paramIdx++, toDate); - if (isStatusProvided) { - for (String status : statusList) { - stmt.setString(paramIdx++, status); + try { + Connection conn = this.getConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + int paramIdx = 1; + stmt.setInt(paramIdx++, tenantId); + stmt.setString(paramIdx++, fromDate); + stmt.setString(paramIdx++, toDate); + if (isStatusProvided) { + for (String status : statusList) { + stmt.setString(paramIdx++, status); + } } - } - if (ownership != null) { - stmt.setString(paramIdx++, ownership); - } - stmt.setInt(paramIdx++, request.getStartIndex()); - stmt.setInt(paramIdx, request.getRowCount()); - try (ResultSet rs = stmt.executeQuery()) { - while (rs.next()) { - Count count = new Count( - rs.getString("ENROLMENT_DATE"), - rs.getInt("ENROLMENT_COUNT") - ); - countList.add(count); + if (ownership != null) { + stmt.setString(paramIdx++, ownership); + } + stmt.setInt(paramIdx++, request.getStartIndex()); + stmt.setInt(paramIdx, request.getRowCount()); + try (ResultSet rs = stmt.executeQuery()) { + while (rs.next()) { + Count count = new Count( + rs.getString("ENROLMENT_DATE"), + rs.getInt("ENROLMENT_COUNT") + ); + countList.add(count); + } } } } catch (SQLException e) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java index 41d5150743..23068865fd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java @@ -536,29 +536,31 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl { sql = sql + " GROUP BY SUBSTRING(e.DATE_OF_ENROLMENT, 1, 10) LIMIT ? OFFSET ?"; - try (Connection conn = this.getConnection(); - PreparedStatement stmt = conn.prepareStatement(sql)) { - int paramIdx = 1; - stmt.setInt(paramIdx++, tenantId); - stmt.setString(paramIdx++, fromDate); - stmt.setString(paramIdx++, toDate); - if (isStatusProvided) { - for (String status : statusList) { - stmt.setString(paramIdx++, status); + try { + Connection conn = this.getConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + int paramIdx = 1; + stmt.setInt(paramIdx++, tenantId); + stmt.setString(paramIdx++, fromDate); + stmt.setString(paramIdx++, toDate); + if (isStatusProvided) { + for (String status : statusList) { + stmt.setString(paramIdx++, status); + } } - } - if (ownership != null) { - stmt.setString(paramIdx++, ownership); - } - stmt.setInt(paramIdx++, request.getStartIndex()); - stmt.setInt(paramIdx, request.getRowCount()); - try (ResultSet rs = stmt.executeQuery()) { - while (rs.next()) { - Count count = new Count( - rs.getString("ENROLMENT_DATE"), - rs.getInt("ENROLMENT_COUNT") - ); - countList.add(count); + if (ownership != null) { + stmt.setString(paramIdx++, ownership); + } + stmt.setInt(paramIdx++, request.getStartIndex()); + stmt.setInt(paramIdx, request.getRowCount()); + try (ResultSet rs = stmt.executeQuery()) { + while (rs.next()) { + Count count = new Count( + rs.getString("ENROLMENT_DATE"), + rs.getInt("ENROLMENT_COUNT") + ); + countList.add(count); + } } } } catch (SQLException e) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java index 0135c2d025..0df8ec959c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java @@ -701,29 +701,31 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl { sql = sql + " GROUP BY SUBSTRING(e.DATE_OF_ENROLMENT, 1, 10) OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; - try (Connection conn = this.getConnection(); - PreparedStatement stmt = conn.prepareStatement(sql)) { - int paramIdx = 1; - stmt.setInt(paramIdx++, tenantId); - stmt.setString(paramIdx++, fromDate); - stmt.setString(paramIdx++, toDate); - if (isStatusProvided) { - for (String status : statusList) { - stmt.setString(paramIdx++, status); + try { + Connection conn = this.getConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + int paramIdx = 1; + stmt.setInt(paramIdx++, tenantId); + stmt.setString(paramIdx++, fromDate); + stmt.setString(paramIdx++, toDate); + if (isStatusProvided) { + for (String status : statusList) { + stmt.setString(paramIdx++, status); + } } - } - if (ownership != null) { - stmt.setString(paramIdx++, ownership); - } - stmt.setInt(paramIdx++, request.getStartIndex()); - stmt.setInt(paramIdx, request.getRowCount()); - try (ResultSet rs = stmt.executeQuery()) { - while (rs.next()) { - Count count = new Count( - rs.getString("ENROLMENT_DATE"), - rs.getInt("ENROLMENT_COUNT") - ); - countList.add(count); + if (ownership != null) { + stmt.setString(paramIdx++, ownership); + } + stmt.setInt(paramIdx++, request.getStartIndex()); + stmt.setInt(paramIdx, request.getRowCount()); + try (ResultSet rs = stmt.executeQuery()) { + while (rs.next()) { + Count count = new Count( + rs.getString("ENROLMENT_DATE"), + rs.getInt("ENROLMENT_COUNT") + ); + countList.add(count); + } } } } catch (SQLException e) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/report/mgt/ReportManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/report/mgt/ReportManagementServiceImpl.java index f3bbb1e666..51c0ec6929 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/report/mgt/ReportManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/report/mgt/ReportManagementServiceImpl.java @@ -203,7 +203,7 @@ public class ReportManagementServiceImpl implements ReportManagementService { } } else { for (Count count : countList) { - resultObject.addProperty(count.getDate(), count.getCount()); + resultObject.addProperty(count.getDate() + " - " + count.getDate(), count.getCount()); } } return resultObject;