Merge pull request #681 from harshanL/cloud-3.1.0

Cloud 3.1.0
Kamidu Sachith Punchihewa 8 years ago committed by GitHub
commit 9b606923a0

@ -1,7 +1,5 @@
# carbon-device-mgt # carbon-device-mgt
<a href='https://wso2.org/jenkins/job/platform-builds/job/carbon-device-mgt/'><img src='https://wso2.org/jenkins/job/platform-builds/job/carbon-device-mgt/badge/icon'></a>
WSO2 CONNECTED DEVICE MANAGEMENT COMPONENTS WSO2 CONNECTED DEVICE MANAGEMENT COMPONENTS
WSO2 Connected Device Manager (WSO2 CDM) is a comprehensive platform that helps solve mobile computing challenges enterprises face today when dealing with both corporate owned, personally enabled (COPE) devices and employee owned devices as part of a bring your own device (BYOD) program. WSO2 Connected Device Manager (WSO2 CDM) is a comprehensive platform that helps solve mobile computing challenges enterprises face today when dealing with both corporate owned, personally enabled (COPE) devices and employee owned devices as part of a bring your own device (BYOD) program.

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

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

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

@ -90,7 +90,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
} catch (FeignException e) { } catch (FeignException e) {
attempts++; attempts++;
try { try {
Thread.sleep(500); Thread.sleep(1000);
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
log.warn("Interrupted the waiting for tier availability."); log.warn("Interrupted the waiting for tier availability.");
} }

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

@ -8,18 +8,19 @@
License for the ~ specific language governing permissions and limitations License for the ~ specific language governing permissions and limitations
~ under the License. --> ~ under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>apimgt-extensions</artifactId> <artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.36-SNAPSHOT</version> <version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client</artifactId> <artifactId>org.wso2.carbon.apimgt.integration.client</artifactId>
<version>2.0.36-SNAPSHOT</version> <version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Integration Client</name> <name>WSO2 Carbon - API Management Integration Client</name>
<description>WSO2 Carbon - API Management Integration Client</description> <description>WSO2 Carbon - API Management Integration Client</description>

@ -8,20 +8,21 @@
License for the ~ specific language governing permissions and limitations License for the ~ specific language governing permissions and limitations
~ under the License. --> ~ under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>apimgt-extensions</artifactId> <artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.36-SNAPSHOT</version> <version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.generated.client</artifactId> <artifactId>org.wso2.carbon.apimgt.integration.generated.client</artifactId>
<version>2.0.36-SNAPSHOT</version> <version>2.0.16-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Integration Generated Client</name> <name>WSO2 Carbon - API Management Integration Client</name>
<description>WSO2 Carbon - API Management Integration Client</description> <description>WSO2 Carbon - API Management Integration Client</description>
<url>http://wso2.org</url> <url>http://wso2.org</url>
@ -200,7 +201,5 @@
<artifactId>jackson-datatype-joda</artifactId> <artifactId>jackson-datatype-joda</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
</project> </project>

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

@ -218,7 +218,7 @@ public class APIPublisherUtil {
JsonObject httpVerb = new JsonObject(); JsonObject httpVerb = new JsonObject();
httpVerb.add("responses", response); httpVerb.add("responses", response);
httpVerb.addProperty("x-auth-type", uriTemplate.getAuthType()); httpVerb.addProperty("x-auth-type", "Application%20%26%20Application%20User");
httpVerb.addProperty("x-throttling-tier", "Unlimited"); httpVerb.addProperty("x-throttling-tier", "Unlimited");
if (uriTemplate.getScope() != null) { if (uriTemplate.getScope() != null) {
httpVerb.addProperty("x-scope", uriTemplate.getScope().getKey()); httpVerb.addProperty("x-scope", uriTemplate.getScope().getKey());
@ -289,6 +289,5 @@ public class APIPublisherUtil {
} }
} }
} }
apiConfig.setUriTemplates(templates);
} }
} }

