merged with upstream

merge-requests/7/head
ayyoob 8 years ago
commit 3423ef025d

@ -22,13 +22,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Annotations</name>
<description>WSO2 Carbon - API Management Custom Annotation Module</description>

@ -21,12 +21,12 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension.api</artifactId>
<packaging>war</packaging>
<name>WSO2 Carbon - API Application Management API</name>

@ -22,12 +22,12 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Application Management</name>

@ -21,13 +21,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.handlers</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Security Handler Component</name>
<description>WSO2 Carbon - API Management Security Handler Module</description>

@ -22,13 +22,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Webapp Publisher</name>
<description>WSO2 Carbon - API Management Webapp Publisher</description>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apimgt-extensions</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Component</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -35,7 +35,7 @@ import javax.ws.rs.core.Response;
}
),
tags = {
@Tag(name = "devicemgt_admin", description = "")
@Tag(name = "device_management", description = "")
}
)
@Api(value = "Certificate Management", description = "This API includes all the certificate management related operations")

@ -21,13 +21,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Certificate Management Core</name>
<description>WSO2 Carbon - Certificate Management Core</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Component</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -144,6 +144,7 @@
org.wso2.carbon.event.output.adapter.core,
org.wso2.carbon.event.output.adapter.core.exception,
org.osgi.framework,
org.wso2.carbon.device.mgt.core.operation.mgt,
org.wso2.carbon.core
</Import-Package>
</instructions>

