Revision 56683
Added by Ioannis Diplas over 4 years ago
PiWikServiceImpl.java | ||
---|---|---|
64 | 64 |
|
65 | 65 |
private final static String INSERT_PIWIK_INFO = "insert into piwik_site (repositoryid, siteid, creationdate, requestorname, requestoremail, validated, repositoryname, country, authenticationtoken) values (?, ?, now(), ?, ?, ?, ?, ?, ?)"; |
66 | 66 |
|
67 |
private final static String GET_PIWIK_SITES = "select count(*) OVER() as totals, repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, validated, validationdate, comment, repositoryname, country from piwik_site ";
|
|
67 |
private final static String GET_PIWIK_SITES = "select repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, validated, validationdate, comment, repositoryname, country from piwik_site "; |
|
68 | 68 |
|
69 |
private final static String GET_PIWIK_SITES_TOTAL = "select count(*) as totals from piwik_site "; |
|
70 |
|
|
69 | 71 |
private final static String APPROVE_PIWIK_SITE = "update piwik_site set validated=true, validationdate=now() where repositoryid = ?;"; |
70 | 72 |
|
71 | 73 |
private RowMapper<PiwikInfo> piwikRowMapper = (rs, i) -> new PiwikInfo(rs.getString("repositoryid"), getOpenaireId(rs.getString("repositoryid")), rs.getString("repositoryname"), rs.getString("country"), |
... | ... | |
124 | 126 |
} |
125 | 127 |
|
126 | 128 |
@Override |
129 |
public int getPiwikSitesTotals(){ |
|
130 |
try{ |
|
131 |
return new JdbcTemplate(dataSource).queryForObject(GET_PIWIK_SITES_TOTAL,Integer.class); |
|
132 |
}catch (EmptyResultDataAccessException e){ |
|
133 |
return 0; |
|
134 |
} |
|
135 |
} |
|
136 |
|
|
137 |
@Override |
|
127 | 138 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN')") |
128 | 139 |
public ResponseEntity<Object> approvePiwikSite(String repositoryId) { |
129 | 140 |
new JdbcTemplate(dataSource).update(APPROVE_PIWIK_SITE, new Object[] {repositoryId}, new int[] {Types.VARCHAR}); |
Also available in: Unified diff
Adding totals to final array