public psidev.psi.mi.xml254.jaxb.Participant toJaxb( psidev.psi.mi.xml.model.Participant mParticipant) throws ConverterException { if (mParticipant == null) { throw new IllegalArgumentException("You must give a non null model Participant."); } checkDependencies(); psidev.psi.mi.xml254.jaxb.Participant jParticipant = new psidev.psi.mi.xml254.jaxb.Participant(); // Initialise the JAXB object reading the model // 1. set attributes jParticipant.setId(mParticipant.getId()); // 2. set sub elements // interactor / interaction if (mParticipant.hasInteractor() || mParticipant.hasInteractorRef()) { // compact form: export ref if (PsimiXmlForm.FORM_COMPACT == ConverterContext.getInstance().getConverterConfig().getXmlForm()) { if (mParticipant.hasInteractorRef()) jParticipant.setInteractorRef(mParticipant.getInteractorRef().getRef()); else jParticipant.setInteractorRef(mParticipant.getInteractor().getId()); } // not compact form : export the full interactor else { jParticipant.setInteractor(interactorConverter.toJaxb(mParticipant.getInteractor())); } } else if (mParticipant.hasInteraction()) { jParticipant.setInteractionRef(mParticipant.getInteraction().getId()); } else { throw new ConverterException( "Neither an interactor or an interaction was present in participant " + mParticipant.getId()); } // BiologigicalRoles if (mParticipant.hasBiologicalRole()) { jParticipant.setBiologicalRole(cvTypeConverter.toJaxb(mParticipant.getBiologicalRole())); } // Names if (mParticipant.hasNames()) { jParticipant.setNames(namesConverter.toJaxb(mParticipant.getNames())); } // Xrefs if (mParticipant.hasXref()) { jParticipant.setXref(xrefConverter.toJaxb(mParticipant.getXref())); } // ConfidenceList if (mParticipant.hasConfidences()) { if (jParticipant.getConfidenceList() == null) { jParticipant.setConfidenceList(new ConfidenceList()); } for (psidev.psi.mi.xml.model.Confidence mConfidence : mParticipant.getConfidenceList()) { jParticipant .getConfidenceList() .getConfidences() .add(confidenceConverter.toJaxb(mConfidence)); } } // ExperimentalInteractor if (mParticipant.hasExperimentalInteractors()) { if (jParticipant.getExperimentalInteractorList() == null) { jParticipant.setExperimentalInteractorList( new psidev.psi.mi.xml254.jaxb.ExperimentalInteractorList()); } for (ExperimentalInteractor mExperimentalInteractor : mParticipant.getExperimentalInteractors()) { jParticipant .getExperimentalInteractorList() .getExperimentalInteractors() .add(experimentalInteractorConverter.toJaxb(mExperimentalInteractor)); } } // ExperimentalPreparations if (mParticipant.hasExperimentalPreparations()) { if (jParticipant.getExperimentalPreparationList() == null) { jParticipant.setExperimentalPreparationList( new psidev.psi.mi.xml254.jaxb.ExperimentalPreparationList()); } for (ExperimentalPreparation mExperimentalPreparation : mParticipant.getExperimentalPreparations()) { jParticipant .getExperimentalPreparationList() .getExperimentalPreparations() .add(experimentalPreparationConverter.toJaxb(mExperimentalPreparation)); } } // ExperimentalRoles if (mParticipant.hasExperimentalRoles()) { if (jParticipant.getExperimentalRoleList() == null) { jParticipant.setExperimentalRoleList(new psidev.psi.mi.xml254.jaxb.ExperimentalRoleList()); } for (ExperimentalRole mExperimentalRole : mParticipant.getExperimentalRoles()) { jParticipant .getExperimentalRoleList() .getExperimentalRoles() .add(experimentalRoleConverter.toJaxb(mExperimentalRole)); } } // Features if (mParticipant.hasFeatures()) { if (jParticipant.getFeatureList() == null) { jParticipant.setFeatureList(new psidev.psi.mi.xml254.jaxb.FeatureList()); } for (Feature mFeature : mParticipant.getFeatures()) { jParticipant.getFeatureList().getFeatures().add(featureConverter.toJaxb(mFeature)); } } // HostOrganisms if (!mParticipant.getHostOrganisms().isEmpty()) { if (jParticipant.getHostOrganismList() == null) { jParticipant.setHostOrganismList(new HostOrganismList()); } for (HostOrganism mHostOrganism : mParticipant.getHostOrganisms()) { jParticipant .getHostOrganismList() .getHostOrganisms() .add(hostOrganismConverter.toJaxb(mHostOrganism)); } } // Parameters if (mParticipant.hasParameters()) { if (jParticipant.getParameterList() == null) { jParticipant.setParameterList(new ParameterList()); } for (Parameter mParameter : mParticipant.getParameters()) { jParticipant.getParameterList().getParameters().add(parameterConverter.toJaxb(mParameter)); } } // ParticipantIdentificationMethod if (mParticipant.hasParticipantIdentificationMethods()) { if (jParticipant.getParticipantIdentificationMethodList() == null) { jParticipant.setParticipantIdentificationMethodList( new psidev.psi.mi.xml254.jaxb.ParticipantIdentificationMethodList()); } for (ParticipantIdentificationMethod mParticipantIdentificationMethod : mParticipant.getParticipantIdentificationMethods()) { jParticipant .getParticipantIdentificationMethodList() .getParticipantIdentificationMethods() .add(participantIdentificationMethodConverter.toJaxb(mParticipantIdentificationMethod)); } } // Attributes if (mParticipant.hasAttributes()) { if (jParticipant.getAttributeList() == null) { jParticipant.setAttributeList(new AttributeList()); } for (Attribute mAttribute : mParticipant.getAttributes()) { jParticipant.getAttributeList().getAttributes().add(attributeConverter.toJaxb(mAttribute)); } } return jParticipant; }