Update operation template core changes

app-icon-change
Thameera 2 years ago
parent f92e766856
commit 8533542035

@ -1,20 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
~
~ Unauthorised copying/redistribution of this file, via any medium is strictly prohibited.
~ Copyright (c) 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
~
~ Licensed under the Entgra Commercial License, Version 1.0 (the "License");
~ you may not use this file except in compliance with the License.
~ 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
~
~ https://entgra.io/licenses/entgra-commercial/1.0
~ 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
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@ -55,7 +54,7 @@ public class OperationTemplateCacheLoader extends CacheLoader<String, OperationT
public OperationTemplate load(String key) throws OperationTemplateMgtPluginException {
OperationTemplateCacheKey operationTemplateCacheKey = OperationTemplateManagementUtil.getOperationTemplateCacheKey(
key);
int subTypeId = operationTemplateCacheKey.getSubTypeId();
String subTypeId = operationTemplateCacheKey.getSubTypeId();
String operationCode = operationTemplateCacheKey.getOperationCode();
String deviceType = operationTemplateCacheKey.getDeviceType();

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@ -32,8 +31,8 @@ public interface OperationTemplateDAO {
OperationTemplate updateOperationTemplate(OperationTemplate operationTemplate)
throws OperationTemplateManagementDAOException;
OperationTemplate getOperationTemplate(int subTypeId, String deviceType, String operationCode) throws OperationTemplateManagementDAOException;
OperationTemplate getOperationTemplate(String subTypeId, String deviceType, String operationCode) throws OperationTemplateManagementDAOException;
void deleteOperationTemplate(int subTypeId, String deviceCode, String operationCode) throws OperationTemplateManagementDAOException;
void deleteOperationTemplate(String subTypeId, String deviceCode, String operationCode) throws OperationTemplateManagementDAOException;
}

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@ -63,7 +62,7 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
int index = 1;
stmt.setObject(index++, new Gson().toJson(operationTemplate.getOperationDefinition()));
stmt.setString(index++, operationTemplate.getCode());
stmt.setInt(index++, operationTemplate.getSubTypeId());
stmt.setString(index++, operationTemplate.getSubTypeId());
stmt.setString(index++, operationTemplate.getDeviceType());
stmt.setTimestamp(index++, new Timestamp(System.currentTimeMillis()));
stmt.setTimestamp(index++, null);
@ -98,7 +97,7 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, operationTemplate.getOperationDefinition());
stmt.setTimestamp(2, new Timestamp(System.currentTimeMillis()));
stmt.setInt(3, operationTemplate.getSubTypeId());
stmt.setString(3, operationTemplate.getSubTypeId());
stmt.setString(4, operationTemplate.getDeviceType());
stmt.setString(5, operationTemplate.getCode());
stmt.executeUpdate();
@ -123,13 +122,13 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
* @throws OperationTemplateManagementDAOException
*/
@Override
public OperationTemplate getOperationTemplate(int subTypeId, String deviceType, String operationCode)
public OperationTemplate getOperationTemplate(String subTypeId, String deviceType, String operationCode)
throws OperationTemplateManagementDAOException {
try {
String sql = "SELECT * FROM SUB_OPERATION_TEMPLATE WHERE SUB_TYPE_ID = ? AND DEVICE_TYPE = ? AND OPERATION_CODE = ?";
Connection conn = ConnectionManagerUtils.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setInt(1, subTypeId);
stmt.setString(1, subTypeId);
stmt.setString(2, deviceType);
stmt.setString(3, operationCode);
@ -158,13 +157,13 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
* @throws OperationTemplateManagementDAOException
*/
@Override
public void deleteOperationTemplate(int subTypeId, String deviceType, String operationCode)
public void deleteOperationTemplate(String subTypeId, String deviceType, String operationCode)
throws OperationTemplateManagementDAOException {
String sql = "DELETE FROM SUB_OPERATION_TEMPLATE WHERE SUB_TYPE_ID = ? AND DEVICE_TYPE = ? AND OPERATION_CODE = ?";
try {
Connection conn = ConnectionManagerUtils.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setInt(1, subTypeId);
stmt.setString(1, subTypeId);
stmt.setString(2, deviceType);
stmt.setString(3, operationCode);
stmt.executeUpdate();

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@ -60,7 +59,7 @@ public class OperationTemplateManagementUtil {
* @param operationCode
* @return
*/
public static String setOperationTemplateCacheKey(int subTypeId, String deviceType, String operationCode) {
public static String setOperationTemplateCacheKey(String subTypeId, String deviceType, String operationCode) {
return subTypeId + "|" + deviceType + "|" + operationCode;
}
@ -71,7 +70,7 @@ public class OperationTemplateManagementUtil {
*/
public static OperationTemplateCacheKey getOperationTemplateCacheKey(String key) {
String[] keys = key.split("\\|");
int subTypeId = Integer.parseInt(keys[0]);
String subTypeId = keys[0];;
String deviceType = keys[1];
String operationCode = keys[2];

@ -1,36 +1,35 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* 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.dto;
public class OperationTemplate {
private int subTypeId;
private String subTypeId;
private String deviceType;
private int operationTemplateId;
private String code;
private String operationDefinition;
public int getSubTypeId() {
public String getSubTypeId() {
return subTypeId;
}
public void setSubTypeId(int subTypeId) {
public void setSubTypeId(String subTypeId) {
this.subTypeId = subTypeId;
}

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@ -21,15 +20,15 @@ package io.entgra.device.mgt.operation.template.dto;
public class OperationTemplateCacheKey {
private int subTypeId;
private String subTypeId;
private String deviceType;
private String operationCode;
public int getSubTypeId() {
public String getSubTypeId() {
return subTypeId;
}
public void setSubTypeId(int subTypeId) {
public void setSubTypeId(String subTypeId) {
this.subTypeId = subTypeId;
}

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@ -132,7 +131,7 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
* @throws OperationTemplateMgtPluginException
*/
@Override
public OperationTemplate getOperationTemplate(int subTypeId, String deviceType, String operationCode)
public OperationTemplate getOperationTemplate(String subTypeId, String deviceType, String operationCode)
throws OperationTemplateMgtPluginException {
try {
@ -158,7 +157,7 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
* @throws OperationTemplateMgtPluginException
*/
@Override
public void deleteOperationTemplate(int subTypeId, String deviceType, String operationCode)
public void deleteOperationTemplate(String subTypeId, String deviceType, String operationCode)
throws OperationTemplateMgtPluginException {
String msg = "Operation Template does not exist for subtype id : " + subTypeId
@ -195,10 +194,11 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
* @param operationCode
* @throws OperationTemplateMgtPluginException
*/
private void validateGetOperationTemplate(int subTypeId, String deviceType, String operationCode)
private void validateGetOperationTemplate(String subTypeId, String deviceType, String operationCode)
throws OperationTemplateMgtPluginException {
AssertUtils.isTrue(subTypeId > 0, "Invalid meter device subtype id: " + subTypeId);
AssertUtils.hasText(subTypeId, "Invalid meter device subtype id: " + subTypeId);
AssertUtils.isTrue(Integer.valueOf(subTypeId)>0, "Invalid meter device subtype id: " + subTypeId);
AssertUtils.hasText(operationCode, "Validation failed due to invalid operation code: " + operationCode);
AssertUtils.hasText(deviceType, "Invalid device type.");
AssertUtils.isTrue(deviceType.equals("METER"), "Invalid device type. ");

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@ -31,8 +30,8 @@ public interface OperationTemplateService {
OperationTemplate updateOperationTemplate(OperationTemplate operationTemplate) throws OperationTemplateMgtPluginException;
OperationTemplate getOperationTemplate(int subTypeId, String deviceType, String operationCode) throws OperationTemplateMgtPluginException;
OperationTemplate getOperationTemplate(String subTypeId, String deviceType, String operationCode) throws OperationTemplateMgtPluginException;
void deleteOperationTemplate(int subTypeId, String deviceType, String operationCode) throws OperationTemplateMgtPluginException;
void deleteOperationTemplate(String subTypeId, String deviceType, String operationCode) throws OperationTemplateMgtPluginException;
}

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@ -45,7 +44,7 @@ public class DAOUtil {
throws SQLException, JsonSyntaxException {
OperationTemplate operationTemplate = new OperationTemplate();
Gson g = new Gson();
operationTemplate.setSubTypeId(rs.getInt("SUB_TYPE_ID"));
operationTemplate.setSubTypeId(rs.getString("SUB_TYPE_ID"));
operationTemplate.setCode(rs.getString("OPERATION_CODE"));
operationTemplate.setDeviceType(rs.getString("DEVICE_TYPE"));
operationTemplate.setOperationTemplateId(rs.getInt("SUB_OPERATION_TEMPLATE_ID"));

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@ -50,7 +49,7 @@ public class DAONegativeTest extends BaseOperationTemplatePluginTest {
try {
ConnectionManagerUtils.beginDBTransaction();
OperationTemplate operationTemplate = new OperationTemplate();
operationTemplate.setSubTypeId(0);
operationTemplate.setSubTypeId("0");
operationTemplate.setCode(null);
operationTemplate.setOperationDefinition(TestUtils.getOperationDefinition(TestUtils.subtypeId, TestUtils.operationCode));
operationTemplateDAO.addOperationTemplate(operationTemplate);

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@ -50,10 +49,10 @@ public class DAOTest extends BaseOperationTemplatePluginTest {
ConnectionManagerUtils.openDBConnection();
OperationTemplate operationTemplateActual = operationTemplateDAO.getOperationTemplate(
4, TestUtils.deviceType, TestUtils.operationCode);
"4", TestUtils.deviceType, TestUtils.operationCode);
ConnectionManagerUtils.closeDBConnection();
Assert.assertNotNull(operationTemplateActual, "Cannot be null");
Assert.assertEquals(operationTemplateActual.getSubTypeId(), 4);
Assert.assertEquals(operationTemplateActual.getSubTypeId(), "4");
Assert.assertEquals(operationTemplateActual.getCode(), TestUtils.operationCode);
Assert.assertEquals(operationTemplateActual.getDeviceType(), TestUtils.deviceType);
}
@ -63,21 +62,21 @@ public class DAOTest extends BaseOperationTemplatePluginTest {
throws DBConnectionException, OperationTemplateManagementDAOException {
OperationTemplate operationTemplate = new OperationTemplate();
operationTemplate.setSubTypeId(4);
operationTemplate.setSubTypeId("4");
operationTemplate.setCode(TestUtils.operationCode);
operationTemplate.setDeviceType(TestUtils.deviceType);
operationTemplate.setOperationDefinition(
TestUtils.getOperationDefinition(4, TestUtils.operationCode));
TestUtils.getOperationDefinition("4", TestUtils.operationCode));
ConnectionManagerUtils.beginDBTransaction();
operationTemplateDAO.addOperationTemplate(operationTemplate);
ConnectionManagerUtils.commitDBTransaction();
OperationTemplate operationTemplateActual = operationTemplateDAO.getOperationTemplate(
4, TestUtils.deviceType, TestUtils.operationCode);
"4", TestUtils.deviceType, TestUtils.operationCode);
ConnectionManagerUtils.closeDBConnection();
Assert.assertNotNull(operationTemplateActual, "Cannot be null");
Assert.assertEquals(operationTemplateActual.getSubTypeId(), 4);
Assert.assertEquals(operationTemplateActual.getSubTypeId(), "4");
Assert.assertEquals(operationTemplateActual.getCode(), TestUtils.operationCode);
Assert.assertEquals(operationTemplateActual.getDeviceType(), TestUtils.deviceType);
}
@ -88,14 +87,14 @@ public class DAOTest extends BaseOperationTemplatePluginTest {
ConnectionManagerUtils.beginDBTransaction();
OperationTemplate operationTemplate = operationTemplateDAO.getOperationTemplate(
4, TestUtils.deviceType, TestUtils.operationCode);
"4", TestUtils.deviceType, TestUtils.operationCode);
OperationTemplate operationTemplateActual = operationTemplateDAO.updateOperationTemplate(
operationTemplate);
ConnectionManagerUtils.commitDBTransaction();
ConnectionManagerUtils.closeDBConnection();
Assert.assertNotNull(operationTemplateActual, "Cannot be null");
Assert.assertEquals(operationTemplateActual.getSubTypeId(), 4);
Assert.assertEquals(operationTemplateActual.getSubTypeId(), "4");
Assert.assertEquals(operationTemplateActual.getCode(), TestUtils.operationCode);
Assert.assertEquals(operationTemplateActual.getDeviceType(), TestUtils.deviceType);
}

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@ -56,7 +55,7 @@ public class ServiceNegativeTest extends BaseOperationTemplatePluginTest {
OperationTemplate operationTemplate = new OperationTemplate();
operationTemplate.setDeviceType(TestUtils.deviceType);
operationTemplate.setCode(TestUtils.operationCode);
operationTemplate.setSubTypeId(0);
operationTemplate.setSubTypeId("0");
operationTemplate.setOperationDefinition(TestUtils.getOperationDefinition(TestUtils.subtypeId, TestUtils.operationCode));
operationTemplateService.addOperationTemplate(operationTemplate);
}

@ -1,25 +1,23 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* 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;
import com.google.common.cache.CacheLoader;
import io.entgra.device.mgt.operation.template.dto.OperationTemplate;
import io.entgra.device.mgt.operation.template.exception.OperationTemplateMgtPluginException;
import io.entgra.device.mgt.operation.template.impl.OperationTemplateServiceImpl;
@ -89,7 +87,7 @@ public class ServiceTest extends BaseOperationTemplatePluginTest {
Assert.assertNull(getOperationTemplateBySubtypeIdAndDeviceTypeAndOperationCode(TestUtils.subtypeId, TestUtils.deviceType, TestUtils.operationCode));
}
public OperationTemplate getOperationTemplateBySubtypeIdAndDeviceTypeAndOperationCode(int subtypeId, String deviceType, String operationCode) throws OperationTemplateMgtPluginException {
public OperationTemplate getOperationTemplateBySubtypeIdAndDeviceTypeAndOperationCode(String subtypeId, String deviceType, String operationCode) throws OperationTemplateMgtPluginException {
return operationTemplateService.getOperationTemplate(subtypeId, deviceType, operationCode);
}
}

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@ -30,23 +29,33 @@ import java.sql.Statement;
public class TestUtils {
private static final Log log = LogFactory.getLog(TestUtils.class);
public static Integer subtypeId = 3;
public static String subtypeId = "3";
public static String deviceType = "METER";
public static String operationCode = "BILLING_REGISTERS_RETRIEVE";
public static String getOperationDefinition(int subtypeId, String operationCode) {
String operationDefinition = "{\"" + subtypeId + "\":2,\"deviceType\":\"METER\",\"maxAttempts\":1,"
+ "\"registerTransaction\":{},\"registers\":[\"0.0.0_0\",\"0.9.0_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*01_0\",\"9.6.0_0\","
+ "\"10.6.0*01_0\",\"10.6.0_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\"],\"attemptCount\":1,\"transportMode\":\"NET_ONLY\","
+ "\"hasPermanentError\":false,\"tryToReachViaSMS\":false,\"waitingTime\":0,"
+ "\"code\":\"" + operationCode + "\",\"properties\":{\"RequireDateAdjust\":\"30000\","
+ "\"RequireAuthentication\":\"32\",\"RequireSerialValidation\":\"1.0.0.0.0.255\"},"
+ "\"type\":\"PROFILE\",\"id\":0,\"control\":\"NO_REPEAT\",\"isEnabled\":true}";
public static String getOperationDefinition(String subtypeId, String operationCode) {
String operationDefinition = "{ \"subTypeId\": "+subtypeId+", \"deviceType\": \"METER\", " +
" \"maxAttempts\": 1, \"registerTransaction\": { " +
" \"globalRegName\": \"CSRQ_RL\", \"register\": \"0.0.96.3.10.255\", " +
" \"attributeIndex\": 2, \"classId\": 70, " +
" \"status\": \"PENDING\", \"receivedTimeStamp\": 0, " +
" \"isWriteOut\": false, \"isProfileRegister\": false, " +
" \"remoteMethod\": { \"index\": 2, \"data\": 0.0, " +
" \"type\": \"INT8\" \t\t},\t\t\"registers\": [\"0.0.0_0\"," +
" \"0.9.0_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*01_0\", \"9.6.0_0\", " +
"\"10.6.0*01_0\", \"10.6.0_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\"], " +
" \"attemptCount\": 1, \"transportMode\": \"NET_ONLY\", " +
" \"hasPermanentError\": false, \"tryToReachViaSMS\": false, " +
" \"waitingTime\": 0, \"code\": \"BILLING_REGISTERS_RETRIEVE\", " +
" \"properties\": { \"RequireDateAdjust\": \"30000\", " +
" \"RequireAuthentication\": \"32\", \"RequireSerialValidation\": \"1.0.0.0.0.255\" }," +
" \"type\": \"PROFILE\", \"id\": 0, \"control\": \"NO_REPEAT\", " +
"\"isEnabled\": true}";
return operationDefinition;
}

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,18 +1,17 @@
/*
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.
* 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
*
* https://entgra.io/licenses/entgra-commercial/1.0
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

@ -1,19 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
~ Copyright (c) 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) 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.
~ 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
~
~ https://entgra.io/licenses/entgra-commercial/1.0
~ 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
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->

@ -797,4 +797,18 @@ CREATE TABLE IF NOT EXISTS DM_TRACCAR_UNSYNCED_DEVICES (
-- END OF DM_TRACCAR_UNSYNCED_DEVICES TABLE --
-- SUB_OPERATION_TEMPLATE TABLE--
--TODO: Need to add SUB_OPERATION_TEMPLATE
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SUB_OPERATION_TEMPLATE]') AND TYPE IN (N'U'))
CREATE TABLE SUB_OPERATION_TEMPLATE (
SUB_OPERATION_TEMPLATE_ID INTEGER IDENTITY(1,1),
OPERATION_DEFINITION VARCHAR(MAX) NOT NULL,
OPERATION_CODE varchar(100) NOT NULL,
SUB_TYPE_ID VARCHAR(45) NOT NULL,
DEVICE_TYPE VARCHAR(25) NOT NULL,
CREATE_TIMESTAMP BIGINT NULL DEFAULT NULL,
UPDATE_TIMESTAMP BIGINT NULL DEFAULT NULL,
PRIMARY KEY (SUB_OPERATION_TEMPLATE_ID),
UNIQUE (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)
);
-- END SUB_OPERATION_TEMPLATE TABLE--

@ -879,7 +879,7 @@ CREATE TABLE SUB_OPERATION_TEMPLATE (
SUB_OPERATION_TEMPLATE_ID int NOT NULL AUTO_INCREMENT,
OPERATION_DEFINITION json NOT NULL,
OPERATION_CODE varchar(100) NOT NULL,
SUB_TYPE_ID int NOT NULL,
SUB_TYPE_ID VARCHAR(45) NOT NULL,
DEVICE_TYPE VARCHAR(25) NOT NULL,
CREATE_TIMESTAMP timestamp NULL DEFAULT NULL,
UPDATE_TIMESTAMP timestamp NULL DEFAULT NULL,

@ -1144,4 +1144,27 @@ CREATE TABLE DM_TRACCAR_UNSYNCED_DEVICES (
-- END OF DM_TRACCAR_UNSYNCED_DEVICES TABLE --
-- SUB_OPERATION_TEMPLATE TABLE--
--TODO: Need to add SUB_OPERATION_TEMPLATE
CREATE TABLE SUB_OPERATION_TEMPLATE (
SUB_OPERATION_TEMPLATE_ID NUMBER(10) NOT NULL,
OPERATION_DEFINITION CLOB NOT NULL,
OPERATION_CODE varchar(100) NOT NULL,
SUB_TYPE_ID VARCHAR(45) NOT NULL,
DEVICE_TYPE VARCHAR(25) NOT NULL,
CREATE_TIMESTAMP TIMESTAMP (2) NOT NULL,
UPDATE_TIMESTAMP TIMESTAMP (2) NOT NULL,
UNIQUE (SUB_TYPE_ID, OPERATION_CODE, DEVICE_TYPE)
);
ALTER TABLE SUB_OPERATION_TEMPLATE
ADD 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);
ALTER TABLE SUB_OPERATION_TEMPLATE
ADD (
CONSTRAINT SUB_OPERATION_TEMPLATE_PK PRIMARY KEY (SUB_OPERATION_TEMPLATE_ID)
);
-- Generate ID using sequence and trigger
CREATE SEQUENCE SUB_OPERATION_TEMPLATE_seq START WITH 1 INCREMENT BY 1;
-- END OF SUB_OPERATION_TEMPLATE TABLE--

@ -798,4 +798,22 @@ CREATE TABLE IF NOT EXISTS DM_TRACCAR_UNSYNCED_DEVICES (
-- END OF DM_TRACCAR_UNSYNCED_DEVICES TABLE --
-- SUB_OPERATION_TEMPLATE TABLE--
--TODO: Need to add SUB_OPERATION_TEMPLATE
CREATE SEQUENCE SUB_OPERATION_TEMPLATE_seq;
CREATE TABLE SUB_OPERATION_TEMPLATE (
SUB_OPERATION_TEMPLATE_ID INTEGER DEFAULT NEXTVAL ('SUB_OPERATION_TEMPLATE_seq') NOT NULL,
OPERATION_DEFINITION json NOT NULL,
OPERATION_CODE varchar(100) NOT NULL,
SUB_TYPE_ID VARCHAR(45) 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),
CONSTRAINT SUB_TYPE_ID_OPERATION_CODE_DEVICE_TYPE UNIQUE (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)
);
-- END OF SUB_OPERATION_TEMPLATE TABLE--

Loading…
Cancel
Save