Merge pull request 'Modify operation template' (#322) from thameera/device-mgt-core:master into master

Reviewed-on: community/device-mgt-core#322
groupoperationslogfix
Pahansith Gunathilake 10 months ago
commit 53c6fa86bc

@ -65,7 +65,7 @@ public class OperationTemplateCacheLoader extends CacheLoader<String, OperationT
}
try {
ConnectionManagerUtils.openDBConnection();
return operationTemplateDAO.getOperationTemplate(subTypeId, deviceType, operationCode);
return operationTemplateDAO.getOperationTemplate(deviceType, subTypeId, operationCode);
} catch (DBConnectionException e) {
String msg =
"Error occurred while obtaining the database connection to retrieve operation template for "

@ -0,0 +1,92 @@
/*
* Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package io.entgra.device.mgt.core.operation.template.cache;
import com.google.common.cache.CacheLoader;
import io.entgra.device.mgt.core.operation.template.dao.OperationTemplateDAO;
import io.entgra.device.mgt.core.operation.template.dao.OperationTemplateDAOFactory;
import io.entgra.device.mgt.core.operation.template.dao.impl.util.OperationTemplateManagementUtil;
import io.entgra.device.mgt.core.operation.template.dto.OperationTemplateCacheKey;
import io.entgra.device.mgt.core.operation.template.exception.DBConnectionException;
import io.entgra.device.mgt.core.operation.template.exception.OperationTemplateManagementDAOException;
import io.entgra.device.mgt.core.operation.template.exception.OperationTemplateMgtPluginException;
import io.entgra.device.mgt.core.operation.template.util.ConnectionManagerUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.Set;
/**
* Class for the Operation Template cache.
*/
public class OperationTemplateCodesCacheLoader extends CacheLoader<String, Set<String>> {
private static final Log log = LogFactory.getLog(OperationTemplateCodesCacheLoader.class);
private final OperationTemplateDAO operationTemplateDAO;
public OperationTemplateCodesCacheLoader() {
this.operationTemplateDAO = OperationTemplateDAOFactory.getOperationTemplateDAO();
}
/**
*
* @param key the non-null key whose value should be loaded
* @return
* @throws OperationTemplateMgtPluginException
*/
@Override
public Set<String> load(String key) throws OperationTemplateMgtPluginException {
OperationTemplateCacheKey operationTemplateCacheKey = OperationTemplateManagementUtil.getOperationTemplateCodeCacheKey(
key);
String subTypeId = operationTemplateCacheKey.getSubTypeId();
String deviceType = operationTemplateCacheKey.getDeviceType();
if (log.isTraceEnabled()) {
log.trace(
"Loading operation template for subtype Id : " + subTypeId + " & deviceType : " + deviceType);
}
try {
ConnectionManagerUtils.openDBConnection();
return operationTemplateDAO.getOperationTemplateCodes(deviceType, subTypeId);
} catch (DBConnectionException e) {
String msg =
"Error occurred while obtaining the database connection to retrieve operation template codes for "
+
"subtype Id : " + subTypeId + " & device type : " + deviceType;
log.error(msg);
throw new OperationTemplateMgtPluginException(msg, e);
} catch (InvalidCacheLoadException e) {
String msg =
"CacheLoader returned null for operation template codes for subtype Id : " + subTypeId
+ " & device type : " + deviceType;
log.error(msg, e);
return null;
} catch (OperationTemplateManagementDAOException e) {
String msg =
"Error occurred in the database level while retrieving operation template codes for subtype Id : "
+ subTypeId + " & device type : " + deviceType;
log.error(msg);
throw new OperationTemplateMgtPluginException(msg, e);
} finally {
ConnectionManagerUtils.closeDBConnection();
}
}
}

@ -21,6 +21,9 @@ package io.entgra.device.mgt.core.operation.template.dao;
import io.entgra.device.mgt.core.operation.template.dto.OperationTemplate;
import io.entgra.device.mgt.core.operation.template.exception.OperationTemplateManagementDAOException;
import java.util.List;
import java.util.Set;
/**
* This class represents the key operations associated with persisting mobile-device related
* information.
@ -31,8 +34,11 @@ public interface OperationTemplateDAO {
OperationTemplate updateOperationTemplate(OperationTemplate operationTemplate)
throws OperationTemplateManagementDAOException;
OperationTemplate getOperationTemplate(String subTypeId, String deviceType, String operationCode) throws OperationTemplateManagementDAOException;
OperationTemplate getOperationTemplate(String deviceType, String subTypeId, String operationCode) throws OperationTemplateManagementDAOException;
List<OperationTemplate> getAllOperationTemplates(String deviceType) throws OperationTemplateManagementDAOException;
void deleteOperationTemplate(String subTypeId, String deviceCode, String operationCode) throws OperationTemplateManagementDAOException;
boolean deleteOperationTemplate(String deviceType, String subTypeId, String operationCode) throws OperationTemplateManagementDAOException;
Set<String> getOperationTemplateCodes(String deviceType, String subTypeId) throws OperationTemplateManagementDAOException;
}

@ -31,6 +31,10 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -102,7 +106,7 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
stmt.setString(5, operationTemplate.getCode());
stmt.executeUpdate();
return getOperationTemplate(operationTemplate.getSubTypeId(), operationTemplate.getDeviceType(), operationTemplate.getCode());
return getOperationTemplate(operationTemplate.getDeviceType(), operationTemplate.getSubTypeId(), operationTemplate.getCode());
} catch (SQLException e) {
String msg = "Error occurred while processing update operation template.";
log.error(msg);
@ -122,14 +126,14 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
* @throws OperationTemplateManagementDAOException
*/
@Override
public OperationTemplate getOperationTemplate(String subTypeId, String deviceType, String operationCode)
public OperationTemplate getOperationTemplate(String deviceType, String subTypeId, String operationCode)
throws OperationTemplateManagementDAOException {
try {
String sql = "SELECT * FROM SUB_OPERATION_TEMPLATE WHERE SUB_TYPE_ID = ? AND DEVICE_TYPE = ? AND OPERATION_CODE = ?";
String sql = "SELECT * FROM SUB_OPERATION_TEMPLATE WHERE DEVICE_TYPE = ? AND SUB_TYPE_ID = ? AND OPERATION_CODE = ?";
Connection conn = ConnectionManagerUtils.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, subTypeId);
stmt.setString(2, deviceType);
stmt.setString(1, deviceType);
stmt.setString(2, subTypeId);
stmt.setString(3, operationCode);
try (ResultSet rs = stmt.executeQuery()) {
@ -151,22 +155,94 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
}
/**
* @param subTypeId
* @param deviceType
* @param operationCode
* @param subTypeId
* @return
* @throws OperationTemplateManagementDAOException
*/
@Override
public void deleteOperationTemplate(String subTypeId, String deviceType, String operationCode)
public Set<String> getOperationTemplateCodes(String deviceType, String subTypeId)
throws OperationTemplateManagementDAOException {
String sql = "DELETE FROM SUB_OPERATION_TEMPLATE WHERE SUB_TYPE_ID = ? AND DEVICE_TYPE = ? AND OPERATION_CODE = ?";
try {
String sql = "SELECT OPERATION_CODE FROM SUB_OPERATION_TEMPLATE WHERE SUB_TYPE_ID = ? AND DEVICE_TYPE = ?";
Connection conn = ConnectionManagerUtils.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, subTypeId);
stmt.setString(2, deviceType);
Set<String> deviceTypes = new HashSet<>();
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
deviceTypes.add(rs.getString("OPERATION_CODE"));
}
return deviceTypes;
}
} catch (SQLException e) {
String msg = "Error occurred while getting operation template codes for sub type id : " + subTypeId
+ " and device type : " + deviceType;
log.error(msg, e);
throw new OperationTemplateManagementDAOException(msg, e);
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining DB connection to getting operation template codes.";
log.error(msg);
throw new OperationTemplateManagementDAOException(msg, e);
}
}
/**
* @param deviceType
* @return
* @throws OperationTemplateManagementDAOException
*/
@Override
public List<OperationTemplate> getAllOperationTemplates(String deviceType)
throws OperationTemplateManagementDAOException {
try {
String sql = "SELECT * FROM SUB_OPERATION_TEMPLATE WHERE DEVICE_TYPE = ?";
List<OperationTemplate> operationTemplates = new ArrayList<>();
Connection conn = ConnectionManagerUtils.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, deviceType);
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
operationTemplates.add(DAOUtil.loadOperationTemplate(rs));
}
return operationTemplates;
}
} catch (SQLException e) {
String msg = "Error occurred while loading operation template list.";
log.error(e.getMessage());
throw new OperationTemplateManagementDAOException(msg, e);
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining DB connection to loading operation template list.";
log.error(msg);
throw new OperationTemplateManagementDAOException(msg, e);
}
}
/**
* @param subTypeId
* @param deviceType
* @param operationCode
* @throws OperationTemplateManagementDAOException
*/
@Override
public boolean deleteOperationTemplate(String deviceType, String subTypeId, String operationCode)
throws OperationTemplateManagementDAOException {
String sql = "DELETE FROM SUB_OPERATION_TEMPLATE WHERE DEVICE_TYPE = ? AND SUB_TYPE_ID = ? AND OPERATION_CODE = ?";
try {
Connection conn = ConnectionManagerUtils.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, deviceType);
stmt.setString(2, subTypeId);
stmt.setString(3, operationCode);
stmt.executeUpdate();
return stmt.executeUpdate() == 1;
} catch (SQLException e) {
String msg = "Error occurred while deleting operation template for sub type id : " + subTypeId
+ " and operation code : " + operationCode;

@ -59,8 +59,18 @@ public class OperationTemplateManagementUtil {
* @param operationCode
* @return
*/
public static String setOperationTemplateCacheKey(String subTypeId, String deviceType, String operationCode) {
return subTypeId + "|" + deviceType + "|" + operationCode;
public static String setOperationTemplateCacheKey(String deviceType, String subTypeId, String operationCode) {
return deviceType + "|" + subTypeId + "|" + operationCode;
}
/**
*
* @param subTypeId
* @param deviceType
* @return
*/
public static String setOperationTemplateCacheKey(String deviceType, String subTypeId) {
return deviceType + "|" + subTypeId;
}
/**
@ -70,8 +80,8 @@ public class OperationTemplateManagementUtil {
*/
public static OperationTemplateCacheKey getOperationTemplateCacheKey(String key) {
String[] keys = key.split("\\|");
String subTypeId = keys[0];;
String deviceType = keys[1];
String deviceType = keys[0];;
String subTypeId = keys[1];
String operationCode = keys[2];
OperationTemplateCacheKey operationTemplateCacheKey = new OperationTemplateCacheKey();
@ -82,4 +92,22 @@ public class OperationTemplateManagementUtil {
return operationTemplateCacheKey;
}
/**
*
* @param key
* @return
*/
public static OperationTemplateCacheKey getOperationTemplateCodeCacheKey(String key) {
String[] keys = key.split("\\|");
String deviceType = keys[0];;
String subTypeId = keys[1];
OperationTemplateCacheKey operationTemplateCacheKey = new OperationTemplateCacheKey();
operationTemplateCacheKey.setSubTypeId(subTypeId);
operationTemplateCacheKey.setDeviceType(deviceType);
return operationTemplateCacheKey;
}
}

@ -22,6 +22,7 @@ import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import io.entgra.device.mgt.core.operation.template.cache.OperationTemplateCacheLoader;
import io.entgra.device.mgt.core.operation.template.cache.OperationTemplateCodesCacheLoader;
import io.entgra.device.mgt.core.operation.template.dao.OperationTemplateDAO;
import io.entgra.device.mgt.core.operation.template.dao.OperationTemplateDAOFactory;
import io.entgra.device.mgt.core.operation.template.dao.impl.util.OperationTemplateManagementUtil;
@ -35,6 +36,9 @@ import io.entgra.device.mgt.core.operation.template.util.AssertUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
@ -46,6 +50,9 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
private static final Log log = LogFactory.getLog(OperationTemplateServiceImpl.class);
private static final LoadingCache<String, OperationTemplate> operationTemplateCache = CacheBuilder.newBuilder()
.expireAfterWrite(15, TimeUnit.MINUTES).build(new OperationTemplateCacheLoader());
private static final LoadingCache<String, Set<String>> operationTemplateCodeCache = CacheBuilder.newBuilder()
.expireAfterWrite(15, TimeUnit.MINUTES).build(new OperationTemplateCodesCacheLoader());
private final OperationTemplateDAO operationTemplateDAO;
public OperationTemplateServiceImpl() {
@ -67,10 +74,6 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
operationTemplateDAO.addOperationTemplate(operationTemplate);
ConnectionManagerUtils.commitDBTransaction();
String key = OperationTemplateManagementUtil.setOperationTemplateCacheKey(
operationTemplate.getSubTypeId(), operationTemplate.getDeviceType(), operationTemplate.getCode());
operationTemplateCache.put(key, operationTemplate);
if (log.isDebugEnabled()) {
String msg = "Operation Template added successfully,for subtype id "
+ operationTemplate.getSubTypeId() + " and operation code "
@ -82,6 +85,61 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
throw new OperationTemplateMgtPluginException(e.getMessage(), e);
} finally {
ConnectionManagerUtils.closeDBConnection();
addOperationTemplateDetailsForCacheLoader(operationTemplate);
}
}
public void addOperationTemplateDetailsForCacheLoader(OperationTemplate operationTemplate) {
try {
String operationTemplateKey = OperationTemplateManagementUtil.setOperationTemplateCacheKey(
operationTemplate.getDeviceType(), operationTemplate.getSubTypeId(), operationTemplate.getCode());
String operationTemplateCodeKey = OperationTemplateManagementUtil.setOperationTemplateCacheKey(
operationTemplate.getDeviceType(), operationTemplate.getSubTypeId());
operationTemplateCache.put(operationTemplateKey, operationTemplate);
Set<String> operationCodeList = operationTemplateCodeCache.get(operationTemplateCodeKey);
if (operationCodeList == null) {
operationCodeList = new HashSet<>();
}
operationCodeList.add(operationTemplate.getCode());
operationTemplateCodeCache.put(operationTemplateCodeKey, operationCodeList);
} catch (Exception e) {
log.error("Error occurred while adding operation template details for the cache loader", e);
}
}
public void deleteOperationTemplateDetailsFromCacheLoader(String deviceType, String subTypeId, String code) {
try {
String operationTemplateKey = OperationTemplateManagementUtil.setOperationTemplateCacheKey(
deviceType, subTypeId, code);
String operationTemplateCodeKey = OperationTemplateManagementUtil.setOperationTemplateCacheKey(
deviceType, subTypeId);
operationTemplateCache.invalidate(operationTemplateKey);
operationTemplateCodeCache.invalidate(operationTemplateCodeKey);
} catch (Exception e) {
log.error("Error occurred removing operation template details for the cache loader", e);
}
}
public void refreshOperationTemplateDetailsFromCacheLoader(OperationTemplate operationTemplate) {
try {
if (operationTemplate != null) {
String operationTemplateKey = OperationTemplateManagementUtil.setOperationTemplateCacheKey(operationTemplate.getDeviceType(),
operationTemplate.getSubTypeId(), operationTemplate.getCode());
String operationTemplateCodeKey = OperationTemplateManagementUtil.setOperationTemplateCacheKey(
operationTemplate.getDeviceType(), operationTemplate.getSubTypeId());
operationTemplateCache.put(operationTemplateKey, operationTemplate);
Set<String> codeList = operationTemplateCodeCache.get(operationTemplateCodeKey);
codeList.remove(operationTemplate.getCode());
operationTemplateCodeCache.put(operationTemplateCodeKey, codeList);
}
} catch (ExecutionException e) {
log.error("Error occurred while updating operation template cache loader");
}
}
@ -102,6 +160,7 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
updatedOperationTemplate = operationTemplateDAO.updateOperationTemplate(
operationTemplate);
ConnectionManagerUtils.commitDBTransaction();
if (log.isDebugEnabled()) {
String msg = "Operation Template updated successfully,for subtype id "
+ operationTemplate.getSubTypeId() + " and operation code " + operationTemplate.getCode()
@ -114,11 +173,8 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
throw new OperationTemplateMgtPluginException(e.getMessage(), e);
} finally {
ConnectionManagerUtils.closeDBConnection();
if (updatedOperationTemplate != null) {
String key = OperationTemplateManagementUtil.setOperationTemplateCacheKey(
operationTemplate.getSubTypeId(), operationTemplate.getDeviceType(), operationTemplate.getCode());
operationTemplateCache.refresh(key);
refreshOperationTemplateDetailsFromCacheLoader(updatedOperationTemplate);
}
}
}
@ -131,12 +187,12 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
* @throws OperationTemplateMgtPluginException
*/
@Override
public OperationTemplate getOperationTemplate(String subTypeId, String deviceType, String operationCode)
public OperationTemplate getOperationTemplate(String deviceType, String subTypeId, String operationCode)
throws OperationTemplateMgtPluginException {
try {
validateGetOperationTemplate(subTypeId, deviceType, operationCode);
String key = OperationTemplateManagementUtil.setOperationTemplateCacheKey(subTypeId, deviceType,
String key = OperationTemplateManagementUtil.setOperationTemplateCacheKey(deviceType, subTypeId,
operationCode);
return operationTemplateCache.get(key);
} catch (ExecutionException e) {
@ -150,6 +206,27 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
}
}
/**
* @param deviceType
* @return
* @throws OperationTemplateMgtPluginException
*/
@Override
public List<OperationTemplate> getAllOperationTemplates(String deviceType)
throws OperationTemplateMgtPluginException {
AssertUtils.hasText(deviceType, "Invalid device type.");
try {
ConnectionManagerUtils.openDBConnection();
return operationTemplateDAO.getAllOperationTemplates(deviceType);
} catch (DBConnectionException | OperationTemplateManagementDAOException e) {
log.error(e.getMessage());
throw new OperationTemplateMgtPluginException(e.getMessage(), e);
} finally {
ConnectionManagerUtils.closeDBConnection();
}
}
/**
* @param subTypeId
* @param deviceType
@ -157,17 +234,18 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
* @throws OperationTemplateMgtPluginException
*/
@Override
public void deleteOperationTemplate(String subTypeId, String deviceType, String operationCode)
public void deleteOperationTemplate(String deviceType, String subTypeId, String operationCode)
throws OperationTemplateMgtPluginException {
String msg = "Operation Template does not exist for subtype id : " + subTypeId
+ " and device type : " + deviceType + " and operation code : "
+ operationCode;
AssertUtils.isNull(getOperationTemplate(subTypeId, deviceType, operationCode), msg);
AssertUtils.isNull(getOperationTemplate(deviceType, subTypeId, operationCode), msg);
boolean isDelete = false;
try {
ConnectionManagerUtils.beginDBTransaction();
operationTemplateDAO.deleteOperationTemplate(subTypeId, deviceType, operationCode);
isDelete = operationTemplateDAO.deleteOperationTemplate(deviceType, subTypeId, operationCode);
ConnectionManagerUtils.commitDBTransaction();
if (log.isDebugEnabled()) {
String debugMsg = "Operation Template deleted successfully,for subtype id "
@ -175,18 +253,46 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
+ operationCode + "";
log.debug(debugMsg);
}
String key = OperationTemplateManagementUtil.setOperationTemplateCacheKey(
subTypeId, deviceType, operationCode);
operationTemplateCache.invalidate(key);
} catch (DBConnectionException | OperationTemplateManagementDAOException e) {
log.error(e.getMessage());
throw new OperationTemplateMgtPluginException(e.getMessage(), e);
} finally {
ConnectionManagerUtils.closeDBConnection();
if (isDelete) {
deleteOperationTemplateDetailsFromCacheLoader(deviceType, subTypeId, operationCode);
}
}
}
/**
* @param deviceType
* @param subTypeId
* @return
* @throws OperationTemplateMgtPluginException
*/
@Override
public Set<String> getOperationTemplateCodes(String deviceType, String subTypeId)
throws OperationTemplateMgtPluginException {
try {
AssertUtils.hasText(subTypeId, "Invalid meter device subtype id: " + subTypeId);
AssertUtils.isTrue(Integer.valueOf(subTypeId)>0, "Invalid meter device subtype id: " + subTypeId);
AssertUtils.hasText(deviceType, "Invalid device type.");
String key = OperationTemplateManagementUtil.setOperationTemplateCacheKey(deviceType, subTypeId);
return operationTemplateCodeCache.get(key);
} catch (ExecutionException e) {
log.error(e.getMessage());
throw new OperationTemplateMgtPluginException(e.getMessage(), e);
} catch (CacheLoader.InvalidCacheLoadException e) {
String msg = "Operation Template codes doesn't exist for subtype id : " + subTypeId + " and device type : "
+ deviceType;
log.error(msg, e);
return null;
}
}
/**
*
* @param subTypeId
@ -216,7 +322,7 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
String msg = "Operation Template already exist for subtype id : " + operationTemplate.getSubTypeId()
+ " and device type : " + operationTemplate.getDeviceType() + " and operation code : "
+ operationTemplate.getCode();
AssertUtils.notNull(getOperationTemplate(operationTemplate.getSubTypeId(), operationTemplate.getDeviceType(),
AssertUtils.notNull(getOperationTemplate(operationTemplate.getDeviceType(), operationTemplate.getSubTypeId(),
operationTemplate.getCode()), msg);
}
@ -232,7 +338,7 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
String msg = "Operation Template does not exist for subtype id : " + operationTemplate.getSubTypeId()
+ " and device type : " + operationTemplate.getDeviceType() + " and operation code : "
+ operationTemplate.getCode();
AssertUtils.isNull(getOperationTemplate(operationTemplate.getSubTypeId(), operationTemplate.getDeviceType(),
AssertUtils.isNull(getOperationTemplate(operationTemplate.getDeviceType(), operationTemplate.getSubTypeId(),
operationTemplate.getCode()), msg);
}

@ -21,6 +21,9 @@ package io.entgra.device.mgt.core.operation.template.spi;
import io.entgra.device.mgt.core.operation.template.dto.OperationTemplate;
import io.entgra.device.mgt.core.operation.template.exception.OperationTemplateMgtPluginException;
import java.util.List;
import java.util.Set;
/**
* Operation Template service interface.
*/
@ -30,8 +33,11 @@ public interface OperationTemplateService {
OperationTemplate updateOperationTemplate(OperationTemplate operationTemplate) throws OperationTemplateMgtPluginException;
OperationTemplate getOperationTemplate(String subTypeId, String deviceType, String operationCode) throws OperationTemplateMgtPluginException;
OperationTemplate getOperationTemplate(String deviceType, String subTypeId, String operationCode) throws OperationTemplateMgtPluginException;
List<OperationTemplate> getAllOperationTemplates(String deviceType) throws OperationTemplateMgtPluginException;
void deleteOperationTemplate(String subTypeId, String deviceType, String operationCode) throws OperationTemplateMgtPluginException;
void deleteOperationTemplate(String deviceType, String subTypeId, String operationCode) throws OperationTemplateMgtPluginException;
Set<String> getOperationTemplateCodes(String deviceType, String subTypeId) throws OperationTemplateMgtPluginException;
}

@ -44,7 +44,6 @@ public class DAOUtil {
public static OperationTemplate loadOperationTemplate(ResultSet rs)
throws SQLException, JsonSyntaxException {
OperationTemplate operationTemplate = new OperationTemplate();
Gson g = new Gson();
operationTemplate.setSubTypeId(rs.getString("SUB_TYPE_ID"));
operationTemplate.setCode(rs.getString("OPERATION_CODE"));
operationTemplate.setDeviceType(rs.getString("DEVICE_TYPE"));

@ -49,7 +49,7 @@ public class DAOTest extends BaseOperationTemplatePluginTest {
ConnectionManagerUtils.openDBConnection();
OperationTemplate operationTemplateActual = operationTemplateDAO.getOperationTemplate(
"4", TestUtils.deviceType, TestUtils.operationCode);
TestUtils.deviceType, "4", TestUtils.operationCode);
ConnectionManagerUtils.closeDBConnection();
Assert.assertNotNull(operationTemplateActual, "Cannot be null");
Assert.assertEquals(operationTemplateActual.getSubTypeId(), "4");
@ -73,7 +73,7 @@ public class DAOTest extends BaseOperationTemplatePluginTest {
ConnectionManagerUtils.commitDBTransaction();
OperationTemplate operationTemplateActual = operationTemplateDAO.getOperationTemplate(
"4", TestUtils.deviceType, TestUtils.operationCode);
TestUtils.deviceType, "4", TestUtils.operationCode);
ConnectionManagerUtils.closeDBConnection();
Assert.assertNotNull(operationTemplateActual, "Cannot be null");
Assert.assertEquals(operationTemplateActual.getSubTypeId(), "4");
@ -87,7 +87,7 @@ public class DAOTest extends BaseOperationTemplatePluginTest {
ConnectionManagerUtils.beginDBTransaction();
OperationTemplate operationTemplate = operationTemplateDAO.getOperationTemplate(
"4", TestUtils.deviceType, TestUtils.operationCode);
TestUtils.deviceType, "4", TestUtils.operationCode);
OperationTemplate operationTemplateActual = operationTemplateDAO.updateOperationTemplate(
operationTemplate);
ConnectionManagerUtils.commitDBTransaction();

@ -29,6 +29,9 @@ import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.List;
import java.util.Set;
public class ServiceTest extends BaseOperationTemplatePluginTest {
private static final Log log = LogFactory.getLog(ServiceTest.class);
@ -43,7 +46,8 @@ public class ServiceTest extends BaseOperationTemplatePluginTest {
@Test(dependsOnMethods = "testAddOperationTemplate")
public void testGetOperationTemplate() throws OperationTemplateMgtPluginException {
OperationTemplate operationTemplateActual = operationTemplateService.getOperationTemplate(TestUtils.subtypeId, TestUtils.deviceType, TestUtils.operationCode);
OperationTemplate operationTemplateActual = operationTemplateService.getOperationTemplate(
TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode);
Assert.assertEquals(operationTemplateActual.getSubTypeId(), operationTemplateActual.getSubTypeId());
Assert.assertEquals(operationTemplateActual.getCode(), TestUtils.operationCode);
Assert.assertEquals(operationTemplateActual.getDeviceType(), TestUtils.deviceType);
@ -59,7 +63,7 @@ public class ServiceTest extends BaseOperationTemplatePluginTest {
operationTemplate.setOperationDefinition(TestUtils.getOperationDefinition(TestUtils.subtypeId, TestUtils.operationCode));
operationTemplateService.addOperationTemplate(operationTemplate);
OperationTemplate operationTemplateActual = operationTemplateService.getOperationTemplate(TestUtils.subtypeId, TestUtils.deviceType, TestUtils.operationCode);
OperationTemplate operationTemplateActual = operationTemplateService.getOperationTemplate(TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode);
Assert.assertNotNull(operationTemplateActual, "Cannot be null");
Assert.assertEquals(operationTemplateActual.getOperationDefinition(), TestUtils.getOperationDefinition(TestUtils.subtypeId, TestUtils.operationCode));
Assert.assertEquals(operationTemplateActual.getSubTypeId(), operationTemplateActual.getSubTypeId());
@ -70,7 +74,7 @@ public class ServiceTest extends BaseOperationTemplatePluginTest {
@Test(dependsOnMethods = "testAddOperationTemplate")
public void testUpdateOperationTemplate() throws OperationTemplateMgtPluginException {
OperationTemplate operationTemplate = operationTemplateService.getOperationTemplate(TestUtils.subtypeId, TestUtils.deviceType, TestUtils.operationCode);
OperationTemplate operationTemplate = operationTemplateService.getOperationTemplate(TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode);
operationTemplate.setOperationDefinition("{}");
OperationTemplate operationTemplateActual = operationTemplateService.updateOperationTemplate(operationTemplate);
@ -81,13 +85,30 @@ public class ServiceTest extends BaseOperationTemplatePluginTest {
Assert.assertEquals(operationTemplateActual.getDeviceType(), TestUtils.deviceType);
}
@Test(dependsOnMethods = {"testAddOperationTemplate", "testGetOperationTemplate", "testUpdateOperationTemplate"})
public void testDeleteOperationTemplate() throws OperationTemplateMgtPluginException {
operationTemplateService.deleteOperationTemplate(TestUtils.subtypeId, TestUtils.deviceType, TestUtils.operationCode);
Assert.assertNull(getOperationTemplateBySubtypeIdAndDeviceTypeAndOperationCode(TestUtils.subtypeId, TestUtils.deviceType, TestUtils.operationCode));
public OperationTemplate getOperationTemplateBySubtypeIdAndDeviceTypeAndOperationCode(String deviceType, String subtypeId, String operationCode) throws OperationTemplateMgtPluginException {
return operationTemplateService.getOperationTemplate(deviceType, subtypeId, operationCode);
}
@Test(dependsOnMethods = "testAddOperationTemplate")
public void testGetOperationTemplateCodesByDeviceTypeAndSubTypeId() throws OperationTemplateMgtPluginException {
Set<String> operationCodes = operationTemplateService.getOperationTemplateCodes(TestUtils.deviceType, TestUtils.subtypeId);
Assert.assertNotNull(operationCodes, "Cannot be null");
}
@Test(dependsOnMethods = "testAddOperationTemplate")
public void testGetAllOperationTemplatesByDeviceType() throws OperationTemplateMgtPluginException {
List<OperationTemplate> operationTemplates = operationTemplateService.getAllOperationTemplates(TestUtils.deviceType);
Assert.assertNotNull(operationTemplates, "Cannot be null");
Assert.assertFalse(operationTemplates.isEmpty(), "operationTemplates is empty");
}
public OperationTemplate getOperationTemplateBySubtypeIdAndDeviceTypeAndOperationCode(String subtypeId, String deviceType, String operationCode) throws OperationTemplateMgtPluginException {
return operationTemplateService.getOperationTemplate(subtypeId, deviceType, operationCode);
@Test(dependsOnMethods = {"testAddOperationTemplate", "testGetOperationTemplate", "testUpdateOperationTemplate",
"testGetOperationTemplateCodesByDeviceTypeAndSubTypeId", "testGetAllOperationTemplatesByDeviceType"})
public void testDeleteOperationTemplate() throws OperationTemplateMgtPluginException {
operationTemplateService.deleteOperationTemplate(TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode);
Assert.assertNull(getOperationTemplateBySubtypeIdAndDeviceTypeAndOperationCode(TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode));
}
}

@ -18,12 +18,12 @@
package io.entgra.device.mgt.core.subtype.mgt.dao.impl;
import io.entgra.device.mgt.core.subtype.mgt.exception.DBConnectionException;
import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtDAOException;
import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAO;
import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil;
import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType;
import io.entgra.device.mgt.core.subtype.mgt.dao.util.DAOUtil;
import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType;
import io.entgra.device.mgt.core.subtype.mgt.exception.DBConnectionException;
import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtDAOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -101,7 +101,9 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO {
public DeviceSubType getDeviceSubType(String subTypeId, int tenantId, String deviceType)
throws SubTypeMgtDAOException {
try {
String sql = "SELECT * FROM DM_DEVICE_SUB_TYPE WHERE SUB_TYPE_ID = ? AND TENANT_ID = ? AND DEVICE_TYPE = ?";
String sql = "SELECT s.*, o.OPERATION_CODE FROM DM_DEVICE_SUB_TYPE s " +
"LEFT JOIN SUB_OPERATION_TEMPLATE o on s.SUB_TYPE_ID = o.SUB_TYPE_ID " +
"WHERE s.SUB_TYPE_ID = ? AND s.TENANT_ID = ? AND s.DEVICE_TYPE = ?";
Connection conn = ConnectionManagerUtil.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
@ -109,10 +111,8 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO {
stmt.setInt(2, tenantId);
stmt.setString(3, deviceType);
try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
return DAOUtil.loadDeviceSubType(rs);
}
return null;
List<DeviceSubType> deviceSubTypes = DAOUtil.loadDeviceSubTypes(rs);
return (deviceSubTypes != null && !deviceSubTypes.isEmpty()) ? deviceSubTypes.get(0) : null;
}
}
@ -133,18 +133,20 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO {
public List<DeviceSubType> getAllDeviceSubTypes(int tenantId, String deviceType)
throws SubTypeMgtDAOException {
try {
String sql = "SELECT * FROM DM_DEVICE_SUB_TYPE WHERE TENANT_ID = ? AND DEVICE_TYPE = ? ORDER BY " +
"SUB_TYPE_ID";
String sql = "SELECT s.*, o.OPERATION_CODE FROM DM_DEVICE_SUB_TYPE s " +
"LEFT JOIN SUB_OPERATION_TEMPLATE o on s.SUB_TYPE_ID = o.SUB_TYPE_ID AND s.DEVICE_TYPE = o.DEVICE_TYPE " +
"WHERE s.TENANT_ID = ? AND s.DEVICE_TYPE = ? ORDER BY " +
"s.SUB_TYPE_ID";
Connection conn = ConnectionManagerUtil.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setInt(1, tenantId);
stmt.setString(2, deviceType);
try (ResultSet rs = stmt.executeQuery()) {
return DAOUtil.loadDeviceSubTypes(rs);
List<DeviceSubType> deviceSubTypes = DAOUtil.loadDeviceSubTypes(rs);
return deviceSubTypes;
}
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining DB connection to retrieve all device sub types for " +
deviceType + " subtypes";

@ -20,11 +20,12 @@ package io.entgra.device.mgt.core.subtype.mgt.dao.util;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class DAOUtil {
@ -49,10 +50,35 @@ public class DAOUtil {
}
public static List<DeviceSubType> loadDeviceSubTypes(ResultSet rs) throws SQLException {
List<DeviceSubType> deviceSubTypes = new ArrayList<>();
while (rs.next()) {
deviceSubTypes.add(loadDeviceSubType(rs));
try {
Map<String, DeviceSubType> deviceSubTypes = new LinkedHashMap<>();
DeviceSubType deviceSubType = new DeviceSubType() {
@Override
public <T> DeviceSubType convertToDeviceSubType() {
return null;
}
@Override
public String parseSubTypeToJson() throws JsonProcessingException {
return null;
}
};
while (rs.next()) {
String currentSubTypeId = rs.getString("SUB_TYPE_ID");
String deviceType = rs.getString("DEVICE_TYPE");
String operationCode = rs.getString("OPERATION_CODE");
String key = deviceType + "|" + currentSubTypeId;
if (!deviceSubTypes.containsKey(key)) {
deviceSubType = loadDeviceSubType(rs);
}
if (operationCode != null) {
deviceSubType.addOperationCode(operationCode);
}
deviceSubTypes.put(key, deviceSubType);
}
return new ArrayList<>(deviceSubTypes.values());
} catch (Exception e) {
return null;
}
return deviceSubTypes;
}
}

@ -21,6 +21,9 @@ package io.entgra.device.mgt.core.subtype.mgt.dto;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.HashSet;
import java.util.Set;
public abstract class DeviceSubType {
@ -29,16 +32,22 @@ public abstract class DeviceSubType {
private String deviceType;
private String subTypeName;
private String typeDefinition;
private Set<String> operationCodes = new HashSet<>();
public DeviceSubType() {
}
public DeviceSubType(String subTypeId, int tenantId, String deviceType, String subTypeName, String typeDefinition) {
public DeviceSubType(String subTypeId, int tenantId, String deviceType, String subTypeName, String typeDefinition,
Set<String> operationCodes) {
this.subTypeId = subTypeId;
this.tenantId = tenantId;
this.deviceType = deviceType;
this.subTypeName = subTypeName;
this.typeDefinition = typeDefinition;
if (operationCodes != null || !operationCodes.isEmpty()) {
this.operationCodes.addAll(operationCodes);
}
}
public String getSubTypeId() {
@ -85,4 +94,10 @@ public abstract class DeviceSubType {
public abstract String parseSubTypeToJson() throws JsonProcessingException;
public void addOperationCode(String code) {
operationCodes.add(code);
}
public Set<String> getOperationCodes() {
return operationCodes;
}
}

@ -125,4 +125,19 @@ public class ServiceTest extends BaseDeviceSubTypePluginTest {
int subTypeCount = deviceSubTypeService.getDeviceSubTypeCount(deviceType);
log.info(deviceType + " Device subtypes count: " + subTypeCount);
}
@Test
public void testGetMeterDeviceType() throws SubTypeMgtPluginException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
DeviceSubType subTypeActual = deviceSubTypeService.getDeviceSubType("7", tenantId,
"METER");
Assert.assertNotNull(subTypeActual);
}
@Test
public void testGetAllMeterDeviceTypes() throws SubTypeMgtPluginException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceSubType> subTypeActual = deviceSubTypeService.getAllDeviceSubTypes(tenantId, "METER");
Assert.assertNotNull(subTypeActual);
}
}

@ -26,7 +26,19 @@
`TYPE_DEFINITION` TEXT NOT NULL,
PRIMARY KEY (`SUB_TYPE_ID`,`DEVICE_TYPE`)
);
-- SUB_OPERATION_TEMPLATE TABLE--
CREATE TABLE SUB_OPERATION_TEMPLATE (
SUB_OPERATION_TEMPLATE_ID int NOT NULL AUTO_INCREMENT,
OPERATION_DEFINITION TEXT NOT NULL,
OPERATION_CODE varchar(100) NOT NULL,
SUB_TYPE_ID int NOT NULL,
DEVICE_TYPE VARCHAR(25) NOT NULL,
CREATE_TIMESTAMP timestamp NULL DEFAULT NULL,
UPDATE_TIMESTAMP timestamp NULL DEFAULT NULL,
PRIMARY KEY (SUB_OPERATION_TEMPLATE_ID),
UNIQUE KEY SUB_OPERATION_TEMPLATE (SUB_TYPE_ID,OPERATION_CODE, DEVICE_TYPE),
CONSTRAINT fk_SUB_OPERATION_TEMPLATE_DM_DEVICE_SUB_TYPE FOREIGN KEY (SUB_TYPE_ID, DEVICE_TYPE) REFERENCES DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, DEVICE_TYPE)
);
-- -----------------------------------------------------
-- Sample data for test cases
-- -----------------------------------------------------
@ -35,3 +47,898 @@ INSERT INTO DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, TENANT_ID, DEVICE_TYPE, SUB_TYPE_NA
(3,-1234,'Meter','TestSubType','{"make": "TestSubType", "model": "ATx-Mega SIM800", "subTypeId": 3, "hasSMSSupport": true, "hasICMPSupport": true, "socketServerPort": 8071}'),
(4,-1234,'Meter','TestSubType','{"make": "TestSubType", "model": "ATx-Mega SIM800", "subTypeId": 4, "hasSMSSupport": true, "hasICMPSupport": true, "socketServerPort": 8071}');
INSERT INTO DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, TENANT_ID, DEVICE_TYPE, SUB_TYPE_NAME, TYPE_DEFINITION) VALUES (
'5', -1234, 'METER','Microstar - IEC Bulk',
'{
"compatibleComModules": {
"4": {
"subTypeId": 4,
"make": "Microstar",
"model": "IEC-GSM",
"socketServerPort": 5258,
"hasICMPSupport": true,
"hasSMSSupport": false,
"hasNMDSupport":false,
"tenantId": -1234
}
},
"compatibleComModulesIds": [4],
"supportedOperations": [
"BILLING_REGISTERS_RETRIEVE",
"TIME_SYNC",
"SELF_TEST",
"LOAD_PROFILE_RETRIEVE"
],
"defaultRegisters": {
"METER_ID": "1-0:0.0.0()",
"METER_FW_VER": "1-0:0.2.0()",
"TIME": "1-0:0.9.1()",
"DATE": "1-0:0.9.2()"
},
"userClientMapping": {
"0": 0,
"1": 1,
"2": 2
},
"make": "MicroStar",
"model": "IEC Bulk",
"serverAddress": 0,
"defaultClientAddress": 0,
"registerMapping": {
"0.0.0_0": {
"obis": "1-0:0.0.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_71.7.0": {
"obis": "1-1:71.7.0",
"attributeIndex": -1,
"classId": -1,
"scalingOption": "CUSTOM",
"scalar": 1000.0
},
"LP": {
"obis": "P.01",
"attributeIndex": -1,
"classId": -1,
"isProfileRegister": true
},
"LP_3.8.0": {
"obis": "1-1:3.8.0",
"attributeIndex": -1,
"classId": -1
},
"LP_63.7.0": {
"obis": "1-1:73.7.0",
"attributeIndex": -1,
"classId": -1
},
"1.8.2_0": {
"obis": "1-1:1.8.2()",
"attributeIndex": -1,
"classId": -1
},
"2.8.0*01_0": {
"obis": "1-1:2.8.0*1()",
"attributeIndex": -1,
"classId": -1
},
"1.8.2*01_0": {
"obis": "1-1:1.8.2*1()",
"attributeIndex": -1,
"classId": -1
},
"LP_72.7.0": {
"obis": "1-1:72.7.0",
"attributeIndex": -1,
"classId": -1,
"scalingOption": "CUSTOM",
"scalar": 1000.0
},
"2.8.1_0": {
"obis": "1-1:2.8.1()",
"attributeIndex": -1,
"classId": -1
},
"0.9.2_0": {
"obis": "1-0:0.9.2()",
"attributeIndex": -1,
"classId": -1
},
"31.7.0_0": {
"obis": "1-1:31.7.0()",
"attributeIndex": -1,
"classId": -1
},
"2.8.3_0": {
"obis": "1-1:2.8.3()",
"attributeIndex": -1,
"classId": -1
},
"51.7.0_0": {
"obis": "1-1:51.7.0()",
"attributeIndex": -1,
"classId": -1
},
"1.8.0_0": {
"obis": "1-1:1.8.0()",
"attributeIndex": -1,
"classId": -1
},
"10.6.0*01_0": {
"obis": "1-1:10.6.0*1()",
"attributeIndex": -1,
"classId": -1
},
"71.7.0_0": {
"obis": "1-1:71.7.0()",
"attributeIndex": -1,
"classId": -1
},
"2.8.2*01_0": {
"obis": "1-1:2.8.2*1()",
"attributeIndex": -1,
"classId": -1
},
"72.7.0_0": {
"obis": "1-1:72.7.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_9.5.0": {
"obis": "1-1:9.4.0",
"attributeIndex": -1,
"classId": -1
},
"52.7.0_0": {
"obis": "1-1:52.7.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_13.7.0": {
"obis": "1-1:13.7.0",
"attributeIndex": -1,
"classId": -1
},
"LP_31.7.0": {
"obis": "1-1:31.7.0",
"attributeIndex": -1,
"classId": -1,
"scalingOption": "CUSTOM",
"scalar": 1000.0
},
"0.4.3_0": {
"obis": "1-0:0.4.3()",
"attributeIndex": -1,
"classId": -1
},
"0.4.5_0": {
"obis": "1-0:0.4.5()",
"attributeIndex": -1,
"classId": -1
},
"1.8.3*01_0": {
"obis": "1-1:1.8.3*1()",
"attributeIndex": -1,
"classId": -1
},
"32.7.0_0": {
"obis": "1-1:32.7.0()",
"attributeIndex": -1,
"classId": -1
},
"1.8.0*01_0": {
"obis": "1-1:1.8.0*1()",
"attributeIndex": -1,
"classId": -1
},
"LP_32.7.0": {
"obis": "1-1:32.7.0",
"attributeIndex": -1,
"classId": -1,
"scalingOption": "CUSTOM",
"scalar": 1000.0
},
"LP_2.5.0": {
"obis": "1-1:2.4.0",
"attributeIndex": -1,
"classId": -1
},
"10.6.0_0": {
"obis": "1-1:10.6.0()",
"attributeIndex": -1,
"classId": -1
},
"2.8.3*01_0": {
"obis": "1-1:2.8.3*1()",
"attributeIndex": -1,
"classId": -1
},
"1.8.3_0": {
"obis": "1-1:1.8.3()",
"attributeIndex": -1,
"classId": -1
},
"LP_33.7.0": {
"obis": "1-1:33.7.0",
"attributeIndex": -1,
"classId": -1
},
"0.9.1_0": {
"obis": "1-0:0.9.1()",
"attributeIndex": -1,
"classId": -1
},
"2.8.0_0": {
"obis": "1-1:2.8.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_1.5.0": {
"obis": "1-1:1.4.0",
"attributeIndex": -1,
"classId": -1
},
"2.8.2_0": {
"obis": "1-1:2.8.2()",
"attributeIndex": -1,
"classId": -1
},
"1.8.1_0": {
"obis": "1-1:1.8.1()",
"attributeIndex": -1,
"classId": -1
},
"LP_51.7.0": {
"obis": "1-1:51.7.0",
"attributeIndex": -1,
"classId": -1,
"scalingOption": "CUSTOM",
"scalar": 1000.0
},
"LP_43.7.0": {
"obis": "1-1:53.7.0",
"attributeIndex": -1,
"classId": -1
},
"1.8.1*01_0": {
"obis": "1-1:1.8.1*1()",
"attributeIndex": -1,
"classId": -1
},
"9.6.0_0": {
"obis": "1-1:9.6.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_52.7.0": {
"obis": "1-1:52.7.0",
"attributeIndex": -1,
"classId": -1,
"scalingOption": "CUSTOM",
"scalar": 1000.0
},
"14.7.0_0": {
"obis": "1-1:14.7.0()",
"attributeIndex": -1,
"classId": -1
},
"9.6.0*01_0": {
"obis": "1-1:9.6.0*1()",
"attributeIndex": -1,
"classId": -1
},
"LP_1.8.0": {
"obis": "1-1:1.8.0",
"attributeIndex": -1,
"classId": -1
},
"0.4.6_0": {
"obis": "1-0:0.4.6()",
"attributeIndex": -1,
"classId": -1
},
"2.8.1*01_0": {
"obis": "1-1:2.8.1*1()",
"attributeIndex": -1,
"classId": -1
},
"LP_10.5.0": {
"obis": "1-1:10.4.0",
"attributeIndex": -1,
"classId": -1
},
"0.4.2_0": {
"obis": "1-0:0.4.2()",
"attributeIndex": -1,
"classId": -1
},
"LP_15.4.0": {
"obis": "1-1:15.4.0",
"attributeIndex": -1,
"classId": -1
},
"FW_VER": {
"obis": "1-0:0.2.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_2.8.0": {
"obis": "1-1:2.8.0",
"attributeIndex": -1,
"classId": -1
}
},
"transportProtocol": "IEC",
"defaultComModuleId": 4,
"defaultComModule": {
"subTypeId": 4,
"make": "Microstar",
"model": "IEC-GSM",
"socketServerPort": 5258,
"hasICMPSupport": true,
"hasSMSSupport": false,
"hasNMDSupport":false,
"tenantId": -1234
}
}'
);
INSERT INTO DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, TENANT_ID, DEVICE_TYPE, SUB_TYPE_NAME, TYPE_DEFINITION) VALUES (
'6', -1234, 'METER', 'Anteleco - IEC 3Phase',
'{
"compatibleComModules": {
"1": {
"subTypeId": 1,
"make": "AnteLeco",
"model": "ATx-Mega SIM800",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":false,
"tenantId": -1234
},
"8": {
"subTypeId": 8,
"make": "AnteLeco",
"model": "NB-IoT B",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":false,
"tenantId": -1234
},
"10": {
"subTypeId": 10,
"make": "AnteLeco",
"model": "ATx-Mega SIM800 B",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":false,
"tenantId": -1234
}
},
"compatibleComModulesIds": [1,8,10],
"supportedOperations": [
"BILLING_REGISTERS_RETRIEVE",
"REMOTE_RELAY_ON",
"REMOTE_RELAY_OFF",
"TIME_SYNC",
"SELF_TEST",
"LOAD_PROFILE_RETRIEVE"
],
"defaultRegisters": {
"METER_ID": "0.0.96.1.0.255()",
"METER_FW_VER": "1.0.0.2.0.255()",
"TIME": "1.0.0.9.1()",
"DATE": "1.0.0.9.2()"
},
"userClientMapping": {
"0": 0,
"1": 1,
"2": 2
},
"make": "Anteleco",
"model": "IEC 3Phase",
"serverAddress": 0,
"defaultClientAddress": 0,
"registerMapping": {
"0.0.0_0": {
"obis": "0.0.96.1.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_71.7.0": {
"obis": "71.7",
"attributeIndex": -1,
"classId": -1
},
"LP": {
"obis": "P.01",
"attributeIndex": -1,
"classId": -1,
"isProfileRegister": true
},
"CSRQ_RL": {
"obis": "0.0.96.128.1.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_3.8.0": {
"obis": "3.8",
"attributeIndex": -1,
"classId": -1
},
"2.8.3*01_0": {
"obis": "1.0.2.8.3.1()",
"attributeIndex": -1,
"classId": -1
},
"1.8.3_0": {
"obis": "1.0.1.8.3.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_63.7.0": {
"obis": "63.5",
"attributeIndex": -1,
"classId": -1
},
"1.8.2_0": {
"obis": "1.0.1.8.2.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_33.7.0": {
"obis": "33.5",
"attributeIndex": -1,
"classId": -1
},
"0.9.1_0": {
"obis": "1.0.0.9.1()",
"attributeIndex": -1,
"classId": -1
},
"2.8.0*01_0": {
"obis": "1.0.2.8.0.1()",
"attributeIndex": -1,
"classId": -1
},
"2.8.0_0": {
"obis": "1.0.2.8.0.255()",
"attributeIndex": -1,
"classId": -1
},
"1.8.2*01_0": {
"obis": "1.0.1.8.2.1()",
"attributeIndex": -1,
"classId": -1
},
"LP_72.7.0": {
"obis": "72.7",
"attributeIndex": -1,
"classId": -1
},
"LP_1.5.0": {
"obis": "1.5",
"attributeIndex": -1,
"classId": -1
},
"2.8.2_0": {
"obis": "1.0.2.8.2.255()",
"attributeIndex": -1,
"classId": -1
},
"2.8.1_0": {
"obis": "1.0.2.8.1.255()",
"attributeIndex": -1,
"classId": -1
},
"0.9.2_0": {
"obis": "1.0.0.9.2()",
"attributeIndex": -1,
"classId": -1
},
"31.7.0_0": {
"obis": "1.0.31.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"2.8.3_0": {
"obis": "1.0.2.8.3.255()",
"attributeIndex": -1,
"classId": -1
},
"51.7.0_0": {
"obis": "1.0.51.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"1.8.1_0": {
"obis": "1.0.1.8.1.255()",
"attributeIndex": -1,
"classId": -1
},
"1.8.0_0": {
"obis": "1.0.1.8.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_51.7.0": {
"obis": "51.7",
"attributeIndex": -1,
"classId": -1
},
"LP_43.7.0": {
"obis": "43.5",
"attributeIndex": -1,
"classId": -1
},
"71.7.0_0": {
"obis": "1.0.71.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_4.8.0": {
"obis": "4.8",
"attributeIndex": -1,
"classId": -1
},
"1.8.1*01_0": {
"obis": "1.0.1.8.1.1()",
"attributeIndex": -1,
"classId": -1
},
"2.8.2*01_0": {
"obis": "1.0.2.8.2.1()",
"attributeIndex": -1,
"classId": -1
},
"72.7.0_0": {
"obis": "1.0.72.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_52.7.0": {
"obis": "52.7",
"attributeIndex": -1,
"classId": -1
},
"14.7.0_0": {
"obis": "1.0.14.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_9.5.0": {
"obis": "9.5",
"attributeIndex": -1,
"classId": -1
},
"LP_13.5.0": {
"obis": "13.5",
"attributeIndex": -1,
"classId": -1
},
"52.7.0_0": {
"obis": "1.0.52.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_31.7.0": {
"obis": "31.7",
"attributeIndex": -1,
"classId": -1
},
"LP_1.8.0": {
"obis": "1.8",
"attributeIndex": -1,
"classId": -1
},
"1.8.3*01_0": {
"obis": "1.0.1.8.3.1()",
"attributeIndex": -1,
"classId": -1
},
"32.7.0_0": {
"obis": "1.0.32.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"1.8.0*01_0": {
"obis": "1.0.1.8.0.1()",
"attributeIndex": -1,
"classId": -1
},
"2.8.1*01_0": {
"obis": "1.0.2.8.1.1()",
"attributeIndex": -1,
"classId": -1
},
"LP_10.5.0": {
"obis": "10.5",
"attributeIndex": -1,
"classId": -1
},
"LP_32.7.0": {
"obis": "32.7",
"attributeIndex": -1,
"classId": -1
},
"FW_VER": {
"obis": "1.0.0.2.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_2.8.0": {
"obis": "2.8",
"attributeIndex": -1,
"classId": -1
},
"LP_2.5.0": {
"obis": "2.5",
"attributeIndex": -1,
"classId": -1
}
},
"transportProtocol": "IEC",
"defaultComModuleId": 10,
"defaultComModule": {
"subTypeId": 10,
"make": "AnteLeco",
"model": "ATx-Mega SIM800 B",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":false,
"tenantId": -1234
}
}'
);
INSERT INTO DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, TENANT_ID, DEVICE_TYPE, SUB_TYPE_NAME, TYPE_DEFINITION) VALUES (
'7', -1234, 'METER', 'Anteleco - NMD',
'{
"compatibleComModules": {
"5": {
"subTypeId": 5,
"make": "AnteLeco",
"model": "STM32 M65-NMD",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":true,
"tenantId": -1234
},
"9": {
"subTypeId": 9,
"make": "AnteLeco",
"model": "NB-IoT NMD",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":true,
"tenantId": -1234
}
},
"compatibleComModulesIds": [5,9],
"supportedOperations": [
"BILLING_REGISTERS_RETRIEVE",
"STATUS_RETRIEVE",
"TIME_SYNC",
"SELF_TEST",
"LOAD_PROFILE_RETRIEVE"
],
"defaultRegisters": {
"METER_ID": "0.0.96.1.0.255",
"METER_FW_VER": "1.0.0.2.0.255",
"CLOCK": "0.0.1.0.0.255"
},
"userClientMapping": {
"1": 2,
"2": 3,
"3": 4
},
"make": "Anteleco",
"model": "NMD",
"serverAddress": 1,
"defaultClientAddress": 16,
"registerMapping": {
"CO_128.0.12": {
"obis": "1.0.128.0.12.255",
"attributeIndex": 2,
"classId": 1
},
"0.0.0_0": {
"obis": "0.0.96.1.0.255",
"attributeIndex": 2,
"classId": 1
},
"CO_128.0.11": {
"obis": "1.0.128.0.11.255",
"attributeIndex": 2,
"classId": 1
},
"CO_128.32.0": {
"obis": "1.0.128.32.0.255",
"attributeIndex": 2,
"classId": 1
},
"LP": {
"obis": "1.0.99.1.1.255",
"attributeIndex": 2,
"classId": 7,
"isProfileRegister": true
},
"CO_128.36.0": {
"obis": "1.0.128.36.0.255",
"attributeIndex": 2,
"classId": 1
},
"CO_52.7.0": {
"obis": "1.0.52.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_96.50.22": {
"obis": "0.0.96.50.22.255",
"attributeIndex": 2,
"classId": 8
},
"CO_12.26.0": {
"obis": "1.0.12.26.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_96.50.21": {
"obis": "0.0.96.50.21.255",
"attributeIndex": 2,
"classId": 8
},
"0.9.0_0": {
"obis": "0.0.1.0.0.255",
"attributeIndex": 2,
"classId": 8
},
"C3DE": {
"obis": "0.0.99.98.10.255",
"attributeIndex": 2,
"classId": 7,
"isProfileRegister": true
},
"CO_128.0.10": {
"obis": "1.0.128.0.10.255",
"attributeIndex": 2,
"classId": 3
},
"C2DE": {
"obis": "0.0.99.98.9.255",
"attributeIndex": 2,
"classId": 7,
"isProfileRegister": true
},
"C1DE": {
"obis": "0.0.99.98.8.255",
"attributeIndex": 2,
"classId": 7,
"isProfileRegister": true
},
"CO_0.9.0_0": {
"obis": "0.0.1.0.0.255",
"attributeIndex": 2,
"classId": 8
},
"CO_72.128.0": {
"obis": "1.0.72.128.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_52.128.0": {
"obis": "1.0.52.128.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_32.128.0": {
"obis": "1.0.32.128.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_72.7.0": {
"obis": "1.0.72.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_128.40.0": {
"obis": "1.0.128.40.0.255",
"attributeIndex": 2,
"classId": 1
},
"72.7.0_0": {
"obis": "1.0.72.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"14.7.0_0": {
"obis": "1.0.14.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"52.7.0_0": {
"obis": "1.0.52.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_32.7.0": {
"obis": "1.0.32.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"32.7.0_0": {
"obis": "1.0.32.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_12.23.0": {
"obis": "1.0.12.23.0.255",
"attributeIndex": 2,
"classId": 3
},
"PFEL": {
"obis": "1.0.99.97.0.255",
"attributeIndex": 2,
"classId": 7,
"isProfileRegister": true
},
"FW_VER": {
"obis": "1.0.0.2.0.255",
"attributeIndex": 2,
"classId": 1
},
"96.6.0_0": {
"obis": "0.0.96.6.0.255",
"attributeIndex": 2,
"classId": 3
},
"96.6.3_0": {
"obis": "0.0.96.6.3.255",
"attributeIndex": 2,
"classId": 3
},
"96.6.3_1": {
"obis": "0.1.96.6.3.255",
"attributeIndex": 2,
"classId": 3
}
},
"transportProtocol": "DLMS",
"defaultComModuleId": 5,
"defaultComModule": {
"subTypeId": 5,
"make": "AnteLeco",
"model": "STM32 M65-NMD",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":true,
"tenantId": -1234
}
}'
);
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"5","deviceType":"METER","code":"BILLING_REGISTERS_RETRIEVE","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateValidation":"3600000","requireAuthentication":"0"},"transportMode":"NET_ONLY","registerTransactions":[],"registers":["0.0.0_0","0.9.1_0","0.9.2_0","1.8.0_0","1.8.1_0","1.8.2_0","1.8.3_0","2.8.0_0","2.8.1_0","2.8.2_0","2.8.3_0","1.8.0*01_0","1.8.1*01_0","1.8.2*01_0","1.8.3*01_0","2.8.0*01_0","2.8.1*01_0","2.8.2*01_0","2.8.3*01_0","9.6.0_0","9.6.0*01_0","10.6.0_0","10.6.0*01_0","0.4.2_0","0.4.3_0","0.4.5_0","0.4.6_0","14.7.0_0","31.7.0_0","32.7.0_0","51.7.0_0","52.7.0_0","71.7.0_0","72.7.0_0"]}','BILLING_REGISTERS_RETRIEVE',5,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"5","deviceType":"METER","code":"LOAD_PROFILE_RETRIEVE","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateValidation":"3600000","requireAuthentication":"0"},"transportMode":"NET_ONLY","registerTransactions":[],"registers":["LP"]}','LOAD_PROFILE_RETRIEVE',5,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"5","deviceType":"METER","code":"TIME_SYNC","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateAdjust":"30000","requireAuthentication":"0"},"registerTransactions":[],"registers":["0.9.1_0","0.9.2_0"]}','TIME_SYNC',5,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"5","deviceType":"METER","code":"SELF_TEST","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateAdjust":"30000","requireAuthentication":"0"},"transportMode":"NET_ONLY","registerTransactions":[],"registers":["0.0.0_0","0.9.1_0","0.9.2_0","FW_VER","1.8.0_0","1.8.1_0","1.8.2_0","1.8.3_0","2.8.0_0","2.8.1_0","2.8.2_0","2.8.3_0","1.8.0*01_0","1.8.1*01_0","1.8.2*01_0","1.8.3*01_0","2.8.0*01_0","2.8.1*01_0","2.8.2*01_0","2.8.3*01_0","9.6.0_0","9.6.0*01_0","10.6.0_0","10.6.0*01_0","0.4.2_0","0.4.3_0","0.4.5_0","0.4.6_0","14.7.0_0","31.7.0_0","32.7.0_0","51.7.0_0","52.7.0_0","71.7.0_0","72.7.0_0"]}','SELF_TEST',5,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"6","deviceType":"METER","code":"REMOTE_RELAY_ON","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireAuthentication":"0"},"transportMode":"ALLOW_SMS_FALLBACK","registerTransactions":[{"globalRegName":"CSRQ_RL","remoteMethod":{"index":2,"data":"003()","type":"STRING"}}],"registers":["0.9.1_0","0.9.2_0","CSRQ_RL","1.8.0_0","1.8.1_0","1.8.2_0","1.8.3_0","2.8.0_0","2.8.1_0","2.8.2_0","2.8.3_0"]}','REMOTE_RELAY_ON',6,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"6","deviceType":"METER","code":"REMOTE_RELAY_OFF","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireAuthentication":"0"},"transportMode":"ALLOW_SMS_FALLBACK","registerTransactions":[{"globalRegName":"CSRQ_RL","remoteMethod":{"index":1,"data":"004()","type":"STRING"}}],"registers":["0.9.1_0","0.9.2_0","CSRQ_RL","1.8.0_0","1.8.1_0","1.8.2_0","1.8.3_0","2.8.0_0","2.8.1_0","2.8.2_0","2.8.3_0"]}','REMOTE_RELAY_OFF',6,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"6","deviceType":"METER","code":"BILLING_REGISTERS_RETRIEVE","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateAdjust":"30000","requireAuthentication":"0"},"transportMode":"ALLOW_SMS_FALLBACK","registerTransactions":[],"registers":["0.0.0_0","0.9.1_0","0.9.2_0","1.8.0_0","1.8.1_0","1.8.2_0","1.8.3_0","2.8.0_0","2.8.1_0","2.8.2_0","2.8.3_0","1.8.0*01_0","1.8.1*01_0","1.8.2*01_0","1.8.3*01_0","2.8.0*01_0","2.8.1*01_0","2.8.2*01_0","2.8.3*01_0","14.7.0_0","31.7.0_0","32.7.0_0","51.7.0_0","52.7.0_0","71.7.0_0","72.7.0_0","CSRQ_RL"]}','BILLING_REGISTERS_RETRIEVE',6,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"6","deviceType":"METER","code":"LOAD_PROFILE_RETRIEVE","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateValidation":"3600000","requireAuthentication":"0"},"transportMode":"NET_ONLY","registerTransactions":[],"registers":["LP"]}','LOAD_PROFILE_RETRIEVE',6,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"6","deviceType":"METER","code":"TIME_SYNC","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateAdjust":"30000","requireAuthentication":"0"},"registerTransactions":[],"registers":["0.9.1_0","0.9.2_0"]}','TIME_SYNC',6,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
Loading…
Cancel
Save