@Override protected Publication syncAttributes(Publication intactObject) { Collection<Experiment> experiments = new ArrayList<Experiment>( intactObject.getExperiments().size() ); for ( Experiment experiment : intactObject.getExperiments() ) { experiments.add( ExperimentPersister.getInstance().syncIfTransient( experiment ) ); } intactObject.setExperiments( experiments ); return super.syncAttributes( intactObject ); } }
public GeneratedEntry addPublication(Publication publication) { if (publication != null) { for (Experiment experiment : publication.getExperiments()) { addExperiment(experiment); } } else { throw new IntactException("No publication is null"); } return this; }
protected void traversePublication(Publication publication, IntactVisitor ... visitors) { if (publication == null) return; for (IntactVisitor visitor : visitors) { visitor.visitPublication(publication); traverse(publication.getExperiments(), visitors); } }
protected void traversePublication(Publication publication, IntactVisitor ... visitors) { if (publication == null) return; for (IntactVisitor visitor : visitors) { visitor.visitPublication(publication); traverse(publication.getExperiments(), visitors); } }
public GeneratedEntry addPublication(Publication publication) { if (publication != null) { for (Experiment experiment : publication.getExperiments()) { addExperiment(experiment); } } else { throw new IntactException("No publication is null"); } return this; }
private boolean isPublicationEligibleForDataset(Publication p){ // the publication is not excluded by the selector if (this.selector.getPublicationsIdToExclude().contains(p.getShortLabel())){ return false; } // all the experiments must contain less than 100 interactions for (Experiment exp : p.getExperiments()){ if (this.selector.getMaxNumberOfInteractionsPerExperiment() <= exp.getInteractions().size()){ return false; } } return true; }
@Override protected void saveOrUpdateAttributes(Publication intactObject) throws PersisterException { super.saveOrUpdateAttributes(intactObject); for ( Experiment experiment : intactObject.getExperiments() ) { ExperimentPersister.getInstance().saveOrUpdate( experiment ); } }
/** * Checks if any of the experiments for a publication is On Hold * * @param publication The publication to check * @return true if any of the experiments has the cv topic on hold in its annotations */ public static boolean isPublicationOnHold(Publication publication) { for (Experiment experiment : publication.getExperiments()) { for (Annotation annotation : experiment.getAnnotations()) { if (annotation.getCvTopic() != null && CvTopic.ON_HOLD.equals(annotation.getCvTopic().getShortLabel())) { return true; } } } return false; }
public static boolean isToBeReviewed(Publication publication) { if (publication == null) { throw new NullPointerException("You must give a non null publication"); } for (Annotation a : publication.getAnnotations()) { if (a.getCvTopic() != null && CvTopic.TO_BE_REVIEWED.equals(a.getCvTopic().getShortLabel())) { return true; } } for (Experiment experiment : publication.getExperiments()) { if (ExperimentUtils.isToBeReviewed(experiment)) { return true; } } return false; }
/** * Retrieves the experiment from a publication, initializing them if necessary. * * @param publication the publication * @return The returned experiments are ensured to be initialized * @since 2.4.0 */ public static Collection<Experiment> ensureInitializedExperiments(Publication publication) { Collection<Experiment> experiments; if (IntactCore.isInitialized(publication.getExperiments())) { experiments = publication.getExperiments(); } else { experiments = IntactContext.getCurrentInstance().getDaoFactory().getExperimentDao().getByPubAc(publication.getAc()); } return experiments; }
public static boolean isToBeReviewed(Publication publication) { if (publication == null) { throw new NullPointerException("You must give a non null publication"); } for (Annotation a : publication.getAnnotations()) { if (a.getCvTopic() != null && CvTopic.TO_BE_REVIEWED.equals(a.getCvTopic().getShortLabel())) { return true; } } for (Experiment experiment : publication.getExperiments()) { if (ExperimentUtils.isToBeReviewed(experiment)) { return true; } } return false; }
/** * Retrieves the experiment from a publication, initializing them if necessary. * * @param publication the publication * @return The returned experiments are ensured to be initialized * @since 2.4.0 */ public static Collection<Experiment> ensureInitializedExperiments(Publication publication) { Collection<Experiment> experiments; if (IntactCore.isInitialized(publication.getExperiments())) { experiments = publication.getExperiments(); } else { experiments = IntactContext.getCurrentInstance().getDaoFactory().getExperimentDao().getByPubAc(publication.getAc()); } return experiments; }
public static boolean isOnHold(Publication publication) { if (publication == null) { throw new NullPointerException("You must give a non null publication"); } for (Annotation a : publication.getAnnotations()) { if (a.getCvTopic() != null && CvTopic.ON_HOLD.equals(a.getCvTopic().getShortLabel())) { return true; } } for (Experiment experiment : publication.getExperiments()) { if (ExperimentUtils.isOnHold(experiment)) { return true; } } return false; }
public static boolean isOnHold(Publication publication) { if (publication == null) { throw new NullPointerException("You must give a non null publication"); } for (Annotation a : publication.getAnnotations()) { if (a.getCvTopic() != null && CvTopic.ON_HOLD.equals(a.getCvTopic().getShortLabel())) { return true; } } for (Experiment experiment : publication.getExperiments()) { if (ExperimentUtils.isOnHold(experiment)) { return true; } } return false; }
/** * Checks if any of the experiments for a publication is On Hold * * @param publication The publication to check * @return true if any of the experiments has the cv topic on hold in its annotations */ public static boolean isPublicationOnHold(Publication publication) { for (Experiment experiment : publication.getExperiments()) { for (Annotation annotation : experiment.getAnnotations()) { if (annotation.getCvTopic() != null && CvTopic.ON_HOLD.equals(annotation.getCvTopic().getShortLabel())) { return true; } } } return false; }
protected void copyPublication( Publication source, Publication target ) { copyCollection( source.getExperiments(), target.getExperiments() ); copyCollection( source.getLifecycleEvents(), target.getLifecycleEvents() ); copyProperty(source, "currentOwner", target); copyProperty(source, "currentReviewer", target); copyProperty(source, "publicationId", target); copyProperty(source, "status", target); }
protected void copyPublication( Publication source, Publication target ) { copyCollection( source.getExperiments(), target.getExperiments() ); copyCollection( source.getLifecycleEvents(), target.getLifecycleEvents() ); copyProperty(source, "currentOwner", target); copyProperty(source, "currentReviewer", target); copyProperty(source, "publicationId", target); copyProperty(source, "status", target); }
public static boolean isAccepted(Publication publication) { if (publication == null) { throw new NullPointerException("You must give a non null publication"); } if (publication.getStatus() != null) { final String statusId = publication.getStatus().getIdentifier(); return CvPublicationStatusType.ACCEPTED.identifier().equals(statusId) || CvPublicationStatusType.ACCEPTED_ON_HOLD.identifier().equals(statusId) || CvPublicationStatusType.READY_FOR_RELEASE.identifier().equals(statusId) || CvPublicationStatusType.RELEASED.identifier().equals(statusId); } for (Annotation a : publication.getAnnotations()) { if (a.getCvTopic() != null && CvTopic.ACCEPTED.equals(a.getCvTopic().getShortLabel())) { return true; } } return ExperimentUtils.areAllAccepted(publication.getExperiments()); }
public static boolean isAccepted(Publication publication) { if (publication == null) { throw new NullPointerException("You must give a non null publication"); } if (publication.getStatus() != null) { final String statusId = publication.getStatus().getIdentifier(); return CvPublicationStatusType.ACCEPTED.identifier().equals(statusId) || CvPublicationStatusType.ACCEPTED_ON_HOLD.identifier().equals(statusId) || CvPublicationStatusType.READY_FOR_RELEASE.identifier().equals(statusId) || CvPublicationStatusType.RELEASED.identifier().equals(statusId); } for (Annotation a : publication.getAnnotations()) { if (a.getCvTopic() != null && CvTopic.ACCEPTED.equals(a.getCvTopic().getShortLabel())) { return true; } } return ExperimentUtils.areAllAccepted(publication.getExperiments()); }
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; }