Search in sources :

Example 1 with WorkVisibilityDefault

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

the class OrcidMessageVersionConverterImplV1_2_rc3ToV1_2_rc4 method downgradeProfile.

private void downgradeProfile(OrcidProfile orcidProfile) {
    if (orcidProfile != null) {
        if (orcidProfile.getOrcidHistory() != null) {
            if (orcidProfile.getOrcidHistory().getVerifiedEmail() != null) {
                orcidProfile.getOrcidHistory().setVerifiedEmail(null);
            }
            if (orcidProfile.getOrcidHistory().getVerifiedPrimaryEmail() != null) {
                orcidProfile.getOrcidHistory().setVerifiedPrimaryEmail(null);
            }
        }
        if (orcidProfile.getOrcidInternal() != null) {
            // earlier versions of the XSD don't have GroupOrcidIdentifier 
            if (orcidProfile.getOrcidInternal().getReferredBy() != null) {
                orcidProfile.getOrcidInternal().setReferredBy(null);
            }
            // earlier versions of the XSD don't have 
            if (orcidProfile.getOrcidInternal().getPreferences() != null && orcidProfile.getOrcidInternal().getPreferences().getDeveloperToolsEnabled() != null) {
                orcidProfile.getOrcidInternal().getPreferences().setDeveloperToolsEnabled(null);
            }
        }
        if (orcidProfile.getOrcidInternal() != null) {
            if (orcidProfile.getOrcidInternal().getPreferences() != null) {
                Preferences prefs = orcidProfile.getOrcidInternal().getPreferences();
                if (prefs.getActivitiesVisibilityDefault() != null && prefs.getActivitiesVisibilityDefault().getValue() != null) {
                    prefs.setWorkVisibilityDefault(new WorkVisibilityDefault(prefs.getActivitiesVisibilityDefault().getValue()));
                    prefs.setActivitiesVisibilityDefault(null);
                }
            }
        }
        //Previews versions doesnt have organization defined funding type
        if (orcidProfile.getOrcidActivities() != null) {
            OrcidActivities activities = orcidProfile.getOrcidActivities();
            if (activities.getFundings() != null) {
                FundingList fundingList = activities.getFundings();
                for (Funding funding : fundingList.getFundings()) {
                    funding.setOrganizationDefinedFundingType(null);
                }
            }
        }
    }
}
Also used : FundingList(org.orcid.jaxb.model.message.FundingList) WorkVisibilityDefault(org.orcid.jaxb.model.message.WorkVisibilityDefault) Funding(org.orcid.jaxb.model.message.Funding) Preferences(org.orcid.jaxb.model.message.Preferences) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities)

Aggregations

Funding (org.orcid.jaxb.model.message.Funding)1 FundingList (org.orcid.jaxb.model.message.FundingList)1 OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)1 Preferences (org.orcid.jaxb.model.message.Preferences)1 WorkVisibilityDefault (org.orcid.jaxb.model.message.WorkVisibilityDefault)1