@ -22,17 +22,21 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.policy.mgt.Profile;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationContext;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationExecutionFailedException;
import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation;
import org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.internal.MQTTDataHolder;
import org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.internal.util.MQTTAdapterConstants;
import org.wso2.carbon.event.output.adapter.core.MessageType;
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration;
import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException;
import org.wso2.carbon.device.mgt.core.operation.mgt.PolicyOperation;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@ -57,7 +61,7 @@ public class MQTTNotificationStrategy implements NotificationStrategy {
configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_USERNAME,
config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_USERNAME));
configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_PASSWORD,
config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_PASSWORD));
config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_PASSWORD));
configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_CLEAR_SESSION,
config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_CLEAR_SESSION));
configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_SCOPES,
@ -79,23 +83,48 @@ public class MQTTNotificationStrategy implements NotificationStrategy {
@Override
public void execute(NotificationContext ctx) throws PushNotificationExecutionFailedException {
Map<String, String> dynamicProperties = new HashMap<>();
Operation operation = ctx.getOperation();
Properties properties = operation.getProperties();
if (properties != null && properties.get(MQTT_ADAPTER_TOPIC) != null) {
Map<String, String> dynamicProperties = new HashMap<>();
dynamicProperties.put("topic", (String) properties.get(MQTT_ADAPTER_TOPIC));
MQTTDataHolder.getInstance().getOutputEventAdapterService().publish(mqttAdapterName, dynamicProperties,
operation.getPayLoad());
} else {
String topic = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true) + "/"
+ ctx.getDeviceId().getType() + "/" + ctx.getDeviceId().getId() + "/" + operation.getType()
.toString().toLowerCase() + "/" + operation.getCode();
dynamicProperties.put("topic", topic);
if (operation.getPayLoad() == null) {
operation.setPayLoad("");
if (PolicyOperation.POLICY_OPERATION_CODE.equals(operation.getCode())) {
PolicyOperation policyOperation = (PolicyOperation) operation;
List<ProfileOperation> profileOperations = policyOperation.getProfileOperations();
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true);
String deviceType = ctx.getDeviceId().getType();
String deviceId = ctx.getDeviceId().getId();
for (ProfileOperation profileOperation : profileOperations) {
Map<String, String> dynamicProperties = new HashMap<>();
String topic = tenantDomain + "/"
+ deviceType + "/" + deviceId + "/" + profileOperation.getType()
.toString().toLowerCase() + "/" + profileOperation.getCode().toLowerCase();
dynamicProperties.put("topic", topic);
MQTTDataHolder.getInstance().getOutputEventAdapterService().publish(mqttAdapterName, dynamicProperties,
profileOperation.getPayLoad());
}
} else {
Map<String, String> dynamicProperties = new HashMap<>();
String topic = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true) + "/"
+ ctx.getDeviceId().getType() + "/" + ctx.getDeviceId().getId() + "/" + operation.getType()
.toString().toLowerCase() + "/" + operation.getCode();
dynamicProperties.put("topic", topic);
if (operation.getPayLoad() == null) {
operation.setPayLoad("");
}
MQTTDataHolder.getInstance().getOutputEventAdapterService().publish(mqttAdapterName, dynamicProperties,
operation.getPayLoad());
}
}
MQTTDataHolder.getInstance().getOutputEventAdapterService().publish(mqttAdapterName, dynamicProperties,
operation.getPayLoad());
}
@Override
@ -109,3 +138,4 @@ public class MQTTNotificationStrategy implements NotificationStrategy {
}
}

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -72,7 +72,7 @@ import javax.ws.rs.core.Response;
"Further, this is strictly restricted to admin users only ")
public interface UserManagementAdminService {
@PUT
@POST
@Path("/{username}/credentials")
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,

@ -77,6 +77,9 @@ public class UserManagementServiceImpl implements UserManagementService {
private static final String API_BASE_PATH = "/users";
private static final Log log = LogFactory.getLog(UserManagementServiceImpl.class);
private static final String DEFAULT_DEVICE_USER = "Internal/devicemgt-user";
private static final String DEFAULT_DEVICE_ADMIN = "Internal/devicemgt-admin";
@POST
@Override
public Response addUser(UserInfo userInfo) {
@ -100,8 +103,17 @@ public class UserManagementServiceImpl implements UserManagementService {
this.buildDefaultUserClaims(userInfo.getFirstname(), userInfo.getLastname(),
userInfo.getEmailAddress());
// calling addUser method of carbon user api
List<String> tmpRoles = new ArrayList<>();
String[] userInfoRoles = userInfo.getRoles();
tmpRoles.add(DEFAULT_DEVICE_USER);
if (userInfoRoles != null) {
tmpRoles.addAll(Arrays.asList(userInfoRoles));
}
String[] roles = new String[tmpRoles.size()];
tmpRoles.toArray(roles);
userStoreManager.addUser(userInfo.getUsername(), initialUserPassword,
userInfo.getRoles(), defaultUserClaims, null);
roles, defaultUserClaims, null);
// Outputting debug message upon successful addition of user
if (log.isDebugEnabled()) {
log.debug("User '" + userInfo.getUsername() + "' has successfully been added.");

@ -89,7 +89,7 @@
<filter-class>org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter</filter-class>
<init-param>
<param-name>patterns</param-name>
<param-value>"text/html*","application/json*","text/plain*"</param-value>
<param-value>text/html" ,application/json" ,text/plain</param-value>
</init-param>
<init-param>
<param-name>filterAction</param-name>

@ -21,7 +21,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -90,4 +90,5 @@ public final class DeviceManagementConstants {
public static final String DB_TYPE_H2 = "H2";
public static final String DB_TYPE_POSTGRESQL = "PostgreSQL";
}
}

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -26,18 +26,18 @@ import java.util.Map;
public interface QueryBuilder {
Map<String, List<String>> buildQueries(List<Condition> conditions) throws InvalidOperatorException;
Map<String, List<QueryHolder>> buildQueries(List<Condition> conditions) throws InvalidOperatorException;
String processAND(List<Condition> conditions) throws InvalidOperatorException;
String processAND(List<Condition> conditions, ValueType[] valueType, Integer intArr[]) throws InvalidOperatorException;
String processOR(List<Condition> conditions) throws InvalidOperatorException;
String processOR(List<Condition> conditions, ValueType[] valueType, Integer intArr[]) throws InvalidOperatorException;
List<String> processLocation(Condition condition) throws InvalidOperatorException;
List<QueryHolder> processLocation(Condition condition) throws InvalidOperatorException;
List<String> processANDProperties(List<Condition> conditions) throws InvalidOperatorException;
List<QueryHolder> processANDProperties(List<Condition> conditions) throws InvalidOperatorException;
List<String> processORProperties(List<Condition> conditions) throws InvalidOperatorException;
List<QueryHolder> processORProperties(List<Condition> conditions) throws InvalidOperatorException;
String processUpdatedDevices(long epochTime) throws InvalidOperatorException;
QueryHolder processUpdatedDevices(long epochTime) throws InvalidOperatorException;
}

@ -0,0 +1,43 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.search.mgt;
public class QueryHolder {
private String query;
private ValueType[] types;
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
public ValueType[] getTypes() {
return types;
}
public void setTypes(ValueType[] types) {
this.types = types;
}
}

@ -0,0 +1,78 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.search.mgt;
public class ValueType {
public enum columnType {
STRING,
INTEGER,
DOUBLE,
LONG
}
private String stringValue;
private int intValue;
private Double doubleValue;
private long longValue;
private columnType columnType;
public String getStringValue() {
return stringValue;
}
public void setStringValue(String stringValue) {
this.stringValue = stringValue;
}
public int getIntValue() {
return intValue;
}
public void setIntValue(int intValue) {
this.intValue = intValue;
}
public Double getDoubleValue() {
return doubleValue;
}
public void setDoubleValue(Double doubleValue) {
this.doubleValue = doubleValue;
}
public ValueType.columnType getColumnType() {
return columnType;
}
public void setColumnType(ValueType.columnType columnType) {
this.columnType = columnType;
}
public long getLongValue() {
return longValue;
}
public void setLongValue(long longValue) {
this.longValue = longValue;
}
}

@ -62,27 +62,32 @@ public class ProcessorImpl implements Processor {
@Override
public List<Device> execute(SearchContext searchContext) throws SearchMgtException {
if(!Utils.validateOperators(searchContext.getConditions())){
throw new SearchMgtException("Invalid validator is provided.");
}
QueryBuilder queryBuilder = new QueryBuilderImpl();
List<Device> generalDevices = new ArrayList<>();
List<List<Device>> allANDDevices = new ArrayList<>();
List<List<Device>> allORDevices = new ArrayList<>();
List<Device> locationDevices = new ArrayList<>();
try {
Map<String, List<String>> queries = queryBuilder.buildQueries(searchContext.getConditions());
DeviceManagementDAOFactory.openConnection();
Map<String, List<QueryHolder>> queries = queryBuilder.buildQueries(searchContext.getConditions());
if (queries.containsKey(Constants.GENERAL)) {
generalDevices = searchDeviceDetailsTable(queries.get(Constants.GENERAL).get(0));
}
if (queries.containsKey(Constants.PROP_AND)) {
for (String query : queries.get(Constants.PROP_AND)) {
List<Device> andDevices = searchDeviceDetailsTable(query);
for (QueryHolder queryHolder : queries.get(Constants.PROP_AND)) {
List<Device> andDevices = searchDeviceDetailsTable(queryHolder);
allANDDevices.add(andDevices);
}
}
if (queries.containsKey(Constants.PROP_OR)) {
for (String query : queries.get(Constants.PROP_OR)) {
List<Device> orDevices = searchDeviceDetailsTable(query);
for (QueryHolder queryHolder : queries.get(Constants.PROP_OR)) {
List<Device> orDevices = searchDeviceDetailsTable(queryHolder);
allORDevices.add(orDevices);
}
}
@ -141,12 +146,12 @@ public class ProcessorImpl implements Processor {
@Override
public List<Device> getUpdatedDevices(long epochTime) throws SearchMgtException {
if((1 + (int)Math.floor(Math.log10(epochTime))) <=10 ) {
if ((1 + (int) Math.floor(Math.log10(epochTime))) <= 10) {
epochTime = epochTime * 1000;
}
QueryBuilder queryBuilder = new QueryBuilderImpl();
try {
String query = queryBuilder.processUpdatedDevices(epochTime);
QueryHolder query = queryBuilder.processUpdatedDevices(epochTime);
DeviceManagementDAOFactory.openConnection();
return searchDeviceDetailsTable(query);
} catch (InvalidOperatorException e) {
@ -218,7 +223,7 @@ public class ProcessorImpl implements Processor {
for (List<Device> devices : deLists) {
Map<Integer, Device> deviceMap = new HashMap<>();
for (Device device: devices) {
for (Device device : devices) {
deviceMap.put(device.getId(), device);
}
maps.add(deviceMap);
@ -241,9 +246,9 @@ public class ProcessorImpl implements Processor {
}
}
private List<Device> searchDeviceDetailsTable(String query) throws SearchDAOException {
private List<Device> searchDeviceDetailsTable(QueryHolder queryHolder) throws SearchDAOException {
if (log.isDebugEnabled()) {
log.debug("Query : " + query);
log.debug("Query : " + queryHolder.getQuery());
}
Connection conn;
PreparedStatement stmt = null;
@ -252,7 +257,26 @@ public class ProcessorImpl implements Processor {
Map<Integer, Integer> devs = new HashMap<>();
try {
conn = this.getConnection();
stmt = conn.prepareStatement(query);
stmt = conn.prepareStatement(queryHolder.getQuery());
int x = 1;
ValueType[] types = queryHolder.getTypes();
for (ValueType type : types) {
if (type.getColumnType().equals(ValueType.columnType.STRING)) {
stmt.setString(x, type.getStringValue());
x++;
} else if (type.getColumnType().equals(ValueType.columnType.INTEGER)) {
stmt.setInt(x, type.getIntValue());
x++;
} else if (type.getColumnType().equals(ValueType.columnType.LONG)){
stmt.setLong(x, type.getLongValue());
x++;
} else if(type.getColumnType().equals(ValueType.columnType.DOUBLE)){
stmt.setDouble(x, type.getDoubleValue());
x++;
}
}
rs = stmt.executeQuery();
while (rs.next()) {
if (!devs.containsKey(rs.getInt("ID"))) {
@ -362,8 +386,8 @@ public class ProcessorImpl implements Processor {
}
} catch (SQLException e) {
throw new SearchDAOException("Error occurred while retrieving the device properties.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt,rs);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
return devices;
}

@ -23,9 +23,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.search.Condition;
import org.wso2.carbon.device.mgt.core.search.mgt.Constants;
import org.wso2.carbon.device.mgt.core.search.mgt.InvalidOperatorException;
import org.wso2.carbon.device.mgt.core.search.mgt.QueryBuilder;
import org.wso2.carbon.device.mgt.core.search.mgt.*;
import java.util.ArrayList;
import java.util.HashMap;
@ -41,7 +39,7 @@ public class QueryBuilderImpl implements QueryBuilder {
private boolean isDeviceAdminUser;
@Override
public Map<String, List<String>> buildQueries(List<Condition> conditions) throws InvalidOperatorException {
public Map<String, List<QueryHolder>> buildQueries(List<Condition> conditions) throws InvalidOperatorException {
List<Condition> andColumns = new ArrayList<>();
List<Condition> orColumns = new ArrayList<>();
List<Condition> otherANDColumns = new ArrayList<>();
@ -82,10 +80,27 @@ public class QueryBuilderImpl implements QueryBuilder {
}
}
Map<String, List<String>> queries = new HashMap<>();
Map<String, List<QueryHolder>> queries = new HashMap<>();
if ((!andColumns.isEmpty()) || (!orColumns.isEmpty())) {
queries.put(Constants.GENERAL, Utils.convertStringToList(this.getGenericQueryPart() + this.processAND(andColumns) +
this.processOR(orColumns)));
// Size is taken as the sum of both columns and for tenant id.
ValueType valueTypeArray[] = new ValueType[andColumns.size() + orColumns.size() + 1];
// String query =Utils.convertStringToList(
// passing the integer value to the x so that array is correctly passed.
Integer intArr[] = new Integer[1];
intArr[0] = 1;
//int x = 1;
String query = this.getGenericQueryPart(valueTypeArray) +
this.processAND(andColumns, valueTypeArray, intArr) +
this.processOR(orColumns, valueTypeArray, intArr);
List<QueryHolder> queryHolders = new ArrayList<>();
QueryHolder queryHolder = new QueryHolder();
queryHolder.setQuery(query);
queryHolder.setTypes(valueTypeArray);
queryHolders.add(queryHolder);
queries.put(Constants.GENERAL, queryHolders);
}
if (!otherANDColumns.isEmpty()) {
queries.put(Constants.PROP_AND, this.processANDProperties(otherANDColumns));
@ -108,124 +123,262 @@ public class QueryBuilderImpl implements QueryBuilder {
}
@Override
public String processAND(List<Condition> conditions) throws InvalidOperatorException {
public String processAND(List<Condition> conditions, ValueType[] valueType, Integer intArr[]) throws InvalidOperatorException {
String querySuffix = "";
for (Condition con : conditions) {
if (Utils.checkDeviceDetailsColumns(con.getKey())) {
if (con.operator.equals(WILDCARD_OPERATOR)){
querySuffix = querySuffix + " OR DD." + Utils.getDeviceDetailsColumnNames().get(con.getKey())
+ " LIKE \'%" + con.getValue() + "%\'";
} else {
querySuffix = querySuffix + " AND DD." + Utils.getDeviceDetailsColumnNames().get(con.getKey()) + con
.getOperator() + Utils.getConvertedValue(con.getKey(), con.getValue());
try {
// TODO: find upto what address location of the array has filled.
int x = intArr[0];
for (Condition con : conditions) {
if (Utils.checkDeviceDetailsColumns(con.getKey())) {
if (con.operator.equals(WILDCARD_OPERATOR)) {
querySuffix = querySuffix + " OR DD." + Utils.getDeviceDetailsColumnNames().get(con.getKey())
+ " LIKE ? ";
ValueType type = new ValueType();
type.setColumnType(ValueType.columnType.STRING);
type.setStringValue("%"+con.getValue()+"%");
valueType[x] = type;
x++;
} else {
querySuffix = querySuffix + " AND DD." + Utils.getDeviceDetailsColumnNames().get(con.getKey()) + con
.getOperator() + " ? ";
ValueType type = new ValueType();
if (Utils.checkColumnType(con.getKey())) {
type.setColumnType(ValueType.columnType.STRING);
type.setStringValue(Utils.getConvertedValue(con.getKey(), con.getValue()));
} else {
type.setColumnType(ValueType.columnType.INTEGER);
type.setIntValue(Integer.parseInt(Utils.getConvertedValue(con.getKey(), con.getValue())));
}
valueType[x] = type;
x++;
}
} else if (Utils.checkDeviceLocationColumns(con.getKey().toLowerCase())) {
querySuffix = querySuffix + " AND DL." + Utils.getDeviceLocationColumnNames().get(con.getKey().toLowerCase()) +
con.getOperator() + " ? ";
ValueType type = new ValueType();
type.setColumnType(ValueType.columnType.STRING);
type.setStringValue(con.getValue());
valueType[x] = type;
x++;
}
} else if (Utils.checkDeviceLocationColumns(con.getKey().toLowerCase())) {
querySuffix = querySuffix + " AND DL." + Utils.getDeviceLocationColumnNames().get(con.getKey().toLowerCase()) +
con.getOperator() + con.getValue();
}
intArr[0] = x;
} catch (Exception e) {
throw new InvalidOperatorException("Error occurred while building the sql", e);
}
return querySuffix;
}
@Override
public String processOR(List<Condition> conditions) throws InvalidOperatorException {
public String processOR(List<Condition> conditions, ValueType[] valueType, Integer intArr[]) throws InvalidOperatorException {
String querySuffix = "";
for (Condition con : conditions) {
if (Utils.checkDeviceDetailsColumns(con.getKey())) {
if (con.operator.equals(WILDCARD_OPERATOR)) {
querySuffix = querySuffix + " OR DD." + Utils.getDeviceDetailsColumnNames().get(con.getKey())
+ " LIKE \'%" + con.getValue() + "%\'";
} else {
querySuffix = querySuffix + " OR DD." + Utils.getDeviceDetailsColumnNames().get(con.getKey()) + con
.getOperator() + Utils.getConvertedValue(con.getKey(), con.getValue());
// TODO: find upto what address location of the array has filled.
try {
int x = intArr[0];
for (Condition con : conditions) {
if (Utils.checkDeviceDetailsColumns(con.getKey())) {
if (con.operator.equals(WILDCARD_OPERATOR)) {
querySuffix = querySuffix + " OR DD." + Utils.getDeviceDetailsColumnNames().get(con.getKey())
+ " LIKE ? ";
ValueType type = new ValueType();
type.setColumnType(ValueType.columnType.STRING);
type.setStringValue("%"+con.getValue()+"%");
valueType[x] = type;
x++;
} else {
querySuffix = querySuffix + " OR DD." + Utils.getDeviceDetailsColumnNames().get(con.getKey()) + con
.getOperator() + " ? ";
ValueType type = new ValueType();
if (Utils.checkColumnType(con.getKey())) {
type.setColumnType(ValueType.columnType.STRING);
type.setStringValue(Utils.getConvertedValue(con.getKey(), con.getValue()));
} else {
type.setColumnType(ValueType.columnType.INTEGER);
type.setIntValue(Integer.parseInt(Utils.getConvertedValue(con.getKey(), con.getValue())));
}
valueType[x] = type;
x++;
}
} else if (Utils.checkDeviceLocationColumns(con.getKey().toLowerCase())) {
querySuffix =
querySuffix + " OR DL." + Utils.getDeviceLocationColumnNames().get(con.getKey().toLowerCase())
+ con.getOperator() + " ? ";
ValueType type = new ValueType();
type.setColumnType(ValueType.columnType.STRING);
type.setStringValue(con.getValue());
valueType[x] = type;
x++;
}
} else if (Utils.checkDeviceLocationColumns(con.getKey().toLowerCase())) {
querySuffix =
querySuffix + " OR DL." + Utils.getDeviceLocationColumnNames().get(con.getKey().toLowerCase())
+ con.getOperator() + con.getValue();
}
intArr[0] = x;
} catch (Exception e) {
throw new InvalidOperatorException("Error occurred while building the sql", e);
}
return querySuffix;
}
@Override
public List<String> processLocation(Condition condition) throws InvalidOperatorException {
List<String> queryList = new ArrayList<>();
queryList.add(this.buildLocationQuery(condition.getValue()));
return queryList;
public List<QueryHolder> processLocation(Condition condition) throws InvalidOperatorException {
List<QueryHolder> queryHolders = new ArrayList<>();
queryHolders.add(this.buildLocationQuery(condition.getValue()));
return queryHolders;
}
@Override
public List<String> processANDProperties(List<Condition> conditions) throws InvalidOperatorException {
public List<QueryHolder> processANDProperties(List<Condition> conditions) throws InvalidOperatorException {
return this.getQueryList(conditions);
}
@Override
public List<String> processORProperties(List<Condition> conditions) throws InvalidOperatorException {
public List<QueryHolder> processORProperties(List<Condition> conditions) throws InvalidOperatorException {
return this.getQueryList(conditions);
}
@Override
public String processUpdatedDevices(long epochTime) throws InvalidOperatorException {
return this.getGenericQueryPart() + " AND ( DD.UPDATE_TIMESTAMP > " + epochTime +
" OR DL.UPDATE_TIMESTAMP > " + epochTime + " )";
public QueryHolder processUpdatedDevices(long epochTime) throws InvalidOperatorException {
try {
ValueType valueTypeArray[] = new ValueType[3];
String query = this.getGenericQueryPart(valueTypeArray) + " AND ( DD.UPDATE_TIMESTAMP > ? " +
"OR DL.UPDATE_TIMESTAMP > ? )";
ValueType val1 = new ValueType();
val1.setColumnType(ValueType.columnType.LONG);
val1.setLongValue(epochTime);
valueTypeArray[1] = val1;
ValueType val2 = new ValueType();
val2.setColumnType(ValueType.columnType.LONG);
val2.setLongValue(epochTime);
valueTypeArray[2] = val2;
QueryHolder queryHolder = new QueryHolder();
queryHolder.setQuery(query);
queryHolder.setTypes(valueTypeArray);
return queryHolder;
} catch (Exception e) {
throw new InvalidOperatorException("Error occurred while building the for the updated devices.", e);
}
}
private List<String> getQueryList(List<Condition> conditions) {
List<String> queryList = new ArrayList<>();
for (Condition con : conditions) {
private List<QueryHolder> getQueryList(List<Condition> conditions) throws InvalidOperatorException {
try {
List<QueryHolder> queryHolders = new ArrayList<>();
for (Condition con : conditions) {
QueryHolder query = new QueryHolder();
ValueType valueTypeArray[] = new ValueType[3];
String querySuffix = this.getPropertyQueryPart(valueTypeArray) + " AND DI.KEY_FIELD = " + " ? " +
" AND DI.VALUE_FIELD " + con.getOperator() + " ? ";
ValueType key = new ValueType();
key.setColumnType(ValueType.columnType.STRING);
key.setStringValue(con.getKey());
valueTypeArray[1] = key;
ValueType value = new ValueType();
value.setColumnType(ValueType.columnType.STRING);
value.setStringValue(con.getValue());
valueTypeArray[2] = value;
String querySuffix = this.getPropertyQueryPart() + " AND DI.KEY_FIELD = " + "\'" + con.getKey() + "\'" +
" AND DI.VALUE_FIELD " + con.getOperator() + "\'" + con.getValue() + "\'";
queryList.add(querySuffix);
query.setQuery(querySuffix);
query.setTypes(valueTypeArray);
queryHolders.add(query);
}
return queryHolders;
} catch (Exception e) {
throw new InvalidOperatorException("Error occurred while building the sql", e);
}
return queryList;
}
private String buildLocationQuery(String location) {
private QueryHolder buildLocationQuery(String location) throws InvalidOperatorException {
try {
ValueType valueTypeArray[] = new ValueType[7];
String query = this.getGenericQueryPart(valueTypeArray);
query = query + " AND (DL.STREET1 LIKE ? ";
query = query + " OR DL.STREET2 LIKE ? ";
query = query + " OR DL.CITY LIKE ? ";
query = query + " OR DL.STATE LIKE ? ";
query = query + " OR DL.COUNTRY LIKE ? ";
query = query + " OR DL.ZIP LIKE ? )";
ValueType value = new ValueType();
value.setColumnType(ValueType.columnType.STRING);
value.setStringValue("%" + location + "%");
// Same location is passed to each place
valueTypeArray[1] = value;
valueTypeArray[2] = value;
valueTypeArray[3] = value;
valueTypeArray[4] = value;
valueTypeArray[5] = value;
valueTypeArray[6] = value;
String query = this.getGenericQueryPart();
query = query + " AND (DL.STREET1 LIKE \'%" + location + "%\'";
query = query + " OR DL.STREET2 LIKE \'%" + location + "%\'";
query = query + " OR DL.CITY LIKE \'%" + location + "%\'";
query = query + " OR DL.STATE LIKE \'%" + location + "%\'";
query = query + " OR DL.COUNTRY LIKE \'%" + location + "%\'";
query = query + " OR DL.ZIP LIKE \'%" + location + "%\')";
return query;
QueryHolder queryHolder = new QueryHolder();
queryHolder.setQuery(query);
queryHolder.setTypes(valueTypeArray);
return queryHolder;
} catch (Exception e) {
throw new InvalidOperatorException("Error occurred while building the sql for location.", e);
}
}
private String getGenericQueryPart() {
return "SELECT D.ID, D.DESCRIPTION, D.NAME, \n" +
"D.DEVICE_TYPE_ID, D.DEVICE_IDENTIFICATION, DT.ID AS DEVICE_TYPE_ID, \n" +
"DT.NAME AS DEVICE_TYPE_NAME, DD.DEVICE_ID, DD.DEVICE_MODEL, DD.VENDOR, \n" +
"DD.OS_VERSION, DD.OS_BUILD_DATE, DD.BATTERY_LEVEL, DD.INTERNAL_TOTAL_MEMORY, DD.INTERNAL_AVAILABLE_MEMORY,\n" +
"DD.EXTERNAL_TOTAL_MEMORY, DD.EXTERNAL_AVAILABLE_MEMORY, DD.CONNECTION_TYPE, \n" +
"DD.SSID, DD.CPU_USAGE, DD.TOTAL_RAM_MEMORY, DD.AVAILABLE_RAM_MEMORY, \n" +
"DD.PLUGGED_IN, DD.UPDATE_TIMESTAMP, DL.LATITUDE, DL.LONGITUDE, DL.STREET1, DL.STREET2, DL.CITY, DL.ZIP, \n" +
"DL.STATE, DL.COUNTRY, DL.UPDATE_TIMESTAMP AS DL_UPDATED_TIMESTAMP, DE.OWNER, DE.OWNERSHIP, DE.STATUS " +
"AS DE_STATUS FROM DM_DEVICE_DETAIL AS DD INNER JOIN DM_DEVICE AS D ON D.ID=DD.DEVICE_ID\n" +
"LEFT JOIN DM_DEVICE_LOCATION AS DL ON DL.DEVICE_ID=D.ID \n" +
"INNER JOIN DM_DEVICE_TYPE AS DT ON DT.ID=D.DEVICE_TYPE_ID\n" +
"INNER JOIN DM_ENROLMENT AS DE ON D.ID=DE.DEVICE_ID\n" +
"WHERE D.TENANT_ID = " + PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
private String getGenericQueryPart(ValueType[] valueTypeArray) throws InvalidOperatorException {
try {
String query = "SELECT D.ID, D.DESCRIPTION, D.NAME, \n" +
"D.DEVICE_TYPE_ID, D.DEVICE_IDENTIFICATION, DT.ID AS DEVICE_TYPE_ID, \n" +
"DT.NAME AS DEVICE_TYPE_NAME, DD.DEVICE_ID, DD.DEVICE_MODEL, DD.VENDOR, \n" +
"DD.OS_VERSION, DD.OS_BUILD_DATE, DD.BATTERY_LEVEL, DD.INTERNAL_TOTAL_MEMORY, DD.INTERNAL_AVAILABLE_MEMORY,\n" +
"DD.EXTERNAL_TOTAL_MEMORY, DD.EXTERNAL_AVAILABLE_MEMORY, DD.CONNECTION_TYPE, \n" +
"DD.SSID, DD.CPU_USAGE, DD.TOTAL_RAM_MEMORY, DD.AVAILABLE_RAM_MEMORY, \n" +
"DD.PLUGGED_IN, DD.UPDATE_TIMESTAMP, DL.LATITUDE, DL.LONGITUDE, DL.STREET1, DL.STREET2, DL.CITY, DL.ZIP, \n" +
"DL.STATE, DL.COUNTRY, DL.UPDATE_TIMESTAMP AS DL_UPDATED_TIMESTAMP, DE.OWNER, DE.OWNERSHIP, DE.STATUS " +
"AS DE_STATUS FROM DM_DEVICE_DETAIL AS DD INNER JOIN DM_DEVICE AS D ON D.ID=DD.DEVICE_ID\n" +
"LEFT JOIN DM_DEVICE_LOCATION AS DL ON DL.DEVICE_ID=D.ID \n" +
"INNER JOIN DM_DEVICE_TYPE AS DT ON DT.ID=D.DEVICE_TYPE_ID\n" +
"INNER JOIN DM_ENROLMENT AS DE ON D.ID=DE.DEVICE_ID\n" +
"WHERE D.TENANT_ID = ? ";
ValueType type = new ValueType();
type.setIntValue(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
type.setColumnType(ValueType.columnType.INTEGER);
valueTypeArray[0] = type;
return query;
} catch (Exception e) {
throw new InvalidOperatorException("Error occurred while building the sql", e);
}
}
private String getPropertyQueryPart() {
return "SELECT D.ID, D.DESCRIPTION, D.NAME, \n" +
"D.DEVICE_TYPE_ID, D.DEVICE_IDENTIFICATION, DT.ID AS DEVICE_TYPE_ID, \n" +
"DT.NAME AS DEVICE_TYPE_NAME, DD.DEVICE_ID, DD.DEVICE_MODEL, DD.VENDOR, \n" +
"DD.OS_VERSION, DD.OS_BUILD_DATE, DD.BATTERY_LEVEL, DD.INTERNAL_TOTAL_MEMORY, DD.INTERNAL_AVAILABLE_MEMORY,\n" +
"DD.EXTERNAL_TOTAL_MEMORY, DD.EXTERNAL_AVAILABLE_MEMORY, DD.CONNECTION_TYPE, \n" +
"DD.SSID, DD.CPU_USAGE, DD.TOTAL_RAM_MEMORY, DD.AVAILABLE_RAM_MEMORY, \n" +
"DD.PLUGGED_IN, DD.UPDATE_TIMESTAMP, DL.LATITUDE, DL.LONGITUDE, DL.STREET1, DL.STREET2, DL.CITY, DL.ZIP, \n" +
"DL.STATE, DL.COUNTRY, DL.UPDATE_TIMESTAMP AS DL_UPDATED_TIMESTAMP, DI.KEY_FIELD, DI.VALUE_FIELD, \n" +
"DE.OWNER, DE.OWNERSHIP, DE.STATUS AS DE_STATUS " +
"FROM DM_DEVICE_DETAIL AS DD INNER JOIN DM_DEVICE AS D ON D.ID=DD.DEVICE_ID\n" +
"LEFT JOIN DM_DEVICE_LOCATION AS DL ON DL.DEVICE_ID=D.ID \n" +
"INNER JOIN DM_DEVICE_TYPE AS DT ON DT.ID=D.DEVICE_TYPE_ID\n" +
"INNER JOIN DM_ENROLMENT AS DE ON D.ID=DE.DEVICE_ID\n" +
"LEFT JOIN DM_DEVICE_INFO AS DI ON DI.DEVICE_ID=D.ID\n" +
"WHERE D.TENANT_ID = " +
PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
private String getPropertyQueryPart(ValueType[] valueTypeArray) throws InvalidOperatorException {
try {
String query = "SELECT D.ID, D.DESCRIPTION, D.NAME, \n" +
"D.DEVICE_TYPE_ID, D.DEVICE_IDENTIFICATION, DT.ID AS DEVICE_TYPE_ID, \n" +
"DT.NAME AS DEVICE_TYPE_NAME, DD.DEVICE_ID, DD.DEVICE_MODEL, DD.VENDOR, \n" +
"DD.OS_VERSION, DD.OS_BUILD_DATE, DD.BATTERY_LEVEL, DD.INTERNAL_TOTAL_MEMORY, DD.INTERNAL_AVAILABLE_MEMORY,\n" +
"DD.EXTERNAL_TOTAL_MEMORY, DD.EXTERNAL_AVAILABLE_MEMORY, DD.CONNECTION_TYPE, \n" +
"DD.SSID, DD.CPU_USAGE, DD.TOTAL_RAM_MEMORY, DD.AVAILABLE_RAM_MEMORY, \n" +
"DD.PLUGGED_IN, DD.UPDATE_TIMESTAMP, DL.LATITUDE, DL.LONGITUDE, DL.STREET1, DL.STREET2, DL.CITY, DL.ZIP, \n" +
"DL.STATE, DL.COUNTRY, DL.UPDATE_TIMESTAMP AS DL_UPDATED_TIMESTAMP, DI.KEY_FIELD, DI.VALUE_FIELD, \n" +
"DE.OWNER, DE.OWNERSHIP, DE.STATUS AS DE_STATUS " +
"FROM DM_DEVICE_DETAIL AS DD INNER JOIN DM_DEVICE AS D ON D.ID=DD.DEVICE_ID\n" +
"LEFT JOIN DM_DEVICE_LOCATION AS DL ON DL.DEVICE_ID=D.ID \n" +
"INNER JOIN DM_DEVICE_TYPE AS DT ON DT.ID=D.DEVICE_TYPE_ID\n" +
"INNER JOIN DM_ENROLMENT AS DE ON D.ID=DE.DEVICE_ID\n" +
"LEFT JOIN DM_DEVICE_INFO AS DI ON DI.DEVICE_ID=D.ID\n" +
"WHERE D.TENANT_ID = ? ";
ValueType type = new ValueType();
type.setIntValue(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
type.setColumnType(ValueType.columnType.INTEGER);
valueTypeArray[0] = type;
return query;
} catch (Exception e) {
throw new InvalidOperatorException("Error occurred while building the sql", e);
}
}
}

@ -20,6 +20,7 @@
package org.wso2.carbon.device.mgt.core.search.mgt.impl;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.search.Condition;
import java.util.ArrayList;
import java.util.HashMap;
@ -31,6 +32,8 @@ public class Utils {
private static Map<String, String> genericColumnsMap = new HashMap<>();
private static Map<String, String> locationColumnsMap = new HashMap<>();
private static Map<String, String> operators = new HashMap<>();
static {
genericColumnsMap.put("deviceModel", "DEVICE_MODEL");
genericColumnsMap.put("vendor", "VENDOR");
@ -58,6 +61,18 @@ public class Utils {
locationColumnsMap.put("zip", "STATE");
locationColumnsMap.put("country", "COUNTRY");
//=, >, <, >=, <=, <>, !=, !>, !<
operators.put("=", "=");
operators.put(">", ">");
operators.put("<", "<");
operators.put(">=", ">=");
operators.put("<=", "<=");
operators.put("<>", "<>");
operators.put("!=", "!=");
operators.put("!>", "!>");
operators.put("!<", "!<");
operators.put("%", "%");
}
public static boolean checkColumnType(String column) {
@ -142,5 +157,15 @@ public class Utils {
return str.substring(0, str.length() - 1);
}
public static boolean validateOperators(List<Condition> conditions) {
for (Condition con : conditions) {
if (!operators.containsKey(con.getOperator())) {
return false;
}
}
return true;
}
}

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -24,6 +24,7 @@ var uriMatcher = new URIMatcher(String(uri));
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
var utility = require("/app/modules/utility.js")["utility"];
function appendQueryParam (url, queryParam , value) {
if (url.indexOf("?") > 0) {
@ -60,7 +61,7 @@ if (uriMatcher.match("/{context}/api/data-tables/invoker")) {
// response callback
function (backendResponse) {
response["status"] = backendResponse["status"];
response["content"] = backendResponse["responseText"];
response["content"] = utility.encodeJson(backendResponse["responseText"]);
}
);
}

@ -30,8 +30,8 @@
"enabled": true,
"issuer" : "devicemgt",
"appName" : "devicemgt",
"identityProviderUrl" : "https://localhost:9443/samlsso",
"acs": "https://localhost:9443/devicemgt/uuf/sso/acs",
"identityProviderUrl" : "https://%iot.keymanager.host%:%iot.keymanager.https.port%/samlsso",
"acs": "https://%iot.keymanager.host%:%iot.keymanager.https.port%/devicemgt/uuf/sso/acs",
"identityAlias": "wso2carbon",
"responseSigningEnabled" : true,
"validateAssertionValidityPeriod": true,

@ -1,9 +1,9 @@
{
"appContext": "/devicemgt/",
"httpsURL" : "https://%server.ip%:8243",
"httpURL" : "http://%server.ip%:8280",
"wssURL" : "https://localhost:9445",
"portalURL": "https://%server.ip%:9445",
"httpsURL" : "https://%iot.gateway.host%:%iot.gateway.https.port%",
"httpURL" : "http://%iot.gateway.host%:%iot.gateway.http.port",
"wssURL" : "https://%iot.analytics.host%:%iot.analytics.https.port%",
"portalURL": "https://%iot.analytics.host%:%iot.analytics.https.port%",
"dashboardServerURL" : "%https.ip%",
"androidEnrollmentDir": "/android-web-agent/enrollment",
"windowsEnrollmentDir": "/windows-web-agent/enrollment",
@ -18,12 +18,12 @@
"clientName": "emm",
"owner": "admin@carbon.super",
"dynamicClientAppRegistrationServiceURL": "%https.ip%/dynamic-client-web/register",
"apiManagerClientAppRegistrationServiceURL": "https://%server.ip%:8243/api-application-registration/register/tenants",
"grantType": "password refresh_token urn:ietf:params:oauth:grant-type:saml2-carbon urn:ietf:params:oauth:grant-type:jwt-bearer",
"apiManagerClientAppRegistrationServiceURL": "https://%iot.gateway.host%:%iot.gateway.https.port%/api-application-registration/register/tenants",
"grantType": "password refresh_token urn:ietf:params:oauth:grant-type:saml2-bearer urn:ietf:params:oauth:grant-type:jwt-bearer",
"tokenScope": "admin",
"callbackUrl": "%https.ip%/api/device-mgt/v1.0"
},
"tokenServiceURL": "https://%server.ip%:8243/token"
"tokenServiceURL": "https://%iot.gateway.host%:%iot.gateway.https.port%/token"
},
"adminUser":"admin@carbon.super",
"adminUserTenantId":"-1234",
@ -140,6 +140,39 @@
"perm:admin:certificates:view",
"perm:admin:certificates:add",
"perm:admin:certificates:verify",
"perm:ios:enroll",
"perm:ios:view-device",
"perm:ios:apn",
"perm:ios:ldap",
"perm:ios:enterprise-app",
"perm:ios:store-application",
"perm:ios:remove-application",
"perm:ios:app-list",
"perm:ios:profile-list",
"perm:ios:lock",
"perm:ios:enterprise-wipe",
"perm:ios:device-info",
"perm:ios:restriction",
"perm:ios:email",
"perm:ios:cellular",
"perm:ios:applications",
"perm:ios:wifi",
"perm:ios:ring",
"perm:ios:location",
"perm:ios:notification",
"perm:ios:airplay",
"perm:ios:caldav",
"perm:ios:cal-subscription",
"perm:ios:passcode-policy",
"perm:ios:webclip",
"perm:ios:vpn",
"perm:ios:per-app-vpn",
"perm:ios:app-to-per-app-vpn",
"perm:ios:app-lock",
"perm:ios:clear-passcode",
"perm:ios:remove-profile",
"perm:ios:get-restrictions",
"perm:ios:wipe-data",
"perm:admin"
],
"isOAuthEnabled" : true,

@ -0,0 +1,140 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed 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.
*/
var batchProviders;
batchProviders = function () {
var operations = {};
var CONTENT_TYPE_JSON = "application/json";
var JS_MAX_VALUE = "9007199254740992";
var JS_MIN_VALUE = "-9007199254740992";
var TABLENAME_ANDROID = "ORG_WSO2_GEO_FUSEDSPATIALEVENT";
var TABLENAME_ANDROID_SENSE = "ORG_WSO2_IOT_ANDROID_LOCATION";
var tableName = function (deviceType) {
switch (deviceType) {
case "android" :
return TABLENAME_ANDROID;
break;
case "android_sense" :
return TABLENAME_ANDROID_SENSE;
break;
default:
return null;
}
};
var typeMap = {
"bool": "string",
"boolean": "string",
"string": "string",
"int": "number",
"integer": "number",
"long": "number",
"double": "number",
"float": "number",
"time": "time"
};
var log = new Log();
var carbon = require('carbon');
var JSUtils = Packages.org.wso2.carbon.analytics.jsservice.Utils;
var AnalyticsCachedJSServiceConnector = Packages.org.wso2.carbon.analytics.jsservice.AnalyticsCachedJSServiceConnector;
var AnalyticsCache = Packages.org.wso2.carbon.analytics.jsservice.AnalyticsCachedJSServiceConnector.AnalyticsCache;
var cacheTimeoutSeconds = 5;
var cacheSizeBytes = 1024 * 1024 * 1024; // 1GB
response.contentType = CONTENT_TYPE_JSON;
var cache = application.get("AnalyticsWebServiceCache");
if (cache == null) {
cache = new AnalyticsCache(cacheTimeoutSeconds, cacheSizeBytes);
application.put("AnalyticsWebServiceCache", cache);
}
var connector = new AnalyticsCachedJSServiceConnector(cache);
/**
* returns an array of column names & types
* @param providerConfig
*/
operations.getSchema = function (loggedInUser) {
var tablename = tableName(deviceType);
if (tablename == null) {
return [];
}
var schema = [];
var result = connector.getTableSchema(loggedInUser, tablename).getMessage();
result = JSON.parse(result);
var columns = result.columns;
Object.getOwnPropertyNames(columns).forEach(function (name, idx, array) {
var type = "ordinal";
if (columns[name]['type']) {
type = columns[name]['type'];
}
schema.push({
fieldName: name,
fieldType: typeMap[type.toLowerCase()]
});
});
// log.info(schema);
return schema;
};
/**
* returns the actual data
* @param providerConfig
* @param limit
*/
operations.getData = function (loggedInUser, deviceId, deviceType) {
var luceneQuery = "";
var limit = 100;
var result;
var tablename = tableName(deviceType);
if (tablename == null) {
return [];
}
//if there's a filter present, we should perform a Lucene search instead of reading the table
if (luceneQuery) {
luceneQuery = 'id:"' + deviceId + '" AND type:"' + deviceType + '"';
var filter = {
"query": luceneQuery,
"start": 0,
"count": limit
};
result = connector.search(loggedInUser, tablename, stringify(filter)).getMessage();
} else {
var from = JS_MIN_VALUE;
var to = JS_MAX_VALUE;
result = connector.getRecordsByRange(loggedInUser, tablename, from, to, 0, limit, null).getMessage();
}
result = JSON.parse(result);
var data = [];
for (var i = 0; i < result.length; i++) {
var values = result[i].values;
data.push(values);
}
return data;
};
return operations;
}();

@ -24,6 +24,7 @@ deviceModule = function () {
var constants = require('/app/modules/constants.js');
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
var batchProvider = require("/app/modules/batch-provider-api.js")["batchProviders"];
var publicMethods = {};
var privateMethods = {};
@ -67,6 +68,36 @@ deviceModule = function () {
log.error("User object was not found in the session");
throw constants["ERRORS"]["USER_NOT_FOUND"];
}
var userName = carbonUser.username + "@" + carbonUser.domain;
var locationDataSet = [];
switch(deviceType) {
case 'android':
locationDataSet = batchProvider.getData(userName, deviceId, deviceType);
break;
case 'android_sense':
locationDataSet = batchProvider.getData(userName, deviceId, deviceType);
break;
}
var locationData = [];
var locationTimeData = [];
for (var i = 0 ; i < locationDataSet.length; i++) {
var gpsReading = {};
var gpsReadingTimes = {};
gpsReading.lat = locationDataSet[i].latitude;
gpsReading.lng = locationDataSet[i].longitude;
if (deviceType == "android") {
gpsReadingTimes.time = locationDataSet[i].timeStamp;
} else {
gpsReadingTimes.time = locationDataSet[i].meta_timestamp;
}
locationData.push(gpsReading);
locationTimeData.push(gpsReadingTimes);
}
var utility = require('/app/modules/utility.js')["utility"];
try {
utility.startTenantFlow(carbonUser);
@ -144,6 +175,10 @@ deviceModule = function () {
if (device["deviceInfo"]) {
filteredDeviceData["latestDeviceInfo"] = device["deviceInfo"];
}
var locationHistory = {};
locationHistory.locations = locationData;
locationHistory.times = locationTimeData;
filteredDeviceData["locationHistory"] = locationHistory;
response["content"] = filteredDeviceData;
response["status"] = "success";
return response;

@ -39,7 +39,11 @@ var groupModule = {};
} else if (permissions.LIST_GROUPS) {
endPoint = deviceServiceEndpoint + "/groups/count";
} else {
log.error("Access denied for user: " + carbonUser.username);
if (!user) {
log.error("User object was not found in the session");
throw constants["ERRORS"]["USER_NOT_FOUND"];
}
log.error("Access denied for user: " + user.username);
return -1;
}
return serviceInvokers.XMLHttp.get(
@ -116,7 +120,7 @@ var groupModule = {};
}
);
};
groupModule.getRolesOfGroup = function (groupId) {
return serviceInvokers.XMLHttp.get(
deviceServiceEndpoint + "/groups/id/" + groupId + "/roles", function (responsePayload) {

@ -22,6 +22,7 @@ var conf = function () {
conf = require("/app/conf/config.json");
var pinch = require("/app/modules/conf-reader/pinch.min.js")["pinch"];
var server = require("carbon")["server"];
var process = require("process");
pinch(conf, /^/,
function (path, key, value) {
if ((typeof value === "string") && value.indexOf("%https.ip%") > -1) {
@ -36,8 +37,23 @@ var conf = function () {
} else if ((typeof value === "string") && value.indexOf("%server.ip%") > -1) {
var getProperty = require("process").getProperty;
return value.replace("%server.ip%", getProperty("carbon.local.ip"));
} else {
var paramPattern = new RegExp("%(.*?)%", "g");
var out = value;
while ((matches = paramPattern.exec(value)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (matches.index === paramPattern.lastIndex) {
paramPattern.lastIndex++;
}
if (matches.length == 2) {
var property = process.getProperty(matches[1]);
if (property) {
out = out.replace(new RegExp("%" + matches[1] + "%", "g"), property);
}
}
}
return out;
}
return value;
}
);
application.put("CONF", conf);

@ -29,7 +29,8 @@ var carbonServer = new carbonModule.server.Server({
application.put("carbonServer", carbonServer);
var permissions = {
"/permission/admin/Login": ["ui.execute"]
"/permission/admin/Login": ["ui.execute"],
"/permission/admin/manage/api/subscribe": ["ui.execute"]
};
var adminPermissions = {

@ -117,15 +117,44 @@ var invokers = function () {
log.debug("Response status : " + xmlHttpRequest.status);
log.debug("Response payload if any : " + xmlHttpRequest.responseText);
if (xmlHttpRequest.status == 401 && (xmlHttpRequest.responseText == TOKEN_EXPIRED ||
xmlHttpRequest.responseText == TOKEN_INVALID ) && count < 5) {
tokenUtil.refreshTokenPair();
return privateMethods.execute(httpMethod, requestPayload, endpoint, responseCallback, ++count, headers);
} else {
if (xmlHttpRequest.status == 401) {
if ((xmlHttpRequest.responseText == TOKEN_EXPIRED ||
xmlHttpRequest.responseText == TOKEN_INVALID ) && count < 5) {
tokenUtil.refreshTokenPair();
return privateMethods.execute(httpMethod, requestPayload, endpoint, responseCallback, ++count, headers);
} else if (privateMethods.isInvalidCredential(xmlHttpRequest.responseText)) {
tokenUtil.refreshTokenPair();
return privateMethods.execute(httpMethod, requestPayload, endpoint, responseCallback, ++count, headers);
}
} else {
return responseCallback(xmlHttpRequest);
}
}
};
/**
* This method verify whether the access token is expired using response payload.
* This is required when using API gateway.
* @param responsePayload response payload.
* return true if it is invalid otherwise false.
*/
privateMethods["isInvalidCredential"] =
function (responsePayload) {
if (responsePayload) {
try {
payload = parse(responsePayload);
if (payload["fault"]["code"] == 900901) {
log.debug("Access token is invalid: " + payload["fault"]["code"]);
log.debug(payload["fault"]["description"]);
return true;
}
} catch (err) {
// do nothing
}
}
return false;
};
/**
* This method add Oauth authentication header to outgoing XML-HTTP Requests if Oauth authentication is enabled.
* @param httpMethod HTTP request type.

@ -153,5 +153,24 @@ utility = function () {
return scopesList;
};
/**
* Escapes special characters such as <,>,',",...etc
* This will prevent XSS attacks upon JSON.
* @param text
* @returns {*}
*/
publicMethods.encodeJson = function (text) {
return text
.replace(/\\u003c/g, "&lt;")
.replace(/</g, "&lt;")
.replace(/\\u003e/g, "&gt;")
.replace(/>/g, "&gt;")
.replace(/\\u0027/g, "&#39;")
.replace(/'/g, "&#39;")
.replace(/\\"/g, "&quot;")
.replace(/\\u0022/g, "&quot;")
};
return publicMethods;
}();

@ -47,7 +47,7 @@ var dynamicForm = '<div class="dynamic-search-param row"><div class="row"><a cla
'</option><option value = "vendor">Vendor</option><option value = "osVersion">OS Version' +
'</option><option value = "batteryLevel">Battery Level</option><option value =' +
' "internalTotalMemory">Internal Total Memory</option> <option value ="internalAvailableMemory">' +
'Internal Available Memory</option> <option value = "externalTotalMemory">externalTotalMemory</option>' +
'Internal Available Memory</option> <option value = "externalTotalMemory">External Total Memory</option>' +
' <option value = "externalAvailableMemory">External Available Memory' +
'</option> <option value = "connectionType">Connection Type</option> <option value =' +
' "ssid">SSID</option><option value = "cpuUsage">CPU Usage</option><option value = "totalRAMMemory">' +
@ -83,7 +83,7 @@ $(document).ready(function () {
*/
function getOperators(keyValue) {
if (nonNumericKeyValuePair.indexOf(keyValue) < 0) {
return '<option> =</option><option> !=</option><option> <</option><option> =<</option><option>' +
return '<option> =</option><option> !=</option><option> <</option><option> <=</option><option>' +
' ></option><option> >=</option>';
} else {
return '<option> =</option><option> !=</option><option><option> %</option>';

@ -50,9 +50,9 @@
<div class="wr-form">
<p class="page-sub-title">Advanced Device Search</p>
<hr/>
<div id="device-listing-status" class="raw hidden">
<div id="device-listing-status" class="row hidden">
<div class="col-lg-12 col-md-12">
<ul style="list-style-type: none;">
<ul style="list-style-type: none; padding:0px;">
<li class="message message-info">
<h4>
<i class="icon fw fw-info"></i>
@ -90,7 +90,9 @@
<br>
<div id="customSearchParam" class="col-lg-10 col-md-10">
</div>
</div>
<div class="row">
<div id="customSearchParam" class="col-lg-12 col-md-12"></div>
</div>
</div>
</div>

@ -89,7 +89,7 @@
<div class="row no-gutter add-padding-5x add-margin-top-5x" style="border: 1px solid #e4e4e4;">
<div class="media">
<div id="device_overview">
<div class="media-left col-lg-1">
<div class="media-left col-lg-2">
<div class="icon">
<img src="/devicemgt/public/cdmf.page.groups/images/group-icon.png" style="background-color: #11375b; height: 152px;">
</div>
@ -277,7 +277,7 @@
<span>
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-grouping fw-stack-1x"></i>
<i class="fw fw-group fw-stack-1x"></i>
</span> Device Grouping
</span>
</h3>

@ -375,15 +375,15 @@ function loadDevices(searchType, searchParam) {
var fnCreatedRow = function (row, data, dataIndex) {
$(row).attr('data-type', 'selectable');
$(row).attr('data-deviceid', data.deviceIdentifier);
$(row).attr('data-devicetype', data.deviceType);
$(row).attr('data-url', context + '/device/' + data.deviceType + '?id=' + data.deviceIdentifier);
var model = getPropertyValue(data.properties, 'DEVICE_MODEL');
var vendor = getPropertyValue(data.properties, 'VENDOR');
var owner = data.user;
var status = data.status;
var ownership = data.ownership;
var deviceType = data.deviceType;
$(row).attr('data-deviceid', htmlspecialchars(data.deviceIdentifier));
$(row).attr('data-devicetype', htmlspecialchars(data.deviceType));
$(row).attr('data-url', context + '/device/' + htmlspecialchars(data.deviceType) + '?id=' + htmlspecialchars(data.deviceIdentifier));
var model = htmlspecialchars(getPropertyValue(data.properties, 'DEVICE_MODEL'));
var vendor = htmlspecialchars(getPropertyValue(data.properties, 'VENDOR'));
var owner = htmlspecialchars(data.user);
var status = htmlspecialchars(data.status);
var ownership = htmlspecialchars(data.ownership);
var deviceType = htmlspecialchars(data.deviceType);
var category = getDeviceTypeCategory(deviceType);
$.each($('td', row), function (colIndex) {
switch (colIndex) {
@ -417,6 +417,10 @@ function loadDevices(searchType, searchParam) {
});
};
function htmlspecialchars(text){
return jQuery('<div/>').text(text).html();
}
var dataFilter = function (data) {
data = JSON.parse(data);
var objects = [];
@ -455,6 +459,13 @@ function loadDevices(searchType, searchParam) {
$('#device-grid').removeClass('hidden');
$("#loading-content").remove();
attachDeviceEvents();
if($('.advance-search').length < 1){
$(this).closest('.dataTables_wrapper').find('div[id$=_filter] input')
.after('<a href="'+context+'/devices/search"' +
' class="advance-search add-padding-3x">Advance Search</a>');
}
}, {
"placeholder": "Search By Device Name",
"searchKey": "name"

@ -112,6 +112,10 @@ function toTitleCase(str) {
});
}
function htmlspecialchars(text){
return jQuery('<div/>').text(text).html();
}
function loadGroups() {
var groupListing = $("#group-listing");
var currentUser = groupListing.data("currentUser");
@ -134,10 +138,10 @@ function loadGroups() {
var objects = [];
$(data.deviceGroups).each(function (index) {
objects.push({
groupId: data.deviceGroups[index].id,
name: data.deviceGroups[index].name,
description: data.deviceGroups[index].description,
owner: data.deviceGroups[index].owner
groupId: htmlspecialchars(data.deviceGroups[index].id),
name: htmlspecialchars(data.deviceGroups[index].name),
description: htmlspecialchars(data.deviceGroups[index].description),
owner: htmlspecialchars(data.deviceGroups[index].owner)
})
});
var json = {

@ -86,6 +86,10 @@ function InitiateViewOption() {
// $(location).attr('href', $(this).data("url"));
}
function htmlspecialchars(text){
return jQuery('<div/>').text(text).html();
}
function loadRoles() {
var loadingContent = $("#loading-content");
loadingContent.show();
@ -98,8 +102,8 @@ function loadRoles() {
$(data.roles).each(function (index) {
objects.push(
{
name: data.roles[index],
DT_RowId: "role-" + data.roles[index]
name: htmlspecialchars(data.roles[index]),
DT_RowId: "role-" + htmlspecialchars(data.roles[index])
}
)
});

@ -258,6 +258,10 @@ function InitiateViewOption() {
}
}
function htmlspecialchars(text){
return jQuery('<div/>').text(text).html();
}
function loadUsers() {
var loadingContentView = "#loading-content";
$(loadingContentView).show();
@ -269,11 +273,11 @@ function loadUsers() {
$(data.users).each(function (index) {
objects.push({
filter: data.users[index].username,
firstname: data.users[index].firstname ? data.users[index].firstname : "",
lastname: data.users[index].lastname ? data.users[index].lastname : "",
emailAddress: data.users[index].emailAddress ? data.users[index].emailAddress : "",
DT_RowId: "user-" + data.users[index].username
filter: htmlspecialchars(data.users[index].username),
firstname: htmlspecialchars(data.users[index].firstname) ? htmlspecialchars(data.users[index].firstname) : "",
lastname: htmlspecialchars(data.users[index].lastname) ? htmlspecialchars(data.users[index].lastname) : "",
emailAddress: htmlspecialchars(data.users[index].emailAddress) ? htmlspecialchars(data.users[index].emailAddress) : "",
DT_RowId: "user-" + htmlspecialchars(data.users[index].username)
})
});

@ -273,6 +273,7 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter
thisTable.removeClass("table-selectable");
$(button).addClass("active").html('Select');
$(button).parent().next().children().addClass("disabled");
$('.DTTT_selected.selected').removeClass(rowSelectedClass);
// EMM related function
$(document).on('click', '.viewEnabledIcon', InitiateViewOption);
//--- End of EMM related codes

@ -41,22 +41,22 @@ $(document).ready(function () {
/* for device list sorting drop down */
$(".ctrl-filter-type-switcher").popover({
html : true,
content : function () {
return $("#content-filter-types").html();
}
});
html: true,
content: function () {
return $("#content-filter-types").html();
}
});
$(".ast-container").on("click", ".claim-btn", function(e){
$(".ast-container").on("click", ".claim-btn", function (e) {
e.stopPropagation();
var deviceId = $(this).data("deviceid");
var deviceListing = $("#device-listing");
var currentUser = deviceListing.data("current-user");
var serviceURL = "/temp-controller-agent/enrollment/claim?username=" + currentUser;
var deviceIdentifier = {id: deviceId, type: "TemperatureController"};
invokerUtil.put(serviceURL, deviceIdentifier, function(message){
invokerUtil.put(serviceURL, deviceIdentifier, function (message) {
console.log(message);
}, function(message){
}, function (message) {
console.log(message);
});
});
@ -68,15 +68,15 @@ $(document).ready(function () {
* @param button: Select All Device button
*/
function selectAllDevices(button) {
if(!$(button).data('select')){
$(deviceCheckbox).each(function(index){
if (!$(button).data('select')) {
$(deviceCheckbox).each(function (index) {
$(this).prop('checked', true);
addDeviceSelectedClass(this);
});
$(button).data('select', true);
$(button).html('Deselect All Devices');
}else{
$(deviceCheckbox).each(function(index){
} else {
$(deviceCheckbox).each(function (index) {
$(this).prop('checked', false);
addDeviceSelectedClass(this);
});
@ -92,7 +92,7 @@ function selectAllDevices(button) {
* @param selection: Selection button
*/
function changeDeviceView(view, selection) {
$(".view-toggle").each(function() {
$(".view-toggle").each(function () {
$(this).removeClass("selected");
});
$(selection).addClass("selected");
@ -117,27 +117,33 @@ function addDeviceSelectedClass(checkbox) {
}
function toTitleCase(str) {
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
return str.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
}
var deviceTypeCount, compiledDeviceTypesCount = 0;
function loadDevices(searchType, searchParam){
function htmlspecialchars(text) {
return jQuery('<div/>').text(text).html();
}
function loadDevices(searchType, searchParam) {
var deviceListing = $("#device-listing");
var deviceListingSrc = deviceListing.attr("src");
var currentUser = deviceListing.data("currentUser");
$('#ast-container').html("");
deviceTypeCount = deviceTypesList.length;
if(deviceTypesList.length > 0){
if (deviceTypesList.length > 0) {
for (var i = 0; i < deviceTypesList.length; i++) {
var viewModel = {};
viewModel.thumb = deviceTypesList[i].thumb;
viewModel.appContext = clientJsAppContext;
viewModel.deviceTypeName = deviceTypesList[i].deviceTypeName;
viewModel.deviceTypeId = deviceTypesList[i].deviceTypeId;
viewModel.deviceCategory = deviceTypesList[i].deviceCategory;
viewModel.deviceTypeLabel = deviceTypesList[i].deviceTypeLabel;
viewModel.deviceTypeName = htmlspecialchars(deviceTypesList[i].deviceTypeName);
viewModel.deviceTypeId = htmlspecialchars(deviceTypesList[i].deviceTypeId);
viewModel.deviceCategory = htmlspecialchars(deviceTypesList[i].deviceCategory);
viewModel.deviceTypeLabel = htmlspecialchars(deviceTypesList[i].deviceTypeLabel);
compileTemplate(viewModel, deviceListingSrc);
}
} else {
@ -155,12 +161,12 @@ function loadDevices(searchType, searchParam){
}
function compileTemplate(viewModel, templateSrc){
function compileTemplate(viewModel, templateSrc) {
$.template("device-listing", templateSrc, function (template) {
$("#ast-container").html($("#ast-container").html() + template(viewModel));
compiledDeviceTypesCount++;
if(deviceTypeCount == compiledDeviceTypesCount){
$('#device-type-grid').datatables_extended({"bFilter": false, "order": [[ 1, "asc" ]]});
if (deviceTypeCount == compiledDeviceTypesCount) {
$('#device-type-grid').datatables_extended({"bFilter": false, "order": [[1, "asc"]]});
}
});
}
@ -171,17 +177,16 @@ function compileTemplate(viewModel, templateSrc){
var deviceCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']";
var assetContainer = "#ast-container";
function openCollapsedNav(){
function openCollapsedNav() {
$('.wr-hidden-nav-toggle-btn').addClass('active');
$('#hiddenNav').slideToggle('slideDown', function(){
if($(this).css('display') == 'none'){
$('#hiddenNav').slideToggle('slideDown', function () {
if ($(this).css('display') == 'none') {
$('.wr-hidden-nav-toggle-btn').removeClass('active');
}
});
}
/*
* DOM ready functions.
*/
@ -196,22 +201,22 @@ $(document).ready(function () {
/* for device list sorting drop down */
$(".ctrl-filter-type-switcher").popover({
html : true,
content : function () {
return $("#content-filter-types").html();
}
});
html: true,
content: function () {
return $("#content-filter-types").html();
}
});
$(".ast-container").on("click", ".claim-btn", function(e){
$(".ast-container").on("click", ".claim-btn", function (e) {
e.stopPropagation();
var deviceId = $(this).data("deviceid");
var deviceListing = $("#device-listing");
var currentUser = deviceListing.data("current-user");
var serviceURL = "/temp-controller-agent/enrollment/claim?username=" + currentUser;
var deviceIdentifier = {id: deviceId, type: "TemperatureController"};
invokerUtil.put(serviceURL, deviceIdentifier, function(message){
invokerUtil.put(serviceURL, deviceIdentifier, function (message) {
console.log(message);
}, function(message){
}, function (message) {
console.log(message);
});
});
@ -222,20 +227,20 @@ $(document).ready(function () {
$("[data-toggle=popover]").popover();
$(".ctrl-filter-type-switcher").popover({
html : true,
content: function() {
return $('#content-filter-types').html();
}
});
html: true,
content: function () {
return $('#content-filter-types').html();
}
});
$('#nav').affix({
offset: {
top: $('header').height()
}
});
offset: {
top: $('header').height()
}
});
$(document).on("click", "tr.clickable-row", function(){
window.document.location = $(this).data('href');
$(document).on("click", "tr.clickable-row", function () {
window.document.location = $(this).data('href');
})
});

@ -67,11 +67,4 @@
});
}
</script>
<script type="text/javascript">
function toggleEnrollment(){
$(".modal-content").html($("#qr-code-modal").html());
generateQRCode(".modal-content .qr-code");
showQRCodePopup();
}
</script>
{{/zone}}

@ -20,15 +20,15 @@
var modalDialog = (function () {
var publicMethoads = {};
publicMethoads.header = function (headerText) {
$("#modal-title-text").html(headerText);
$("#basic-modal-view #modal-title-text").html(headerText);
};
publicMethoads.content = function (contentText) {
$("#modal-content-text").html(contentText);
$("#basic-modal-view #modal-content-text").html(contentText);
};
publicMethoads.footer = function (footerContent) {
$("#modal-footer-content").html(footerContent);
$("#basic-modal-view #modal-footer-content").html(footerContent);
};
publicMethoads.footerButtons = function (buttonList) {
@ -37,7 +37,7 @@ var modalDialog = (function () {
footerContent = footerContent + '<div class="buttons"><a href="#" id="' + btn.id +
'" class="btn-operations">' + btn.text + '</a></div>';
}
$("#modal-footer-content").html(footerContent);
$("#basic-modal-view #modal-footer-content").html(footerContent);
};
publicMethoads.show = function () {
@ -62,11 +62,21 @@ var modalDialog = (function () {
publicMethoads.hide = function () {
$("#basic-modal-view").addClass('hidden');
$("#basic-modal-view").modal('hide');
$("#modal-title-text").html("");
$("#modal-content-text").html("");
$("#modal-footer-content").html("");
$('body').removeClass('modal-open').css('padding-right', '0px');
$('.modal-backdrop').remove();
};
$("#basic-modal-view").on('hidden.bs.modal', function () {
$('#basic-modal-view .modal-dialog').html('<div class="modal-content"><div class="modal-header">' +
'<h3 class="pull-left modal-title"><span class="fw-stack error-msg-icon hidden">' +
'<i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-error fw-stack-1x"></i></span>' +
'<span class="fw-stack warning-msg-icon hidden"><i class="fw fw-circle-outline fw-stack-2x"></i>' +
'<i class="fw fw-warning fw-stack-1x"></i></span><span id="modal-title-text"></span></h3>' +
'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>' +
'</button></div><div class="modal-body add-margin-top-2x add-margin-bottom-2x">' +
'<div id="modal-content-text"></div></div>' +
'<div class="modal-footer" id="modal-footer-content"></div></div>');
$('body').removeClass('modal-open').css('padding-right', '0px');
});
return publicMethoads;
}(modalDialog));

@ -80,9 +80,9 @@
<!--<a href="{{@app.context}}notification-listing" title="Failures of operations on the device side will be listed here">-->
<a data-toggle="sidebar" data-target="#right-sidebar" data-container=".page-content"
aria-expanded="false" rel="notifications-sidebar">
<span class="icon fw-stack">
<i class="fw fw-notification fw-stack-1x"></i>
</span>
<span class="icon fw-stack">
<i class="fw fw-notification fw-stack-1x"></i>
</span>
<span class="hidden-xs">Notifications</span>
<span class="badge notifications" id="notification-bubble"></span>
</a>
@ -90,9 +90,8 @@
</ul>
{{/zone}}
{{#zone "sidePanes"}}
<div class="sidebar-wrapper" id="right-sidebar" is-authorized="{{isAuthorizedForNotifications}}"
data-side="right" data-width="320" data-sidebar-fixed="true" data-fixed-offset="50" data-spy="affix"
data-offset-top="80">
<div class="sidebar-wrapper sidebar-wrapper-animation-fix" id="right-sidebar" is-authorized="{{isAuthorizedForNotifications}}"
data-side="right" data-width="320" data-sidebar-fixed="true" data-top="90" data-fixed-offset="90" data-offset-top="50" data-spy="affix">
<ul class="sidebar-messages">
</ul>
<div class="text-center"><a href="{{@app.context}}/notification-listing" class="btn btn-primary">Show All Notifications</a></div>

@ -32,6 +32,7 @@ function onRequest(context) {
var constants = require("/app/modules/constants.js");
var uiPermissions = userModule.getUIPermissions();
context["permissions"] = uiPermissions;
context["userMgtEnabled"] = (uiPermissions["LIST_USERS"] || uiPermissions["LIST_ROLES"]);
var links = {
"user-mgt": [],

@ -128,15 +128,16 @@ function loadNewNotifications() {
}
/**
* Toggle function for
* notification listing sidebar.
* Sidebar function
* @return {Null}
*/
$.sidebar_toggle = function (action, target, container) {
$.sidebar_toggle = function(action, target, container) {
var elem = '[data-toggle=sidebar]',
button,
containerOffsetLeft,
containerOffsetRight,
container,
conrainerOffsetLeft,
conrainerOffsetRight,
target,
targetOffsetLeft,
targetOffsetRight,
targetWidth,
@ -145,104 +146,177 @@ $.sidebar_toggle = function (action, target, container) {
pushType,
buttonParent;
/**
* Dynamically adjust the height of sidebar to fill parent
*/
function sidebarHeightAdjust(){
$('.sidebar-wrapper').each(function(){
var elemOffsetBottom = $(this).data('offset-bottom'),
scrollBottom = ($(document).height() - $(window).height()),
offesetBottom = 0,
getBottomOffset = elemOffsetBottom - (scrollBottom - ($(window).scrollTop()-elemOffsetBottom) - elemOffsetBottom);
if(getBottomOffset > 0){
offesetBottom = getBottomOffset;
}
$(this).height(($(window).height() - ($(this).offset().top - $(window).scrollTop())) - offesetBottom);
if((typeof $.fn.nanoScroller == 'function') && ($('.nano-content', this).length > 0)){
$(".nano-content").parent()[0].nanoscroller.reset();
}
});
};
var sidebar_window = {
update: function (target, container, button) {
containerOffsetLeft = $(container).data('offset-left') ? $(container).data('offset-left') : 0;
containerOffsetRight = $(container).data('offset-right') ? $(container).data('offset-right') : 0;
targetOffsetLeft = $(target).data('offset-left') ? $(target).data('offset-left') : 0;
targetOffsetRight = $(target).data('offset-right') ? $(target).data('offset-right') : 0;
targetWidth = $(target).data('width');
targetSide = $(target).data("side");
pushType = $(container).parent().is('body') == true ? 'padding' : 'margin';
if (button !== undefined) {
update: function(target, container, button){
conrainerOffsetLeft = $(container).data('offset-left') ? $(container).data('offset-left') : 0,
conrainerOffsetRight = $(container).data('offset-right') ? $(container).data('offset-right') : 0,
targetTop = $(target).data('top') ? $(target).data('top') : 0,
targetOffsetLeft = $(target).data('offset-left') ? $(target).data('offset-left') : 0,
targetOffsetRight = $(target).data('offset-right') ? $(target).data('offset-right') : 0,
targetWidth = $(target).data('width'),
targetSide = $(target).data("side"),
pushType = $(container).parent().is('body') == true ? 'padding' : 'padding'; //TODO: Remove if works everywhere
$(container).addClass('sidebar-target');
if(button !== undefined){
relationship = button.attr('rel') ? button.attr('rel') : '';
buttonParent = $(button).parent();
}
},
show: function () {
if ($(target).data('sidebar-fixed') == true) {
$(target).css('top', targetTop);
sidebarHeightAdjust();
},
show: function(){
if($(target).data('sidebar-fixed') == true) {
$(target).css('top',$(target).data('fixed-offset') + 'px');
$(target).height($(window).height() - $(target).data('fixed-offset'));
}
$(target).off('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend');
$(target).trigger('show.sidebar');
if (targetWidth !== undefined) {
if(targetWidth !== undefined) {
$(target).css('width', targetWidth);
}
$(target).addClass('toggled');
if (button !== undefined) {
if (relationship !== '') {
if(button !== undefined){
if(relationship !== ''){
// Removing active class from all relative buttons
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').removeClass("active");
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').attr('aria-expanded', 'false');
$(elem+'[rel='+relationship+']:not([data-handle=close])').removeClass("active");
$(elem+'[rel='+relationship+']:not([data-handle=close])').attr('aria-expanded', 'false');
}
// Adding active class to button
if (button.attr('data-handle') !== 'close') {
if(button.attr('data-handle') !== 'close'){
button.addClass("active");
button.attr('aria-expanded', 'true');
}
if (buttonParent.is('li')) {
if (relationship !== '') {
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().removeClass("active");
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().
attr('aria-expanded', 'false');
if(buttonParent.is('li')) {
if(relationship !== ''){
$(elem+'[rel='+relationship+']:not([data-handle=close])').parent().removeClass("active");
$(elem+'[rel='+relationship+']:not([data-handle=close])').parent().attr('aria-expanded', 'false');
}
buttonParent.addClass("active");
buttonParent.attr('aria-expanded', 'true');
}
}
// Sidebar open function
if (targetSide == 'left') {
if ((button !== undefined) && (button.attr('data-container-divide'))) {
$(container).css(pushType + '-' + targetSide, targetWidth + targetOffsetLeft);
if (targetSide == 'left'){
if ($(target).attr('data-container-divide')){
$(container).css(pushType+'-'+targetSide, targetWidth + targetOffsetLeft);
$(target).css(targetSide, targetOffsetLeft);
}
$(target).css(targetSide, targetOffsetLeft);
} else if (targetSide == 'right') {
if ((button !== undefined) && (button.attr('data-container-divide'))) {
$(container).css(pushType + '-' + targetSide, targetWidth + targetOffsetRight);
else if ($(target).attr('data-container-push')){
$(container).css(targetSide, Math.abs(targetWidth + targetOffsetLeft));
$(target).css(targetSide, -Math.abs(targetWidth + targetOffsetLeft));
}
else {
$(target).css(targetSide, Math.abs(targetOffsetLeft));
}
}
else if (targetSide == 'right'){
if ($(target).attr('data-container-divide')){
$(container).css(pushType+'-'+targetSide, targetWidth + targetOffsetRight);
$(target).css(targetSide, targetOffsetRight);
}
else if ($(target).attr('data-container-push')){
$(container).css(targetSide, Math.abs(targetWidth + targetOffsetRight));
$(target).css(targetSide, -Math.abs(targetWidth + targetOffsetRight));
}
else {
$(target).css(targetSide, Math.abs(targetOffsetRight));
}
$(target).css(targetSide, targetOffsetRight);
}
$(target).trigger('shown.sidebar');
},
hide: function () {
hide: function(){
$(target).trigger('hide.sidebar');
$(target).removeClass('toggled');
if (button !== undefined) {
if (relationship !== '') {
if(button !== undefined){
if(relationship !== ''){
// Removing active class from all relative buttons
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').removeClass("active");
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').attr('aria-expanded', 'false');
$(elem+'[rel='+relationship+']:not([data-handle=close])').removeClass("active");
$(elem+'[rel='+relationship+']:not([data-handle=close])').attr('aria-expanded', 'false');
}
// Removing active class from button
if (button.attr('data-handle') !== 'close') {
if(button.attr('data-handle') !== 'close'){
button.removeClass("active");
button.attr('aria-expanded', 'false');
}
if ($(button).parent().is('li')) {
if (relationship !== '') {
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().removeClass("active");
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().
attr('aria-expanded', 'false');
if($(button).parent().is('li')){
if(relationship !== ''){
$(elem+'[rel='+relationship+']:not([data-handle=close])').parent().removeClass("active");
$(elem+'[rel='+relationship+']:not([data-handle=close])').parent().attr('aria-expanded', 'false');
}
}
}
// Sidebar close function
if (targetSide == 'left') {
if ((button !== undefined) && (button.attr('data-container-divide'))) {
$(container).css(pushType + '-' + targetSide, targetOffsetLeft);
if (targetSide == 'left'){
if($(target).attr('data-container-divide')){
$(container).css(pushType+'-'+targetSide, targetOffsetLeft);
$(target).css(targetSide, -Math.abs(targetWidth + targetOffsetRight));
}
$(target).css(targetSide, -Math.abs(targetWidth + targetOffsetLeft));
} else if (targetSide == 'right') {
if ((button !== undefined) && (button.attr('data-container-divide'))) {
$(container).css(pushType + '-' + targetSide, targetOffsetRight);
else if($(target).attr('data-container-push')){
$(container).css(targetSide, targetOffsetLeft);
$(target).css(targetSide, -Math.abs(targetWidth + targetOffsetLeft));
}
else {
$(target).css(targetSide, -Math.abs(targetWidth + targetOffsetLeft));
}
$(target).css(targetSide, -Math.abs(targetWidth + targetOffsetRight));
}
else if (targetSide == 'right'){
if($(target).attr('data-container-divide')){
$(container).css(pushType+'-'+targetSide, targetOffsetRight);
$(target).css(targetSide, -Math.abs(targetWidth + targetOffsetRight));
}
else if($(target).attr('data-container-push')){
$(container).css(targetSide, targetOffsetRight);
$(target).css(targetSide, -Math.abs(targetWidth + targetOffsetRight));
}
else {
$(target).css(targetSide, -Math.abs(targetWidth + targetOffsetRight));
}
}
$(target).trigger('hidden.sidebar');
$(target).on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) {
$(container).removeClass('sidebar-target');
});
}
};
if (action === 'show') {
sidebar_window.update(target, container);
sidebar_window.show();
@ -251,27 +325,52 @@ $.sidebar_toggle = function (action, target, container) {
sidebar_window.update(target, container);
sidebar_window.hide();
}
// binding click function
var body = 'body';
$(body).off('click', elem);
$(body).on('click', elem, function (e) {
$('body').off('click', elem);
$('body').on('click', elem, function(e) {
e.preventDefault();
button = $(this);
container = button.data('container');
target = button.data('target');
container = $(target).data('container');
sidebar_window.update(target, container, button);
/**
* Sidebar function on data container divide
* @return {Null}
*/
if (button.attr('aria-expanded') == 'false') {
if(button.attr('aria-expanded') == 'false'){
sidebar_window.show();
} else if (button.attr('aria-expanded') == 'true') {
}
else if (button.attr('aria-expanded') == 'true') {
sidebar_window.hide();
}
});
$(window)
.load(sidebarHeightAdjust)
.resize(sidebarHeightAdjust)
.scroll(sidebarHeightAdjust);
};
var sideWrapper = $('.sidebar-wrapper');
$(document).on('affix.bs.affix','.sidebar-wrapper',function(){
sideWrapper.css('top',$('.navbar-wrapper').height());
sideWrapper.data('top',$('.navbar-wrapper').height());
sideWrapper.data('fixed-offset', $('.navbar-wrapper').height());
});
$(document).on('affix-top.bs.affix','.sidebar-wrapper',function(){
sideWrapper.css('top',$('.navbar-wrapper').height() + $('.header').height());
sideWrapper.data('top',$('.navbar-wrapper').height() + $('.header').height());
sideWrapper.data('fixed-offset', $('.navbar-wrapper').height() + $('.header').height());
});
$.fn.collapse_nav_sub = function () {
var navSelector = 'ul.nav';
@ -324,7 +423,6 @@ $.fn.collapse_nav_sub = function () {
$(document).ready(function () {
loadNotificationsPanel();
$.sidebar_toggle();
$("#right-sidebar").on("click", ".new-notification", function () {
var notificationId = $(this).data("id");

@ -804,7 +804,7 @@ header .dropdown[aria-expanded=true], header .dropdown:hover {
.navbar .container-fluid > .navbar-header .icon,
.navbar .container > .navbar-collapse .icon,
.navbar .container > .navbar-header .icon {
margin-bottom: 4px;
margin-bottom: 0px !important;
}
.navbar-nav {
@ -1108,6 +1108,14 @@ header .dropdown[aria-expanded=true], header .dropdown:hover {
right: 0;
}
.sidebar-wrapper-animation-fix{
-webkit-transition: left 0.5s ease, right 0.5s ease !important;
-moz-transition: left 0.5s ease, right 0.5s ease !important;
-ms-transition: left 0.5s ease, right 0.5s ease !important;
-o-transition: left 0.5s ease, right 0.5s ease !important;
transition: left 0.5s ease, right 0.5s ease !important;
}
ul.sidebar-messages {
padding: 0;
margin: 0;
@ -6393,6 +6401,7 @@ ul.tiles .icon {
background: #f4f4f4;
border:1px solid #ddd;
margin-bottom:10px;
padding: 15px;
}
.media .list-group-item a, .media .list-group-item a{
background:#f4f4f4;
@ -6536,6 +6545,9 @@ select > option:hover {
padding-right: 5px;
}
.btn-operations:hover, .btn-operations:focus, .btn-operations:active {
color : #C7C7C7;
}
/**
*

@ -360,11 +360,29 @@ var utils = {};
if (updateCache) {
appConfFile.open("r");
var content = appConfFile.readAll();
var getProperty = require("process").getProperty;
var process = require("process");
var getProperty = process.getProperty;
content = content.replace(/\$\{server\.ip}/g, getProperty("carbon.local.ip"));
content = content.replace(/\$\{server\.http_port}/g, getProperty("carbon.http.port"));
content = content.replace(/\$\{server\.https_port}/g, getProperty("carbon.https.port"));
//parsing system params
var paramPattern = new RegExp("%(.*?)%", "g");
var out = content;
while ((matches = paramPattern.exec(content)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (matches.index === paramPattern.lastIndex) {
paramPattern.lastIndex++;
}
if (matches.length == 2) {
var property = process.getProperty(matches[1]);
if (property) {
out = out.replace(new RegExp("%" + matches[1] + "%", "g"), property);
}
}
}
content = out;
var appConf = parse(content);
application.put(constants.CACHE_KEY_APP_CONF, appConf);
application.put(constants.CACHE_KEY_APP_CONF_FILE_LMD,

@ -23,7 +23,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -21,7 +21,7 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -21,7 +21,7 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -21,13 +21,13 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.dynamic.client.registration</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Dynamic client registration service</name>
<description>WSO2 Carbon - Dynamic Client Registration Service</description>

@ -21,13 +21,13 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.dynamic.client.web.app.registration</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Dynamic client web app registration</name>
<description>WSO2 Carbon - Dynamic Client Web-app Registration Service</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>dynamic-client-registration</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Dynamic client registration</name>
<url>http://wso2.org</url>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - OAuth Extensions</name>
<url>http://wso2.org</url>

@ -21,7 +21,7 @@
<parent>
<artifactId>identity-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name>
<description>WSO2 Carbon - Policy Decision Point</description>

@ -3,14 +3,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.decision.point</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name>
<description>WSO2 Carbon - Policy Decision Point</description>

@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Information Point</name>
<description>WSO2 Carbon - Policy Information Point</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Common</name>
<description>WSO2 Carbon - Policy Management Common</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Core</name>
<description>WSO2 Carbon - Policy Management Core</description>

@ -23,13 +23,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>policy-mgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Policy Management Component</name>
<url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.webapp.authenticator.framework</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Web Application Authenticator Framework Bundle</name>
<description>WSO2 Carbon - Web Application Authenticator Framework Bundle</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Webapp Authenticator Framework</name>
<url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.application.extension.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Application Extension Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a api application registration, which takes care of subscription

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.handler.server.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management - APIM handler Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the handler for the api authentications

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Webapp Publisher Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Feature</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<name>WSO2 Carbon - Certificate Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for back-end Certificate Management functionality

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<name>WSO2 Carbon - Device Type Deployer Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - Device Type Deployer Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<name>WSO2 Carbon - GCM Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<name>WSO2 Carbon - MQTT Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<name>WSO2 Carbon - XMPP Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - XMPP Based Push Notification Provider Feature</description>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -3,13 +3,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.analytics.dashboard.feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Device Management Dashboard Analytics Feature</name>
<description>WSO2 Carbon - Device Management Dashboard Analytics Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains bundles related to device analytics data publisher</description>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -4,14 +4,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Extensions Feature</name>
<url>http://wso2.org</url>
<description>This feature contains common extensions used by key device management functionalities

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<version>2.0.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save