diff --git a/dao/src/main/java/org/thingsboard/server/dao/service/Validator.java b/dao/src/main/java/org/thingsboard/server/dao/service/Validator.java
index 16454e5914..b3a121baf6 100644
--- a/dao/src/main/java/org/thingsboard/server/dao/service/Validator.java
+++ b/dao/src/main/java/org/thingsboard/server/dao/service/Validator.java
@@ -47,6 +47,19 @@ public class Validator {
}
}
+ /**
+ * This method validate EntityId entity id. If entity id is invalid than throw
+ * IncorrectParameterException exception
+ *
+ * @param entityId the entityId
+ * @param errorMessageFunction the error message for exception that apply entityId
+ */
+ public static void validateEntityId(EntityId entityId, Function errorMessageFunction) {
+ if (entityId == null || entityId.getId() == null) {
+ throw new IncorrectParameterException(errorMessageFunction.apply(entityId));
+ }
+ }
+
/**
* This method validate String string. If string is invalid than throw
* IncorrectParameterException exception