View Main.java
List<WorkItem> finishedWorkItems = workItemService.findFinishedWorkItemsBetweenStartDateAndEndDate("2016-02-13", "2016-02-20");
System.out.println("---finishedWorkItems---");
finishedWorkItems.forEach(System.out::println);
View WorkItemService.java
public List<WorkItem> findFinishedWorkItemsBetweenStartDateAndEndDate(String startDate, String endDate)
{
Date startDateInDateFormat = null;
Date endDateInDateFormat = null;
try
{
startDateInDateFormat = new SimpleDateFormat("yyyy-MM-dd").parse(startDate);
endDateInDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").parse(endDate + "T23:59:59");
}
catch (ParseException e)
View WorkItemRepository.java
package se.grouprich.projectmanagement.repository;
import java.util.Date;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;
import se.grouprich.projectmanagement.model.Team;
View AppConfig.java
package se.grouprich.projectmanagement.config;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.auditing.DateTimeProvider;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
View UsernameAuditorAware.java
package se.grouprich.projectmanagement.model.auditing;
import org.springframework.data.domain.AuditorAware;
public class UsernameAuditorAware implements AuditorAware<String>
{
@Override
public String getCurrentAuditor()
{
return "DefaultUser";
View AuditingDateTimeProvider.java
package se.grouprich.projectmanagement.model.auditing;
import java.util.Calendar;
import java.util.GregorianCalendar;
import org.springframework.data.auditing.DateTimeProvider;
public class AuditingDateTimeProvider implements DateTimeProvider
{
@Override
View AbstractEntity.java
package se.grouprich.projectmanagement.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;