@ -53,7 +53,7 @@ public class AnnotationProcessor {
private static final Log log = LogFactory.getLog(AnnotationProcessor.class); private static final Log log = LogFactory.getLog(AnnotationProcessor.class);
private static final String AUTH_TYPE = "Application & Application User"; private static final String AUTH_TYPE = "Any";
private static final String STRING_ARR = "string_arr"; private static final String STRING_ARR = "string_arr";
private static final String STRING = "string"; private static final String STRING = "string";
private static final String PACKAGE_ORG_APACHE = "org.apache"; private static final String PACKAGE_ORG_APACHE = "org.apache";

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

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

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

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

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

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

@ -1,104 +0,0 @@
/*
* 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.extensions.device.type.deployer.config;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* <p>Java class for DeviceDetails complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="DeviceDetails">
* &lt;simpleContent>
* &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string">
* &lt;attribute name="table-id" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/extension>
* &lt;/simpleContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Claimable", propOrder = {
"value"
})
public class Claimable {
@XmlValue
protected String value;
@XmlAttribute(name = "enabled")
protected boolean enabled;
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the enabled property.
*
* @return
* possible object is
* {@link String }
*
*/
public boolean isEnabled() {
return enabled;
}
/**
* Sets the value of the enabled property.
*
* @param enabled
* allowed object is
* {@link String }
*
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}

@ -18,8 +18,11 @@
*/ */
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config; package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
import javax.xml.bind.annotation.*; import javax.xml.bind.annotation.XmlAccessType;
import java.util.List; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/** /**
@ -53,8 +56,6 @@ public class DeviceTypeConfiguration {
@XmlElement(name = "DeviceDetails", required = true) @XmlElement(name = "DeviceDetails", required = true)
protected DeviceDetails deviceDetails; protected DeviceDetails deviceDetails;
@XmlElement(name = "Claimable", required = true)
protected Claimable claimable;
@XmlElement(name = "Features", required = true) @XmlElement(name = "Features", required = true)
protected Features features; protected Features features;
@XmlElement(name = "ProvisioningConfig", required = true) @XmlElement(name = "ProvisioningConfig", required = true)
@ -73,21 +74,6 @@ public class DeviceTypeConfiguration {
protected String name; protected String name;
@XmlElement(name = "PolicyMonitoring", required = true) @XmlElement(name = "PolicyMonitoring", required = true)
protected PolicyMonitoring policyMonitoring; protected PolicyMonitoring policyMonitoring;
@XmlElementWrapper(name = "InitialOperationConfig")
@XmlElement(name = "Operation", required = true)
protected List<String> operations;
public List<String> getOperations() {
return operations;
}
public void setOperations(List<String> operations) {
this.operations = operations;
}
/** /**
* Gets the value of the taskConfiguration property. * Gets the value of the taskConfiguration property.
@ -133,27 +119,6 @@ public class DeviceTypeConfiguration {
this.deviceDetails = value; this.deviceDetails = value;
} }
/**
* Gets the value of the Claimable property.
*
* @return possible object is
* {@link DeviceDetails }
*/
public Claimable getClaimable() {
return claimable;
}
/**
* Sets the value of the deviceDetails property.
*
* @param value allowed object is
* {@link DeviceDetails }
*/
public void setClaimable(Claimable value) {
this.claimable = value;
}
/** /**
* Gets the value of the policyMonitoring property. * Gets the value of the policyMonitoring property.
* *

@ -1,39 +0,0 @@
package org.wso2.carbon.device.mgt.extensions.device.type.deployer.config;
import javax.xml.bind.annotation.*;
import java.util.List;
/**
* <p>Java class for InitialOperationConfig complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="InitialOperationConfig">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Operations" type="{http://www.w3.org/2001/XMLSchema}list"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlRootElement(name = "InitialOperationConfig")
public class InitialOperationConfig {
private List<String> operations;
@XmlElementWrapper(name = "Operations", required = true)
@XmlElement(name = "Operation", required = true)
public List<String> getOperations() {
return operations;
}
public void setOperationsll(List<String> operations) {
this.operations = operations;
}
}

@ -65,7 +65,6 @@ public class DeviceTypeManager implements DeviceManager {
private LicenseManager licenseManager; private LicenseManager licenseManager;
private boolean propertiesExist; private boolean propertiesExist;
private boolean requiredDeviceTypeAuthorization; private boolean requiredDeviceTypeAuthorization;
private boolean claimable;
private FeatureManager featureManager; private FeatureManager featureManager;
@ -102,13 +101,8 @@ public class DeviceTypeManager implements DeviceManager {
String msg = "Error occurred while adding default license for " + deviceType + " devices"; String msg = "Error occurred while adding default license for " + deviceType + " devices";
throw new DeviceTypeDeployerFileException(msg, e); throw new DeviceTypeDeployerFileException(msg, e);
} }
claimable = false;
if (deviceTypeConfiguration.getClaimable() != null ) {
claimable = deviceTypeConfiguration.getClaimable().isEnabled();
}
DeviceDetails deviceDetails = deviceTypeConfiguration.getDeviceDetails(); DeviceDetails deviceDetails = deviceTypeConfiguration.getDeviceDetails();
if (deviceDetails != null) { if (deviceDetails != null) {
//Check whether device dao definition exist. //Check whether device dao definition exist.
@ -347,7 +341,7 @@ public class DeviceTypeManager implements DeviceManager {
@Override @Override
public boolean isClaimable(DeviceIdentifier deviceIdentifier) throws DeviceManagementException { public boolean isClaimable(DeviceIdentifier deviceIdentifier) throws DeviceManagementException {
return claimable; return false;
} }
@Override @Override

@ -20,7 +20,11 @@ package org.wso2.carbon.device.mgt.extensions.device.type.deployer.template;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.MonitoringOperation;
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
@ -53,8 +57,6 @@ public class DeviceTypeManagerService implements DeviceManagementService {
private OperationMonitoringTaskConfig operationMonitoringConfigs; private OperationMonitoringTaskConfig operationMonitoringConfigs;
private List<MonitoringOperation> monitoringOperations; private List<MonitoringOperation> monitoringOperations;
private PolicyMonitoringManager policyMonitoringManager; private PolicyMonitoringManager policyMonitoringManager;
private InitialOperationConfig initialOperationConfig;
private List<String> operations;
public DeviceTypeManagerService(DeviceTypeConfigIdentifier deviceTypeConfigIdentifier, public DeviceTypeManagerService(DeviceTypeConfigIdentifier deviceTypeConfigIdentifier,
DeviceTypeConfiguration deviceTypeConfiguration) { DeviceTypeConfiguration deviceTypeConfiguration) {
@ -64,8 +66,7 @@ public class DeviceTypeManagerService implements DeviceManagementService {
this.populatePushNotificationConfig(deviceTypeConfiguration.getPushNotificationProvider()); this.populatePushNotificationConfig(deviceTypeConfiguration.getPushNotificationProvider());
this.operationMonitoringConfigs = new OperationMonitoringTaskConfig(); this.operationMonitoringConfigs = new OperationMonitoringTaskConfig();
this.setOperationMonitoringConfig(deviceTypeConfiguration); this.setOperationMonitoringConfig(deviceTypeConfiguration);
this.setInitialOperationConfig(deviceTypeConfiguration); if (deviceTypeConfiguration.getPolicyMonitoring() != null) {
if (deviceTypeConfiguration.getPolicyMonitoring() != null ) {
this.policyMonitoringManager = new DefaultPolicyMonitoringManager(); this.policyMonitoringManager = new DefaultPolicyMonitoringManager();
} }
} }
@ -155,11 +156,6 @@ public class DeviceTypeManagerService implements DeviceManagementService {
return policyMonitoringManager; return policyMonitoringManager;
} }
@Override
public InitialOperationConfig getInitialOperationConfig() {
return initialOperationConfig;
}
private void setProvisioningConfig(String tenantDomain, DeviceTypeConfiguration deviceTypeConfiguration) { private void setProvisioningConfig(String tenantDomain, DeviceTypeConfiguration deviceTypeConfiguration) {
if (deviceTypeConfiguration.getProvisioningConfig() != null) { if (deviceTypeConfiguration.getProvisioningConfig() != null) {
boolean sharedWithAllTenants = deviceTypeConfiguration.getProvisioningConfig().isSharedWithAllTenants(); boolean sharedWithAllTenants = deviceTypeConfiguration.getProvisioningConfig().isSharedWithAllTenants();
@ -169,15 +165,6 @@ public class DeviceTypeManagerService implements DeviceManagementService {
} }
} }
protected void setInitialOperationConfig(DeviceTypeConfiguration deviceTypeConfiguration) {
if (deviceTypeConfiguration.getOperations() != null) {
List<String> ops = deviceTypeConfiguration.getOperations();
if (ops != null && !ops.isEmpty()) {
initialOperationConfig.setOperations(ops);
}
}
}
private void setType(String type) { private void setType(String type) {
this.type = type; this.type = type;
} }

@ -36,8 +36,6 @@
</Feature> </Feature>
</Features> </Features>
<Claimable enabled="true"/>
<Sensors table-id="SAMPLE_DEVICE_2"> <Sensors table-id="SAMPLE_DEVICE_2">
<Sensor code="CPU_Temperature"> <Sensor code="CPU_Temperature">
<Name>temperature sensor fitted</Name> <Name>temperature sensor fitted</Name>

@ -22,15 +22,15 @@
<parent> <parent>
<artifactId>device-mgt-extensions</artifactId> <artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.36-SNAPSHOT</version> <version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm</artifactId> <artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm</artifactId>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>WSO2 Carbon - FCM Based Push Notification Provider Implementation</name> <name>WSO2 Carbon - GCM Based Push Notification Provider Implementation</name>
<description>WSO2 Carbon - FCM Based Push Notification Provider Implementation</description> <description>WSO2 Carbon - GCM Based Push Notification Provider Implementation</description>
<url>http://wso2.org</url> <url>http://wso2.org</url>
<dependencies> <dependencies>
@ -128,10 +128,10 @@
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name> <Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version> <Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>FCM Based Push Notification Provider Bundle</Bundle-Description> <Bundle-Description>GCM Based Push Notification Provider Bundle</Bundle-Description>
<Export-Package> <Export-Package>
!org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.internal, !org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.internal,
org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.* org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.*
</Export-Package> </Export-Package>
<Import-Package> <Import-Package>
com.google.gson, com.google.gson,

@ -16,24 +16,24 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm; package org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy; 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.PushNotificationConfig;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationProvider; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationProvider;
public class FCMBasedPushNotificationProvider implements PushNotificationProvider { public class GCMBasedPushNotificationProvider implements PushNotificationProvider {
private static final String PS_PROVIDER_FCM = "FCM"; private static final String PS_PROVIDER_GCM = "GCM";
@Override @Override
public String getType() { public String getType() {
return PS_PROVIDER_FCM; return PS_PROVIDER_GCM;
} }
@Override @Override
public NotificationStrategy getNotificationStrategy(PushNotificationConfig config) { public NotificationStrategy getNotificationStrategy(PushNotificationConfig config) {
return new FCMNotificationStrategy(config); return new GCMNotificationStrategy(config);
} }
} }

@ -16,7 +16,7 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm; package org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
@ -27,7 +27,7 @@ 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.NotificationStrategy;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; 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.common.push.notification.PushNotificationExecutionFailedException;
import org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.internal.FCMDataHolder; import org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.internal.GCMDataHolder;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
@ -35,16 +35,16 @@ import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.util.List; import java.util.List;
public class FCMNotificationStrategy implements NotificationStrategy { public class GCMNotificationStrategy implements NotificationStrategy {
private static final String FCM_TOKEN = "FCM_TOKEN"; private static final String GCM_TOKEN = "GCM_TOKEN";
private static final String FCM_ENDPOINT = "https://fcm.googleapis.com/fcm/send"; private final static String GCM_ENDPOINT = "https://fcm.googleapis.com/fcm/send";
private static final String FCM_API_KEY = "fcmAPIKey"; private static final String GCM_API_KEY = "gcmAPIKey";
private static final int TIME_TO_LIVE = 60; private static final int TIME_TO_LIVE = 60;
private static final int HTTP_STATUS_CODE_OK = 200; private static final int HTTP_STATUS_CODE_OK = 200;
private PushNotificationConfig config; private PushNotificationConfig config;
public FCMNotificationStrategy(PushNotificationConfig config) { public GCMNotificationStrategy(PushNotificationConfig config) {
this.config = config; this.config = config;
} }
@ -57,7 +57,7 @@ public class FCMNotificationStrategy implements NotificationStrategy {
public void execute(NotificationContext ctx) throws PushNotificationExecutionFailedException { public void execute(NotificationContext ctx) throws PushNotificationExecutionFailedException {
try { try {
Device device = Device device =
FCMDataHolder.getInstance().getDeviceManagementProviderService().getDevice(ctx.getDeviceId()); GCMDataHolder.getInstance().getDeviceManagementProviderService().getDevice(ctx.getDeviceId());
this.sendWakeUpCall(ctx.getOperation().getCode(), device); this.sendWakeUpCall(ctx.getOperation().getCode(), device);
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
throw new PushNotificationExecutionFailedException("Error occurred while retrieving device information", e); throw new PushNotificationExecutionFailedException("Error occurred while retrieving device information", e);
@ -79,13 +79,13 @@ public class FCMNotificationStrategy implements NotificationStrategy {
private void sendWakeUpCall(String message, private void sendWakeUpCall(String message,
Device device) throws IOException, PushNotificationExecutionFailedException { Device device) throws IOException, PushNotificationExecutionFailedException {
OutputStream os = null; OutputStream os = null;
byte[] bytes = getFCMRequest(message, getFCMToken(device.getProperties())).getBytes(); byte[] bytes = getGCMRequest(message, getGCMToken(device.getProperties())).getBytes();
HttpURLConnection conn = null; HttpURLConnection conn = null;
try { try {
conn = (HttpURLConnection) new URL(FCM_ENDPOINT).openConnection(); conn = (HttpURLConnection) new URL(GCM_ENDPOINT).openConnection();
conn.setRequestProperty("Content-Type", "application/json"); conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", "key=" + config.getProperty(FCM_API_KEY)); conn.setRequestProperty("Authorization", "key=" + config.getProperty(GCM_API_KEY));
conn.setRequestMethod("POST"); conn.setRequestMethod("POST");
conn.setDoOutput(true); conn.setDoOutput(true);
os = conn.getOutputStream(); os = conn.getOutputStream();
@ -102,35 +102,35 @@ public class FCMNotificationStrategy implements NotificationStrategy {
} }
} }
private static String getFCMRequest(String message, String registrationId) { private static String getGCMRequest(String message, String registrationId) {
JsonObject fcmRequest = new JsonObject(); JsonObject gcmRequest = new JsonObject();
fcmRequest.addProperty("delay_while_idle", false); gcmRequest.addProperty("delay_while_idle", false);
fcmRequest.addProperty("time_to_live", TIME_TO_LIVE); gcmRequest.addProperty("time_to_live", TIME_TO_LIVE);
//Add message to FCM request //Add message to GCM request
JsonObject data = new JsonObject(); JsonObject data = new JsonObject();
if (message != null && !message.isEmpty()) { if (message != null && !message.isEmpty()) {
data.addProperty("data", message); data.addProperty("data", message);
fcmRequest.add("data", data); gcmRequest.add("data", data);
} }
//Set device reg-id //Set device reg-id
JsonArray regIds = new JsonArray(); JsonArray regIds = new JsonArray();
regIds.add(new JsonPrimitive(registrationId)); regIds.add(new JsonPrimitive(registrationId));
fcmRequest.add("registration_ids", regIds); gcmRequest.add("registration_ids", regIds);
return fcmRequest.toString(); return gcmRequest.toString();
} }
private static String getFCMToken(List<Device.Property> properties) { private static String getGCMToken(List<Device.Property> properties) {
String fcmToken = null; String gcmToken = null;
for (Device.Property property : properties) { for (Device.Property property : properties) {
if (FCM_TOKEN.equals(property.getName())) { if (GCM_TOKEN.equals(property.getName())) {
fcmToken = property.getValue(); gcmToken = property.getValue();
break; break;
} }
} }
return fcmToken; return gcmToken;
} }
} }

@ -16,16 +16,16 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.internal; package org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.internal;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
public class FCMDataHolder { public class GCMDataHolder {
private DeviceManagementProviderService deviceManagementProviderService; private DeviceManagementProviderService deviceManagementProviderService;
private static FCMDataHolder thisInstance = new FCMDataHolder(); private static GCMDataHolder thisInstance = new GCMDataHolder();
public static FCMDataHolder getInstance() { public static GCMDataHolder getInstance() {
return thisInstance; return thisInstance;
} }

@ -16,7 +16,7 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.internal; package org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.internal;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -24,7 +24,7 @@ import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
/** /**
* @scr.component name="org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.internal.FCMPushNotificationServiceComponent" immediate="true" * @scr.component name="org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.internal.GCMPushNotificationServiceComponent" immediate="true"
* @scr.reference name="carbon.device.mgt.provider" * @scr.reference name="carbon.device.mgt.provider"
* interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService" * interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService"
* cardinality="1..1" * cardinality="1..1"
@ -32,20 +32,23 @@ import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
* bind="setDeviceManagementProviderService" * bind="setDeviceManagementProviderService"
* unbind="unsetDeviceManagementProviderService" * unbind="unsetDeviceManagementProviderService"
*/ */
public class FCMPushNotificationServiceComponent { public class GCMPushNotificationServiceComponent {
private static final Log log = LogFactory.getLog(FCMPushNotificationServiceComponent.class); private static final Log log = LogFactory.getLog(GCMPushNotificationServiceComponent.class);
@SuppressWarnings("unused") @SuppressWarnings("unused")
protected void activate(ComponentContext componentContext) { protected void activate(ComponentContext componentContext) {
try { try {
if (log.isDebugEnabled()) {
log.debug("Initializing GCM based push notification provider implementation bundle");
}
//Do nothing //Do nothing
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("FCM based push notification provider implementation bundle has been successfully " + log.debug("GCM based push notification provider implementation bundle has been successfully " +
"initialized"); "initialized");
} }
} catch (Throwable e) { } catch (Throwable e) {
log.error("Error occurred while initializing FCM based push notification provider " + log.error("Error occurred while initializing GCM based push notification provider " +
"implementation bundle", e); "implementation bundle", e);
} }
} }
@ -56,12 +59,12 @@ public class FCMPushNotificationServiceComponent {
protected void setDeviceManagementProviderService( protected void setDeviceManagementProviderService(
DeviceManagementProviderService deviceManagementProviderService) { DeviceManagementProviderService deviceManagementProviderService) {
FCMDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService); GCMDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService);
} }
protected void unsetDeviceManagementProviderService( protected void unsetDeviceManagementProviderService(
DeviceManagementProviderService deviceManagementProviderService) { DeviceManagementProviderService deviceManagementProviderService) {
FCMDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService); GCMDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService);
} }
} }

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

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

