Search in sources :

Example 1 with AbstractMapFunctionEntity

use of org.opennms.netmgt.bsm.persistence.api.functions.map.AbstractMapFunctionEntity in project opennms by OpenNMS.

the class BusinessServiceManagerImpl method setMapFunction.

@Override
public void setMapFunction(final Edge edge, final MapFunction mapFunction) {
    // This is a workaround for a hibernate bug which does not remove
    // orphan elements if the element is replaced using the setter. See:
    // https://hibernate.atlassian.net/browse/HHH-6484
    final BusinessServiceEdgeEntity edgeEntity = this.getBusinessServiceEdgeEntity(edge);
    final AbstractMapFunctionEntity prevMapFunctionEntity = edgeEntity.getMapFunction();
    if (prevMapFunctionEntity != null && prevMapFunctionEntity.getId() != null) {
        this.mapFunctionDao.delete(prevMapFunctionEntity);
    }
    final AbstractMapFunctionEntity mapFunctionEntity = new MapFunctionMapper().toPersistenceFunction(mapFunction);
    edgeEntity.setMapFunction(mapFunctionEntity);
}
Also used : BusinessServiceEdgeEntity(org.opennms.netmgt.bsm.persistence.api.BusinessServiceEdgeEntity) AbstractMapFunctionEntity(org.opennms.netmgt.bsm.persistence.api.functions.map.AbstractMapFunctionEntity)

Aggregations

BusinessServiceEdgeEntity (org.opennms.netmgt.bsm.persistence.api.BusinessServiceEdgeEntity)1 AbstractMapFunctionEntity (org.opennms.netmgt.bsm.persistence.api.functions.map.AbstractMapFunctionEntity)1