@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 curator decides to curate the publication. * * @param publication the publication to use * @param reason an optional comment */ @LifecycleTransition(statusChange = false) public void changeOwnership(Publication publication, User newOwner, String reason) { if ( publication == null ) { throw new IllegalArgumentException( "You must give a non null publication" ); } User previousOwner = publication.getCurrentOwner(); publication.setCurrentOwner( newOwner ); addLifecycleEvent(publication, CvLifecycleEventType.OWNER_CHANGED, "New owner: "+newOwner.getLogin()+" - "+reason); // Notify listeners for ( LifecycleEventListener listener : getListeners() ) { listener.fireOwnerChanged( publication, previousOwner, newOwner ); } }
/** * This curator decides to curate the publication. * * @param publication the publication to use * @param reason an optional comment */ @LifecycleTransition(statusChange = false) public void changeOwnership(Publication publication, User newOwner, String reason) { if ( publication == null ) { throw new IllegalArgumentException( "You must give a non null publication" ); } User previousOwner = publication.getCurrentOwner(); publication.setCurrentOwner( newOwner ); addLifecycleEvent(publication, CvLifecycleEventType.OWNER_CHANGED, "New owner: "+newOwner.getLogin()+" - "+reason); // Notify listeners for ( LifecycleEventListener listener : getListeners() ) { listener.fireOwnerChanged( publication, previousOwner, newOwner ); } }
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 ); } }
/** * A publication is assigned to another curator, who will be the owner. * * @param publication the publication * @param curator the curator to be assigned */ @LifecycleTransition(fromStatus = CvPublicationStatusType.NEW, toStatus = CvPublicationStatusType.ASSIGNED) public void assignToCurator(Publication publication, User curator ) { final User previousOwner = publication.getCurrentOwner(); publication.setCurrentOwner( curator ); final User currentUser = IntactContext.getCurrentInstance().getUserContext().getUser(); changeStatus(publication, CvPublicationStatusType.ASSIGNED, CvLifecycleEventType.ASSIGNED, "Assigned to: "+ curator.getLogin() + " by " + currentUser.getLogin() ); // Notify listeners for ( LifecycleEventListener listener : getListeners() ) { listener.fireOwnerChanged( publication, previousOwner, curator ); listener.fireAssigned( publication, currentUser, curator ); } } }
/** * A publication is assigned to another curator, who will be the owner. * * @param publication the publication * @param curator the curator to be assigned */ @LifecycleTransition(fromStatus = CvPublicationStatusType.NEW, toStatus = CvPublicationStatusType.ASSIGNED) public void assignToCurator(Publication publication, User curator ) { final User previousOwner = publication.getCurrentOwner(); publication.setCurrentOwner( curator ); final User currentUser = IntactContext.getCurrentInstance().getUserContext().getUser(); changeStatus(publication, CvPublicationStatusType.ASSIGNED, CvLifecycleEventType.ASSIGNED, "Assigned to: "+ curator.getLogin() + " by " + currentUser.getLogin() ); // Notify listeners for ( LifecycleEventListener listener : getListeners() ) { listener.fireOwnerChanged( publication, previousOwner, curator ); listener.fireAssigned( publication, currentUser, curator ); } } }
/** * This curator decides to curate the publication. * * @param publication the publication */ @LifecycleTransition(fromStatus = CvPublicationStatusType.NEW, toStatus = CvPublicationStatusType.ASSIGNED) public void claimOwnership(Publication publication) { IntactContext intactContext = IntactContext.getCurrentInstance(); final User previousOwner = publication.getCurrentOwner(); publication.setCurrentOwner(intactContext.getUserContext().getUser()); changeStatus(publication, CvPublicationStatusType.ASSIGNED, CvLifecycleEventType.SELF_ASSIGNED, "Claimed ownership"); // Notify listeners for ( LifecycleEventListener listener : getListeners() ) { listener.fireOwnerChanged( publication, previousOwner, intactContext.getUserContext().getUser() ); listener.fireAssigned( publication, null, intactContext.getUserContext().getUser() ); } }
/** * This curator decides to curate the publication. * * @param publication the publication */ @LifecycleTransition(fromStatus = CvPublicationStatusType.NEW, toStatus = CvPublicationStatusType.ASSIGNED) public void claimOwnership(Publication publication) { IntactContext intactContext = IntactContext.getCurrentInstance(); final User previousOwner = publication.getCurrentOwner(); publication.setCurrentOwner(intactContext.getUserContext().getUser()); changeStatus(publication, CvPublicationStatusType.ASSIGNED, CvLifecycleEventType.SELF_ASSIGNED, "Claimed ownership"); // Notify listeners for ( LifecycleEventListener listener : getListeners() ) { listener.fireOwnerChanged( publication, previousOwner, intactContext.getUserContext().getUser() ); listener.fireAssigned( publication, null, intactContext.getUserContext().getUser() ); } }
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; }