Search in sources :

Example 46 with OrcidProfile

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

the class NotificationManagerTest method testSendVerifiedRequiredAnnouncement2017.

@Test
public void testSendVerifiedRequiredAnnouncement2017() throws JAXBException, IOException, URISyntaxException {
    for (Locale locale : Locale.values()) {
        OrcidProfile orcidProfile = getProfile(locale);
        notificationManager.sendVerifiedRequiredAnnouncement2017(orcidProfile);
    }
}
Also used : Locale(org.orcid.jaxb.model.message.Locale) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 47 with OrcidProfile

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

the class NotificationManagerTest method testSendWelcomeEmail.

@Test
public void testSendWelcomeEmail() throws JAXBException, IOException, URISyntaxException {
    OrcidMessage orcidMessage = (OrcidMessage) unmarshaller.unmarshal(getClass().getResourceAsStream(ORCID_INTERNAL_FULL_XML));
    OrcidProfile orcidProfile = orcidMessage.getOrcidProfile();
    notificationManager.sendWelcomeEmail(orcidProfile.getOrcidIdentifier().getPath(), orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue());
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 48 with OrcidProfile

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

the class GroupAdministratorController method getClients.

@RequestMapping(value = "/get-clients.json", method = RequestMethod.GET)
@Produces(value = { MediaType.APPLICATION_JSON })
@ResponseBody
public List<Client> getClients() {
    OrcidProfile profile = getEffectiveProfile();
    String groupOrcid = profile.getOrcidIdentifier().getPath();
    if (profile.getType() == null || !profile.getType().equals(OrcidType.GROUP)) {
        LOGGER.warn("Trying to get clients of non group user {}", profile.getOrcidIdentifier().getPath());
        throw new OrcidClientGroupManagementException(getMessage("web.orcid.privilege.exception"));
    }
    OrcidClientGroup group = orcidClientGroupManager.retrieveOrcidClientGroup(groupOrcid);
    List<Client> clients = new ArrayList<Client>();
    for (OrcidClient orcidClient : group.getOrcidClient()) {
        clients.add(Client.valueOf(orcidClient));
    }
    return clients;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidClientGroup(org.orcid.jaxb.model.clientgroup.OrcidClientGroup) OrcidClientGroupManagementException(org.orcid.core.exception.OrcidClientGroupManagementException) OrcidClient(org.orcid.jaxb.model.clientgroup.OrcidClient) ArrayList(java.util.ArrayList) OrcidClient(org.orcid.jaxb.model.clientgroup.OrcidClient) Client(org.orcid.pojo.ajaxForm.Client) Produces(javax.ws.rs.Produces) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 49 with OrcidProfile

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

the class DeveloperToolsController method disableDeveloperTools.

/**
     * Disable developer tools on the current profile
     * 
     * @return true if the developer tools were disabled on the profile
     * */
@RequestMapping(value = "/disable-developer-tools.json", method = RequestMethod.POST)
@ResponseBody
public boolean disableDeveloperTools(HttpServletRequest request) {
    OrcidProfile profile = getEffectiveProfile();
    boolean updated = true;
    if (profile.getOrcidInternal() != null && profile.getOrcidInternal().getPreferences() != null && profile.getOrcidInternal().getPreferences().getDeveloperToolsEnabled() != null && profile.getOrcidInternal().getPreferences().getDeveloperToolsEnabled().isValue()) {
        // Disable the developer tools
        updated = profileEntityManager.disableDeveloperTools(profile);
        // Disable the sso access
        orcidSSOManager.revokeSSOAccess(profile.getOrcidIdentifier().getPath());
    }
    return updated;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 50 with OrcidProfile

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

the class AddDelegateForm method getOrcidProfile.

public OrcidProfile getOrcidProfile(String orcid) {
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidProfile.setOrcidIdentifier(orcid);
    OrcidBio orcidBio = new OrcidBio();
    orcidProfile.setOrcidBio(orcidBio);
    Delegation delegation = new Delegation();
    orcidBio.setDelegation(delegation);
    GivenPermissionTo givenPermissionTo = new GivenPermissionTo();
    delegation.setGivenPermissionTo(givenPermissionTo);
    DelegationDetails delegationDetails = new DelegationDetails();
    givenPermissionTo.getDelegationDetails().add(delegationDetails);
    DelegateSummary delegateSummary = new DelegateSummary(new OrcidIdentifier(delegateOrcid));
    delegationDetails.setDelegateSummary(delegateSummary);
    return orcidProfile;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) GivenPermissionTo(org.orcid.jaxb.model.message.GivenPermissionTo) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) DelegateSummary(org.orcid.jaxb.model.message.DelegateSummary) OrcidIdentifier(org.orcid.jaxb.model.message.OrcidIdentifier) DelegationDetails(org.orcid.jaxb.model.message.DelegationDetails) Delegation(org.orcid.jaxb.model.message.Delegation)

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