added mobile app bundle to queue.proto

This commit is contained in:
dashevchenko 2024-10-31 14:58:47 +02:00
parent f42aa71020
commit 9c9d6d95d4
7 changed files with 23 additions and 6 deletions

View File

@ -74,6 +74,7 @@ import org.thingsboard.server.dao.edge.EdgeService;
import org.thingsboard.server.dao.entity.EntityService; import org.thingsboard.server.dao.entity.EntityService;
import org.thingsboard.server.dao.entityview.EntityViewService; import org.thingsboard.server.dao.entityview.EntityViewService;
import org.thingsboard.server.dao.event.EventService; import org.thingsboard.server.dao.event.EventService;
import org.thingsboard.server.dao.mobile.MobileAppBundleService;
import org.thingsboard.server.dao.mobile.MobileAppService; import org.thingsboard.server.dao.mobile.MobileAppService;
import org.thingsboard.server.dao.nosql.CassandraBufferedRateReadExecutor; import org.thingsboard.server.dao.nosql.CassandraBufferedRateReadExecutor;
import org.thingsboard.server.dao.nosql.CassandraBufferedRateWriteExecutor; import org.thingsboard.server.dao.nosql.CassandraBufferedRateWriteExecutor;
@ -385,6 +386,10 @@ public class ActorSystemContext {
@Getter @Getter
private MobileAppService mobileAppService; private MobileAppService mobileAppService;
@Autowired
@Getter
private MobileAppBundleService mobileAppBundleService;
@Autowired @Autowired
@Getter @Getter
private SlackService slackService; private SlackService slackService;

View File

@ -89,6 +89,7 @@ import org.thingsboard.server.dao.edge.EdgeService;
import org.thingsboard.server.dao.entity.EntityService; import org.thingsboard.server.dao.entity.EntityService;
import org.thingsboard.server.dao.entityview.EntityViewService; import org.thingsboard.server.dao.entityview.EntityViewService;
import org.thingsboard.server.dao.event.EventService; import org.thingsboard.server.dao.event.EventService;
import org.thingsboard.server.dao.mobile.MobileAppBundleService;
import org.thingsboard.server.dao.mobile.MobileAppService; import org.thingsboard.server.dao.mobile.MobileAppService;
import org.thingsboard.server.dao.nosql.CassandraStatementTask; import org.thingsboard.server.dao.nosql.CassandraStatementTask;
import org.thingsboard.server.dao.nosql.TbResultSetFuture; import org.thingsboard.server.dao.nosql.TbResultSetFuture;
@ -843,6 +844,11 @@ class DefaultTbContext implements TbContext {
return mainCtx.getMobileAppService(); return mainCtx.getMobileAppService();
} }
@Override
public MobileAppBundleService getMobileAppBundleService() {
return mainCtx.getMobileAppBundleService();
}
@Override @Override
public SlackService getSlackService() { public SlackService getSlackService() {
return mainCtx.getSlackService(); return mainCtx.getSlackService();

View File

@ -18,6 +18,7 @@ package org.thingsboard.server.common.data.mobile.qrCodeSettings;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.thingsboard.server.common.data.BaseData; import org.thingsboard.server.common.data.BaseData;
@ -37,12 +38,13 @@ public class QrCodeSettings extends BaseData<QrCodeSettingsId> implements HasTen
private TenantId tenantId; private TenantId tenantId;
@Schema(description = "Use settings from system level", example = "true") @Schema(description = "Use settings from system level", example = "true")
private boolean useSystemSettings; private boolean useSystemSettings;
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Type of application: true means use default Thingsboard app", example = "true") @Schema(description = "Type of application: true means use default Thingsboard app", example = "true")
private boolean useDefaultApp; private boolean useDefaultApp;
@Schema(description = "Mobile app bundle.") @Schema(description = "Mobile app bundle.")
private MobileAppBundleId mobileAppBundleId; private MobileAppBundleId mobileAppBundleId;
@Valid
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "QR code config configuration.") @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "QR code config configuration.")
@Valid
@NotNull
private QRCodeConfig qrCodeConfig; private QRCodeConfig qrCodeConfig;
@Schema(description = "Indicates if google play link is available", example = "true") @Schema(description = "Indicates if google play link is available", example = "true")
private boolean androidEnabled; private boolean androidEnabled;

View File

