E - The class of ORCID activities being synchronizedS - The class of ORCID activity summariesG - The class of ORCID activity groupsT - The class of ORCID activity typesORCIDFundingHelper, ORCIDWorkHelperpublic abstract class ORCIDHelper<E extends org.um.dsi.gavea.orcid.model.common.ElementSummary,S extends org.um.dsi.gavea.orcid.model.common.ElementSummary,G,T extends java.lang.Enum<T>>
extends java.lang.Object
client. Supports bulk
requests when available. The concrete ORCID activities to be managed by the
helper are expected to support external identifiers.
Provides support for asynchronous communication with ORCID although it is
only active for GET requests due to resource limitations.| Modifier and Type | Field | Description |
|---|---|---|
ORCIDClient |
client |
The client used to communicate with ORCID.
|
static java.lang.String |
INVALID_EXTERNALIDENTIFIERS |
|
static java.lang.String |
INVALID_ORGANIZATION |
|
static java.lang.String |
INVALID_PUBLICATIONDATE |
|
static java.lang.String |
INVALID_TITLE |
|
static java.lang.String |
INVALID_TYPE |
|
static java.lang.String |
INVALID_YEAR |
|
static java.lang.String |
OVERLAPPING_EIDs |
| Constructor | Description |
|---|---|
ORCIDHelper(ORCIDClient orcidClient,
int bulk_size_add,
int bulk_size_get) |
Initializes the helper with a given ORCID client, which defines whether
asynchronous calls will be performed, and sets whether bulk ORCID
commands are available and with which size.
|
| Modifier and Type | Method | Description |
|---|---|---|
java.util.List<PTCRISyncResult<E>> |
add(java.util.List<E> activities,
ProgressHandler handler) |
Synchronously adds a list of activities to an ORCID profile, either
through atomic or bulk calls if available.
|
static void |
cleanWorkLocalKey(org.um.dsi.gavea.orcid.model.common.ElementSummary activity) |
Clears (sets to null) the local key of an activity, currently assumed to
be stored in the put-code field.
|
abstract E |
createUpdate(E original,
ExternalIdsDiff diff) |
Creates an update to an activity given the difference on meta-data.
|
PTCRISyncResult<E> |
delete(java.math.BigInteger putcode) |
Synchronously deletes an activity from an ORCID profile.
|
void |
deleteAllSourced() |
Deletes the entire set of activity summaries in the ORCID profile whose
source is the Member API id defined in the ORCID client.
|
static ORCIDHelper<org.um.dsi.gavea.orcid.model.funding.Funding,org.um.dsi.gavea.orcid.model.funding.FundingSummary,org.um.dsi.gavea.orcid.model.activities.FundingGroup,org.um.dsi.gavea.orcid.model.funding.FundingType> |
factoryStaticFundings() |
Creates a static (i.e., no server connection) ORCID helper to manage
funding activities.
|
static ORCIDHelper<org.um.dsi.gavea.orcid.model.work.Work,org.um.dsi.gavea.orcid.model.work.WorkSummary,org.um.dsi.gavea.orcid.model.activities.WorkGroup,org.um.dsi.gavea.orcid.model.work.WorkType> |
factoryStaticWorks() |
Creates a static (i.e., no server connection) ORCID helper to manage work
activities.
|
static java.math.BigInteger |
getActivityLocalKey(org.um.dsi.gavea.orcid.model.common.ElementSummary activity) |
Retrieves the local key of an activity, currently assumed to be stored in
the put-code field.
|
static java.math.BigInteger |
getActivityLocalKey(org.um.dsi.gavea.orcid.model.common.ElementSummary activity,
java.math.BigInteger defaultValue) |
Retrieves the local key of an activity, currently assumed to be stored in
the put-code field.
|
java.util.List<S> |
getAllTypedSummaries(java.util.Collection<T> types) |
Retrieves the entire set of activity summaries of given types from the
set ORCID profile that have at least an external identifier set.
|
void |
getFulls(java.util.List<S> summaries,
java.util.Map<java.math.BigInteger,PTCRISyncResult<E>> cb,
ProgressHandler handler) |
Reads a full ORCID activity from an ORCID profile and adds it to a
callback map.
|
abstract org.um.dsi.gavea.orcid.model.common.ExternalIds |
getNonNullExternalIdsE(E activity) |
Returns the non-null external identifiers of an activity (null becomes
empty list).
|
abstract org.um.dsi.gavea.orcid.model.common.ExternalIds |
getNonNullExternalIdsS(S summary) |
Returns the non-null external identifiers of an activity summary (null
becomes empty list).
|
org.um.dsi.gavea.orcid.model.common.ExternalIds |
getPartOfExternalIdsE(E activity) |
Returns the non-null part-of external identifiers of an activity (null
becomes empty list).
|
java.util.Map<E,ExternalIdsDiff> |
getSelfExternalIdsDiffS(S summary,
java.util.Collection<E> activities) |
Calculates the symmetric difference of self
external
identifiers between an activity summary and a set of activities. |
org.um.dsi.gavea.orcid.model.common.ExternalIds |
getSelfExternalIdsE(E activity) |
Returns the non-null self external identifiers of an activity (null
becomes empty list).
|
java.util.List<S> |
getSourcedSummaries() |
Retrieves the entire set (i.e., not merged) of activity summaries in the
ORCID profile whose source is the Member API id defined in the ORCID
client.
|
T |
getTypeE(E activity) |
Retrieves the type of an activity.
|
boolean |
hasNewSelfIDs(E preElement,
S posElement) |
Checks whether an activity is already up to date regarding another one
regarding self
external identifiers. |
boolean |
isUpToDateE(E preElement,
E posElement) |
Checks whether an activity is already up to date regarding another one,
considering the self
external identifiers and
additional meta-data. |
boolean |
isUpToDateS(E preElement,
S posElement) |
Checks whether an activity is already up to date regarding another one,
considering the self
external identifiers and
additional meta-data. |
abstract void |
setExternalIdsE(E activity,
org.um.dsi.gavea.orcid.model.common.ExternalIds eids) |
Assigns a set of external identifiers to an activity.
|
abstract void |
setExternalIdsS(S summary,
org.um.dsi.gavea.orcid.model.common.ExternalIds eids) |
Assigns a set of external identifiers to an activity summary.
|
java.util.Set<java.lang.String> |
testMinimalQuality(S summary) |
Tests whether an activity summary has minimal quality to be synchronized,
by inspecting its meta-data and that of coexisting activities, and
returns the detected invalid fields.
|
void |
tryMinimalQualityE(E activity,
java.util.Collection<E> others) |
Tests whether an activity has minimal quality to be synchronized, by
inspecting its meta-data.
|
PTCRISyncResult<E> |
update(java.math.BigInteger remotePutcode,
E updated) |
Synchronously updates an activity to an ORCID profile.
|
public static final java.lang.String INVALID_EXTERNALIDENTIFIERS
public static final java.lang.String INVALID_TITLE
public static final java.lang.String INVALID_PUBLICATIONDATE
public static final java.lang.String INVALID_YEAR
public static final java.lang.String INVALID_TYPE
public static final java.lang.String INVALID_ORGANIZATION
public static final java.lang.String OVERLAPPING_EIDs
public final ORCIDClient client
public ORCIDHelper(ORCIDClient orcidClient, int bulk_size_add, int bulk_size_get)
orcidClient - the ORCID clientbulk_size_add - number of activities per bulk add requestbulk_size_get - number of activities per bulk get requestpublic static ORCIDHelper<org.um.dsi.gavea.orcid.model.work.Work,org.um.dsi.gavea.orcid.model.work.WorkSummary,org.um.dsi.gavea.orcid.model.activities.WorkGroup,org.um.dsi.gavea.orcid.model.work.WorkType> factoryStaticWorks()
public static ORCIDHelper<org.um.dsi.gavea.orcid.model.funding.Funding,org.um.dsi.gavea.orcid.model.funding.FundingSummary,org.um.dsi.gavea.orcid.model.activities.FundingGroup,org.um.dsi.gavea.orcid.model.funding.FundingType> factoryStaticFundings()
public final java.util.List<S> getAllTypedSummaries(java.util.Collection<T> types) throws org.um.dsi.gavea.orcid.client.exception.OrcidClientException
group(Object).types - the ORCID types of the activities to be retrieved (may be null)org.um.dsi.gavea.orcid.client.exception.OrcidClientException - if the communication with ORCID failspublic final java.util.List<S> getSourcedSummaries() throws org.um.dsi.gavea.orcid.client.exception.OrcidClientException
org.um.dsi.gavea.orcid.client.exception.OrcidClientException - if the communication with ORCID failspublic final void getFulls(java.util.List<S> summaries, java.util.Map<java.math.BigInteger,PTCRISyncResult<E>> cb, ProgressHandler handler) throws java.lang.InterruptedException
PTCRISyncResult.summaries - the ORCID activity summaries representing the merged groupscb - the callback objecthandler - the handler to report progressjava.lang.InterruptedException - if the asynchronous GET process is interruptedreadClient(List)public final java.util.List<PTCRISyncResult<E>> add(java.util.List<E> activities, ProgressHandler handler)
PTCRISyncResult. If the overall
communication fails, the result is replicated for each input.activities - the new ORCID activities to be addedhandler - the handler to report progresspublic final PTCRISyncResult<E> update(java.math.BigInteger remotePutcode, E updated)
PTCRISyncResult.remotePutcode - the put-code of the remote ORCID activity that will be updatedupdated - the new state of the activity that will be updatedupdateClient(BigInteger, ElementSummary)public final PTCRISyncResult<E> delete(java.math.BigInteger putcode)
PTCRISyncResult.putcode - the remote put-code of the ORCID activity to be deleteddeleteClient(BigInteger)public final void deleteAllSourced()
throws org.um.dsi.gavea.orcid.client.exception.OrcidClientException
org.um.dsi.gavea.orcid.client.exception.OrcidClientException - if the communication with ORCID failspublic abstract org.um.dsi.gavea.orcid.model.common.ExternalIds getNonNullExternalIdsE(E activity)
getNonNullExternalIdsS(ElementSummary) because
summarize(ElementSummary) itself calls this method.activity - the ORCID activity from which to retrieve the external
identifierspublic abstract org.um.dsi.gavea.orcid.model.common.ExternalIds getNonNullExternalIdsS(S summary)
summary - the ORCID activity summary from which to retrieve the external
identifierspublic abstract void setExternalIdsE(E activity, org.um.dsi.gavea.orcid.model.common.ExternalIds eids)
activity - the ORCID activity to which to assign the external identifierseids - the external identifiers to be assignedpublic abstract void setExternalIdsS(S summary, org.um.dsi.gavea.orcid.model.common.ExternalIds eids)
summary - the ORCID activity summary to which to assign the external
identifierseids - the external identifiers to be assignedpublic abstract E createUpdate(E original, ExternalIdsDiff diff)
original - the original ORCID activitydiff - the difference on external identifierspublic static java.math.BigInteger getActivityLocalKey(org.um.dsi.gavea.orcid.model.common.ElementSummary activity)
activity - the ORCID activity from which to get the local keypublic static java.math.BigInteger getActivityLocalKey(org.um.dsi.gavea.orcid.model.common.ElementSummary activity,
java.math.BigInteger defaultValue)
activity - the ORCID activity from which to get the local keydefaultValue - a default value in case the put-code is emptypublic static void cleanWorkLocalKey(org.um.dsi.gavea.orcid.model.common.ElementSummary activity)
activity - the activity to which to clear the local keypublic final T getTypeE(E activity)
getTypeS(ElementSummary).activity - the ORCID activitypublic final org.um.dsi.gavea.orcid.model.common.ExternalIds getPartOfExternalIdsE(E activity)
getPartOfExternalIdsS(ElementSummary).activity - the ORCID activity from which to retrieve the external
identifierspublic final org.um.dsi.gavea.orcid.model.common.ExternalIds getSelfExternalIdsE(E activity)
getSelfExternalIdsS(ElementSummary).activity - the ORCID activity from which to retrieve the external
identifierspublic final java.util.Map<E,ExternalIdsDiff> getSelfExternalIdsDiffS(S summary, java.util.Collection<E> activities)
external
identifiers between an activity summary and a set of activities.
Elements that do not match (i.e., no identifier is common) are ignored.summary - the activity summary to be compared with other activitiesactivities - the set of activities against which the activity summary is
comparedpublic final boolean hasNewSelfIDs(E preElement, S posElement)
external identifiers.
This test is expected to be used by the import algorithms, where only new
self external identifiers are to be considered.preElement - the potentially out of date ORCID activityposElement - the up to date ORCID activitypublic final boolean isUpToDateS(E preElement, S posElement)
external identifiers and
additional meta-data. Only meta-data existent in the activity summaries
is conside
This test is expected to be used by the export algorithms, where the
meta-data is expected to be up-to-date on the remote profile.preElement - the potentially out of date ORCID activityposElement - the up to date ORCID activitypublic final boolean isUpToDateE(E preElement, E posElement)
external identifiers and
additional meta-data. Only meta-data existent in the activity summaries
is considered. Builds on
isUpToDateS(ElementSummary, ElementSummary).
This test is expected to be used by the export algorithms, where the
meta-data is expected to be up-to-date on the remote profile.preElement - the potentially out of date ORCID activityposElement - the up to date ORCID activitypublic final void tryMinimalQualityE(E activity, java.util.Collection<E> others) throws InvalidActivityException
activity - the activity to test for qualityothers - other coexisting activitiesInvalidActivityException - if the quality test fails, containing the reasons for failingpublic final java.util.Set<java.lang.String> testMinimalQuality(S summary)
testMinimalQuality(ElementSummary, Collection).
TODO: contributors are not being considered as they are not contained in
the summaries.summary - the ORCID activity summary to test for quality