protected void initialiseExpansionMethod(Collection<MitabCvTerm> expansion, T interaction){ if (expansion.size() > 1){ if (getParserListener() != null){ getParserListener().onSeveralCvTermsFound(expansion, expansion.iterator().next(), expansion.size()+" complex expansions found. Only the first one will be loaded."); } interaction.getAnnotations().add(new MitabAnnotation(expansion.iterator().next())); } else if (!expansion.isEmpty()){ interaction.getAnnotations().add(new MitabAnnotation(expansion.iterator().next())); } }
/** * * @param interaction : the interaction to wrap */ public AbstractBinaryInteractionWrapper(I interaction){ if (interaction == null){ throw new IllegalArgumentException("The wrappedInteraction of a AbstractBinaryInteractionWrapper cannot be null"); } if (interaction.getParticipants().size() > 2){ throw new IllegalArgumentException("The wrappedInteraction of a AbstractBinaryInteractionWrapper cannot have more than two participants"); } this.wrappedInteraction = interaction; Annotation annot = InteractionUtils.collectComplexExpansionMethodFromAnnotations(interaction.getAnnotations()); this.annotations = new AnnotationList(); ((AnnotationList)this.annotations).addAllOnly(interaction.getAnnotations()); if (annot != null){ this.complexExpansion = annot.getTopic(); ((AnnotationList)this.annotations).removeOnly(complexExpansion); } }
interaction.getAnnotations().addAll(annotI);
target.getAnnotations().clear(); target.getAnnotations().addAll(source.getAnnotations()); target.getChecksums().clear(); target.getChecksums().addAll(source.getChecksums());
/** * This method will copy basic properties from the Interaction source in the complex target. * It will erase existing annotations, xrefs, checksums and identifiers * This method does not copy the participants of the source * @param source * @param target */ public static void copyAndOverrideBasicComplexPropertiesWithInteractionProperties(Interaction source, Complex target){ if (source != null && target != null){ target.setInteractionType(source.getInteractionType()); target.setCreatedDate(source.getCreatedDate()); target.setUpdatedDate(source.getUpdatedDate()); if (source.getShortName() != null){ target.setShortName(source.getShortName()); } // copy collections target.getAnnotations().clear(); target.getAnnotations().addAll(source.getAnnotations()); target.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); target.getIdentifiers().clear(); target.getIdentifiers().addAll(source.getIdentifiers()); target.getChecksums().clear(); target.getChecksums().addAll(source.getChecksums()); } }