Commit ca3be149 authored by Enriko Käsper's avatar Enriko Käsper
Browse files

TEIS-395: fix NPE.

parent 6bb5af3c
......@@ -10,6 +10,8 @@ import ee.sm.ti.teis.types.enums.ObjectStatus;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import static java.util.Optional.ofNullable;
@Component
public class OfficialsGroupMsListener {
......@@ -22,7 +24,8 @@ public class OfficialsGroupMsListener {
@RabbitListener(queues = {QueueConfig.MS_OFFICIALS_GROUPS_QUEUE})
public OfficialsGroupsDomainResponse findOfficialsGroups(QueueConfig.OfficialUserGroupDomainRequest request) {
ObjectStatus status = service.validateAndAssignDefaultStatus(request.getPayload().getObjectStatus().name());
ObjectStatus status = service.validateAndAssignDefaultStatus(
ofNullable(request.getPayload().getObjectStatus()).map(t -> t.name()).orElse(null));
OfficialsGroupEntity entity = service.findGroupByIdAndStatus(request.getPayload().getId(), status);
OfficialsGroupsDomainResponse response = new OfficialsGroupsDomainResponse();
response.setPayload(service.composeDomainDtoFromEntity(entity), request.getRequestMetaDTO());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment