Add supported operations param to subtype

default-scope-updating-issue
Lasantha Dharmakeerthi 4 months ago
commit d1a9fbe67d

@ -72,7 +72,7 @@ public class DAOUtil {
deviceSubType = loadDeviceSubType(rs);
}
if (operationCode != null) {
deviceSubType.addOperationCode(operationCode);
deviceSubType.addSupportedOperation(operationCode);
}
deviceSubTypes.put(key, deviceSubType);
}

@ -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<String> operationCodes = new HashSet<>();
private final Set<String> supportedOperations = new HashSet<>();
public DeviceSubType() {
}
public DeviceSubType(String subTypeId, int tenantId, String deviceType, String subTypeName, String typeDefinition,
Set<String> operationCodes) {
public DeviceSubType(String subTypeId, int tenantId, String deviceType,
String subTypeName, String typeDefinition,
Set<String> 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<String> supportedOperations) {
this.supportedOperations.addAll(supportedOperations);
}
public Set<String> getOperationCodes() {
return operationCodes;
public void addSupportedOperation(String code) {
supportedOperations.add(code);
}
public Set<String> getSupportedOperations() {
return supportedOperations;
}
}

Loading…
Cancel
Save