|
|
|
@ -23,8 +23,6 @@ import jakarta.servlet.ServletOutputStream; |
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
import jakarta.validation.ConstraintViolation; |
|
|
|
import lombok.Getter; |
|
|
|
import org.apache.commons.lang3.exception.ExceptionUtils; |
|
|
|
import org.hibernate.exception.ConstraintViolationException; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
@ -92,6 +90,7 @@ import org.thingsboard.server.common.data.id.EntityId; |
|
|
|
import org.thingsboard.server.common.data.id.EntityIdFactory; |
|
|
|
import org.thingsboard.server.common.data.id.EntityViewId; |
|
|
|
import org.thingsboard.server.common.data.id.HasId; |
|
|
|
import org.thingsboard.server.common.data.id.JobId; |
|
|
|
import org.thingsboard.server.common.data.id.MobileAppBundleId; |
|
|
|
import org.thingsboard.server.common.data.id.MobileAppId; |
|
|
|
import org.thingsboard.server.common.data.id.NotificationTargetId; |
|
|
|
@ -108,6 +107,7 @@ import org.thingsboard.server.common.data.id.UUIDBased; |
|
|
|
import org.thingsboard.server.common.data.id.UserId; |
|
|
|
import org.thingsboard.server.common.data.id.WidgetTypeId; |
|
|
|
import org.thingsboard.server.common.data.id.WidgetsBundleId; |
|
|
|
import org.thingsboard.server.common.data.job.Job; |
|
|
|
import org.thingsboard.server.common.data.mobile.app.MobileApp; |
|
|
|
import org.thingsboard.server.common.data.mobile.bundle.MobileAppBundle; |
|
|
|
import org.thingsboard.server.common.data.notification.targets.NotificationTarget; |
|
|
|
@ -146,6 +146,7 @@ import org.thingsboard.server.dao.edge.EdgeService; |
|
|
|
import org.thingsboard.server.dao.entityview.EntityViewService; |
|
|
|
import org.thingsboard.server.dao.exception.DataValidationException; |
|
|
|
import org.thingsboard.server.dao.exception.IncorrectParameterException; |
|
|
|
import org.thingsboard.server.dao.job.JobService; |
|
|
|
import org.thingsboard.server.dao.mobile.MobileAppBundleService; |
|
|
|
import org.thingsboard.server.dao.mobile.MobileAppService; |
|
|
|
import org.thingsboard.server.dao.model.ModelConstants; |
|
|
|
@ -370,6 +371,9 @@ public abstract class BaseController { |
|
|
|
@Autowired |
|
|
|
protected NotificationTargetService notificationTargetService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
protected JobService jobService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
protected CalculatedFieldService calculatedFieldService; |
|
|
|
|
|
|
|
@ -825,6 +829,10 @@ public abstract class BaseController { |
|
|
|
return checkEntityId(notificationTargetId, notificationTargetService::findNotificationTargetById, operation); |
|
|
|
} |
|
|
|
|
|
|
|
Job checkJobId(JobId jobId, Operation operation) throws ThingsboardException { |
|
|
|
return checkEntityId(jobId, jobService::findJobById, operation); |
|
|
|
} |
|
|
|
|
|
|
|
protected <I extends EntityId> I emptyId(EntityType entityType) { |
|
|
|
return (I) EntityIdFactory.getByTypeAndUuid(entityType, ModelConstants.NULL_UUID); |
|
|
|
} |
|
|
|
|