add version changes and modifications

master
Thameera 2 years ago
parent 800fa4fb9a
commit f92e766856

@ -23,7 +23,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>operation-template-mgt</artifactId>
<version>5.0.20-SNAPSHOT</version>
<version>5.0.21-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -36,5 +36,4 @@ public interface OperationTemplateDAO {
void deleteOperationTemplate(int subTypeId, String deviceCode, String operationCode) throws OperationTemplateManagementDAOException;
boolean isExistsOperationTemplateBySubtypeIdAndOperationCode(int subTypeId, String deviceType, String operationCode) throws OperationTemplateManagementDAOException;
}

@ -180,41 +180,4 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
throw new OperationTemplateManagementDAOException(msg, e);
}
}
/**
* @param subTypeId
* @param deviceType
* @param operationCode
* @return
* @throws OperationTemplateManagementDAOException
*/
@Override
public boolean isExistsOperationTemplateBySubtypeIdAndOperationCode(int 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(2, deviceType);
stmt.setString(3, operationCode);
try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
return true;
}
return false;
}
} catch (SQLException e) {
String msg = "Error occurred while loading operation template.";
log.error(e.getMessage());
throw new OperationTemplateManagementDAOException(msg, e);
}
} catch (DBConnectionException e) {
String msg = "Error occurred while obtaining DB connection to loading operation template.";
log.error(msg);
throw new OperationTemplateManagementDAOException(msg, e);
}
}
}

@ -21,9 +21,9 @@ package io.entgra.device.mgt.operation.template.dto;
public class OperationTemplateCacheKey {
int subTypeId;
String deviceType;
String operationCode;
private int subTypeId;
private String deviceType;
private String operationCode;
public int getSubTypeId() {
return subTypeId;

@ -50,13 +50,13 @@ public class ServiceNegativeTest extends BaseOperationTemplatePluginTest {
@Test(description = "This method tests Add Operation template under negative circumstances while missing " +
"required fields",
expectedExceptions = {OperationTemplateMgtPluginException.class},
expectedExceptionsMessageRegExp = "Error occurred while processing insert operation template.")
expectedExceptionsMessageRegExp = "Invalid meter device subtype id: 0")
public void testAddOperationTemplates() throws OperationTemplateMgtPluginException {
OperationTemplate operationTemplate = new OperationTemplate();
operationTemplate.setDeviceType(TestUtils.deviceType);
operationTemplate.setCode(TestUtils.operationCode);
operationTemplate.setSubTypeId(1000);
operationTemplate.setSubTypeId(0);
operationTemplate.setOperationDefinition(TestUtils.getOperationDefinition(TestUtils.subtypeId, TestUtils.operationCode));
operationTemplateService.addOperationTemplate(operationTemplate);
}

@ -23,7 +23,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>5.0.20-SNAPSHOT</version>
<version>5.0.21-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -24,7 +24,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>5.0.20-SNAPSHOT</version>
<version>5.0.21-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

@ -24,7 +24,7 @@
<parent>
<artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>5.0.20-SNAPSHOT</version>
<version>5.0.21-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Loading…
Cancel
Save