001package org.biopax.paxtools.impl.level3; 002 003import org.biopax.paxtools.model.BioPAXElement; 004import org.biopax.paxtools.model.level3.CovalentBindingFeature; 005import org.biopax.paxtools.model.level3.SequenceModificationVocabulary; 006import org.hibernate.annotations.Cache; 007import org.hibernate.annotations.CacheConcurrencyStrategy; 008import org.hibernate.annotations.DynamicInsert; 009import org.hibernate.annotations.DynamicUpdate; 010import org.hibernate.annotations.Proxy; 011import org.hibernate.search.annotations.Indexed; 012 013import javax.persistence.Entity; 014import javax.persistence.ManyToOne; 015import javax.persistence.Transient; 016 017@Entity 018@Proxy(proxyClass= CovalentBindingFeature.class) 019@Indexed 020@DynamicUpdate @DynamicInsert 021@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) 022public class CovalentBindingFeatureImpl extends BindingFeatureImpl implements CovalentBindingFeature 023{ 024 private SequenceModificationVocabulary modificationType; 025 026 public CovalentBindingFeatureImpl() { 027 } 028 029 @Override @Transient 030 public Class<? extends CovalentBindingFeature> getModelInterface() 031 { 032 return CovalentBindingFeature.class; 033 } 034 035 @ManyToOne(targetEntity = SequenceModificationVocabularyImpl.class) 036 public SequenceModificationVocabulary getModificationType() 037 { 038 return this.modificationType; 039 } 040 041 public void setModificationType(SequenceModificationVocabulary modificationType) 042 { 043 this.modificationType = modificationType; 044 } 045 046 @Override 047 protected boolean semanticallyEquivalent(BioPAXElement element) 048 { 049 if(!(element instanceof CovalentBindingFeature)) 050 return false; 051 052 CovalentBindingFeature that = (CovalentBindingFeature) element; 053 SequenceModificationVocabulary type = that.getModificationType(); 054 boolean value = ((type == null) ? 055 this.getModificationType() == null : 056 this.getModificationType().equals(type)); 057 return value && super.semanticallyEquivalent(element); 058 } 059 060 @Override 061 public int equivalenceCode() 062 { 063 return super.equivalenceCode() + 064 29 * (modificationType == null ? 0 : modificationType.equivalenceCode()); 065 } 066}