forked from community/device-mgt-core
parent
bcab5f3bfe
commit
25ca3d22e8
@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.jaxrs.beans;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.geo.service.GeoCoordinate;
|
||||||
|
|
||||||
|
public class GeoCluster {
|
||||||
|
private final GeoCoordinate coordinates;
|
||||||
|
private final GeoCoordinate southWestBound;
|
||||||
|
private final GeoCoordinate northEastBound;
|
||||||
|
private final long count;
|
||||||
|
private final String geohashPrefix;
|
||||||
|
private final String deviceIdentification;
|
||||||
|
private final String deviceName;
|
||||||
|
private final String deviceType;
|
||||||
|
private final String lastSeen;
|
||||||
|
|
||||||
|
public GeoCluster(GeoCoordinate coordinates, GeoCoordinate southWestBound, GeoCoordinate northEastBound,
|
||||||
|
long count, String geohashPrefix, String deviceIdentification, String deviceName,
|
||||||
|
String deviceType, String lastSeen) {
|
||||||
|
this.coordinates = coordinates;
|
||||||
|
this.southWestBound = southWestBound;
|
||||||
|
this.northEastBound = northEastBound;
|
||||||
|
this.count = count;
|
||||||
|
this.geohashPrefix = geohashPrefix;
|
||||||
|
this.deviceIdentification = deviceIdentification;
|
||||||
|
this.deviceName = deviceName;
|
||||||
|
this.deviceType = deviceType;
|
||||||
|
this.lastSeen = lastSeen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGeohashPrefix() {
|
||||||
|
return geohashPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCount() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeoCoordinate getCoordinates() {
|
||||||
|
return coordinates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeoCoordinate getSouthWestBound() {
|
||||||
|
return southWestBound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeoCoordinate getNorthEastBound() {
|
||||||
|
return northEastBound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceIdentification() {
|
||||||
|
return deviceIdentification;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceName() {
|
||||||
|
return deviceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceType() {
|
||||||
|
return deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastSeen() {
|
||||||
|
return lastSeen;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.common.geo.service;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
|
|
||||||
|
public class GeoCluster {
|
||||||
|
|
||||||
|
private final GeoCoordinate coordinates;
|
||||||
|
private final GeoCoordinate southWestBound;
|
||||||
|
private final GeoCoordinate northEastBound;
|
||||||
|
private final long count;
|
||||||
|
private final String geohashPrefix;
|
||||||
|
private final Device device;
|
||||||
|
|
||||||
|
public GeoCluster(GeoCoordinate coordinates, GeoCoordinate southWestBound, GeoCoordinate northEastBound,
|
||||||
|
long count, String geohashPrefix, Device device) {
|
||||||
|
this.coordinates = coordinates;
|
||||||
|
this.southWestBound = southWestBound;
|
||||||
|
this.northEastBound = northEastBound;
|
||||||
|
this.count = count;
|
||||||
|
this.geohashPrefix = geohashPrefix;
|
||||||
|
this.device = device;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGeohashPrefix() {
|
||||||
|
return geohashPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCount() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeoCoordinate getCoordinates() {
|
||||||
|
return coordinates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeoCoordinate getSouthWestBound() {
|
||||||
|
return southWestBound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeoCoordinate getNorthEastBound() {
|
||||||
|
return northEastBound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Device getDevice() {
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.common.geo.service;
|
||||||
|
|
||||||
|
public class GeoCoordinate {
|
||||||
|
|
||||||
|
private final double latitude;
|
||||||
|
private final double longitude;
|
||||||
|
|
||||||
|
public GeoCoordinate(double latitude, double longitude) {
|
||||||
|
this.latitude = latitude;
|
||||||
|
this.longitude = longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLatitude() {
|
||||||
|
return latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLongitude() {
|
||||||
|
return longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,139 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.common.geo.service;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GeoQuery {
|
||||||
|
|
||||||
|
private final GeoCoordinate southWest;
|
||||||
|
private final GeoCoordinate northEast;
|
||||||
|
private final int geohashLength;
|
||||||
|
private List<String> deviceTypes;
|
||||||
|
private List<String> deviceIdentifiers;
|
||||||
|
private List<EnrolmentInfo.Status> statuses;
|
||||||
|
private List<String> ownerships;
|
||||||
|
private List<String> owners;
|
||||||
|
private boolean noClusters;
|
||||||
|
private long createdBefore;
|
||||||
|
private long createdAfter;
|
||||||
|
private long updatedBefore;
|
||||||
|
private long updatedAfter;
|
||||||
|
|
||||||
|
public GeoQuery(GeoCoordinate southWest, GeoCoordinate northEast, int geohashLength) {
|
||||||
|
this.southWest = southWest;
|
||||||
|
this.northEast = northEast;
|
||||||
|
this.geohashLength = geohashLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeoCoordinate getSouthWest() {
|
||||||
|
return southWest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeoCoordinate getNorthEast() {
|
||||||
|
return northEast;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGeohashLength() {
|
||||||
|
return geohashLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getDeviceTypes() {
|
||||||
|
return deviceTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceTypes(List<String> deviceTypes) {
|
||||||
|
this.deviceTypes = deviceTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getDeviceIdentifiers() {
|
||||||
|
return deviceIdentifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceIdentifiers(List<String> deviceIdentifiers) {
|
||||||
|
this.deviceIdentifiers = deviceIdentifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EnrolmentInfo.Status> getStatuses() {
|
||||||
|
return statuses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatuses(List<EnrolmentInfo.Status> statuses) {
|
||||||
|
this.statuses = statuses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getOwnerships() {
|
||||||
|
return ownerships;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwnerships(List<String> ownerships) {
|
||||||
|
this.ownerships = ownerships;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getOwners() {
|
||||||
|
return owners;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwners(List<String> owners) {
|
||||||
|
this.owners = owners;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNoClusters() {
|
||||||
|
return noClusters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoClusters(boolean noClusters) {
|
||||||
|
this.noClusters = noClusters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCreatedBefore() {
|
||||||
|
return createdBefore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedBefore(long createdBefore) {
|
||||||
|
this.createdBefore = createdBefore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCreatedAfter() {
|
||||||
|
return createdAfter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAfter(long createdAfter) {
|
||||||
|
this.createdAfter = createdAfter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getUpdatedBefore() {
|
||||||
|
return updatedBefore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedBefore(long updatedBefore) {
|
||||||
|
this.updatedBefore = updatedBefore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getUpdatedAfter() {
|
||||||
|
return updatedAfter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedAfter(long updatedAfter) {
|
||||||
|
this.updatedAfter = updatedAfter;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,65 +0,0 @@
|
|||||||
package org.wso2.carbon.device.mgt.core.geo;
|
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.core.geo.geoHash.GeoCoordinate;
|
|
||||||
|
|
||||||
public class GeoCluster {
|
|
||||||
private GeoCoordinate coordinates;
|
|
||||||
private GeoCoordinate southWestBound;
|
|
||||||
private GeoCoordinate northEastBound;
|
|
||||||
private long count;
|
|
||||||
private String geohashPrefix;
|
|
||||||
private String deviceIdentification;
|
|
||||||
private String deviceName;
|
|
||||||
private String deviceType;
|
|
||||||
private String lastSeen;
|
|
||||||
|
|
||||||
|
|
||||||
public GeoCluster(GeoCoordinate coordinates, GeoCoordinate southWestBound, GeoCoordinate northEastBound, long count,
|
|
||||||
String geohashPrefix, String deviceIdentification, String deviceName, String deviceType, String lastSeen){
|
|
||||||
this.coordinates=coordinates;
|
|
||||||
this.southWestBound=southWestBound;
|
|
||||||
this.northEastBound=northEastBound;
|
|
||||||
this.count=count;
|
|
||||||
this.geohashPrefix=geohashPrefix;
|
|
||||||
this.deviceIdentification=deviceIdentification;
|
|
||||||
this.deviceName=deviceName;
|
|
||||||
this.deviceType=deviceType;
|
|
||||||
this.lastSeen = lastSeen;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGeohashPrefix() {
|
|
||||||
return geohashPrefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getCount() {
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GeoCoordinate getCoordinates() {
|
|
||||||
return coordinates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GeoCoordinate getSouthWestBound() {
|
|
||||||
return southWestBound;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GeoCoordinate getNorthEastBound() {
|
|
||||||
return northEastBound;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeviceIdentification() {
|
|
||||||
return deviceIdentification;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeviceName() {
|
|
||||||
return deviceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeviceType() { return deviceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLastSeen() {
|
|
||||||
return lastSeen;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package org.wso2.carbon.device.mgt.core.geo.geoHash;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class GeoCoordinate {
|
|
||||||
private double latitude;
|
|
||||||
private double longitude;
|
|
||||||
|
|
||||||
public GeoCoordinate(double latitude, double longitude){
|
|
||||||
this.latitude=latitude;
|
|
||||||
this.longitude=longitude;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getLatitude() {
|
|
||||||
return latitude;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getLongitude() {
|
|
||||||
return longitude;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.wso2.carbon.device.mgt.core.geo.geoHash.geoHashStrategy;
|
package org.wso2.carbon.device.mgt.core.geo.geoHash.geoHashStrategy;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.core.geo.geoHash.GeoCoordinate;
|
import org.wso2.carbon.device.mgt.common.geo.service.GeoCoordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is to decide a length for the geohash prefix
|
* This interface is to decide a length for the geohash prefix
|
||||||
* which will be used to group the clusters based on geohash
|
* which will be used to group the clusters based on geohash
|
||||||
*/
|
*/
|
||||||
public interface GeoHashLengthStrategy {
|
public interface GeoHashLengthStrategy {
|
||||||
|
|
||||||
int getGeohashLength(GeoCoordinate southWest, GeoCoordinate northEast, int zoom);
|
int getGeohashLength(GeoCoordinate southWest, GeoCoordinate northEast, int zoom);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue