001package org.biopax.paxtools.impl.level3;
002
003import org.biopax.paxtools.model.level3.BindingFeature;
004import org.biopax.paxtools.model.level3.EntityFeature;
005import org.biopax.paxtools.model.level3.PhysicalEntity;
006import org.biopax.paxtools.model.level3.SmallMolecule;
007import org.biopax.paxtools.util.IllegalBioPAXArgumentException;
008import org.hibernate.annotations.Cache;
009import org.hibernate.annotations.CacheConcurrencyStrategy;
010import org.hibernate.annotations.Proxy;
011import org.hibernate.annotations.DynamicInsert;
012import org.hibernate.annotations.DynamicUpdate; 
013import org.hibernate.search.annotations.Indexed;
014
015import javax.persistence.Entity;
016import javax.persistence.Transient;
017
018@Entity
019@Proxy(proxyClass= SmallMolecule.class)
020@Indexed
021@DynamicUpdate @DynamicInsert
022@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
023public class SmallMoleculeImpl extends SimplePhysicalEntityImpl
024                implements SmallMolecule
025{
026        public SmallMoleculeImpl() {
027        }
028        
029        @Override @Transient
030        public Class<? extends PhysicalEntity> getModelInterface() {
031                return SmallMolecule.class;
032        }
033        
034        @Override
035        public void addFeature(EntityFeature feature) {
036                if(feature==null || feature instanceof BindingFeature)
037                        super.addFeature(feature);
038                else 
039                        throw new IllegalBioPAXArgumentException(
040                                        "Range violation: SmallMolecule.feature can have only BindingFeature"); 
041        }
042        
043        @Override
044        public void addNotFeature(EntityFeature feature) {
045                if(feature==null || feature instanceof BindingFeature)
046                        super.addNotFeature(feature);
047                else 
048                        throw new IllegalBioPAXArgumentException(
049                                        "Range violation: SmallMolecule.notFeature can have only BindingFeature");      
050        }
051        
052}