@Transactional public User assignReviewer(Publication publication) { final User owner = publication.getCurrentOwner(); if (owner == null) { throw new IllegalArgumentException("Cannot assign a reviewer to a publication without owner: "+ DebugUtil.annotatedObjectToString(publication, false)); } // check if the curator has a "mentor" reviewer, the one that is supposed to check her entries while learning User reviewer = UserUtils.getMentorReviewer(IntactContext.getCurrentInstance(), owner); if (reviewer == null) { SelectionRandomizer<User> selectionRandomizer = createSelectionRandomizer(); reviewer = selectionRandomizer.randomSelection(owner); if (reviewer == null) { throw new IllegalStateException("No reviewers could be found"); } } publication.setCurrentReviewer(reviewer); return reviewer; }
@Transactional public User assignReviewer(Publication publication) { final User owner = publication.getCurrentOwner(); if (owner == null) { throw new IllegalArgumentException("Cannot assign a reviewer to a publication without owner: "+ DebugUtil.annotatedObjectToString(publication, false)); } // check if the curator has a "mentor" reviewer, the one that is supposed to check her entries while learning User reviewer = UserUtils.getMentorReviewer(IntactContext.getCurrentInstance(), owner); if (reviewer == null) { SelectionRandomizer<User> selectionRandomizer = createSelectionRandomizer(); reviewer = selectionRandomizer.randomSelection(owner); if (reviewer == null) { throw new IllegalStateException("No reviewers could be found"); } } publication.setCurrentReviewer(reviewer); return reviewer; }
/** * This reviewer decides to review the publication. * * @param publication the publication to use * @param reason an optional comment */ @LifecycleTransition(statusChange = false) public void changeReviewer(Publication publication, User newReviewer, String reason) { addLifecycleEvent(publication, CvLifecycleEventType.REVIEWER_CHANGED, reason); User previousReviewer = publication.getCurrentReviewer(); publication.setCurrentReviewer( newReviewer ); // Notify listeners for ( LifecycleEventListener listener : getListeners() ) { listener.fireReviewerChanged( publication, previousReviewer, newReviewer ); } }
/** * This reviewer decides to review the publication. * * @param publication the publication to use * @param reason an optional comment */ @LifecycleTransition(statusChange = false) public void changeReviewer(Publication publication, User newReviewer, String reason) { addLifecycleEvent(publication, CvLifecycleEventType.REVIEWER_CHANGED, reason); User previousReviewer = publication.getCurrentReviewer(); publication.setCurrentReviewer( newReviewer ); // Notify listeners for ( LifecycleEventListener listener : getListeners() ) { listener.fireReviewerChanged( publication, previousReviewer, newReviewer ); } }
private void synchronizePublication( Publication publication, boolean synchronizeAnnotatedAttributes ) { if (IntactCore.isInitializedAndDirty(publication.getExperiments())){ Collection<Experiment> experiments = synchronizeCollection(publication.getExperiments()); publication.getExperiments().clear(); publication.getExperiments().addAll(experiments); } publication.setStatus( synchronize( publication.getStatus() ) ); publication.setCurrentOwner( synchronizeUser(publication.getCurrentOwner()) ); publication.setCurrentReviewer( synchronizeUser(publication.getCurrentReviewer()) ); final List<LifecycleEvent> events = publication.getLifecycleEvents(); if (IntactCore.isInitializedAndDirty( events )){ Collection<LifecycleEvent> synchedEvents = new ArrayList<LifecycleEvent>( events.size() ); for ( LifecycleEvent event : events ) { synchedEvents.add( synchronizeEvent(event) ); } events.clear(); events.addAll( synchedEvents ); } if (synchronizeAnnotatedAttributes){ synchronizeAnnotatedObjectCommons( publication ); } }
private void synchronizePublication( Publication publication, boolean synchronizeAnnotatedAttributes ) { if (IntactCore.isInitializedAndDirty(publication.getExperiments())){ Collection<Experiment> experiments = synchronizeCollection(publication.getExperiments()); publication.getExperiments().clear(); publication.getExperiments().addAll(experiments); } publication.setStatus( synchronize( publication.getStatus() ) ); publication.setCurrentOwner( synchronizeUser(publication.getCurrentOwner()) ); publication.setCurrentReviewer( synchronizeUser(publication.getCurrentReviewer()) ); final List<LifecycleEvent> events = publication.getLifecycleEvents(); if (IntactCore.isInitializedAndDirty( events )){ Collection<LifecycleEvent> synchedEvents = new ArrayList<LifecycleEvent>( events.size() ); for ( LifecycleEvent event : events ) { synchedEvents.add( synchronizeEvent(event) ); } events.clear(); events.addAll( synchedEvents ); } if (synchronizeAnnotatedAttributes){ synchronizeAnnotatedObjectCommons( publication ); } }
public Publication clonePublication(Publication publication) throws IntactClonerException { if (publication == null) return null; Publication clone = new Publication(); clonerManager.addClone(publication, clone); if (isCollectionClonable(publication.getExperiments())) { Collection<Experiment> experiments = IntactCore.ensureInitializedExperiments(publication); for (Experiment e : experiments) { clone.addExperiment(clone(e)); } } if (isCollectionClonable(publication.getLifecycleEvents())) { Collection<LifecycleEvent> events = IntactCore.ensureInitializedLifecycleEvents(publication); for (LifecycleEvent event : events) { clone.addLifecycleEvent(clone(event)); } } clone.setStatus(clone(publication.getStatus())); clone.setCurrentOwner(clone(publication.getCurrentOwner())); clone.setCurrentReviewer(clone(publication.getCurrentReviewer())); return clone; }
public Publication clonePublication(Publication publication) throws IntactClonerException { if (publication == null) return null; Publication clone = new Publication(); clonerManager.addClone(publication, clone); if (isCollectionClonable(publication.getExperiments())) { Collection<Experiment> experiments = IntactCore.ensureInitializedExperiments(publication); for (Experiment e : experiments) { clone.addExperiment(clone(e)); } } if (isCollectionClonable(publication.getLifecycleEvents())) { Collection<LifecycleEvent> events = IntactCore.ensureInitializedLifecycleEvents(publication); for (LifecycleEvent event : events) { clone.addLifecycleEvent(clone(event)); } } clone.setStatus(clone(publication.getStatus())); clone.setCurrentOwner(clone(publication.getCurrentOwner())); clone.setCurrentReviewer(clone(publication.getCurrentReviewer())); return clone; }