diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/util/DAOUtil.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/util/DAOUtil.java index f4569c6c36..3a1aa6fa67 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/util/DAOUtil.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/util/DAOUtil.java @@ -72,7 +72,7 @@ public class DAOUtil { deviceSubType = loadDeviceSubType(rs); } if (operationCode != null) { - deviceSubType.addOperationCode(operationCode); + deviceSubType.addSupportedOperation(operationCode); } deviceSubTypes.put(key, deviceSubType); } diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dto/DeviceSubType.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dto/DeviceSubType.java index cc27bb592e..e52ed3dbd0 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dto/DeviceSubType.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dto/DeviceSubType.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.core.JsonProcessingException; import java.util.HashSet; import java.util.Set; - public abstract class DeviceSubType { private String subTypeId; @@ -32,22 +31,22 @@ public abstract class DeviceSubType { private String deviceType; private String subTypeName; private String typeDefinition; - private Set operationCodes = new HashSet<>(); + private final Set supportedOperations = new HashSet<>(); + public DeviceSubType() { } - public DeviceSubType(String subTypeId, int tenantId, String deviceType, String subTypeName, String typeDefinition, - Set operationCodes) { + public DeviceSubType(String subTypeId, int tenantId, String deviceType, + String subTypeName, String typeDefinition, + Set supportedOperations) { this.subTypeId = subTypeId; this.tenantId = tenantId; this.deviceType = deviceType; this.subTypeName = subTypeName; this.typeDefinition = typeDefinition; - if (operationCodes != null || !operationCodes.isEmpty()) { - this.operationCodes.addAll(operationCodes); + if (supportedOperations != null && !supportedOperations.isEmpty()) { + this.supportedOperations.addAll(supportedOperations); } - - } public String getSubTypeId() { @@ -94,10 +93,16 @@ public abstract class DeviceSubType { public abstract String parseSubTypeToJson() throws JsonProcessingException; - public void addOperationCode(String code) { - operationCodes.add(code); + public void setSupportedOperations(Set supportedOperations) { + this.supportedOperations.addAll(supportedOperations); } - public Set getOperationCodes() { - return operationCodes; + + public void addSupportedOperation(String code) { + supportedOperations.add(code); } + + public Set getSupportedOperations() { + return supportedOperations; + } + }