@ -25,7 +25,7 @@ import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterService; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterService;
/** /**
* @scr.component name="org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.internal.XMPPPushNotificationServiceComponent" immediate="true" * @scr.component name="org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.internal.XMPPPushNotificationServiceComponent" immediate="true"
* @scr.reference name="carbon.device.mgt.provider" * @scr.reference name="carbon.device.mgt.provider"
* interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService" * interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService"
* cardinality="1..1" * cardinality="1..1"

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.36-SNAPSHOT</version> <version>2.0.16-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
@ -34,7 +34,7 @@
<url>http://wso2.org</url> <url>http://wso2.org</url>
<modules> <modules>
<module>org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm</module> <module>org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm</module>
<module>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt</module> <module>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt</module>
<module>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp</module> <module>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp</module>
<module>org.wso2.carbon.device.mgt.extensions.device.type.deployer</module> <module>org.wso2.carbon.device.mgt.extensions.device.type.deployer</module>

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

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

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.36-SNAPSHOT</version> <version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -291,13 +291,6 @@
<artifactId>org.wso2.carbon.identity.jwt.client.extension</artifactId> <artifactId>org.wso2.carbon.identity.jwt.client.extension</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.user.store.count</artifactId>
<version>${carbon.identity.framework.version}</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -30,13 +30,13 @@ public class BasePaginatedResult {
value = "Number of total resources.", value = "Number of total resources.",
example = "1") example = "1")
@JsonProperty("count") @JsonProperty("count")
private long count; private int count;
public long getCount() { public int getCount() {
return count; return count;
} }
public void setCount(long count) { public void setCount(int count) {
this.count = count; this.count = count;
} }
} }

@ -32,7 +32,6 @@ import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
@ -49,7 +48,6 @@ import javax.ws.rs.DELETE;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam; import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
@ -136,13 +134,7 @@ import javax.ws.rs.core.Response;
description = "Getting Policy Compliance Details of a Device", description = "Getting Policy Compliance Details of a Device",
key = "perm:devices:compliance-data", key = "perm:devices:compliance-data",
permissions = {"/device-mgt/devices/owning-device/view"} permissions = {"/device-mgt/devices/owning-device/view"}
), )
@Scope(
name = "Change device status.",
description = "Change device status.",
key = "perm:devices:change-status",
permissions = {"/device-mgt/devices/change-status"}
),
} }
) )
@Path("/devices") @Path("/devices")
@ -1158,79 +1150,4 @@ public interface DeviceManagementService {
@PathParam("id") @PathParam("id")
@Size(max = 45) @Size(max = 45)
String id); String id);
@PUT
@Path("/{type}/{id}/changestatus")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
httpMethod = "PUT",
value = "Change device status by device id.",
notes = "Returns the status of the changed device operation.",
tags = "Device Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:change-status")
})
}
)
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully changed the device status.",
response = Device.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. Empty body because the client already has the latest " +
"version of the requested resource."),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error.",
response = ErrorResponse.class),
@ApiResponse(
code = 404,
message = "Not Found. \n No device is found under the provided type and id.",
response = ErrorResponse.class),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while retrieving information requested device.",
response = ErrorResponse.class)
})
Response changeDeviceStatus(
@ApiParam(
name = "type",
value = "The device type, such as ios, android or windows.",
required = true)
@PathParam("type")
@Size(max = 45)
String type,
@ApiParam(
name = "id",
value = "Device id",
required = true)
@PathParam("id")
@Size(max = 45)
String id,
@ApiParam(
name = "newStatus",
value = "New status of the device.",
required = true)
@QueryParam("newStatus")
EnrolmentInfo.Status newStatus);
} }

@ -23,14 +23,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException; import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException;
@ -60,16 +53,7 @@ import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils; import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import javax.ws.rs.Consumes; import javax.ws.rs.*;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.text.ParseException; import java.text.ParseException;
@ -569,36 +553,4 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
} }
} }
/**
* Change device status.
*
* @param type Device type
* @param id Device id
* @param newsStatus Device new status
* @return {@link Response} object
*/
@PUT
@Path("/{type}/{id}/changestatus")
public Response changeDeviceStatus(@PathParam("type") @Size(max = 45) String type,
@PathParam("id") @Size(max = 45) String id,
@QueryParam("newStatus") EnrolmentInfo.Status newsStatus) {
RequestValidationUtil.validateDeviceIdentifier(type, id);
DeviceManagementProviderService deviceManagementProviderService =
DeviceMgtAPIUtils.getDeviceManagementService();
try {
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(id, type);
Device persistedDevice = deviceManagementProviderService.getDevice(deviceIdentifier);
if (persistedDevice == null) {
return Response.status(Response.Status.NOT_FOUND).build();
}
boolean response = deviceManagementProviderService.changeDeviceStatus(deviceIdentifier, newsStatus);
return Response.status(Response.Status.OK).entity(response).build();
} catch (DeviceManagementException e) {
String msg = "Error occurred while changing device status of type : " + type + " and " +
"device id : " + id;
log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
}
}
} }

