blob: 549989b02c8028644038832377c046765c4139f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
package org.onap.dcae.dmaapbc.dbcapp.service;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.onap.dcae.dmaapbc.dbcapp.domain.DmaapAccess;
import org.onap.dcae.dmaapbc.dbcapp.domain.ManifestTransportModel;
import org.onap.portalsdk.core.service.DataAccessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Hibernate-assisted methods to manipulate the DBCA_DMAAP table.
*/
@Service("dmaapAccessService")
@Transactional
public class DmaapAccessServiceImpl implements DmaapAccessService {
@Autowired
private DataAccessService dataAccessService;
public DataAccessService getDataAccessService() {
return dataAccessService;
}
public void setDataAccessService(DataAccessService dataAccessService) {
this.dataAccessService = dataAccessService;
}
/*
* (non-Javadoc)
* @see org.onap.dmaapbc.dbcapp.service.DmaapAccessService#getManifest()
*/
@Override
public ManifestTransportModel getManifest() {
return null;
}
/*
* (non-Javadoc)
* @see org.onap.dmaapbc.dbcapp.service.DmaapAccessService#getDmaapAccessCount()
*/
@SuppressWarnings("unchecked")
@Override
public int getDmaapAccessCount() {
List<DmaapAccess> accesses = (List<DmaapAccess>) getDataAccessService().getList(DmaapAccess.class, null);
return accesses.size();
}
/*
* (non-Javadoc)
* @see org.onap.dmaapbc.dbcapp.service.DmaapAccessService#getDmaapAccessList(java.lang.String)
*/
@SuppressWarnings("unchecked")
@Override
public List<DmaapAccess> getDmaapAccessList(String userId) {
List<Criterion> restrictionsList = new ArrayList<Criterion>();
Criterion criterion1 = Restrictions.eq("userId", userId);
restrictionsList.add(criterion1);
List<DmaapAccess> accesses = (List<DmaapAccess>) getDataAccessService().getList(DmaapAccess.class, null,
restrictionsList, null);
return accesses;
}
/*
* (non-Javadoc)
* @see org.onap.dmaapbc.dbcapp.service.DmaapAccessService#getDmaapAccess(java.lang.Long)
*/
@Override
public DmaapAccess getDmaapAccess(Long dmaapId) {
return (DmaapAccess) getDataAccessService().getDomainObject(DmaapAccess.class, dmaapId, null);
}
/*
* (non-Javadoc)
* @see org.onap.dmaapbc.dbcapp.service.DmaapAccessService#saveDmaapAccess(org.onap.dmaapbc.dbcapp.domain.DmaapAccess)
*/
@Override
public void saveDmaapAccess(DmaapAccess dmaap) {
getDataAccessService().saveDomainObject(dmaap, null);
}
/*
* (non-Javadoc)
* @see org.onap.dmaapbc.dbcapp.service.DmaapAccessService#deleteDmaapAccess(java.lang.Long)
*/
@Override
public void deleteDmaapAccess(Long dmaapId) {
DmaapAccess dmaapAccess = getDmaapAccess(dmaapId);
if (dmaapAccess != null)
getDataAccessService().deleteDomainObject(dmaapAccess, null);
}
}
|