Commit 8adf36df authored by Raigo Ukkivi's avatar Raigo Ukkivi
Browse files

TEIS-343. Allow to find deleted group emtak codes.

parent 049a6af1
......@@ -100,7 +100,7 @@ public class OfficialsGroupEmtakService {
}
if (StringUtils.isNotBlank(request.getPayload().getOfficialsGroupId())) {
final UUID groupId = UUID.fromString(request.getPayload().getOfficialsGroupId());
groupService.findCurrentGroupById(groupId);
groupService.findGroupById(groupId);
}
if (StringUtils.isNotBlank(request.getPayload().getEmtak())) {
final String emtakClassifierCode = composeEmtakCode(request.getPayload().getEmtak());
......
......@@ -141,8 +141,7 @@ public class OfficialsGroupService {
@Transactional
public void delete(UUID groupId, RequestMetaDTO requestMetaDTO) {
OfficialsGroupEntity group = repository.findById(groupId)
.orElseThrow(() -> new TeisResourceNotFoundException(OFFICIALS_GROUP_NOT_FOUND_MESSAGE, List.of(groupId)));
OfficialsGroupEntity group = findGroupById(groupId);
if (group.getObjectStatus() == CURRENT) {
group.setObjectStatus(ObjectStatus.DELETED);
repository.save(group);
......@@ -156,6 +155,11 @@ public class OfficialsGroupService {
.orElseThrow(() -> new TeisResourceNotFoundException(OFFICIALS_GROUP_NOT_FOUND_MESSAGE, List.of(id)));
}
public OfficialsGroupEntity findGroupById(UUID id) {
return repository.findById(id)
.orElseThrow(() -> new TeisResourceNotFoundException(OFFICIALS_GROUP_NOT_FOUND_MESSAGE, List.of(id)));
}
@Transactional
public OfficialsGroupEntity updateGroup(OfficialsGroupDto dto, RequestMetaDTO requestMetaDTO) {
OfficialsGroupEntity group = findCurrentGroupById(dto.getId());
......
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