@ -38,8 +38,6 @@ import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.RequestValidationUtil;
import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import org.wso2.carbon.device.mgt.jaxrs.util.Constants;
import org.wso2.carbon.device.mgt.jaxrs.util.CredentialManagementResponseBuilder; import org.wso2.carbon.device.mgt.jaxrs.util.CredentialManagementResponseBuilder;
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils; import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
import org.wso2.carbon.identity.user.store.count.UserStoreCountRetriever;
import org.wso2.carbon.identity.user.store.count.exception.UserStoreCounterException;
import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.user.api.UserStoreManager;
import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.CarbonUtils;
@ -397,30 +395,6 @@ public class UserManagementServiceImpl implements UserManagementService {
@Path("/count") @Path("/count")
@Override @Override
public Response getUserCount() { public Response getUserCount() {
try {
UserStoreCountRetriever userStoreCountRetrieverService = DeviceMgtAPIUtils.getUserStoreCountRetrieverService();
if (userStoreCountRetrieverService != null) {
long count = userStoreCountRetrieverService.countUsers("");
if (count != -1) {
BasicUserInfoList result = new BasicUserInfoList();
result.setCount(count);
return Response.status(Response.Status.OK).entity(result).build();
}
}
} catch (UserStoreCounterException e) {
String msg =
"Error occurred while retrieving the count of users that exist within the current tenant";
log.error(msg, e);
}
return getUserCountViaUserStoreManager();
}
/**
* This method returns the count of users using UserStoreManager.
*
* @return user count
*/
private Response getUserCountViaUserStoreManager() {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Getting the user count"); log.debug("Getting the user count");
} }

@ -37,21 +37,14 @@ import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService;
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.InputValidationException; import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.InputValidationException;
import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService;
import org.wso2.carbon.identity.user.store.count.AbstractCountRetrieverFactory;
import org.wso2.carbon.identity.user.store.count.UserStoreCountRetriever;
import org.wso2.carbon.identity.user.store.count.exception.UserStoreCounterException;
import org.wso2.carbon.identity.user.store.count.jdbc.JDBCCountRetrieverFactory;
import org.wso2.carbon.identity.user.store.count.jdbc.internal.InternalCountRetrieverFactory;
import org.wso2.carbon.policy.mgt.common.PolicyMonitoringTaskException; import org.wso2.carbon.policy.mgt.common.PolicyMonitoringTaskException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
import org.wso2.carbon.policy.mgt.core.task.TaskScheduleService; import org.wso2.carbon.policy.mgt.core.task.TaskScheduleService;
import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.user.api.AuthorizationManager; import org.wso2.carbon.user.api.AuthorizationManager;
import org.wso2.carbon.user.api.RealmConfiguration;
import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserRealm;
import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.user.api.UserStoreManager;
import org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager;
import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.user.core.service.RealmService;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
@ -113,32 +106,6 @@ public class DeviceMgtAPIUtils {
return deviceManagementProviderService; return deviceManagementProviderService;
} }
public static UserStoreCountRetriever getUserStoreCountRetrieverService()
throws UserStoreCounterException {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
List<Object> countRetrieverFactories = ctx.getOSGiServices(AbstractCountRetrieverFactory.class, null);
RealmService realmService = (RealmService) ctx.getOSGiService(RealmService.class, null);
RealmConfiguration realmConfiguration = realmService.getBootstrapRealmConfiguration();
String userStoreType;
//Ignoring Sonar warning as getUserStoreClass() returning string name of the class. So cannot use 'instanceof'.
if (JDBCUserStoreManager.class.getName().equals(realmConfiguration.getUserStoreClass())) {
userStoreType = JDBCCountRetrieverFactory.JDBC;
} else {
userStoreType = InternalCountRetrieverFactory.INTERNAL;
}
AbstractCountRetrieverFactory countRetrieverFactory = null;
for (Object countRetrieverFactoryObj : countRetrieverFactories) {
countRetrieverFactory = (AbstractCountRetrieverFactory) countRetrieverFactoryObj;
if (userStoreType.equals(countRetrieverFactory.getCounterType())) {
break;
}
}
if (countRetrieverFactory == null) {
return null;
}
return countRetrieverFactory.buildCountRetriever(realmConfiguration);
}
public static DeviceAccessAuthorizationService getDeviceAccessAuthorizationService() { public static DeviceAccessAuthorizationService getDeviceAccessAuthorizationService() {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
DeviceAccessAuthorizationService deviceAccessAuthorizationService = DeviceAccessAuthorizationService deviceAccessAuthorizationService =

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

@ -1,36 +0,0 @@
/*
* Copyright (c) 2016, 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.common;
import java.util.List;
public class InitialOperationConfig {
private List<String> operations;
public List<String> getOperations() {
return operations;
}
public void setOperations(List<String> operations) {
this.operations = operations;
}
}

@ -25,7 +25,7 @@ import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "Condition", description = "Contains the advance search parameters.") @ApiModel(value = "Condition", description = "Contains the advance search parameters.")
public class Condition { public class Condition {
@ApiModelProperty(name = "key", value = "Provide the operation code. You can assign the following operation " + @ApiModelProperty(name = "conditions", value = "Provide the operation code. You can assign the following operation " +
"codes:\n" + "codes:\n" +
"DEVICE_MODEL : The model of the device.\n" + "DEVICE_MODEL : The model of the device.\n" +
"VENDOR : The name of the device vendor.\n" + "VENDOR : The name of the device vendor.\n" +

@ -18,7 +18,10 @@
*/ */
package org.wso2.carbon.device.mgt.common.spi; package org.wso2.carbon.device.mgt.common.spi;
import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
@ -45,8 +48,4 @@ public interface DeviceManagementService {
PolicyMonitoringManager getPolicyMonitoringManager(); PolicyMonitoringManager getPolicyMonitoringManager();
InitialOperationConfig getInitialOperationConfig();
} }

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

@ -420,5 +420,12 @@ public interface DeviceDAO {
*/ */
List<EnrolmentInfo> getEnrolmentsByStatus(List<DeviceIdentifier> deviceIds, Status status, List<EnrolmentInfo> getEnrolmentsByStatus(List<DeviceIdentifier> deviceIds, Status status,
int tenantId) throws DeviceManagementDAOException; int tenantId) throws DeviceManagementDAOException;
/**
* Retrieving the tenants which are have device enrolled.
* @return
* @throws DeviceManagementDAOException
*/
List<Integer> getDeviceEnrolledTenants() throws DeviceManagementDAOException;
} }

@ -1063,4 +1063,26 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
return devices; return devices;
} }
public List<Integer> getDeviceEnrolledTenants() throws DeviceManagementDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
List<Integer> tenants = new ArrayList<>();
try {
conn = this.getConnection();
String sql = "SELECT distinct(TENANT_ID) FROM DM_DEVICE";
stmt = conn.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
tenants.add(rs.getInt("TENANT_ID"));
}
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while retrieving tenants which have " +
"device registered.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
return tenants;
}
} }

@ -62,6 +62,11 @@ public class DeviceManagementDataHolder {
private Map<String, OperationMonitoringTaskConfig> map = new HashMap<>(); private Map<String, OperationMonitoringTaskConfig> map = new HashMap<>();
public void addToMap(OperationMonitoringTaskConfig taskConfig) {
this.map.put("aa", taskConfig);
}
public Map<String, OperationMonitoringTaskConfig> getMap(){ public Map<String, OperationMonitoringTaskConfig> getMap(){
return this.map; return this.map;
} }

@ -307,14 +307,6 @@ public interface DeviceManagementProviderService {
PolicyMonitoringManager getPolicyMonitoringManager(String deviceType); PolicyMonitoringManager getPolicyMonitoringManager(String deviceType);
/** List<Integer> getDeviceEnrolledTenants() throws DeviceManagementException;
* Change device status.
*
* @param deviceIdentifier {@link DeviceIdentifier} object
* @param newStatus New status of the device
* @return Whether status is changed or not
* @throws DeviceManagementException on errors while trying to change device status
*/
boolean changeDeviceStatus(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status newStatus)
throws DeviceManagementException;
} }

@ -23,7 +23,20 @@ import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.DeviceNotFoundException;
import org.wso2.carbon.device.mgt.common.DeviceTypeIdentifier;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.MonitoringOperation;
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.common.TransactionManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo;
@ -53,7 +66,6 @@ import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent;
import org.wso2.carbon.device.mgt.core.internal.PluginInitializationListener; import org.wso2.carbon.device.mgt.core.internal.PluginInitializationListener;
import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import org.wso2.carbon.email.sender.core.ContentProviderInfo; import org.wso2.carbon.email.sender.core.ContentProviderInfo;
import org.wso2.carbon.email.sender.core.EmailContext; import org.wso2.carbon.email.sender.core.EmailContext;
@ -245,8 +257,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
if (status) { if (status) {
addDeviceToGroups(deviceIdentifier, device.getEnrolmentInfo().getOwnership()); addDeviceToGroups(deviceIdentifier, device.getEnrolmentInfo().getOwnership());
addInitialOperations(deviceIdentifier, device.getType());
} }
return status; return status;
} }
@ -1269,6 +1279,21 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
return dms.getPolicyMonitoringManager(); return dms.getPolicyMonitoringManager();
} }
@Override
public List<Integer> getDeviceEnrolledTenants() throws DeviceManagementException {
try {
DeviceManagementDAOFactory.openConnection();
return deviceDAO.getDeviceEnrolledTenants();
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while retrieving the tenants " +
"which have device enrolled.", e);
} catch (SQLException e) {
throw new DeviceManagementException("Error occurred while opening a connection to the data source", e);
} finally {
DeviceManagementDAOFactory.closeConnection();
}
}
@Override @Override
public List<Device> getDevicesOfUser(String username) throws DeviceManagementException { public List<Device> getDevicesOfUser(String username) throws DeviceManagementException {
List<Device> devices = new ArrayList<>(); List<Device> devices = new ArrayList<>();
@ -1956,68 +1981,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
return false; return false;
} }
/**
* Change device status.
*
* @param deviceIdentifier {@link DeviceIdentifier} object
* @param newStatus New status of the device
* @return Whether status is changed or not
* @throws DeviceManagementException on errors while trying to change device status
*/
@Override
public boolean changeDeviceStatus(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status newStatus)
throws DeviceManagementException {
boolean isDeviceUpdated = false;
Device device = getDevice(deviceIdentifier);
int deviceId = device.getId();
EnrolmentInfo enrolmentInfo = device.getEnrolmentInfo();
enrolmentInfo.setStatus(newStatus);
int tenantId = this.getTenantId();
switch (newStatus) {
case ACTIVE:
isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
break;
case INACTIVE:
isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
break;
case REMOVED:
isDeviceUpdated = disenrollDevice(deviceIdentifier);
break;
default:
throw new DeviceManagementException("Invalid status retrieved. Status : " + newStatus);
}
return isDeviceUpdated;
}
private boolean updateEnrollment(int deviceId, EnrolmentInfo enrolmentInfo, int tenantId)
throws DeviceManagementException {
boolean isUpdatedEnrollment = false;
boolean isAutoCommit = true;
try {
DeviceManagementDAOFactory.openConnection();
isAutoCommit = DeviceManagementDAOFactory.getConnection().getAutoCommit();
DeviceManagementDAOFactory.getConnection().setAutoCommit(true);
int updatedRows = enrollmentDAO.updateEnrollment(deviceId, enrolmentInfo, tenantId);
if (updatedRows > 0) {
isUpdatedEnrollment = true;
}
} catch (SQLException e) {
throw new DeviceManagementException("Error occurred while opening a connection to the data source", e);
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while updating the enrollment information device for" +
"id '" + deviceId + "' ." , e);
} finally {
try {
DeviceManagementDAOFactory.getConnection().setAutoCommit(isAutoCommit);
} catch (SQLException e) {
log.error("Exception occurred while setting auto commit.");
}
DeviceManagementDAOFactory.closeConnection();
}
return isUpdatedEnrollment;
}
private int getTenantId() { private int getTenantId() {
return CarbonContext.getThreadLocalCarbonContext().getTenantId(); return CarbonContext.getThreadLocalCarbonContext().getTenantId();
} }
@ -2074,37 +2037,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
} }
} }
private void addInitialOperations(DeviceIdentifier deviceIdentifier, String deviceType) throws DeviceManagementException {
DeviceManagementProviderService deviceManagementProviderService = DeviceManagementDataHolder.getInstance().
getDeviceManagementProvider();
DeviceManagementService deviceManagementService =
pluginRepository.getDeviceManagementService(deviceType, this.getTenantId());
InitialOperationConfig init = deviceManagementService.getInitialOperationConfig();
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>();
deviceIdentifiers.add(deviceIdentifier);
if (init != null) {
List<String> initialOperations = init.getOperations();
for (String str : initialOperations) {
CommandOperation operation = new CommandOperation();
operation.setEnabled(true);
operation.setType(Operation.Type.COMMAND);
operation.setCode(str);
try {
deviceManagementProviderService.
addOperation(deviceType,
operation, deviceIdentifiers);
} catch (OperationManagementException e) {
throw new DeviceManagementException("Unable to find the device with the id: '" + deviceIdentifier.getId(),
e);
} catch (InvalidDeviceException e) {
throw new DeviceManagementException("Unable to find the device with the id: '" + deviceIdentifier.getId(),
e);
}
}
}
}
/** /**
* Checks for the default group existence and create group based on device ownership * Checks for the default group existence and create group based on device ownership
* *

@ -22,17 +22,25 @@ package org.wso2.carbon.device.mgt.core.task.impl;
import com.google.gson.Gson; import com.google.gson.Gson;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.device.mgt.core.task.DeviceMgtTaskException; import org.wso2.carbon.device.mgt.core.task.DeviceMgtTaskException;
import org.wso2.carbon.device.mgt.core.task.DeviceTaskManager; import org.wso2.carbon.device.mgt.core.task.DeviceTaskManager;
import org.wso2.carbon.ntask.core.Task; import org.wso2.carbon.ntask.core.Task;
import org.wso2.carbon.user.api.Tenant;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import java.util.List;
import java.util.List;
import java.util.Map; import java.util.Map;
public class DeviceDetailsRetrieverTask implements Task { public class DeviceDetailsRetrieverTask implements Task {
private static Log log = LogFactory.getLog(DeviceDetailsRetrieverTask.class); private static Log log = LogFactory.getLog(DeviceDetailsRetrieverTask.class);
// private DeviceTaskManager deviceTaskManager = new DeviceTaskManagerImpl(); // private DeviceTaskManager deviceTaskManager = new DeviceTaskManagerImpl();
private String deviceType; private String deviceType;
private String oppConfig; private String oppConfig;
private OperationMonitoringTaskConfig operationMonitoringTaskConfig; private OperationMonitoringTaskConfig operationMonitoringTaskConfig;
@ -57,18 +65,41 @@ public class DeviceDetailsRetrieverTask implements Task {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Device details retrieving task started to run."); log.debug("Device details retrieving task started to run.");
} }
DeviceTaskManager deviceTaskManager = new DeviceTaskManagerImpl(deviceType,
operationMonitoringTaskConfig);
//pass the configurations also from here, monitoring tasks
try { try {
deviceTaskManager.addOperations(); // Tenant tenants[] = DeviceManagementDataHolder.getInstance().
} catch (DeviceMgtTaskException e) { // getRealmService().getTenantManager().getAllTenants();
log.error(
"Error occurred while trying to add the operations to device to retrieve device details.", List<Integer> tenants = DeviceManagementDataHolder.getInstance().
e); getDeviceManagementProvider().getDeviceEnrolledTenants();
for (Integer tenant : tenants) {
String tenantDomain = DeviceManagementDataHolder.getInstance().
getRealmService().getTenantManager().getDomain(tenant);
try {
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenant);
DeviceTaskManager deviceTaskManager = new DeviceTaskManagerImpl(deviceType,
operationMonitoringTaskConfig);
//pass the configurations also from here, monitoring tasks
try {
deviceTaskManager.addOperations();
} catch (DeviceMgtTaskException e) {
log.error("Error occurred while trying to add the operations to " +
"device to retrieve device details.", e);
}
} finally {
PrivilegedCarbonContext.endTenantFlow();
}
}
} catch (UserStoreException e) {
log.error("Error occurred while trying to get the available tenants", e);
} catch (DeviceManagementException e) {
log.error("Error occurred while trying to get the available tenants " +
"from device manager provider service.", e);
} }
} }
} }

@ -17,7 +17,10 @@
*/ */
package org.wso2.carbon.device.mgt.core; package org.wso2.carbon.device.mgt.core;
import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
@ -72,9 +75,4 @@ public class TestDeviceManagementService implements DeviceManagementService {
return null; return null;
} }
@Override
public InitialOperationConfig getInitialOperationConfig() {
return null;
}
} }

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

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