@ -58,6 +58,7 @@ enum EntityTypeProto {
OAUTH2_CLIENT = 35; OAUTH2_CLIENT = 35;
DOMAIN = 36; DOMAIN = 36;
MOBILE_APP = 37; MOBILE_APP = 37;
MOBILE_APP_BUNDLE = 38;
} }
/** /**

View File

@ -39,7 +39,6 @@ public class QrCodeSettingsDataValidator extends DataValidator<QrCodeSettings> {
@Override @Override
protected void validateDataImpl(TenantId tenantId, QrCodeSettings qrCodeSettings) { protected void validateDataImpl(TenantId tenantId, QrCodeSettings qrCodeSettings) {
MobileAppBundleId mobileAppBundleId = qrCodeSettings.getMobileAppBundleId(); MobileAppBundleId mobileAppBundleId = qrCodeSettings.getMobileAppBundleId();
QRCodeConfig qrCodeConfig = qrCodeSettings.getQrCodeConfig();
if (!qrCodeSettings.isUseDefaultApp() && (mobileAppBundleId == null)) { if (!qrCodeSettings.isUseDefaultApp() && (mobileAppBundleId == null)) {
throw new DataValidationException("Mobile app bundle is required to use custom application!"); throw new DataValidationException("Mobile app bundle is required to use custom application!");
} }
@ -56,8 +55,5 @@ public class QrCodeSettingsDataValidator extends DataValidator<QrCodeSettings> {
throw new DataValidationException("IOS app store info is empty! "); throw new DataValidationException("IOS app store info is empty! ");
} }
} }
if (qrCodeConfig == null) {
throw new DataValidationException("Qr code configuration is required!");
}
} }
} }

View File

@ -61,6 +61,7 @@ import org.thingsboard.server.dao.edge.EdgeService;
import org.thingsboard.server.dao.entity.EntityService; import org.thingsboard.server.dao.entity.EntityService;
import org.thingsboard.server.dao.entityview.EntityViewService; import org.thingsboard.server.dao.entityview.EntityViewService;
import org.thingsboard.server.dao.event.EventService; import org.thingsboard.server.dao.event.EventService;
import org.thingsboard.server.dao.mobile.MobileAppBundleService;
import org.thingsboard.server.dao.mobile.MobileAppService; import org.thingsboard.server.dao.mobile.MobileAppService;
import org.thingsboard.server.dao.nosql.CassandraStatementTask; import org.thingsboard.server.dao.nosql.CassandraStatementTask;
import org.thingsboard.server.dao.nosql.TbResultSetFuture; import org.thingsboard.server.dao.nosql.TbResultSetFuture;
@ -355,6 +356,8 @@ public interface TbContext {
MobileAppService getMobileAppService(); MobileAppService getMobileAppService();
MobileAppBundleService getMobileAppBundleService();
SlackService getSlackService(); SlackService getSlackService();
boolean isExternalNodeForceAck(); boolean isExternalNodeForceAck();

View File

@ -30,6 +30,7 @@ import org.thingsboard.server.common.data.id.DomainId;
import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.EdgeId;
import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.EntityViewId; import org.thingsboard.server.common.data.id.EntityViewId;
import org.thingsboard.server.common.data.id.MobileAppBundleId;
import org.thingsboard.server.common.data.id.MobileAppId; import org.thingsboard.server.common.data.id.MobileAppId;
import org.thingsboard.server.common.data.id.NotificationRequestId; import org.thingsboard.server.common.data.id.NotificationRequestId;
import org.thingsboard.server.common.data.id.NotificationRuleId; import org.thingsboard.server.common.data.id.NotificationRuleId;
@ -157,6 +158,9 @@ public class TenantIdLoader {
case MOBILE_APP: case MOBILE_APP:
tenantEntity = ctx.getMobileAppService().findMobileAppById(ctxTenantId, new MobileAppId(id)); tenantEntity = ctx.getMobileAppService().findMobileAppById(ctxTenantId, new MobileAppId(id));
break; break;
case MOBILE_APP_BUNDLE:
tenantEntity = ctx.getMobileAppBundleService().findMobileAppBundleById(ctxTenantId, new MobileAppBundleId(id));
break;
default: default:
throw new RuntimeException("Unexpected entity type: " + entityId.getEntityType()); throw new RuntimeException("Unexpected entity type: " + entityId.getEntityType());
} }