View Javadoc
1   package de.dlr.shepard.labJournal.dao;
2   
3   import de.dlr.shepard.labJournal.entities.LabJournalEntry;
4   import de.dlr.shepard.neo4Core.dao.GenericDAO;
5   import de.dlr.shepard.neo4Core.entities.User;
6   import jakarta.enterprise.context.RequestScoped;
7   import java.util.Date;
8   import java.util.List;
9   
10  @RequestScoped
11  public class LabJournalEntryDAO extends GenericDAO<LabJournalEntry> {
12  
13    @Override
14    public Class<LabJournalEntry> getEntityType() {
15      return LabJournalEntry.class;
16    }
17  
18    public boolean deleteLabJournalEntry(long id, User user, Date updatedAt) {
19      LabJournalEntry labJournalEntry = findByNeo4jId(id);
20      if (null == labJournalEntry) return false;
21      labJournalEntry.setUpdatedAt(updatedAt);
22      labJournalEntry.setUpdatedBy(user);
23      labJournalEntry.setDeleted(true);
24      createOrUpdate(labJournalEntry);
25      return true;
26    }
27  
28    public List<LabJournalEntry> findLabJournalEntriesByIds(List<Long> ids) {
29      return List.copyOf(session.loadAll(getEntityType(), ids));
30    }
31  }