first commit

This commit is contained in:
snoop 2017-05-31 14:00:47 +09:00
commit b8665e457a
7 changed files with 149 additions and 0 deletions

28
.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
# Created by .ignore support plugin (hsz.mobi)
### Java template
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea/
*.iml
target/

34
pom.xml Normal file
View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.loafle</groupId>
<artifactId>maven_parent_jar</artifactId>
<version>1.0.0-RELEASE</version>
</parent>
<groupId>com.loafle</groupId>
<artifactId>overflow_jpa_noauth_agent_dao</artifactId>
<packaging>jar</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>com.loafle.overflow_jpa_noauth_agent_dao</name>
<dependencies>
<dependency>
<groupId>com.loafle</groupId>
<artifactId>overflow_jpa_base_dao</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.loafle</groupId>
<artifactId>overflow_noauth_agent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,42 @@
package com.loafle.overflow.noauthagent.dao;
import com.loafle.overflow.noauthagent.model.NoAuthAgent;
import com.loafle.overflow.commons.dao.JPABaseDAO;
import javax.persistence.Query;
import java.util.List;
/**
* Created by root on 17. 5. 30.
*/
public class JPANoAuthAgentDAO extends JPABaseDAO<NoAuthAgent> implements NoAuthAgentDao {
public NoAuthAgent findByTempKey(NoAuthAgent noAuthAgent) {
Query query = getEntityManager().createNativeQuery("SELECT na.* FROM NOAUTH_AGENT na WHERE na.TEMP_KEY = :tempkey", NoAuthAgent.class);
query.setParameter("tempkey", noAuthAgent.getTempKey());
NoAuthAgent authAgent = null;
try {
authAgent = (NoAuthAgent)query.getSingleResult();
}catch(Exception e) {
e.printStackTrace();
}finally {
return authAgent;
}
}
public List<NoAuthAgent> findAllByNoAuth(NoAuthAgent noAuthAgent) {
Query query = getEntityManager().createNativeQuery("SELECT na.* FROM NOAUTH_AGENT na WHERE na.AUTH_STATUS != :authStatus", NoAuthAgent.class);
query.setParameter("authStatus", noAuthAgent.getAuthStatus().toString());
List<NoAuthAgent> authAgentList = null;
try {
authAgentList = (List<NoAuthAgent>)query.getResultList();
}catch(Exception e) {
e.printStackTrace();
}finally {
return authAgentList;
}
}
}

View File

@ -0,0 +1,14 @@
package com.loafle.overflow.noauthagent.dao;
import com.loafle.overflow.noauthagent.model.NoAuthAgent;
import com.loafle.overflow.commons.dao.BaseDAO;
import java.util.List;
/**
* Created by root on 17. 5. 30.
*/
public interface NoAuthAgentDao extends BaseDAO<NoAuthAgent> {
NoAuthAgent findByTempKey(NoAuthAgent noAuthAgent);
List<NoAuthAgent> findAllByNoAuth(NoAuthAgent noAuthAgent);
}

0
src/main/resources/_ Normal file
View File

View File

@ -0,0 +1,14 @@
package com.loafle;
import static org.junit.Assert.*;
import org.junit.Ignore;
import org.junit.Test;
public class AppTest {
@Ignore
@Test
public void testSum() {
fail("Not yet implemented");
}
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="3 seconds">
<contextName>overflow_jpa_noauth_agent_dao</contextName>
<!-- TRACE > DEBUG > INFO > WARN > ERROR -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{32} - %msg%n
</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
<logger name="com.loafle" level="ALL" />
</configuration>