// Path: spring-data-neo4j4-demo/src/main/java/org/springframework/data/neo4j/demo/data/AuditEntry.java
// @NodeEntity
// @Data
// public class AuditEntry {
//     @Relationship
//     private Set<AuditInfo> auditInfo;
//     @NotNull
//     private Date auditTime;
//     @NotNull
//     private String auditType;
//     @NotNull
//     private String eventType;
//     @GraphId
//     private Long id;
// 
//     public AuditEntry() {
//         this.auditInfo = new HashSet<AuditInfo>();
//     }
// 
//     public AuditEntry(Date auditTime, String auditType, String eventType) {
//         this.auditTime = auditTime;
//         this.auditType = auditType;
//         this.eventType = eventType;
//         this.auditInfo = new HashSet<AuditInfo>();
//     }
// 
//     public void addInfo(AuditInfo info) {
//         Assert.notNull(info);
//         Assert.notNull(auditInfo);
//         auditInfo.add(info);
//     }
// }
// 
// Path: spring-data-neo4j4-demo/src/main/java/org/springframework/data/neo4j/demo/repository/AuditEntryRepository.java
// public interface AuditEntryRepository extends GraphRepository<AuditEntry> {
//     List<AuditEntry> findByAuditTimeGreaterThanAndAuditTimeLessThanOrderByAuditTimeDesc(Date startDate, Date endDate);
//     List<AuditEntry> findByAuditTypeAndAuditTimeGreaterThanAndAuditTimeLessThanOrderByAuditTimeDesc(String auditType, Date startDate, Date endDate);
// }


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.neo4j.demo.data.AuditEntry;
import org.springframework.data.neo4j.demo.repository.AuditEntryRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.Date;
import java.util.List;
package org.springframework.data.neo4j.demo.service;



@Service
@Transactional
@Validated
public class AuditServiceImpl implements AuditService {
    private static Logger logger = LoggerFactory.getLogger(AuditServiceImpl.class);
    @Autowired
    protected AuditEntryRepository repository;

    @Override
    @Transactional
    public void deleteAllData() {
        logger.info("deleteAllData");
        repository.deleteAll();
    }

    @Override
    @Transactional(readOnly = true)
    public List<AuditEntry> find(String auditType, Date startDate, Date endDate) {
        logger.info("find:" + auditType + ":" + startDate + ":" + endDate);
        return repository.findByAuditTypeAndAuditTimeGreaterThanAndAuditTimeLessThanOrderByAuditTimeDesc(auditType, startDate, endDate);
    }

    @Override
    @SuppressWarnings("unchecked")
    @Transactional
// Path: spring-data-neo4j4-demo/src/main/java/org/springframework/data/neo4j/demo/data/AuditEntry.java
// @NodeEntity
// @Data
// public class AuditEntry {
//     @Relationship
//     private Set<AuditInfo> auditInfo;
//     @NotNull
//     private Date auditTime;
//     @NotNull
//     private String auditType;
//     @NotNull
//     private String eventType;
//     @GraphId
//     private Long id;
// 
//     public AuditEntry() {
//         this.auditInfo = new HashSet<AuditInfo>();
//     }
// 
//     public AuditEntry(Date auditTime, String auditType, String eventType) {
//         this.auditTime = auditTime;
//         this.auditType = auditType;
//         this.eventType = eventType;
//         this.auditInfo = new HashSet<AuditInfo>();
//     }
// 
//     public void addInfo(AuditInfo info) {
//         Assert.notNull(info);
//         Assert.notNull(auditInfo);
//         auditInfo.add(info);
//     }
// }
// 
// Path: spring-data-neo4j4-demo/src/main/java/org/springframework/data/neo4j/demo/repository/AuditEntryRepository.java
// public interface AuditEntryRepository extends GraphRepository<AuditEntry> {
//     List<AuditEntry> findByAuditTimeGreaterThanAndAuditTimeLessThanOrderByAuditTimeDesc(Date startDate, Date endDate);
//     List<AuditEntry> findByAuditTypeAndAuditTimeGreaterThanAndAuditTimeLessThanOrderByAuditTimeDesc(String auditType, Date startDate, Date endDate);
// }


// Path: spring-data-neo4j4-demo/src/main/java/org/springframework/data/neo4j/demo/service/AuditServiceImpl.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.neo4j.demo.data.AuditEntry;
import org.springframework.data.neo4j.demo.repository.AuditEntryRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.Date;
import java.util.List;

package org.springframework.data.neo4j.demo.service;



@Service
@Transactional
@Validated
public class AuditServiceImpl implements AuditService {
    private static Logger logger = LoggerFactory.getLogger(AuditServiceImpl.class);
    @Autowired
    protected AuditEntryRepository repository;

    @Override
    @Transactional
    public void deleteAllData() {
        logger.info("deleteAllData");
        repository.deleteAll();
    }

    @Override
    @Transactional(readOnly = true)
    public List<AuditEntry> find(String auditType, Date startDate, Date endDate) {
        logger.info("find:" + auditType + ":" + startDate + ":" + endDate);
        return repository.findByAuditTypeAndAuditTimeGreaterThanAndAuditTimeLessThanOrderByAuditTimeDesc(auditType, startDate, endDate);
    }

    @Override
    @SuppressWarnings("unchecked")
    @Transactional
    public void save(@Valid AuditEntry entry) {