Browse Source

Bug fixes and no more tenant id in the git repo

pull/6730/head
Andrii Shvaika 4 years ago
parent
commit
6579807bb6
  1. 4
      application/src/main/java/org/thingsboard/server/service/sync/ie/exporting/impl/DefaultEntityExportService.java
  2. 5
      application/src/main/java/org/thingsboard/server/service/sync/ie/exporting/impl/DeviceExportService.java
  3. 3
      application/src/main/java/org/thingsboard/server/service/sync/vc/DefaultEntitiesVersionControlService.java
  4. 3
      common/data/src/main/java/org/thingsboard/server/common/data/ExportableEntity.java

4
application/src/main/java/org/thingsboard/server/service/sync/ie/exporting/impl/DefaultEntityExportService.java

@ -70,11 +70,13 @@ public class DefaultEntityExportService<I extends EntityId, E extends Exportable
throw new IllegalArgumentException(entityId.getEntityType() + " [" + entityId.getId() + "] not found");
}
entity.setId(entity.getExternalId() != null ? entity.getExternalId() : entity.getId());
exportData.setEntity(entity);
exportData.setEntityType(entityId.getEntityType());
setAdditionalExportData(ctx, entity, exportData);
entity.setId(entity.getExternalId() != null ? entity.getExternalId() : entity.getId());
entity.setTenantId(null);
return exportData;
}

5
application/src/main/java/org/thingsboard/server/service/sync/ie/exporting/impl/DeviceExportService.java

@ -41,7 +41,10 @@ public class DeviceExportService extends BaseEntityExportService<DeviceId, Devic
device.setCustomerId(getExternalIdOrElseInternal(ctx, device.getCustomerId()));
device.setDeviceProfileId(getExternalIdOrElseInternal(ctx, device.getDeviceProfileId()));
if (ctx.getSettings().isExportCredentials()) {
exportData.setCredentials(deviceCredentialsService.findDeviceCredentialsByDeviceId(ctx.getTenantId(), device.getId()));
var credentials = deviceCredentialsService.findDeviceCredentialsByDeviceId(ctx.getTenantId(), device.getId());
credentials.setId(null);
credentials.setDeviceId(null);
exportData.setCredentials(credentials);
}
}

3
application/src/main/java/org/thingsboard/server/service/sync/vc/DefaultEntitiesVersionControlService.java

@ -244,6 +244,9 @@ public class DefaultEntitiesVersionControlService implements EntitiesVersionCont
return result;
} catch (LoadEntityException e) {
return onError(e.getData(), e.getCause());
} catch (Exception e) {
log.info("[{}] Failed to process request [{}] due to: ", user.getTenantId(), request, e);
throw e;
}
}

3
common/data/src/main/java/org/thingsboard/server/common/data/ExportableEntity.java

@ -17,6 +17,7 @@ package org.thingsboard.server.common.data;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.HasId;
import org.thingsboard.server.common.data.id.TenantId;
public interface ExportableEntity<I extends EntityId> extends HasId<I>, HasName {
@ -28,4 +29,6 @@ public interface ExportableEntity<I extends EntityId> extends HasId<I>, HasName
long getCreatedTime();
void setCreatedTime(long createdTime);
void setTenantId(TenantId tenantId);
}

Loading…
Cancel
Save