mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
add version changes and modifications
This commit is contained in:
parent
800fa4fb9a
commit
f92e766856
@ -23,7 +23,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>operation-template-mgt</artifactId>
|
<artifactId>operation-template-mgt</artifactId>
|
||||||
<version>5.0.20-SNAPSHOT</version>
|
<version>5.0.21-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -36,5 +36,4 @@ public interface OperationTemplateDAO {
|
|||||||
|
|
||||||
void deleteOperationTemplate(int subTypeId, String deviceCode, String operationCode) throws OperationTemplateManagementDAOException;
|
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);
|
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 {
|
public class OperationTemplateCacheKey {
|
||||||
|
|
||||||
int subTypeId;
|
private int subTypeId;
|
||||||
String deviceType;
|
private String deviceType;
|
||||||
String operationCode;
|
private String operationCode;
|
||||||
|
|
||||||
public int getSubTypeId() {
|
public int getSubTypeId() {
|
||||||
return subTypeId;
|
return subTypeId;
|
||||||
|
|||||||
@ -50,13 +50,13 @@ public class ServiceNegativeTest extends BaseOperationTemplatePluginTest {
|
|||||||
@Test(description = "This method tests Add Operation template under negative circumstances while missing " +
|
@Test(description = "This method tests Add Operation template under negative circumstances while missing " +
|
||||||
"required fields",
|
"required fields",
|
||||||
expectedExceptions = {OperationTemplateMgtPluginException.class},
|
expectedExceptions = {OperationTemplateMgtPluginException.class},
|
||||||
expectedExceptionsMessageRegExp = "Error occurred while processing insert operation template.")
|
expectedExceptionsMessageRegExp = "Invalid meter device subtype id: 0")
|
||||||
public void testAddOperationTemplates() throws OperationTemplateMgtPluginException {
|
public void testAddOperationTemplates() throws OperationTemplateMgtPluginException {
|
||||||
|
|
||||||
OperationTemplate operationTemplate = new OperationTemplate();
|
OperationTemplate operationTemplate = new OperationTemplate();
|
||||||
operationTemplate.setDeviceType(TestUtils.deviceType);
|
operationTemplate.setDeviceType(TestUtils.deviceType);
|
||||||
operationTemplate.setCode(TestUtils.operationCode);
|
operationTemplate.setCode(TestUtils.operationCode);
|
||||||
operationTemplate.setSubTypeId(1000);
|
operationTemplate.setSubTypeId(0);
|
||||||
operationTemplate.setOperationDefinition(TestUtils.getOperationDefinition(TestUtils.subtypeId, TestUtils.operationCode));
|
operationTemplate.setOperationDefinition(TestUtils.getOperationDefinition(TestUtils.subtypeId, TestUtils.operationCode));
|
||||||
operationTemplateService.addOperationTemplate(operationTemplate);
|
operationTemplateService.addOperationTemplate(operationTemplate);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<version>5.0.20-SNAPSHOT</version>
|
<version>5.0.21-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<version>5.0.20-SNAPSHOT</version>
|
<version>5.0.21-SNAPSHOT</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<version>5.0.20-SNAPSHOT</version>
|
<version>5.0.21-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user