// Path: src/main/java/se/omegapoint/facepalm/domain/repository/DocumentRepository.java
// public interface DocumentRepository {
//     List<Document> findAllFor(String user);
// }
// 
// Path: src/main/java/se/omegapoint/facepalm/infrastructure/db/Document.java
// @Entity
// @Table(name = "DOCUMENTS")
// public class Document {
// 
//     @Id
//     @GeneratedValue
//     @Column(name = "ID")
//     private Long id;
// 
//     @Column(name = "FILENAME")
//     private String filename;
// 
//     @Column(name = "USERNAME")
//     private String username;
// 
//     @Column(name = "UPLOADED_DATE")
//     private Date date;
// 
//     @Column(name = "FILE_SIZE")
//     private Long fileSize;
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(final Long id) {
//         this.id = id;
//     }
// 
//     public String getFilename() {
//         return filename;
//     }
// 
//     public void setFilename(final String filename) {
//         this.filename = filename;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(final String username) {
//         this.username = username;
//     }
// 
//     public Date getDate() {
//         return date;
//     }
// 
//     public void setDate(final Date date) {
//         this.date = date;
//     }
// 
//     public Long getFileSize() {
//         return fileSize;
//     }
// 
//     public void setFileSize(final Long fileSize) {
//         this.fileSize = fileSize;
//     }
// }


import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import se.omegapoint.facepalm.domain.repository.DocumentRepository;
import se.omegapoint.facepalm.infrastructure.db.Document;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.time.LocalDateTime;
import java.util.List;
import static java.lang.String.format;
import static java.time.ZoneId.systemDefault;
import static java.util.stream.Collectors.toList;
/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package se.omegapoint.facepalm.infrastructure;




@Repository
@Transactional
@SuppressWarnings("unchecked")
// Path: src/main/java/se/omegapoint/facepalm/domain/repository/DocumentRepository.java
// public interface DocumentRepository {
//     List<Document> findAllFor(String user);
// }
// 
// Path: src/main/java/se/omegapoint/facepalm/infrastructure/db/Document.java
// @Entity
// @Table(name = "DOCUMENTS")
// public class Document {
// 
//     @Id
//     @GeneratedValue
//     @Column(name = "ID")
//     private Long id;
// 
//     @Column(name = "FILENAME")
//     private String filename;
// 
//     @Column(name = "USERNAME")
//     private String username;
// 
//     @Column(name = "UPLOADED_DATE")
//     private Date date;
// 
//     @Column(name = "FILE_SIZE")
//     private Long fileSize;
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(final Long id) {
//         this.id = id;
//     }
// 
//     public String getFilename() {
//         return filename;
//     }
// 
//     public void setFilename(final String filename) {
//         this.filename = filename;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(final String username) {
//         this.username = username;
//     }
// 
//     public Date getDate() {
//         return date;
//     }
// 
//     public void setDate(final Date date) {
//         this.date = date;
//     }
// 
//     public Long getFileSize() {
//         return fileSize;
//     }
// 
//     public void setFileSize(final Long fileSize) {
//         this.fileSize = fileSize;
//     }
// }


// Path: src/main/java/se/omegapoint/facepalm/infrastructure/JPADocumentRepository.java
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import se.omegapoint.facepalm.domain.repository.DocumentRepository;
import se.omegapoint.facepalm.infrastructure.db.Document;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.time.LocalDateTime;
import java.util.List;
import static java.lang.String.format;
import static java.time.ZoneId.systemDefault;
import static java.util.stream.Collectors.toList;

/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package se.omegapoint.facepalm.infrastructure;




@Repository
@Transactional
@SuppressWarnings("unchecked")
public class JPADocumentRepository implements DocumentRepository {