@ -1,6 +1,6 @@
{ {
"appContext": "/devicemgt/", "appContext": "/devicemgt/",
"isCloud": false, "isCloud": true,
"httpsURL": "https://%iot.gateway.host%:%iot.gateway.https.port%", "httpsURL": "https://%iot.gateway.host%:%iot.gateway.https.port%",
"httpURL": "http://%iot.gateway.host%:%iot.gateway.http.port", "httpURL": "http://%iot.gateway.host%:%iot.gateway.http.port",
"wssURL": "https://%iot.analytics.host%:%iot.analytics.https.port%", "wssURL": "https://%iot.analytics.host%:%iot.analytics.https.port%",
@ -182,4 +182,4 @@
"backendRestEndpoints": { "backendRestEndpoints": {
"deviceMgt": "/api/device-mgt/v1.0" "deviceMgt": "/api/device-mgt/v1.0"
} }
} }

@ -174,7 +174,7 @@ var userModule = function () {
} }
try { try {
utility.startTenantFlow(carbonUser); utility.startTenantFlow(carbonUser);
var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/users/count"; var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/users?offset=0&limit=1";
return serviceInvokers.XMLHttp.get( return serviceInvokers.XMLHttp.get(
url, function (responsePayload) { url, function (responsePayload) {
return parse(responsePayload["responseText"])["count"]; return parse(responsePayload["responseText"])["count"];
@ -609,9 +609,6 @@ var userModule = function () {
if (publicMethods.isAuthorized("/permission/admin/device-mgt/platform-configs/view")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/platform-configs/view")) {
permissions["TENANT_CONFIGURATION"] = true; permissions["TENANT_CONFIGURATION"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/change-status")) {
permissions["CHANGE_DEVICE_STATUS"] = true;
}
return permissions; return permissions;
}; };

@ -33,14 +33,12 @@ var permissions = {
"/permission/admin/device-mgt/device/api/subscribe": ["ui.execute"], "/permission/admin/device-mgt/device/api/subscribe": ["ui.execute"],
"/permission/admin/device-mgt/devices/enroll": ["ui.execute"], "/permission/admin/device-mgt/devices/enroll": ["ui.execute"],
"/permission/admin/device-mgt/devices/disenroll": ["ui.execute"], "/permission/admin/device-mgt/devices/disenroll": ["ui.execute"],
"/permission/admin/device-mgt/devices/owning-device/view": ["ui.execute"], "/permission/admin/device-mgt/devices/owning-device/view": ["ui.execute"]
"/permission/admin/manage/portal": ["ui.execute"]
}; };
var adminPermissions = { var adminPermissions = {
"/permission/admin/device-mgt": ["ui.execute"], "/permission/admin/device-mgt": ["ui.execute"],
"/permission/admin/manage/api": ["ui.execute"], "/permission/admin/manage/api": ["ui.execute"]
"/permission/admin/manage/portal": ["ui.execute"]
}; };
//On Startup, admin user will get both roles: devicemgt-admin and devicemgt-user //On Startup, admin user will get both roles: devicemgt-admin and devicemgt-user

@ -40,7 +40,7 @@ var handlers = function () {
"as input - setupTokenPairByPasswordGrantType(x, y)"); "as input - setupTokenPairByPasswordGrantType(x, y)");
} else { } else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]); var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) { if (!encodedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair by " + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair by " +
@ -84,7 +84,7 @@ var handlers = function () {
"as input - setupTokenPairBySamlGrantType(x, y)"); "as input - setupTokenPairBySamlGrantType(x, y)");
} else { } else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]); var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) { if (!encodedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " +
@ -129,7 +129,7 @@ var handlers = function () {
"as input - setupTokenPairBySamlGrantType(x, y)"); "as input - setupTokenPairBySamlGrantType(x, y)");
} else { } else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]); var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) { if (!encodedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " +
@ -158,13 +158,13 @@ var handlers = function () {
// setting up access token pair into session context as a string // setting up access token pair into session context as a string
session.put(constants["TOKEN_PAIR"], stringify(tokenPair)); session.put(constants["TOKEN_PAIR"], stringify(tokenPair));
var scopes = tokenData.scopes.split(" "); var scopes = tokenData.scopes.split(" ");
// adding allowed scopes to the session // adding allowed scopes to the session
session.put(constants["ALLOWED_SCOPES"], scopes); session.put(constants["ALLOWED_SCOPES"], scopes);
} }
} }
} }
}; };
publicMethods["refreshTokenPair"] = function () { publicMethods["refreshTokenPair"] = function () {
var currentTokenPair = parse(session.get(constants["TOKEN_PAIR"])); var currentTokenPair = parse(session.get(constants["TOKEN_PAIR"]));
@ -224,44 +224,44 @@ var handlers = function () {
} }
}; };
privateMethods["setUpEncodedTenantBasedWebSocketClientAppCredentials"] = function (username) { // privateMethods["setUpEncodedTenantBasedWebSocketClientAppCredentials"] = function (username) {
if (!username) { // if (!username) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " + // throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " +
"client credentials to session context. No username of logged in user is found as " + // "client credentials to session context. No username of logged in user is found as " +
"input - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); // "input - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
} else { // } else {
if (devicemgtProps["gatewayEnabled"]) { // if (devicemgtProps["gatewayEnabled"]) {
var tenantBasedWebSocketClientAppCredentials // var tenantBasedWebSocketClientAppCredentials
= tokenUtil.getTenantBasedWebSocketClientAppCredentials(username); // = tokenUtil.getTenantBasedWebSocketClientAppCredentials(username);
if (!tenantBasedWebSocketClientAppCredentials) { // if (!tenantBasedWebSocketClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant " + // throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant " +
"based client credentials to session context as the server is unable " + // "based client credentials to session context as the server is unable " +
"to obtain such credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); // "to obtain such credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
} else { // } else {
var encodedTenantBasedWebSocketClientAppCredentials = // var encodedTenantBasedWebSocketClientAppCredentials =
tokenUtil.encode(tenantBasedWebSocketClientAppCredentials["clientId"] + ":" + // tokenUtil.encode(tenantBasedWebSocketClientAppCredentials["clientId"] + ":" +
tenantBasedWebSocketClientAppCredentials["clientSecret"]); // tenantBasedWebSocketClientAppCredentials["clientSecret"]);
// setting up encoded tenant based client credentials to session context. // // setting up encoded tenant based client credentials to session context.
session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], // session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"],
encodedTenantBasedWebSocketClientAppCredentials); // encodedTenantBasedWebSocketClientAppCredentials);
} // }
} else { // } else {
var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials(); // var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials();
if (!dynamicClientAppCredentials) { // if (!dynamicClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " + // throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " +
"client credentials to session context as the server is unable to obtain " + // "client credentials to session context as the server is unable to obtain " +
"dynamic client credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); // "dynamic client credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
} // }
var encodedTenantBasedWebSocketClientAppCredentials = // var encodedTenantBasedWebSocketClientAppCredentials =
tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" + // tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" +
dynamicClientAppCredentials["clientSecret"]); // dynamicClientAppCredentials["clientSecret"]);
// setting up encoded tenant based client credentials to session context. // // setting up encoded tenant based client credentials to session context.
session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], // session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"],
encodedTenantBasedWebSocketClientAppCredentials); // encodedTenantBasedWebSocketClientAppCredentials);
} // }
} // }
}; // };
return publicMethods; return publicMethods;
}(); }();

