// Path: src/main/java/security/entity/AuthToken.java
// @Entity
// @Table(name = "auth_token")
// public class AuthToken extends AbstractAuditableEntity {
// 
// 	private static final long serialVersionUID = -9001508296580395084L;
// 
// 	private String token;
// 
// 	private String series;
// 
// 	@ManyToOne(fetch = FetchType.EAGER)
// 	@JoinColumn(name = "user", nullable = false)
// 	private User user;
// 
// 	public String getToken() {
// 		return token;
// 	}
// 
// 	public void setToken(String token) {
// 		this.token = token;
// 	}
// 
// 	public String getSeries() {
// 		return series;
// 	}
// 
// 	public void setSeries(String series) {
// 		this.series = series;
// 	}
// 
// 	public User getUser() {
// 		return user;
// 	}
// 
// 	public void setUser(User user) {
// 		this.user = user;
// 	}
// 
// }
// 
// Path: src/main/java/security/repository/AuthTokenRepository.java
// @Repository
// public interface AuthTokenRepository extends JpaRepository<AuthToken, Long> {
// 
// 	@Transactional(readOnly = true)
// 	@Query("select  authToken from AuthToken authToken where authToken.token= :token and authToken.series= :series")
// 	AuthToken findUserByTokenAndSeries(@Param("token") String token,
// 			@Param("series") String series);
// 
// 	@Transactional
// 	@Modifying
// 	@Query("delete from AuthToken authToken where authToken.token= :token and authToken.series= :series")
// 	void deleteByTokenAndSeries(@Param("token") String token,
// 			@Param("series") String series);
// 
// 	@Transactional
// 	@Modifying
// 	@Query(nativeQuery = true, value = "delete  from auth_token where 1="
// 			+ "case "
// 			+ "when (last_modified_date is null and TIMESTAMPDIFF(MINUTE,created_date,sysdate()) > 2) then 1 "
// 			+ "when (last_modified_date <> null and TIMESTAMPDIFF(MINUTE,last_modified_date,sysdate()) > 2) then 1 "
// 			+ "else 0 " + "end ")
// 	void dleteTimedoutTokens();
// }
// 
// Path: src/main/java/security/service/base/AuthTokenService.java
// public interface AuthTokenService {
// 
// 	AuthToken create(AuthToken authToken);
// 
// 	AuthToken update(AuthToken authToken);
// 
// 	AuthToken findUserByTokenAndSeries(final String token, final String series);
// 
// 	void deleteByTokenAndSeries(final String token, final String series);
// 
// 	void deleteExpiredTokens();
// }


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import security.entity.AuthToken;
import security.repository.AuthTokenRepository;
import security.service.base.AuthTokenService;
package security.service.impl;



/**
 * @author abidk
 * 
 */
@Transactional(readOnly = true)
@Service
public class AuthTokenServiceImpl implements AuthTokenService {

	@Autowired
// Path: src/main/java/security/entity/AuthToken.java
// @Entity
// @Table(name = "auth_token")
// public class AuthToken extends AbstractAuditableEntity {
// 
// 	private static final long serialVersionUID = -9001508296580395084L;
// 
// 	private String token;
// 
// 	private String series;
// 
// 	@ManyToOne(fetch = FetchType.EAGER)
// 	@JoinColumn(name = "user", nullable = false)
// 	private User user;
// 
// 	public String getToken() {
// 		return token;
// 	}
// 
// 	public void setToken(String token) {
// 		this.token = token;
// 	}
// 
// 	public String getSeries() {
// 		return series;
// 	}
// 
// 	public void setSeries(String series) {
// 		this.series = series;
// 	}
// 
// 	public User getUser() {
// 		return user;
// 	}
// 
// 	public void setUser(User user) {
// 		this.user = user;
// 	}
// 
// }
// 
// Path: src/main/java/security/repository/AuthTokenRepository.java
// @Repository
// public interface AuthTokenRepository extends JpaRepository<AuthToken, Long> {
// 
// 	@Transactional(readOnly = true)
// 	@Query("select  authToken from AuthToken authToken where authToken.token= :token and authToken.series= :series")
// 	AuthToken findUserByTokenAndSeries(@Param("token") String token,
// 			@Param("series") String series);
// 
// 	@Transactional
// 	@Modifying
// 	@Query("delete from AuthToken authToken where authToken.token= :token and authToken.series= :series")
// 	void deleteByTokenAndSeries(@Param("token") String token,
// 			@Param("series") String series);
// 
// 	@Transactional
// 	@Modifying
// 	@Query(nativeQuery = true, value = "delete  from auth_token where 1="
// 			+ "case "
// 			+ "when (last_modified_date is null and TIMESTAMPDIFF(MINUTE,created_date,sysdate()) > 2) then 1 "
// 			+ "when (last_modified_date <> null and TIMESTAMPDIFF(MINUTE,last_modified_date,sysdate()) > 2) then 1 "
// 			+ "else 0 " + "end ")
// 	void dleteTimedoutTokens();
// }
// 
// Path: src/main/java/security/service/base/AuthTokenService.java
// public interface AuthTokenService {
// 
// 	AuthToken create(AuthToken authToken);
// 
// 	AuthToken update(AuthToken authToken);
// 
// 	AuthToken findUserByTokenAndSeries(final String token, final String series);
// 
// 	void deleteByTokenAndSeries(final String token, final String series);
// 
// 	void deleteExpiredTokens();
// }


// Path: src/main/java/security/service/impl/AuthTokenServiceImpl.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import security.entity.AuthToken;
import security.repository.AuthTokenRepository;
import security.service.base.AuthTokenService;

package security.service.impl;



/**
 * @author abidk
 * 
 */
@Transactional(readOnly = true)
@Service
public class AuthTokenServiceImpl implements AuthTokenService {

	@Autowired
	private AuthTokenRepository authTokenRepository;