/** * ============================================================================= * * ORCID (R) Open Source * http://orcid.org * * Copyright (c) 2012-2014 ORCID, Inc. * Licensed under an MIT-Style License (MIT) * http://orcid.org/open-source-license * * This copyright and license information (including a link to the full license) * shall be included in its entirety in all copies or substantial portion of * the software. * * ============================================================================= */ package org.orcid.core.manager; import java.util.List; import org.orcid.core.manager.read_only.WorkManagerReadOnly; import org.orcid.jaxb.model.common_v2.Visibility; import org.orcid.jaxb.model.record_v2.Work; import org.orcid.jaxb.model.record_v2.WorkBulk; public interface WorkManager extends WorkManagerReadOnly { /** * Updates the visibility of an existing work * * @param workId * The id of the work that will be updated * @param visibility * The new visibility value for the profile work relationship * @return true if the relationship was updated * */ boolean updateVisibilities(String orcid, List<Long> workIds, Visibility visibility); /** * Removes a work. * * @param workId * The id of the work that will be removed from the client * profile * @param clientOrcid * The client orcid * @return true if the work was deleted * */ boolean removeWorks(String clientOrcid, List<Long> workIds); /** * Removes all works for an record. Careful! * * @param orcid * The ORCID iD of the record from which all works will be * removed. */ void removeAllWorks(String orcid); /** * Sets the display index of the new work * @param orcid * The work owner * @param workId * The work id * @return true if the work index was correctly set * */ boolean updateToMaxDisplay(String orcid, Long workId); /** * Add a new work to the work table * * @param work * The work that will be persited * @param isApiRequest * Does the request comes from the API? * @return the work already persisted on database * */ Work createWork(String orcid, Work work, boolean isApiRequest); /** * Add a list of works to the given profile * * @param works * The list of works that want to be added * @param orcid * The id of the user we want to add the works to * * @return the work bulk with the put codes of the new works or the error * that indicates why a work can't be added */ WorkBulk createWorks(String orcid, WorkBulk work); /** * Edits an existing work * * @param work * The work to be edited * @param isApiRequest * Does the request comes from the API? * @return The updated entity * */ Work updateWork(String orcid, Work work, boolean isApiRequest); boolean checkSourceAndRemoveWork(String orcid, Long workId); }