parent
7562c1fbf1
commit
800fa4fb9a
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
|
||||
*
|
||||
* Unauthorised copying/redistribution of this file, via any medium is strictly prohibited.
|
||||
*
|
||||
* Licensed under the Entgra Commercial License, Version 1.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://entgra.io/licenses/entgra-commercial/1.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.operation.template.exception;
|
||||
|
||||
/**
|
||||
* Represents the exception thrown during validating the request.
|
||||
*/
|
||||
public class BadOperationRequestException extends OperationTemplateMgtPluginException {
|
||||
|
||||
private static final long serialVersionUID = 4082332498085984791L;
|
||||
|
||||
public BadOperationRequestException(String message, Throwable ex) {
|
||||
super(message, ex);
|
||||
}
|
||||
|
||||
public BadOperationRequestException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
|
||||
*
|
||||
* Unauthorised copying/redistribution of this file, via any medium is strictly prohibited.
|
||||
*
|
||||
* Licensed under the Entgra Commercial License, Version 1.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://entgra.io/licenses/entgra-commercial/1.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.operation.template.util;
|
||||
|
||||
import io.entgra.device.mgt.operation.template.exception.BadOperationRequestException;
|
||||
import io.entgra.device.mgt.operation.template.exception.OperationTemplateMgtPluginException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
public class AssertUtils {
|
||||
|
||||
private AssertUtils() {
|
||||
throw new IllegalStateException("ValidationUtils class");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object
|
||||
* @param msg
|
||||
* @throws OperationTemplateMgtPluginException
|
||||
*/
|
||||
public static void isNull(Object object, String msg) throws OperationTemplateMgtPluginException {
|
||||
if (object == null) {
|
||||
throw new BadOperationRequestException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object
|
||||
* @param msg
|
||||
* @throws OperationTemplateMgtPluginException
|
||||
*/
|
||||
public static void notNull(Object object, String msg) throws OperationTemplateMgtPluginException {
|
||||
if (object != null) {
|
||||
throw new BadOperationRequestException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param text
|
||||
* @param msg
|
||||
* @throws OperationTemplateMgtPluginException
|
||||
*/
|
||||
public static void hasText(String text, String msg) throws OperationTemplateMgtPluginException {
|
||||
if (StringUtils.isEmpty(text)) {
|
||||
throw new BadOperationRequestException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param expression
|
||||
* @param msg
|
||||
* @throws OperationTemplateMgtPluginException
|
||||
*/
|
||||
public static void isTrue(boolean expression, String msg) throws OperationTemplateMgtPluginException {
|
||||
if (!expression) {
|
||||
throw new BadOperationRequestException(msg);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,425 +0,0 @@
|
||||
-- -----------------------------------------------------
|
||||
-- Table `POWER_METER_DEVICE`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `POWER_METER_DEVICE` (
|
||||
`ID` INTEGER AUTO_INCREMENT NOT NULL,
|
||||
`SERIAL` VARCHAR(45) NOT NULL,
|
||||
`IP_ADDRESS` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`SIM_NUMBER` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`SUB_TYPE_ID` INT NOT NULL,
|
||||
`CUSTOMER_REF` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`NODE_TYPE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`CATEGORY` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`BRANCH` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`DEPOT` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`SUBSTATION_ID` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`HAS_EXPORT` VARCHAR(5) NULL DEFAULT NULL,
|
||||
`COM_MODULE_IMEI` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`HAS_E_BILLING` VARCHAR(5) NULL DEFAULT NULL,
|
||||
`IS_FEEDER_END` VARCHAR(5) NULL DEFAULT NULL,
|
||||
`POLE_ID` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`METER_FW_VER` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`ASSIGNED_ON` TIMESTAMP NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`ID`, `SERIAL`));
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `COMMUNICATION_MODULE`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `COMMUNICATION_MODULE` (
|
||||
`IMEI` VARCHAR(45) NOT NULL,
|
||||
`SIM_IMSI` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`FW_VERSION` INT NULL DEFAULT 0,
|
||||
`SUB_TYPE_ID` INT NOT NULL,
|
||||
`SMS_PIN` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`BRANCH` VARCHAR(45) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`IMEI`));
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `METER_AUTHENTICATION_INFO`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `METER_AUTHENTICATION_INFO` (
|
||||
`ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`CLIENT_ADDRESS` INT NOT NULL,
|
||||
`AUTHENTICATION` VARCHAR(100) NOT NULL,
|
||||
`USER_ID` INT NOT NULL,
|
||||
`PASSWORD` VARCHAR(100) NOT NULL,
|
||||
`METER_SERIAL_ID` VARCHAR(45) NOT NULL,
|
||||
PRIMARY KEY (`ID`));
|
||||
|
||||
CREATE INDEX IDX_METER_AUTHENTICATION_INFO
|
||||
ON METER_AUTHENTICATION_INFO(CLIENT_ADDRESS, METER_SERIAL_ID);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `METER_READINGS`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `METER_READINGS` (
|
||||
`ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`OPERATION_ID` INT NOT NULL,
|
||||
`OPERATION_CODE` VARCHAR(45) NOT NULL,
|
||||
`SUB_TYPE_ID` INT NOT NULL,
|
||||
`NODE_TYPE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`CATEGORY` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`HAS_EXPORT` BOOLEAN NULL DEFAULT NULL,
|
||||
`HAS_E_BILLING` BOOLEAN NULL DEFAULT NULL,
|
||||
`BRANCH` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`DEPOT` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`SUBSTATION_ID` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`SERIAL` VARCHAR(45) NOT NULL,
|
||||
`CUSTOMER_REF` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`RESPONSE` BLOB NOT NULL,
|
||||
`TIMESTAMP` BIGINT(15) NOT NULL,
|
||||
`IS_PARTIAL_RESULT` BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
PRIMARY KEY (`ID`));
|
||||
|
||||
--
|
||||
-- Table structure for table `LAST_METER_READING`
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS LAST_METER_READING (
|
||||
SERIAL VARCHAR(45) NOT NULL,
|
||||
OPERATION_ID INTEGER NOT NULL,
|
||||
SUB_TYPE_ID INT NOT NULL DEFAULT 0,
|
||||
NODE_TYPE VARCHAR(45) NULL DEFAULT NULL,
|
||||
CATEGORY VARCHAR(45) NULL DEFAULT NULL,
|
||||
HAS_EXPORT BOOLEAN NULL DEFAULT NULL,
|
||||
HAS_E_BILLING BOOLEAN NULL DEFAULT NULL,
|
||||
BRANCH VARCHAR(45) NULL DEFAULT NULL,
|
||||
DEPOT VARCHAR(45) NULL DEFAULT NULL,
|
||||
SUBSTATION_ID VARCHAR(45) NULL DEFAULT NULL,
|
||||
CUSTOMER_REF VARCHAR(45) NULL DEFAULT NULL,
|
||||
RESPONSE LONGBLOB NOT NULL,
|
||||
LAST_READING_TIMESTAMP BIGINT NOT NULL,
|
||||
PRIMARY KEY (SERIAL)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `PROFILE_READINGS`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `PROFILE_READINGS` (
|
||||
`ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`OPERATION_ID` INT NOT NULL,
|
||||
`OBIS` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`SUB_TYPE_ID` INT NOT NULL,
|
||||
`NODE_TYPE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`CATEGORY` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`HAS_EXPORT` BOOLEAN NULL DEFAULT NULL,
|
||||
`HAS_E_BILLING` BOOLEAN NULL DEFAULT NULL,
|
||||
`BRANCH` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`DEPOT` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`SUBSTATION_ID` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`SERIAL` VARCHAR(45) NOT NULL,
|
||||
`CUSTOMER_REF` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`PROFILE_DATA` BLOB NOT NULL,
|
||||
`TIMESTAMP` BIGINT(15) NOT NULL,
|
||||
PRIMARY KEY (`ID`));
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `METER_INSTALL`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `METER_INSTALL` (
|
||||
`ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`SERIAL` VARCHAR(45) NOT NULL,
|
||||
`USERNAME` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`JOB_ID` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`LAB_SEAL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`COM_MODULE_SEAL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`TERMINAL_COVER_SEAL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`METER_ENCLOSURE_SEAL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`PRINTED_SERIAL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`CUSTOMER_REF` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`IMPORT_READING` DOUBLE DEFAULT 0,
|
||||
`EXPORT_READING` DOUBLE DEFAULT 0,
|
||||
`READING_TIMESTAMP` BIGINT(15) DEFAULT 0,
|
||||
`TIMESTAMP` TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (`ID`));
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `METER_UNINSTALL`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `METER_UNINSTALL` (
|
||||
`ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`SERIAL` VARCHAR(45) NOT NULL,
|
||||
`USERNAME` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`JOB_ID` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`LAB_SEAL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`COM_MODULE_SEAL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`TERMINAL_COVER_SEAL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`METER_ENCLOSURE_SEAL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`PRINTED_SERIAL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`CUSTOMER_REF` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`IMPORT_READING` DOUBLE DEFAULT 0,
|
||||
`EXPORT_READING` DOUBLE DEFAULT 0,
|
||||
`READING_TIMESTAMP` BIGINT(15) DEFAULT 0,
|
||||
`TIMESTAMP` TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (`ID`));
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `RSSI_LEVEL`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `RSSI_LEVEL` (
|
||||
`ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`IMEI` VARCHAR(45) NOT NULL,
|
||||
`SIM_IMSI` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`FW_VERSION` INT NULL DEFAULT 0,
|
||||
`COM_TYPE_ID` INT NOT NULL,
|
||||
`RSSI` INT NULL DEFAULT 0,
|
||||
`NETWORK` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`CELL_ID` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`LAC` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`RSRP` DECIMAL (5, 2) NULL DEFAULT 0,
|
||||
`RSRQ` DECIMAL (5, 2) NULL DEFAULT 0,
|
||||
`SNR` DECIMAL (5, 2) NULL DEFAULT 0,
|
||||
`PCI` INT NULL DEFAULT 0,
|
||||
`TRANSPORT` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`TIMESTAMP` BIGINT(15) NOT NULL,
|
||||
PRIMARY KEY (`ID`));
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `REQUEST`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `REQUEST` (
|
||||
`ID` int NOT NULL AUTO_INCREMENT,
|
||||
`DUE_DATE` bigint DEFAULT '0',
|
||||
`REQUESTED_BY` varchar(100) NOT NULL,
|
||||
`REQUESTED_DATE` bigint DEFAULT '0',
|
||||
`STATUS` varchar(45) NOT NULL,
|
||||
`BRANCH` varchar(45) DEFAULT NULL,
|
||||
`REMARKS` varchar(255) NOT NULL,
|
||||
`REQUEST_TYPE` int NOT NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
) ;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `METER_ASSIGNMENT_REQUEST`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `METER_ASSIGNMENT_REQUEST` (
|
||||
`ID` int NOT NULL,
|
||||
`SUB_TYPE_ID` int NOT NULL,
|
||||
`PRIMARY_CT_RATIO` float DEFAULT '0',
|
||||
`SECONDARY_CT_RATIO` float DEFAULT '0',
|
||||
`PRIMARY_PT_RATIO` float DEFAULT '0',
|
||||
`SECONDARY_PT_RATIO` float DEFAULT '0',
|
||||
`NODE_TYPE` varchar(45) DEFAULT NULL,
|
||||
`REQUESTED_COUNT` int NOT NULL,
|
||||
`ACCEPTED_COUNT` int DEFAULT NULL,
|
||||
`ASSIGNED_COUNT` int DEFAULT NULL,
|
||||
`SUBSTATION_ID` varchar(45) DEFAULT NULL,
|
||||
`CUSTOMER_REF` varchar(45) DEFAULT NULL,
|
||||
`DEPOT` VARCHAR(45) DEFAULT NULL,
|
||||
`PURPOSE` VARCHAR(50) DEFAULT NULL,
|
||||
`ADDRESS` VARCHAR(255) DEFAULT NULL,
|
||||
`DESCRIPTION` VARCHAR(100) DEFAULT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
CONSTRAINT `fk_ASSIGNMENT_REQUEST_REQUEST` FOREIGN KEY (`ID`) REFERENCES `REQUEST` (`ID`)
|
||||
) ;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `DISCONNECTION_REQUEST`
|
||||
-- -------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `DISCONNECTION_REQUEST` (
|
||||
`ID` int NOT NULL,
|
||||
`ACTIVITY_ID` VARCHAR(45) DEFAULT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
CONSTRAINT `fk_DISCONNECTION_REQUEST_REQUEST` FOREIGN KEY (`ID`) REFERENCES `REQUEST` (`ID`)
|
||||
) ;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `FIELD_TEST_REQUEST`
|
||||
-- -------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `FIELD_TEST_REQUEST` (
|
||||
`ID` int NOT NULL,
|
||||
`TEAM` varchar(255) DEFAULT NULL,
|
||||
`SCHEDULED_DATE` bigint DEFAULT '0',
|
||||
`RESULT` varchar(50) DEFAULT NULL,
|
||||
`ATTACHMENT` blob,
|
||||
PRIMARY KEY (`ID`),
|
||||
CONSTRAINT `fk_ASSIGNMENT_FIELD_TEST_REQUEST_REQUEST` FOREIGN KEY (`ID`) REFERENCES `REQUEST` (`ID`)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `LOAD_PROFILE_REQUEST`
|
||||
-- -------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `LOAD_PROFILE_REQUEST` (
|
||||
`ID` int NOT NULL,
|
||||
`ACTIVITY_ID` VARCHAR(45) DEFAULT NULL,
|
||||
`START_DATE` bigint DEFAULT '0',
|
||||
`END_DATE` bigint DEFAULT '0',
|
||||
PRIMARY KEY (`ID`),
|
||||
CONSTRAINT `fk_LOAD_PROFILE_REQUEST_REQUEST_REQUEST` FOREIGN KEY (`ID`) REFERENCES `REQUEST` (`ID`)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `READOUT_REQUEST`
|
||||
-- -------------------------------------------------------
|
||||
|
||||
CREATE TABLE `READOUT_REQUEST` (
|
||||
`ID` int NOT NULL,
|
||||
`ACTIVITY_ID` VARCHAR(45) DEFAULT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
CONSTRAINT `fk_READUOT_REQUEST_REQUEST_REQUEST` FOREIGN KEY (`ID`) REFERENCES `REQUEST` (`ID`)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `COM_MODULE_REQUEST`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `COM_MODULE_REQUEST` (
|
||||
`ID` INT NOT NULL,
|
||||
`MODULE_TYPE` VARCHAR(45) NOT NULL,
|
||||
`REQUESTED_COUNT` INT NOT NULL,
|
||||
`ACCEPTED_COUNT` INT DEFAULT NULL,
|
||||
`ASSIGNED_COUNT` INT DEFAULT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
CONSTRAINT `fk_COM_MODULE_REQUEST_REQUEST` FOREIGN KEY (`ID`)
|
||||
REFERENCES `REQUEST` (`ID`)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `RECONNECTION_REQUEST`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `RECONNECTION_REQUEST` (
|
||||
`ID` int NOT NULL,
|
||||
`ACTIVITY_ID` VARCHAR(45) DEFAULT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
CONSTRAINT `fk_RECONNECTION_REQUEST_REQUEST` FOREIGN KEY (`ID`)
|
||||
REFERENCES `REQUEST` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
|
||||
|
||||
-----------------------------------------------------
|
||||
-- Table `REQUEST_LIFECYCLE_EVENT`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `REQUEST_LIFECYCLE_EVENT` (
|
||||
`ID` int NOT NULL AUTO_INCREMENT,
|
||||
`REQUEST_ID` int NOT NULL,
|
||||
`UPDATED_BY` varchar(100) NOT NULL,
|
||||
`UPDATED_DATE` bigint DEFAULT '0',
|
||||
`STATUS` varchar(45) NOT NULL,
|
||||
`REMARKS` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
CONSTRAINT `fk_REQUEST_LIFECYCLE_EVENT_REQUEST` FOREIGN KEY (`REQUEST_ID`) REFERENCES `REQUEST` (`ID`)
|
||||
) ;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `DEVICE_EVENTS`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `PROCESSED_DEVICE_EVENTS` (
|
||||
`ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`METER_SERIAL` VARCHAR(45),
|
||||
`IP_ADDRESS` VARCHAR(45),
|
||||
`NUMBER` VARCHAR(45),
|
||||
`TYPE` VARCHAR(45) NOT NULL,
|
||||
`KEY` VARCHAR(100) NOT NULL,
|
||||
`VALUE` VARCHAR(100) NOT NULL,
|
||||
`EVENT` VARCHAR(45) NOT NULL,
|
||||
`TIMESTAMP` BIGINT(15) DEFAULT 0,
|
||||
PRIMARY KEY (`ID`));
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `DM_DEVICE_SUB_TYPE`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `DM_DEVICE_SUB_TYPE` (
|
||||
`TENANT_ID` INT DEFAULT 0,
|
||||
`SUB_TYPE_ID` INT NOT NULL,
|
||||
`DEVICE_TYPE` VARCHAR(25) NOT NULL,
|
||||
`SUB_TYPE_NAME` VARCHAR(45) NOT NULL,
|
||||
`TYPE_DEFINITION` TEXT NOT NULL,
|
||||
PRIMARY KEY (`SUB_TYPE_ID`,`DEVICE_TYPE`)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `OPERATION_TEMPLATE`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `OPERATION_TEMPLATE`(
|
||||
`TEMPLATE_ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`SUB_TYPE_ID` INT NOT NULL,
|
||||
`OPERATION_CODE` VARCHAR(100) NOT NULL,
|
||||
`OPERATION_DEFINITION` TEXT DEFAULT NULL,
|
||||
PRIMARY KEY (`TEMPLATE_ID`)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `GENERIC_METER_REGISTER`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `GENERIC_METER_REGISTER`(
|
||||
`RRPK_ID` VARCHAR(100) NOT NULL,
|
||||
`DESCRIPTION` VARCHAR(100) NOT NULL,
|
||||
`UNIT` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`ORDER` INT NOT NULL,
|
||||
PRIMARY KEY (`RRPK_ID`)
|
||||
);
|
||||
|
||||
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 DAO test cases
|
||||
-- -----------------------------------------------------
|
||||
INSERT INTO DM_DEVICE_TYPE(NAME, DEVICE_TYPE_META, LAST_UPDATED_TIMESTAMP, PROVIDER_TENANT_ID, SHARED_WITH_ALL_TENANTS) VALUES
|
||||
('android','NULL','2020-10-14 16:05:15',-1234,1),('power-meter','NULL','2020-10-14 16:05:15',-1234,1),
|
||||
('communication-module','NULL','2020-10-14 16:05:15',-1234,1),('sim','NULL','2020-10-14 16:05:15',-1234,1);
|
||||
INSERT INTO DM_DEVICE(DESCRIPTION, NAME, DEVICE_TYPE_ID, DEVICE_IDENTIFICATION, LAST_UPDATED_TIMESTAMP, TENANT_ID) VALUES
|
||||
('+94713192111', '192.168.118.111', 4, '413012689159555', '2022-04-04 16:55:52', '-1234'),
|
||||
('NULL', '864495036647555', 3, '864495036647555', '2022-04-04 16:56:52', '-1234'),
|
||||
('NULL', '000019729555', 2, '000019729555', '2022-04-04 16:56:52', '-1234');
|
||||
|
||||
INSERT INTO DM_ENROLMENT(DEVICE_ID,OWNER,OWNERSHIP,STATUS,IS_TRANSFERRED,DATE_OF_ENROLMENT,DATE_OF_LAST_UPDATE,TENANT_ID) VALUES
|
||||
(1,'admin','COPE','ACTIVE',0,'2022-04-11 15:41:30','2022-04-11 15:41:30',-1234),
|
||||
(2,'admin','COPE','ACTIVE',0,'2022-04-11 15:41:30','2022-04-11 15:41:30',-1234),
|
||||
(3,'admin','COPE','ACTIVE',0,'2022-04-11 15:41:30','2022-04-11 15:41:30',-1234);
|
||||
INSERT INTO DM_DEVICE_PROPERTIES (DEVICE_TYPE_NAME,DEVICE_IDENTIFICATION,PROPERTY_NAME,PROPERTY_VALUE,TENANT_ID) VALUES
|
||||
('sim','413012689159555','APN','LECOSMSTC',-1234),
|
||||
('sim','413012689159555','IP_ADDRESS','192.168.118.111',-1234),
|
||||
('sim','413012689159555','MOBILE_NO','+94713192111',-1234),
|
||||
('sim','413012689159555','SUB_TYPE_ID','1',-1234),
|
||||
('sim','413012689159555','token',NULL,-1234),
|
||||
('communication-module','864495036647555','BRANCH','KOTTE',-1234),
|
||||
('communication-module','864495036647555','FW_VERSION','6',-1234),
|
||||
('communication-module','864495036647555','SIM_IMSI','413012689159555',-1234),
|
||||
('communication-module','864495036647555','SIM_PIN','1234',-1234),
|
||||
('communication-module','864495036647555','SUB_TYPE_ID','1',-1234),
|
||||
('communication-module','864495036647555','token',NULL,-1234),
|
||||
('power-meter','000019729555','BRANCH','KOTTE',-1234),
|
||||
('power-meter','000019729555','CATEGORY','BILLING_BULK',-1234),
|
||||
('power-meter','000019729555','COM_MODULE_IMEI','864495036647555',-1234),
|
||||
('power-meter','000019729555','CUSTOMER_REF','0602297555',-1234),
|
||||
('power-meter','000019729555','DEPOT','PITA-KOTTE',-1234),
|
||||
('power-meter','000019729555','HAS_EXPORT','false',-1234),
|
||||
('power-meter','000019729555','HAS_E_BILLING','false',-1234),
|
||||
('power-meter','000019729555','IP_ADDRESS','192.168.118.111',-1234),
|
||||
('power-meter','000019729555','IS_FEEDER_END','false',-1234),
|
||||
('power-meter','000019729555','NODE_TYPE','BILLING',-1234),
|
||||
('power-meter','000019729555','POLE_ID','NW55/5/15C',-1234),
|
||||
('power-meter','000019729555','SIM_NUMBER','+94713192111',-1234),
|
||||
('power-meter','000019729555','SUBSTATION_ID','AZ8555',-1234),
|
||||
('power-meter','000019729555','SUB_TYPE_ID','1',-1234),
|
||||
('power-meter','000019729555','token',NULL,-1234);
|
||||
|
||||
|
||||
-- INSERT INTO SIM_DEVICE (IMSI,IP_ADDRESS,MOBILE_NO,SUB_TYPE_ID,APN) VALUES ('413012689159555','10.217.55.155','+94713192111',1,'LECOSMSTC');
|
||||
INSERT INTO COMMUNICATION_MODULE(IMEI,SIM_IMSI,FW_VERSION,SUB_TYPE_ID,BRANCH,SMS_PIN) VALUES ('864495036647555','413012689159555',6,1,'KOTTE','1234');
|
||||
INSERT INTO POWER_METER_DEVICE (SERIAL,IP_ADDRESS,SIM_NUMBER,COM_MODULE_IMEI,SUB_TYPE_ID,CUSTOMER_REF,NODE_TYPE,CATEGORY,BRANCH,DEPOT,SUBSTATION_ID,HAS_EXPORT,HAS_E_BILLING,IS_FEEDER_END,POLE_ID,ASSIGNED_ON)
|
||||
VALUES ('000019729555','192.168.118.111','+94713192111','864495036647555',1,'0602297555','BILLING','BILLING_BULK','KOTTE','PITA-KOTTE','AZ82555','false','false','false','NW55/5/15C',NULL);
|
||||
|
||||
INSERT INTO DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, TENANT_ID, DEVICE_TYPE, SUB_TYPE_NAME, TYPE_DEFINITION) VALUES
|
||||
(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}');
|
Loading…
Reference in new issue