001package org.biopax.paxtools.impl.level3;
002
003import org.biopax.paxtools.model.level3.Entity;
004import org.biopax.paxtools.model.level3.MolecularInteraction;
005import org.biopax.paxtools.model.level3.PhysicalEntity;
006import org.biopax.paxtools.util.IllegalBioPAXArgumentException;
007import org.hibernate.annotations.Cache;
008import org.hibernate.annotations.CacheConcurrencyStrategy;
009import org.hibernate.annotations.Proxy;
010import org.hibernate.annotations.DynamicInsert;
011import org.hibernate.annotations.DynamicUpdate; 
012import org.hibernate.search.annotations.Indexed;
013
014import javax.persistence.Transient;
015
016/**
017 */
018
019@javax.persistence.Entity
020@Proxy(proxyClass= MolecularInteraction.class)
021@Indexed
022@DynamicUpdate @DynamicInsert
023@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
024public class MolecularInteractionImpl extends InteractionImpl
025        implements MolecularInteraction
026{
027        public MolecularInteractionImpl() {
028        }
029        
030        @Transient
031    public Class<? extends MolecularInteraction> getModelInterface()
032    {
033        return MolecularInteraction.class;
034    }
035
036    public void addParticipant(Entity participant)
037    {
038                if (participant != null) {
039                        if (participant instanceof PhysicalEntity) {
040                                super.addParticipant(participant);
041                        } else {
042                                throw new IllegalBioPAXArgumentException(
043                                                "Participants of a molecular interaction should be"
044                                                                + "of type PhysicalEntity. Parameter "
045                                                                + participant + "is of type "
046                                                                + participant.getClass());
047                        }
048                }
049    }
050}