WithUser refactoring (#2944)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2026-02-27 14:30:52 +02:00
committed by GitHub
parent 5d043b2766
commit b38df5b512
11 changed files with 66 additions and 51 deletions

View File

@@ -119,7 +119,12 @@ public final class VHost extends DmfSender implements MessageListener {
}
}
protected void handleAttributeUpdateRequest(final Message message, final String controllerId) {
void stop() {
container.stop();
rabbitTemplate.destroy();
}
private void handleAttributeUpdateRequest(final Message message, final String controllerId) {
final String tenantId = getTenant(message);
Optional.ofNullable(dmfTenants.get(tenantId))
.flatMap(dmfTenant -> dmfTenant.getController(controllerId))
@@ -127,12 +132,12 @@ public final class VHost extends DmfSender implements MessageListener {
updateAttributes(tenantId, controllerId, DmfUpdateMode.MERGE, controller.getAttributes()));
}
protected void handleCancelDownloadAction(final Message message, final String thingId) {
private void handleCancelDownloadAction(final Message message, final String thingId) {
final Long actionId = extractActionIdFrom(message);
processCancelDownloadAction(thingId, actionId);
}
protected void handleUpdateProcess(final Message message, final String controllerId, final EventTopic actionType) {
private void handleUpdateProcess(final Message message, final String controllerId, final EventTopic actionType) {
final String tenant = getTenant(message);
final DmfDownloadAndUpdateRequest downloadAndUpdateRequest = convertMessage(message,
DmfDownloadAndUpdateRequest.class);
@@ -141,11 +146,6 @@ public final class VHost extends DmfSender implements MessageListener {
processUpdate(tenant, controllerId, actionType, downloadAndUpdateRequest);
}
void stop() {
container.stop();
rabbitTemplate.destroy();
}
private static String getTenant(final Message message) {
final MessageProperties messageProperties = message.getMessageProperties();
final Map<String, Object> headers = messageProperties.getHeaders();
@@ -252,9 +252,9 @@ public final class VHost extends DmfSender implements MessageListener {
openActions.remove(actionId);
}
private void processUpdate(final String tenantId, final String controllerId, final EventTopic actionType,
private void processUpdate(final String tenant, final String controllerId, final EventTopic actionType,
final DmfDownloadAndUpdateRequest updateRequest) {
Optional.ofNullable(dmfTenants.get(tenantId))
Optional.ofNullable(dmfTenants.get(tenant))
.flatMap(dmfTenant -> dmfTenant.getController(controllerId))
.ifPresent(controller -> controller.processUpdate(actionType, updateRequest));
}