@ -44,7 +44,7 @@ var dynamicForm = '<div class="dynamic-search-param row"><div class="row"><a cla
'<select class="state no-tag form-control select2-custom"><option>AND</option><option>OR</option></select></div><div ' + '<select class="state no-tag form-control select2-custom"><option>AND</option><option>OR</option></select></div><div ' +
'class="form-group wr-input-control col-md-4"><label class="wr-input-label ">Key</label><select class=' + 'class="form-group wr-input-control col-md-4"><label class="wr-input-label ">Key</label><select class=' +
'"txt-key form-control select2-custom"><option value = "deviceModel">Device Model' + '"txt-key form-control select2-custom"><option value = "deviceModel">Device Model' +
'</option><option value = "PhoneNumber">Phone Number</option><option value = "vendor">Vendor</option><option value = "osVersion">OS Version' + '</option><option value = "vendor">Vendor</option><option value = "osVersion">OS Version' +
'</option><option value = "batteryLevel">Battery Level</option><option value =' + '</option><option value = "batteryLevel">Battery Level</option><option value =' +
' "internalTotalMemory">Internal Total Memory</option> <option value ="internalAvailableMemory">' + ' "internalTotalMemory">Internal Total Memory</option> <option value ="internalAvailableMemory">' +
'Internal Available Memory</option> <option value = "externalTotalMemory">External Total Memory</option>' + 'Internal Available Memory</option> <option value = "externalTotalMemory">External Total Memory</option>' +
@ -221,4 +221,4 @@ $(document).ready(function () {
}); });
} }
}); });
}); });

@ -90,4 +90,4 @@
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/group-add.js"}} {{js "js/group-add.js"}}
{{/zone}} {{/zone}}

