ing
This commit is contained in:
parent
46d867991c
commit
efb8c949dc
2
pom.xml
2
pom.xml
|
@ -50,7 +50,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.loafle.overflow</groupId>
|
<groupId>com.loafle.overflow</groupId>
|
||||||
<artifactId>commons-java</artifactId>
|
<artifactId>commons-java</artifactId>
|
||||||
<version>1.0.12-SNAPSHOT</version>
|
<version>1.0.13-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -4,6 +4,8 @@ import com.loafle.overflow.model.domain.Domain;
|
||||||
import com.loafle.overflow.model.domain.DomainMember;
|
import com.loafle.overflow.model.domain.DomainMember;
|
||||||
import com.loafle.overflow.model.member.Member;
|
import com.loafle.overflow.model.member.Member;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -16,7 +18,9 @@ public interface DomainMemberDAO extends JpaRepository<DomainMember, Long> {
|
||||||
|
|
||||||
DomainMember findByMemberEmail(String memberEmail);
|
DomainMember findByMemberEmail(String memberEmail);
|
||||||
|
|
||||||
Domain findDomainByMemberId(Long memberId);
|
@Query("SELECT dm.domain from DomainMember dm where dm.member.email = :memberEmail")
|
||||||
|
Domain findDomainByMemberEmail(@Param("memberEmail") String memberEmail);
|
||||||
|
|
||||||
List<Member> findAllMemberByDomainId(Long domainID);
|
@Query("SELECT dm.member from DomainMember dm where dm.domain.id = :domainId")
|
||||||
|
List<Member> findAllMemberByDomainId(@Param("domainId") Long domainId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ public class CentralDomainMemberService implements DomainMemberService {
|
||||||
this.domainMemberDAO.save(domainMember);
|
this.domainMemberDAO.save(domainMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Domain readDomainByMemberID(Long memberID) {
|
public Domain readDomainByMemberEmail(String memberEmail) {
|
||||||
return this.domainMemberDAO.findDomainByMemberId(memberID);
|
return this.domainMemberDAO.findDomainByMemberEmail(memberEmail);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DomainMember readByMemberEmail(String email) {
|
public DomainMember readByMemberEmail(String email) {
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.loafle.overflow.central.module.meta.dao;
|
||||||
import com.loafle.overflow.model.meta.MetaSensorDisplayMapping;
|
import com.loafle.overflow.model.meta.MetaSensorDisplayMapping;
|
||||||
import com.loafle.overflow.model.meta.MetaSensorItemKey;
|
import com.loafle.overflow.model.meta.MetaSensorItemKey;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -12,5 +14,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface MetaSensorDisplayMappingDAO extends JpaRepository<MetaSensorDisplayMapping, Short> {
|
public interface MetaSensorDisplayMappingDAO extends JpaRepository<MetaSensorDisplayMapping, Short> {
|
||||||
public List<MetaSensorItemKey> findAllMetaSensorItemKeyByMetaSensorDisplayItemId(Long metaSensorDisplayItemId);
|
|
||||||
|
@Query("SELECT m.metaSensorItemKey from MetaSensorDisplayMapping m where m.metaSensorDisplayItem.id = :metaSensorDisplayItemId")
|
||||||
|
public List<MetaSensorItemKey> findAllMetaSensorItemKeyByMetaSensorDisplayItemId(@Param("metaSensorDisplayItemId") Long metaSensorDisplayItemId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import com.loafle.overflow.model.meta.MetaSensorItemKey;
|
||||||
import com.loafle.overflow.model.sensor.SensorItemDependency;
|
import com.loafle.overflow.model.sensor.SensorItemDependency;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -14,5 +16,6 @@ import java.util.List;
|
||||||
@Repository
|
@Repository
|
||||||
public interface SensorItemDependencyDAO extends JpaRepository<SensorItemDependency, Long> {
|
public interface SensorItemDependencyDAO extends JpaRepository<SensorItemDependency, Long> {
|
||||||
|
|
||||||
List<MetaSensorItemKey> findAllByMetaSensorDisplayItemId(Long metaSensorDisplayItemId);
|
@Query("SELECT s.metaSensorItemKey from SensorItemDependency s where s.metaSensorDisplayItem.id = :metaSensorDisplayItemId")
|
||||||
|
List<MetaSensorItemKey> findAllMetaSensorItemKeyByMetaSensorDisplayItemId(@Param("metaSensorDisplayItemId") Long metaSensorDisplayItemId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class CentralSensorItemDependencyService implements SensorItemDependencyS
|
||||||
|
|
||||||
public List<MetaSensorItemKey> readAllMetaSensorItemKeyByMetaSensorDisplayItemID(Long metaSensorDisplayItemID)
|
public List<MetaSensorItemKey> readAllMetaSensorItemKeyByMetaSensorDisplayItemID(Long metaSensorDisplayItemID)
|
||||||
throws OverflowException {
|
throws OverflowException {
|
||||||
return this.sensorItemDependencyDAO.findAllByMetaSensorDisplayItemId(metaSensorDisplayItemID);
|
return this.sensorItemDependencyDAO.findAllMetaSensorItemKeyByMetaSensorDisplayItemId(metaSensorDisplayItemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, List<MetaSensorItemKey>> readAllMapByMetaSensorDisplayItems(
|
public Map<String, List<MetaSensorItemKey>> readAllMapByMetaSensorDisplayItems(
|
||||||
|
@ -40,7 +40,7 @@ public class CentralSensorItemDependencyService implements SensorItemDependencyS
|
||||||
|
|
||||||
for (MetaSensorDisplayItem displayItem : metaSensorDisplayItems) {
|
for (MetaSensorDisplayItem displayItem : metaSensorDisplayItems) {
|
||||||
List<MetaSensorItemKey> itemKeys = this.sensorItemDependencyDAO
|
List<MetaSensorItemKey> itemKeys = this.sensorItemDependencyDAO
|
||||||
.findAllByMetaSensorDisplayItemId(displayItem.getId());
|
.findAllMetaSensorItemKeyByMetaSensorDisplayItemId(displayItem.getId());
|
||||||
map.put(displayItem.getKey(), itemKeys);
|
map.put(displayItem.getKey(), itemKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.loafle.overflow.central.module.domain.dao;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||||
|
import com.loafle.overflow.model.domain.Domain;
|
||||||
|
import com.loafle.overflow.model.member.Member;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by snoop on 17. 9. 14.
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ContextConfiguration(classes = {AppConfigTest.class})
|
||||||
|
public class DomainMemberDAOTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DomainMemberDAO domainMemberDAO;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void findDomainByMemberEmail() throws Exception {
|
||||||
|
|
||||||
|
Domain domain = this.domainMemberDAO.findDomainByMemberEmail("overflow@loafle.com");
|
||||||
|
|
||||||
|
assertNotNull(domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void findAllMemberByDomainId() throws Exception {
|
||||||
|
|
||||||
|
List<Member> members = this.domainMemberDAO.findAllMemberByDomainId(Long.valueOf(1));
|
||||||
|
|
||||||
|
assertNotNull(members);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.loafle.overflow.central.module.meta.dao;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||||
|
import com.loafle.overflow.model.meta.MetaSensorItemKey;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by snoop on 17. 9. 14.
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ContextConfiguration(classes = {AppConfigTest.class})
|
||||||
|
public class MetaSensorDisplayMappingDAOTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MetaSensorDisplayMappingDAO metaSensorDisplayMappingDAO;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void findAllMetaSensorItemKeyByMetaSensorDisplayItemId() throws Exception {
|
||||||
|
|
||||||
|
List<MetaSensorItemKey> metaSensorItemKeys = this.metaSensorDisplayMappingDAO.findAllMetaSensorItemKeyByMetaSensorDisplayItemId(Long.valueOf(1));
|
||||||
|
|
||||||
|
assertNotNull(metaSensorItemKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.loafle.overflow.central.module.sensor.dao;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||||
|
import com.loafle.overflow.model.meta.MetaSensorItemKey;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by snoop on 17. 9. 14.
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ContextConfiguration(classes = { AppConfigTest.class })
|
||||||
|
public class SensorItemDependencyDAOTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SensorItemDependencyDAO sensorItemDependencyDAO;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void findAllMetaSensorItemKeyByMetaSensorDisplayItemId() throws Exception {
|
||||||
|
|
||||||
|
List<MetaSensorItemKey> metaSensorItemKeys = this.sensorItemDependencyDAO
|
||||||
|
.findAllMetaSensorItemKeyByMetaSensorDisplayItemId(Long.valueOf(1));
|
||||||
|
|
||||||
|
assertNotNull(metaSensorItemKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user