/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2025 Nordix Foundation.
+ * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
for (var element : instance.getElements()) {
var jpa = new JpaMessage();
jpa.setIdentificationId(instance.getAutomationCompositionId().toString());
+ jpa.setLastMsg(Timestamp.from(message.getTimestamp()));
var doc = from(message);
doc.setInstanceId(instance.getAutomationCompositionId());
doc.setUseState(element.getUseState());
if (elementState != null && elementState.getParticipantId().equals(message.getParticipantId())) {
var jpa = new JpaMessage();
jpa.setIdentificationId(message.getCompositionId().toString());
+ jpa.setLastMsg(Timestamp.from(message.getTimestamp()));
var doc = from(message);
doc.setOutProperties(element.getOutProperties());
doc.setAcElementDefinitionId(element.getAcElementDefinitionId());
@Transactional(readOnly = true)
public List<DocMessage> getAllMessages(UUID identificationId) {
- var result = messageRepository.findByIdentificationIdOrderByLastMsgDesc(identificationId.toString());
+ var result = messageRepository.findByIdentificationIdOrderByLastMsgAsc(identificationId.toString());
return result.stream().map(JpaMessage::toAuthorative).toList();
}
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2025 Nordix Foundation.
+ * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public interface MessageRepository extends JpaRepository<JpaMessage, String> {
- List<JpaMessage> findByIdentificationIdOrderByLastMsgDesc(String identificationId);
+ List<JpaMessage> findByIdentificationIdOrderByLastMsgAsc(String identificationId);
}
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2025 Nordix Foundation.
+ * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
var messageRepository = mock(MessageRepository.class);
var instanceId = UUID.randomUUID();
var jpaMessage = new JpaMessage();
- when(messageRepository.findByIdentificationIdOrderByLastMsgDesc(instanceId.toString()))
+ when(messageRepository.findByIdentificationIdOrderByLastMsgAsc(instanceId.toString()))
.thenReturn(List.of(jpaMessage));
var messageProvider = new MessageProvider(messageRepository, mock(MessageJobRepository.class));
var result = messageProvider.getAllMessages(instanceId);