@ -50,41 +50,12 @@
<tr role="row" class="even"> <tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px;">Status</td> <td class="sorting_1" style="padding:10px 15px;">Status</td>
<td style="padding:10px 15px;"> <td style="padding:10px 15px;">
{{#if permissions.CHANGE_DEVICE_STATUS}} {{#equal device.status "ACTIVE"}}<span><i
{{#equal device.status "ACTIVE"}}<span><i id="statusIcon" class="fw fw-success icon-success"></i> Active</span>{{/equal}}
class="fw fw-success icon-success"></i> {{#equal device.status "INACTIVE"}}<span><i
<a href="#" id="status" data-type="select" data-pk="1" class="fw fw-warning icon-warning"></i> Inactive</span>{{/equal}}
data-title="Select status" {{#equal device.status "BLOCKED"}}<span><i class="fw fw-remove icon-danger"></i> Blocked</span>{{/equal}}
selectedValue="Active"></a> {{#equal device.status "REMOVED"}}<span><i class="fw fw-delete icon-danger"></i> Removed</span>{{/equal}}
</span>{{/equal}}
{{#equal device.status "INACTIVE"}}<span><i id="statusIcon"
class="fw fw-warning icon-warning"></i>
<a href="#" id="status" data-type="select" data-pk="1"
data-title="Select status"
selectedValue="Inactive"></a>
</span>{{/equal}}
{{#equal device.status "BLOCKED"}}<span><i id="statusIcon"
class="fw fw-remove icon-danger"></i>
<a href="#" id="status" data-type="select" data-pk="1"
data-title="Select status"
selectedValue="Blocked"></a>
</span>{{/equal}}
{{#equal device.status "REMOVED"}}<span><i id="statusIcon"
class="fw fw-delete icon-danger"></i>
<a href="#" id="status" data-type="select" data-pk="1"
data-title="Select status"
selectedValue="Removed"></a>
</span>{{/equal}}
{{else}}
{{#equal device.status "ACTIVE"}}<span><i
class="fw fw-success icon-success"></i> Active</span>{{/equal}}
{{#equal device.status "INACTIVE"}}<span><i
class="fw fw-warning icon-warning"></i> Inactive</span>{{/equal}}
{{#equal device.status "BLOCKED"}}<span><i
class="fw fw-remove icon-danger"></i> Blocked</span>{{/equal}}
{{#equal device.status "REMOVED"}}<span><i
class="fw fw-delete icon-danger"></i> Removed</span>{{/equal}}
{{/if}}
</td> </td>
</tr> </tr>
</tbody> </tbody>

@ -15,7 +15,6 @@
specific language governing permissions and limitations specific language governing permissions and limitations
under the License. under the License.
}} }}
{{unit "cdmf.unit.lib.editable"}}
{{#zone "content"}} {{#zone "content"}}
{{#if deviceFound}} {{#if deviceFound}}
{{#if isAuthorized}} {{#if isAuthorized}}

@ -1,8 +0,0 @@
{{#zone "topCss"}}
{{css "css/editable.css"}}
{{/zone}}
{{#zone "bottomJs"}}
{{js "js/editable.js"}}
{{js "js/editable.min.js"}}
{{/zone}}

@ -1,663 +0,0 @@
/*! X-editable - v1.5.1
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
* http://github.com/vitalets/x-editable
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
.editableform {
margin-bottom: 0; /* overwrites bootstrap margin */
}
.editableform .control-group {
margin-bottom: 0; /* overwrites bootstrap margin */
white-space: nowrap; /* prevent wrapping buttons on new line */
line-height: 20px; /* overwriting bootstrap line-height. See #133 */
}
/*
BS3 width:1005 for inputs breaks editable form in popup
See: https://github.com/vitalets/x-editable/issues/393
*/
.editableform .form-control {
width: auto;
}
.editable-buttons {
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
vertical-align: top;
margin-left: 7px;
/* inline-block emulation for IE7*/
zoom: 1;
*display: inline;
}
.editable-buttons.editable-buttons-bottom {
display: block;
margin-top: 7px;
margin-left: 0;
}
.editable-input {
vertical-align: top;
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
width: auto; /* bootstrap-responsive has width: 100% that breakes layout */
white-space: normal; /* reset white-space decalred in parent*/
/* display-inline emulation for IE7*/
zoom: 1;
*display: inline;
}
.editable-buttons .editable-cancel {
margin-left: 7px;
}
/*for jquery-ui buttons need set height to look more pretty*/
.editable-buttons button.ui-button-icon-only {
height: 24px;
width: 30px;
}
.editableform-loading {
background: url('../img/loading.gif') center center no-repeat;
height: 25px;
width: auto;
min-width: 25px;
}
.editable-inline .editableform-loading {
background-position: left 5px;
}
.editable-error-block {
max-width: 300px;
margin: 5px 0 0 0;
width: auto;
white-space: normal;
}
/*add padding for jquery ui*/
.editable-error-block.ui-state-error {
padding: 3px;
}
.editable-error {
color: red;
}
/* ---- For specific types ---- */
.editableform .editable-date {
padding: 0;
margin: 0;
float: left;
}
/* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */
.editable-inline .add-on .icon-th {
margin-top: 3px;
margin-left: 1px;
}
/* checklist vertical alignment */
.editable-checklist label input[type="checkbox"],
.editable-checklist label span {
vertical-align: middle;
margin: 0;
}
.editable-checklist label {
white-space: nowrap;
}
/* set exact width of textarea to fit buttons toolbar */
.editable-wysihtml5 {
width: 566px;
height: 250px;
}
/* clear button shown as link in date inputs */
.editable-clear {
clear: both;
font-size: 0.9em;
text-decoration: none;
text-align: right;
}
/* IOS-style clear button for text inputs */
.editable-clear-x {
background: url('../img/clear.png') center center no-repeat;
display: block;
width: 13px;
height: 13px;
position: absolute;
opacity: 0.6;
z-index: 100;
top: 50%;
right: 6px;
margin-top: -6px;
}
.editable-clear-x:hover {
opacity: 1;
}
.editable-pre-wrapped {
white-space: pre-wrap;
}
.editable-container.editable-popup {
max-width: none !important; /* without this rule poshytip/tooltip does not stretch */
}
.editable-container.popover {
width: auto; /* without this rule popover does not stretch */
}
.editable-container.editable-inline {
display: inline-block;
vertical-align: middle;
width: auto;
/* inline-block emulation for IE7*/
zoom: 1;
*display: inline;
}
.editable-container.ui-widget {
font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */
z-index: 9990; /* should be less than select2 dropdown z-index to close dropdown first when click */
}
.editable-click,
a.editable-click,
a.editable-click:hover {
text-decoration: none;
border-bottom: dashed 1px #0088cc;
}
.editable-click.editable-disabled,
a.editable-click.editable-disabled,
a.editable-click.editable-disabled:hover {
color: #585858;
cursor: default;
border-bottom: none;
}
.editable-empty, .editable-empty:hover, .editable-empty:focus{
font-style: italic;
color: #DD1144;
/* border-bottom: none; */
text-decoration: none;
}
.editable-unsaved {
font-weight: bold;
}
.editable-unsaved:after {
/* content: '*'*/
}
.editable-bg-transition {
-webkit-transition: background-color 1400ms ease-out;
-moz-transition: background-color 1400ms ease-out;
-o-transition: background-color 1400ms ease-out;
-ms-transition: background-color 1400ms ease-out;
transition: background-color 1400ms ease-out;
}
/*see https://github.com/vitalets/x-editable/issues/139 */
.form-horizontal .editable
{
padding-top: 5px;
display:inline-block;
}
/*!
* Datepicker for Bootstrap
*
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
.datepicker {
padding: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
direction: ltr;
/*.dow {
border-top: 1px solid #ddd !important;
}*/
}
.datepicker-inline {
width: 220px;
}
.datepicker.datepicker-rtl {
direction: rtl;
}
.datepicker.datepicker-rtl table tr td span {
float: right;
}
.datepicker-dropdown {
top: 0;
left: 0;
}
.datepicker-dropdown:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
top: -7px;
left: 6px;
}
.datepicker-dropdown:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
position: absolute;
top: -6px;
left: 7px;
}
.datepicker > div {
display: none;
}
.datepicker.days div.datepicker-days {
display: block;
}
.datepicker.months div.datepicker-months {
display: block;
}
.datepicker.years div.datepicker-years {
display: block;
}
.datepicker table {
margin: 0;
}
.datepicker td,
.datepicker th {
text-align: center;
width: 20px;
height: 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
border: none;
}
.table-striped .datepicker table tr td,
.table-striped .datepicker table tr th {
background-color: transparent;
}
.datepicker table tr td.day:hover {
background: #eeeeee;
cursor: pointer;
}
.datepicker table tr td.old,
.datepicker table tr td.new {
color: #999999;
}
.datepicker table tr td.disabled,
.datepicker table tr td.disabled:hover {
background: none;
color: #999999;
cursor: default;
}
.datepicker table tr td.today,
.datepicker table tr td.today:hover,
.datepicker table tr td.today.disabled,
.datepicker table tr td.today.disabled:hover {
background-color: #fde19a;
background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
background-image: linear-gradient(top, #fdd49a, #fdf59a);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
border-color: #fdf59a #fdf59a #fbed50;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
color: #000;
}
.datepicker table tr td.today:hover,
.datepicker table tr td.today:hover:hover,
.datepicker table tr td.today.disabled:hover,
.datepicker table tr td.today.disabled:hover:hover,
.datepicker table tr td.today:active,
.datepicker table tr td.today:hover:active,
.datepicker table tr td.today.disabled:active,
.datepicker table tr td.today.disabled:hover:active,
.datepicker table tr td.today.active,
.datepicker table tr td.today:hover.active,
.datepicker table tr td.today.disabled.active,
.datepicker table tr td.today.disabled:hover.active,
.datepicker table tr td.today.disabled,
.datepicker table tr td.today:hover.disabled,
.datepicker table tr td.today.disabled.disabled,
.datepicker table tr td.today.disabled:hover.disabled,
.datepicker table tr td.today[disabled],
.datepicker table tr td.today:hover[disabled],
.datepicker table tr td.today.disabled[disabled],
.datepicker table tr td.today.disabled:hover[disabled] {
background-color: #fdf59a;
}
.datepicker table tr td.today:active,
.datepicker table tr td.today:hover:active,
.datepicker table tr td.today.disabled:active,
.datepicker table tr td.today.disabled:hover:active,
.datepicker table tr td.today.active,
.datepicker table tr td.today:hover.active,
.datepicker table tr td.today.disabled.active,
.datepicker table tr td.today.disabled:hover.active {
background-color: #fbf069 \9;
}
.datepicker table tr td.today:hover:hover {
color: #000;
}
.datepicker table tr td.today.active:hover {
color: #fff;
}
.datepicker table tr td.range,
.datepicker table tr td.range:hover,
.datepicker table tr td.range.disabled,
.datepicker table tr td.range.disabled:hover {
background: #eeeeee;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.datepicker table tr td.range.today,
.datepicker table tr td.range.today:hover,
.datepicker table tr td.range.today.disabled,
.datepicker table tr td.range.today.disabled:hover {
background-color: #f3d17a;
background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a);
background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a));
background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a);
background-image: -o-linear-gradient(top, #f3c17a, #f3e97a);
background-image: linear-gradient(top, #f3c17a, #f3e97a);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0);
border-color: #f3e97a #f3e97a #edde34;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.datepicker table tr td.range.today:hover,
.datepicker table tr td.range.today:hover:hover,
.datepicker table tr td.range.today.disabled:hover,
.datepicker table tr td.range.today.disabled:hover:hover,
.datepicker table tr td.range.today:active,
.datepicker table tr td.range.today:hover:active,
.datepicker table tr td.range.today.disabled:active,
.datepicker table tr td.range.today.disabled:hover:active,
.datepicker table tr td.range.today.active,
.datepicker table tr td.range.today:hover.active,
.datepicker table tr td.range.today.disabled.active,
.datepicker table tr td.range.today.disabled:hover.active,
.datepicker table tr td.range.today.disabled,
.datepicker table tr td.range.today:hover.disabled,
.datepicker table tr td.range.today.disabled.disabled,
.datepicker table tr td.range.today.disabled:hover.disabled,
.datepicker table tr td.range.today[disabled],
.datepicker table tr td.range.today:hover[disabled],
.datepicker table tr td.range.today.disabled[disabled],
.datepicker table tr td.range.today.disabled:hover[disabled] {
background-color: #f3e97a;
}
.datepicker table tr td.range.today:active,
.datepicker table tr td.range.today:hover:active,
.datepicker table tr td.range.today.disabled:active,
.datepicker table tr td.range.today.disabled:hover:active,
.datepicker table tr td.range.today.active,
.datepicker table tr td.range.today:hover.active,
.datepicker table tr td.range.today.disabled.active,
.datepicker table tr td.range.today.disabled:hover.active {
background-color: #efe24b \9;
}
.datepicker table tr td.selected,
.datepicker table tr td.selected:hover,
.datepicker table tr td.selected.disabled,
.datepicker table tr td.selected.disabled:hover {
background-color: #9e9e9e;
background-image: -moz-linear-gradient(top, #b3b3b3, #808080);
background-image: -ms-linear-gradient(top, #b3b3b3, #808080);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080));
background-image: -webkit-linear-gradient(top, #b3b3b3, #808080);
background-image: -o-linear-gradient(top, #b3b3b3, #808080);
background-image: linear-gradient(top, #b3b3b3, #808080);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0);
border-color: #808080 #808080 #595959;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datepicker table tr td.selected:hover,
.datepicker table tr td.selected:hover:hover,
.datepicker table tr td.selected.disabled:hover,
.datepicker table tr td.selected.disabled:hover:hover,
.datepicker table tr td.selected:active,
.datepicker table tr td.selected:hover:active,
.datepicker table tr td.selected.disabled:active,
.datepicker table tr td.selected.disabled:hover:active,
.datepicker table tr td.selected.active,
.datepicker table tr td.selected:hover.active,
.datepicker table tr td.selected.disabled.active,
.datepicker table tr td.selected.disabled:hover.active,
.datepicker table tr td.selected.disabled,
.datepicker table tr td.selected:hover.disabled,
.datepicker table tr td.selected.disabled.disabled,
.datepicker table tr td.selected.disabled:hover.disabled,
.datepicker table tr td.selected[disabled],
.datepicker table tr td.selected:hover[disabled],
.datepicker table tr td.selected.disabled[disabled],
.datepicker table tr td.selected.disabled:hover[disabled] {
background-color: #808080;
}
.datepicker table tr td.selected:active,
.datepicker table tr td.selected:hover:active,
.datepicker table tr td.selected.disabled:active,
.datepicker table tr td.selected.disabled:hover:active,
.datepicker table tr td.selected.active,
.datepicker table tr td.selected:hover.active,
.datepicker table tr td.selected.disabled.active,
.datepicker table tr td.selected.disabled:hover.active {
background-color: #666666 \9;
}
.datepicker table tr td.active,
.datepicker table tr td.active:hover,
.datepicker table tr td.active.disabled,
.datepicker table tr td.active.disabled:hover {
background-color: #006dcc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(top, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datepicker table tr td.active:hover,
.datepicker table tr td.active:hover:hover,
.datepicker table tr td.active.disabled:hover,
.datepicker table tr td.active.disabled:hover:hover,
.datepicker table tr td.active:active,
.datepicker table tr td.active:hover:active,
.datepicker table tr td.active.disabled:active,
.datepicker table tr td.active.disabled:hover:active,
.datepicker table tr td.active.active,
.datepicker table tr td.active:hover.active,
.datepicker table tr td.active.disabled.active,
.datepicker table tr td.active.disabled:hover.active,
.datepicker table tr td.active.disabled,
.datepicker table tr td.active:hover.disabled,
.datepicker table tr td.active.disabled.disabled,
.datepicker table tr td.active.disabled:hover.disabled,
.datepicker table tr td.active[disabled],
.datepicker table tr td.active:hover[disabled],
.datepicker table tr td.active.disabled[disabled],
.datepicker table tr td.active.disabled:hover[disabled] {
background-color: #0044cc;
}
.datepicker table tr td.active:active,
.datepicker table tr td.active:hover:active,
.datepicker table tr td.active.disabled:active,
.datepicker table tr td.active.disabled:hover:active,
.datepicker table tr td.active.active,
.datepicker table tr td.active:hover.active,
.datepicker table tr td.active.disabled.active,
.datepicker table tr td.active.disabled:hover.active {
background-color: #003399 \9;
}
.datepicker table tr td span {
display: block;
width: 23%;
height: 54px;
line-height: 54px;
float: left;
margin: 1%;
cursor: pointer;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.datepicker table tr td span:hover {
background: #eeeeee;
}
.datepicker table tr td span.disabled,
.datepicker table tr td span.disabled:hover {
background: none;
color: #999999;
cursor: default;
}
.datepicker table tr td span.active,
.datepicker table tr td span.active:hover,
.datepicker table tr td span.active.disabled,
.datepicker table tr td span.active.disabled:hover {
background-color: #006dcc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(top, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datepicker table tr td span.active:hover,
.datepicker table tr td span.active:hover:hover,
.datepicker table tr td span.active.disabled:hover,
.datepicker table tr td span.active.disabled:hover:hover,
.datepicker table tr td span.active:active,
.datepicker table tr td span.active:hover:active,
.datepicker table tr td span.active.disabled:active,
.datepicker table tr td span.active.disabled:hover:active,
.datepicker table tr td span.active.active,
.datepicker table tr td span.active:hover.active,
.datepicker table tr td span.active.disabled.active,
.datepicker table tr td span.active.disabled:hover.active,
.datepicker table tr td span.active.disabled,
.datepicker table tr td span.active:hover.disabled,
.datepicker table tr td span.active.disabled.disabled,
.datepicker table tr td span.active.disabled:hover.disabled,
.datepicker table tr td span.active[disabled],
.datepicker table tr td span.active:hover[disabled],
.datepicker table tr td span.active.disabled[disabled],
.datepicker table tr td span.active.disabled:hover[disabled] {
background-color: #0044cc;
}
.datepicker table tr td span.active:active,
.datepicker table tr td span.active:hover:active,
.datepicker table tr td span.active.disabled:active,
.datepicker table tr td span.active.disabled:hover:active,
.datepicker table tr td span.active.active,
.datepicker table tr td span.active:hover.active,
.datepicker table tr td span.active.disabled.active,
.datepicker table tr td span.active.disabled:hover.active {
background-color: #003399 \9;
}
.datepicker table tr td span.old,
.datepicker table tr td span.new {
color: #999999;
}
.datepicker th.datepicker-switch {
width: 145px;
}
.datepicker thead tr:first-child th,
.datepicker tfoot tr th {
cursor: pointer;
}
.datepicker thead tr:first-child th:hover,
.datepicker tfoot tr th:hover {
background: #eeeeee;
}
.datepicker .cw {
font-size: 10px;
width: 12px;
padding: 0 2px 0 5px;
vertical-align: middle;
}
.datepicker thead tr:first-child th.cw {
cursor: default;
background-color: transparent;
}
.input-append.date .add-on i,
.input-prepend.date .add-on i {
display: block;
cursor: pointer;
width: 16px;
height: 16px;
}
.input-daterange input {
text-align: center;
}
.input-daterange input:first-child {
-webkit-border-radius: 3px 0 0 3px;
-moz-border-radius: 3px 0 0 3px;
border-radius: 3px 0 0 3px;
}
.input-daterange input:last-child {
-webkit-border-radius: 0 3px 3px 0;
-moz-border-radius: 0 3px 3px 0;
border-radius: 0 3px 3px 0;
}
.input-daterange .add-on {
display: inline-block;
width: auto;
min-width: 16px;
height: 18px;
padding: 4px 5px;
font-weight: normal;
line-height: 18px;
text-align: center;
text-shadow: 0 1px 0 #ffffff;
vertical-align: middle;
background-color: #eeeeee;
border: 1px solid #ccc;
margin-left: -5px;
margin-right: -5px;
}

@ -49,7 +49,7 @@
<i class="fw fw-edit fw-stack-1x fw-inverse"></i> <i class="fw fw-edit fw-stack-1x fw-inverse"></i>
</span> </span>
</span> </span>
Change Password Change password is not a option
</h4> </h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i
class="fw fw-cancel"></i></button> class="fw fw-cancel"></i></button>
@ -70,10 +70,10 @@
<br><br> <br><br>
<div> <div>
<input id="new-password" type="password" autocomplete="off" class="form-control modal-input" <input id="new-password" type="password" autocomplete="off" class="form-control modal-input"
placeholder="[ Your password should be 5 characters or more and should not include any white spaces ]"/> placeholder="[ Password should be in minimum 5 characters long and should not include any whitespaces ]"/>
</div> </div>
<br><br> <br><br>
Confirm your new password * Reconfirm your new password *
<br><br> <br><br>
<div> <div>
<input id="retyped-new-password" type="password" autocomplete="off" class="form-control modal-input"/> <input id="retyped-new-password" type="password" autocomplete="off" class="form-control modal-input"/>
@ -109,7 +109,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<div class="buttons"> <div class="buttons">
<a href="{{@app.context}}/uuf/logout" id="change-password-success-link" class="btn-operations">Ok</a> <a href="#" id="change-password-success-link" class="btn-operations">Ok</a>
</div> </div>
</div> </div>
</div> </div>

@ -6610,11 +6610,4 @@ header.header-default {
.tooltip-overflow-fix{ .tooltip-overflow-fix{
overflow: visible !important; overflow: visible !important;
.editable-input select{
height: 35px !important;
}
.editable-submit, .editable-cancel{
padding: 8px 15px !important;
line-height: 0px !important;
} }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -21,16 +21,18 @@ package org.wso2.carbon.policy.mgt.core.task;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.policy.PolicyConfiguration;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.ntask.core.Task; import org.wso2.carbon.ntask.core.Task;
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder;
import org.wso2.carbon.policy.mgt.core.mgt.MonitoringManager; import org.wso2.carbon.policy.mgt.core.mgt.MonitoringManager;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -59,69 +61,94 @@ public class MonitoringTask implements Task {
log.debug("Monitoring task started to run."); log.debug("Monitoring task started to run.");
} }
MonitoringManager monitoringManager = PolicyManagementDataHolder.getInstance().getMonitoringManager();
List<String> deviceTypes = new ArrayList<>();
List<String> configDeviceTypes = new ArrayList<>();
try { try {
deviceTypes = monitoringManager.getDeviceTypes();
for (String deviceType : deviceTypes) { PolicyManagementDataHolder.getInstance().
if (isPlatformExist(deviceType)) { getRealmService().getTenantManager().getAllTenants();
configDeviceTypes.add(deviceType); DeviceManagementProviderService deviceManagementService = new DeviceManagementProviderServiceImpl();
} List<Integer> tenants = deviceManagementService.getDeviceEnrolledTenants();
}
} catch (PolicyComplianceException e) { for (Integer tenant : tenants) {
log.error("Error occurred while getting the device types."); String tenantDomain = PolicyManagementDataHolder.getInstance().
} getRealmService().getTenantManager().getDomain(tenant);
if (!deviceTypes.isEmpty()) { try {
try { PrivilegedCarbonContext.startTenantFlow();
DeviceManagementProviderService deviceManagementProviderService = PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain);
PolicyManagementDataHolder.getInstance().getDeviceManagementService(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenant);
for (String deviceType : configDeviceTypes) {
if (log.isDebugEnabled()) { MonitoringManager monitoringManager = PolicyManagementDataHolder.getInstance().getMonitoringManager();
log.debug("Running task for device type : " + deviceType); List<String> deviceTypes = new ArrayList<>();
} List<String> configDeviceTypes = new ArrayList<>();
PolicyMonitoringManager monitoringService = try {
PolicyManagementDataHolder.getInstance().getDeviceManagementService() deviceTypes = monitoringManager.getDeviceTypes();
.getPolicyMonitoringManager(deviceType); for (String deviceType : deviceTypes) {
List<Device> devices = deviceManagementProviderService.getAllDevices(deviceType); if (isPlatformExist(deviceType)) {
if (monitoringService != null && !devices.isEmpty()) { configDeviceTypes.add(deviceType);
List<Device> notifiableDevices = new ArrayList<>();
if (log.isDebugEnabled()) {
log.debug("Removing inactive and blocked devices from the list for the device type : " +
deviceType);
}
for (Device device : devices) {
EnrolmentInfo.Status status = device.getEnrolmentInfo().getStatus();
if (status.equals(EnrolmentInfo.Status.BLOCKED) ||
status.equals(EnrolmentInfo.Status.REMOVED) ||
status.equals(EnrolmentInfo.Status.UNCLAIMED) ||
status.equals(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED) ||
status.equals(EnrolmentInfo.Status.SUSPENDED)) {
continue;
} else {
notifiableDevices.add(device);
} }
} }
if (log.isDebugEnabled()) { } catch (PolicyComplianceException e) {
log.debug("Following devices selected to send the notification for " + deviceType); log.error("Error occurred while getting the device types.");
for (Device device : notifiableDevices) { }
log.debug(device.getDeviceIdentifier()); if (!deviceTypes.isEmpty()) {
try {
DeviceManagementProviderService deviceManagementProviderService =
PolicyManagementDataHolder.getInstance().getDeviceManagementService();
for (String deviceType : configDeviceTypes) {
if (log.isDebugEnabled()) {
log.debug("Running task for device type : " + deviceType);
}
PolicyMonitoringManager monitoringService =
PolicyManagementDataHolder.getInstance().getDeviceManagementService()
.getPolicyMonitoringManager(deviceType);
List<Device> devices = deviceManagementProviderService.getAllDevices(deviceType);
if (monitoringService != null && !devices.isEmpty()) {
List<Device> notifiableDevices = new ArrayList<>();
if (log.isDebugEnabled()) {
log.debug("Removing inactive and blocked devices from the list for the device type : " +
deviceType);
}
for (Device device : devices) {
EnrolmentInfo.Status status = device.getEnrolmentInfo().getStatus();
if (status.equals(EnrolmentInfo.Status.BLOCKED) ||
status.equals(EnrolmentInfo.Status.REMOVED) ||
status.equals(EnrolmentInfo.Status.UNCLAIMED) ||
status.equals(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED) ||
status.equals(EnrolmentInfo.Status.SUSPENDED)) {
continue;
} else {
notifiableDevices.add(device);
}
}
if (log.isDebugEnabled()) {
log.debug("Following devices selected to send the notification for " + deviceType);
for (Device device : notifiableDevices) {
log.debug(device.getDeviceIdentifier());
}
}
if (!notifiableDevices.isEmpty()) {
monitoringManager.addMonitoringOperation(notifiableDevices);
}
}
} }
if (log.isDebugEnabled()) {
log.debug("Monitoring task running completed.");
}
} catch (Exception e) {
log.error("Error occurred while trying to run a task.", e);
} }
if (!notifiableDevices.isEmpty()) { } else {
monitoringManager.addMonitoringOperation(notifiableDevices); log.info("No device types registered currently. So did not run the monitoring task.");
}
} }
} finally {
PrivilegedCarbonContext.endTenantFlow();
} }
if (log.isDebugEnabled()) {
log.debug("Monitoring task running completed.");
}
} catch (Exception e) {
log.error("Error occurred while trying to run a task.", e);
} }
} else {
log.info("No device types registered currently. So did not run the monitoring task."); } catch (UserStoreException e) {
log.error("Error occurred while trying to get the available tenants", e);
} catch (DeviceManagementException e) {
log.error("Error occurred while trying to get the available tenants from device manager service ", e);
} }
} }

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

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

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

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

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

@ -17,17 +17,18 @@
~ under the License. ~ under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId> <artifactId>apimgt-extensions-feature</artifactId>
<version>2.0.36-SNAPSHOT</version> <version>2.0.16-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client.feature</artifactId> <artifactId>org.wso2.carbon.apimgt.integration.client.feature</artifactId>
<version>2.0.36-SNAPSHOT</version> <version>2.0.16-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - APIM Integration Client Feature</name> <name>WSO2 Carbon - APIM Integration Client Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

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

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

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

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

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

Loading…
Cancel
Save