EventFacadeEjb implements EventFacade { @Override public void archiveOrDearchiveEvent(String eventUuid, boolean archive) { Event event = eventService.getByUuid(eventUuid); event.setArchived(archive); eventService.ensurePersisted(event); }  @Override List<String> getAllActiveUuids(); @Override List<EventDto> getAllActiveEventsAfter(Date date); @Override List<EventDto> getByUuids(List<String> uuids); @Override List<String> getDeletedUuidsSince(Date since); @Override List<DashboardEventDto> getNewEventsForDashboard(EventCriteria eventCriteria); Map<Disease, Long> getEventCountByDisease(EventCriteria eventCriteria); Map<EventStatus, Long> getEventCountByStatus(EventCriteria eventCriteria); @Override EventDto getEventByUuid(String uuid); @Override EventReferenceDto getReferenceByUuid(String uuid); @Override EventDto saveEvent(EventDto dto); @Override void deleteEvent(String eventUuid); @Override long count(EventCriteria eventCriteria); @Override List<EventIndexDto> getIndexList(EventCriteria eventCriteria, Integer first, Integer max, List<SortProperty> sortProperties); @Override List<EventExportDto> getExportList(EventCriteria eventCriteria, Integer first, Integer max); @Override boolean isArchived(String eventUuid); @Override boolean isDeleted(String eventUuid); @Override void archiveOrDearchiveEvent(String eventUuid, boolean archive); @Override List<String> getArchivedUuidsSince(Date since); Event fromDto(@NotNull EventDto source); EventDto convertToDto(Event source, Pseudonymizer pseudonymizer); static EventReferenceDto toReferenceDto(Event entity); static EventDto toDto(Event source); @Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) void archiveAllArchivableEvents(int daysAfterEventGetsArchived); @Override boolean exists(String uuid); @Override String getUuidByCaseUuidOrPersonUuid(String searchTerm); Boolean isEventEditAllowed(String eventUuid);  }
@Test public void testArchiveOrDearchiveEvent() { RDCF rdcf = creator.createRDCF("Region", "District", "Community", "Facility"); UserDto user = creator .createUser(rdcf.region.getUuid(), rdcf.district.getUuid(), rdcf.facility.getUuid(), "Surv", "Sup", UserRole.SURVEILLANCE_SUPERVISOR); EventDto event = creator.createEvent( EventStatus.SIGNAL, "Title", "Description", "First", "Name", "12345", TypeOfPlace.PUBLIC_PLACE, DateHelper.subtractDays(new Date(), 1), new Date(), user.toReference(), user.toReference(), Disease.EVD, rdcf.district); PersonDto eventPerson = creator.createPerson("Event", "Person"); creator.createEventParticipant(event.toReference(), eventPerson, "Description", user.toReference()); Date testStartDate = new Date(); assertEquals(1, getEventFacade().getAllActiveEventsAfter(null).size()); assertEquals(1, getEventFacade().getAllActiveUuids().size()); assertEquals(1, getEventParticipantFacade().getAllActiveEventParticipantsAfter(null).size()); assertEquals(1, getEventParticipantFacade().getAllActiveUuids().size()); getEventFacade().archiveOrDearchiveEvent(event.getUuid(), true); assertEquals(0, getEventFacade().getAllActiveEventsAfter(null).size()); assertEquals(0, getEventFacade().getAllActiveUuids().size()); assertEquals(0, getEventParticipantFacade().getAllActiveEventParticipantsAfter(null).size()); assertEquals(0, getEventParticipantFacade().getAllActiveUuids().size()); assertEquals(1, getEventFacade().getArchivedUuidsSince(testStartDate).size()); getEventFacade().archiveOrDearchiveEvent(event.getUuid(), false); assertEquals(1, getEventFacade().getAllActiveEventsAfter(null).size()); assertEquals(1, getEventFacade().getAllActiveUuids().size()); assertEquals(1, getEventParticipantFacade().getAllActiveEventParticipantsAfter(null).size()); assertEquals(1, getEventParticipantFacade().getAllActiveUuids().size()); assertEquals(0, getEventFacade().getArchivedUuidsSince(testStartDate).size()); }