Search in sources :

Example 16 with Transactional

use of org.springframework.transaction.annotation.Transactional in project opennms by OpenNMS.

the class EnhancedLinkdServiceImpl method store.

@Override
@Transactional
public void store(int nodeId, OspfElement element) {
    if (element == null)
        return;
    final OnmsNode node = m_nodeDao.get(nodeId);
    if (node == null)
        return;
    OspfElement dbelement = node.getOspfElement();
    if (dbelement != null) {
        dbelement.merge(element);
        node.setOspfElement(dbelement);
    } else {
        element.setNode(node);
        element.setOspfNodeLastPollTime(element.getOspfNodeCreateTime());
        node.setOspfElement(element);
    }
    m_nodeDao.saveOrUpdate(node);
    m_nodeDao.flush();
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) OspfElement(org.opennms.netmgt.model.OspfElement) Transactional(org.springframework.transaction.annotation.Transactional)

Example 17 with Transactional

use of org.springframework.transaction.annotation.Transactional in project opennms by OpenNMS.

the class EnhancedLinkdServiceImpl method store.

@Override
@Transactional
public void store(int nodeId, IsIsElement element) {
    if (element == null)
        return;
    final OnmsNode node = m_nodeDao.get(nodeId);
    if (node == null)
        return;
    IsIsElement dbelement = node.getIsisElement();
    if (dbelement != null) {
        dbelement.merge(element);
        node.setIsisElement(dbelement);
    } else {
        element.setNode(node);
        element.setIsisNodeLastPollTime(element.getIsisNodeCreateTime());
        node.setIsisElement(element);
    }
    m_nodeDao.saveOrUpdate(node);
    m_nodeDao.flush();
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) IsIsElement(org.opennms.netmgt.model.IsIsElement) Transactional(org.springframework.transaction.annotation.Transactional)

Example 18 with Transactional

use of org.springframework.transaction.annotation.Transactional in project opennms by OpenNMS.

the class EnhancedLinkdServiceImpl method store.

@Override
@Transactional
public void store(int nodeId, CdpElement element) {
    if (element == null)
        return;
    final OnmsNode node = m_nodeDao.get(nodeId);
    if (node == null)
        return;
    CdpElement dbelement = node.getCdpElement();
    if (dbelement != null) {
        dbelement.merge(element);
        node.setCdpElement(dbelement);
    } else {
        element.setNode(node);
        element.setCdpNodeLastPollTime(element.getCdpNodeCreateTime());
        node.setCdpElement(element);
    }
    m_nodeDao.saveOrUpdate(node);
    m_nodeDao.flush();
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) CdpElement(org.opennms.netmgt.model.CdpElement) Transactional(org.springframework.transaction.annotation.Transactional)

Example 19 with Transactional

use of org.springframework.transaction.annotation.Transactional in project opennms by OpenNMS.

the class EnhancedLinkdServiceImpl method store.

@Override
@Transactional
public void store(int nodeId, LldpElement element) {
    if (element == null)
        return;
    final OnmsNode node = m_nodeDao.get(nodeId);
    if (node == null)
        return;
    LldpElement dbelement = node.getLldpElement();
    if (dbelement != null) {
        dbelement.merge(element);
        node.setLldpElement(dbelement);
    } else {
        element.setNode(node);
        element.setLldpNodeLastPollTime(element.getLldpNodeCreateTime());
        node.setLldpElement(element);
    }
    m_nodeDao.saveOrUpdate(node);
    m_nodeDao.flush();
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) LldpElement(org.opennms.netmgt.model.LldpElement) Transactional(org.springframework.transaction.annotation.Transactional)

Example 20 with Transactional

use of org.springframework.transaction.annotation.Transactional in project opennms by OpenNMS.

the class AccessPointDaoTest method testFindByPhysAddr.

@Test
@Transactional
public void testFindByPhysAddr() {
    addNewAccessPoint("ap1", AP1_MAC, "default-package");
    addNewAccessPoint("ap2", AP2_MAC, "not-default-package");
    OnmsAccessPoint ap1 = m_accessPointDao.get(AP1_MAC);
    assertEquals("default-package", ap1.getPollingPackage());
    OnmsAccessPoint ap2 = m_accessPointDao.get(AP2_MAC);
    assertEquals("not-default-package", ap2.getPollingPackage());
}
Also used : OnmsAccessPoint(org.opennms.netmgt.model.OnmsAccessPoint) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Transactional (org.springframework.transaction.annotation.Transactional)4561 Test (org.junit.Test)1387 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)724 DAOException (com.tomasio.projects.trainning.exception.DAOException)385 CoreException (com.tomasio.projects.trainning.exeption.CoreException)372 ArrayList (java.util.ArrayList)324 Date (java.util.Date)252 Query (javax.persistence.Query)218 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)213 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)211 WithMockUser (org.springframework.security.test.context.support.WithMockUser)204 HashMap (java.util.HashMap)187 List (java.util.List)163 User (io.github.jhipster.sample.domain.User)150 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)135 HashSet (java.util.HashSet)135 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)132 UUID (java.util.UUID)131 Rollback (org.springframework.test.annotation.Rollback)109 ParseException (java.text.ParseException)108