Revision 50862
Added by Panagiotis Kanakakis about 6 years ago
PiWikApiImpl.java | ||
---|---|---|
9 | 9 |
import org.springframework.jdbc.core.RowMapper; |
10 | 10 |
import org.springframework.stereotype.Component; |
11 | 11 |
import org.springframework.web.bind.annotation.PathVariable; |
12 |
import org.springframework.web.bind.annotation.RequestBody; |
|
13 | 12 |
|
14 | 13 |
import javax.annotation.PostConstruct; |
15 | 14 |
import javax.sql.DataSource; |
... | ... | |
53 | 52 |
} |
54 | 53 |
|
55 | 54 |
@Override |
56 |
public PiwikInfo savePiwikInfo(@RequestBody PiwikInfo piwikInfo) {
|
|
55 |
public PiwikInfo savePiwikInfo(PiwikInfo piwikInfo) { |
|
57 | 56 |
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); |
58 | 57 |
jdbcTemplate.update(INSERT_PIWIK_INFO, new Object[]{piwikInfo.getRepositoryId(), piwikInfo.getSiteId(), piwikInfo.getRequestorName(), |
59 | 58 |
piwikInfo.getRequestorEmail(), piwikInfo.isValidated(), piwikInfo.getRepositoryName(), piwikInfo.getCountry(), piwikInfo.getAuthenticationToken()}, |
... | ... | |
78 | 77 |
} |
79 | 78 |
|
80 | 79 |
@Override |
81 |
public String getOpenaireId(@PathVariable("repositoryId") String repositoryId) { |
|
82 |
LOGGER.debug("Getting openaire id for repository: " + repositoryId); |
|
80 |
public String getOpenaireId(@PathVariable("repositoryId") String repositoryid) { |
|
83 | 81 |
try { |
84 |
if (repositoryId != null && repositoryId.contains("::")) { |
|
85 |
return repositoryId.split("::")[0] + "::" + MD5.encrypt2Hex(repositoryId.split("::")[1]); |
|
86 |
} |
|
82 |
if (repositoryid != null && repositoryid.contains("::")) |
|
83 |
return repositoryid.split("::")[0] + "::" + MD5.encrypt2Hex(repositoryid.split("::")[1]); |
|
87 | 84 |
else |
88 | 85 |
return null; |
89 | 86 |
} catch (NoSuchAlgorithmException e) { |
90 |
LOGGER.debug(e);
|
|
87 |
e.printStackTrace();
|
|
91 | 88 |
} |
92 | 89 |
return null; |
93 | 90 |
} |
Also available in: Unified diff
Moving branch folders to trunk.