Search in sources :

Example 66 with OrcidProfile

use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.

the class T1OrcidApiServiceImplLatestMetricsTest method orcidWithMultipleResults.

private Response orcidWithMultipleResults() {
    OrcidMessage orcidMessage = new OrcidMessage();
    OrcidProfile orcidProfile1 = new OrcidProfile();
    OrcidProfile orcidProfile2 = new OrcidProfile();
    OrcidProfile orcidProfile3 = new OrcidProfile();
    OrcidSearchResult orcidSearchResult1 = new OrcidSearchResult();
    OrcidSearchResult orcidSearchResult2 = new OrcidSearchResult();
    OrcidSearchResult orcidSearchResult3 = new OrcidSearchResult();
    orcidSearchResult1.setOrcidProfile(orcidProfile1);
    orcidSearchResult2.setOrcidProfile(orcidProfile2);
    orcidSearchResult3.setOrcidProfile(orcidProfile3);
    List<OrcidSearchResult> searchResults = new ArrayList<OrcidSearchResult>();
    searchResults.add(orcidSearchResult1);
    searchResults.add(orcidSearchResult2);
    searchResults.add(orcidSearchResult3);
    OrcidSearchResults orcidSearchResults = new OrcidSearchResults();
    orcidSearchResults.getOrcidSearchResult().addAll(searchResults);
    orcidMessage.setOrcidSearchResults(orcidSearchResults);
    return Response.ok(orcidMessage).build();
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSearchResult(org.orcid.jaxb.model.message.OrcidSearchResult) OrcidSearchResults(org.orcid.jaxb.model.message.OrcidSearchResults) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) ArrayList(java.util.ArrayList)

Example 67 with OrcidProfile

use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.

the class GroupAdministratorController method manageClients.

@RequestMapping
public ModelAndView manageClients() {
    ModelAndView mav = new ModelAndView("member_developer_tools");
    OrcidProfile profile = getEffectiveProfile();
    if (profile.getType() == null || !profile.getType().equals(OrcidType.GROUP)) {
        LOGGER.warn("Trying to access group/developer-tools page with user {} which is not a group", profile.getOrcidIdentifier().getPath());
        return new ModelAndView("redirect:/my-orcid");
    }
    OrcidClientGroup group = orcidClientGroupManager.retrieveOrcidClientGroup(profile.getOrcidIdentifier().getPath());
    mav.addObject("group", group);
    switch(profile.getGroupType()) {
        case BASIC:
            mav.addObject("clientType", "UPDATER");
            break;
        case PREMIUM:
            mav.addObject("clientType", "PREMIUM_UPDATER");
            break;
        case BASIC_INSTITUTION:
            mav.addObject("clientType", "CREATOR");
            break;
        case PREMIUM_INSTITUTION:
            mav.addObject("clientType", "PREMIUM_CREATOR");
            break;
    }
    return mav;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidClientGroup(org.orcid.jaxb.model.clientgroup.OrcidClientGroup) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 68 with OrcidProfile

use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.

the class GroupAdministratorController method editClient.

@RequestMapping(value = "/edit-client.json", method = RequestMethod.POST)
@Produces(value = { MediaType.APPLICATION_JSON })
@ResponseBody
public Client editClient(@RequestBody Client client) {
    // Clean the error list
    client.setErrors(new ArrayList<String>());
    // Validate fields
    validateDisplayName(client);
    validateWebsite(client);
    validateShortDescription(client);
    validateRedirectUris(client);
    copyErrors(client.getDisplayName(), client);
    copyErrors(client.getWebsite(), client);
    copyErrors(client.getShortDescription(), client);
    for (RedirectUri redirectUri : client.getRedirectUris()) {
        copyErrors(redirectUri, client);
    }
    if (client.getErrors().size() == 0) {
        OrcidProfile profile = getEffectiveProfile();
        String groupOrcid = profile.getOrcidIdentifier().getPath();
        if (profile.getType() == null || !profile.getType().equals(OrcidType.GROUP)) {
            LOGGER.warn("Trying to edit client with non group user {}", profile.getOrcidIdentifier().getPath());
            throw new OrcidClientGroupManagementException(getMessage("web.orcid.privilege.exception"));
        }
        OrcidClient result = null;
        try {
            result = orcidClientGroupManager.updateClient(groupOrcid, client.toOrcidClient());
            clearCache();
        } catch (OrcidClientGroupManagementException e) {
            LOGGER.error(e.getMessage());
            result = new OrcidClient();
            result.setErrors(new ErrorDesc(getMessage("manage.developer_tools.group.unable_to_update")));
        }
        client = Client.valueOf(result);
    }
    return client;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidClientGroupManagementException(org.orcid.core.exception.OrcidClientGroupManagementException) OrcidClient(org.orcid.jaxb.model.clientgroup.OrcidClient) ErrorDesc(org.orcid.jaxb.model.message.ErrorDesc) RedirectUri(org.orcid.pojo.ajaxForm.RedirectUri) Produces(javax.ws.rs.Produces) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 69 with OrcidProfile

use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.

the class ManageDelegatorsController method manageDelegators.

@RequestMapping
public ModelAndView manageDelegators() {
    ModelAndView mav = new ModelAndView("manage_delegators");
    OrcidProfile profile = getEffectiveProfile();
    mav.addObject("profile", profile);
    return mav;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 70 with OrcidProfile

use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.

the class NotificationController method setPreference.

@RequestMapping(value = "/frequencies/{encryptedEmail}/email-frequencies.json", method = RequestMethod.POST)
@ResponseBody
public Preferences setPreference(HttpServletRequest request, HttpServletResponse response, @RequestBody Preferences preferences, @PathVariable("encryptedEmail") String encryptedEmail) throws UnsupportedEncodingException {
    String decryptedEmail = encryptionManager.decryptForExternalUse(new String(Base64.decodeBase64(encryptedEmail), "UTF-8"));
    OrcidProfile profile = orcidProfileManager.retrieveOrcidProfileByEmail(decryptedEmail);
    orcidProfileManager.updatePreferences(profile.getOrcidIdentifier().getPath(), preferences);
    response.addHeader("X-Robots-Tag", "noindex");
    return preferences;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)241 Test (org.junit.Test)118 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)77 Transactional (org.springframework.transaction.annotation.Transactional)50 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)45 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)43 DBUnitTest (org.orcid.test.DBUnitTest)43 Rollback (org.springframework.test.annotation.Rollback)40 OrcidWorks (org.orcid.jaxb.model.message.OrcidWorks)36 OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)35 Date (java.util.Date)27 PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)27 OrcidIdentifier (org.orcid.jaxb.model.message.OrcidIdentifier)25 WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)23 Affiliations (org.orcid.jaxb.model.message.Affiliations)22 FundingTitle (org.orcid.jaxb.model.message.FundingTitle)22 Title (org.orcid.jaxb.model.message.Title)22 Email (org.orcid.jaxb.model.message.Email)21 GivenNames (org.orcid.jaxb.model.message.GivenNames)21 OrcidHistory (org.orcid.jaxb.model.message.OrcidHistory)21