Revision 60959
Added by Konstantina Galouni almost 3 years ago
WorkController.java | ||
---|---|---|
7 | 7 |
import eu.dnetlib.uoaorcidservice.entities.UserTokens; |
8 | 8 |
import eu.dnetlib.uoaorcidservice.entities.Work; |
9 | 9 |
import eu.dnetlib.uoaorcidservice.handlers.ConflictException; |
10 |
import eu.dnetlib.uoaorcidservice.handlers.ForbiddenException; |
|
11 | 10 |
import eu.dnetlib.uoaorcidservice.services.UserTokensService; |
12 | 11 |
import eu.dnetlib.uoaorcidservice.services.WorkService; |
13 | 12 |
import org.apache.log4j.Logger; |
14 | 13 |
import org.springframework.beans.factory.annotation.Autowired; |
15 |
import org.springframework.data.util.Pair; |
|
16 | 14 |
import org.springframework.http.*; |
17 |
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
|
18 |
import org.springframework.security.access.AccessDeniedException; |
|
19 | 15 |
import org.springframework.security.access.AuthorizationServiceException; |
20 | 16 |
import org.springframework.security.access.prepost.PreAuthorize; |
21 | 17 |
import org.springframework.web.bind.annotation.*; |
... | ... | |
34 | 30 |
import java.util.*; |
35 | 31 |
|
36 | 32 |
@RestController |
37 |
//@RequestMapping("/orcid") |
|
38 | 33 |
@PreAuthorize("isAuthenticated()") |
39 | 34 |
@CrossOrigin(origins = "*") |
40 | 35 |
public class WorkController { |
... | ... | |
167 | 162 |
workToSave.setOrcid(userOrcid); |
168 | 163 |
workToSave.setCreationDate(date); |
169 | 164 |
workToSave.setUpdateDate(date); |
165 |
workToSave.setDashboard(result.getDashboard()); |
|
170 | 166 |
|
171 | 167 |
HttpHeaders responseHeaders = response.getHeaders(); |
172 | 168 |
String locationPath = responseHeaders.getLocation().toString(); |
Also available in: Unified diff
[Trunk | Orcid Service]:
1. OrcidServiceCheckDeployController.java: [NEW] Controller added and
a. "hello()" method (@RequestMapping(value = {"", "/health_check"}, method = RequestMethod.GET)) which just prints and returns a greeting message.
b. "checkEverything()" method @RequestMapping(value = "/health_check/advanced", method = RequestMethod.GET) only accessible by PORTAL ADMINS which checks connection with db and prints properties.
2. ResultIdAndWork.java & Work.java: Added field "dashboard" (in ResultInWork class, default value is "production_explpre") and its getters and setters.
3. UserTokens.java: Added field "creationDate" and its getters and setters.
4. UserTokensService.java: Call setCreationDate() method with current Date in "saveUserTokens()" method.
5. WorkController.java: Call setDashboard() method with dashboard value from parameter of type ResultIdAndWork in "saveWork()" method.
6. update_db.js: Script with methods "setUserTokenCreationDate()" (use date of first work for this orcid) and "setDashboardInWorks()" (set all to "production_explore").