congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
AnnotatedObjectUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
AnnotatedObjectUtils
in
uk.ac.ebi.intact.model.util

Best Java code snippets using uk.ac.ebi.intact.model.util.AnnotatedObjectUtils (Showing top 20 results out of 315)

origin: uk.ac.ebi.intact.dataexchange.psimi/intact-psixml-converters

public CvObjectConverter(Institution institution, Class<C> intactCvClass, Class<T> psiCvClass) {
  super(institution);
  this.intactCvClass = intactCvClass;
  this.psiCvClass = psiCvClass;
  Class<?> aliasClass = AnnotatedObjectUtils.getAliasClassType(intactCvClass);
  Class<?> xrefClass = AnnotatedObjectUtils.getXrefClassType(intactCvClass);
  this.aliasConverter = new AliasConverter(institution, aliasClass);
  this.xrefConverter = new XrefConverter(institution, xrefClass);
}
origin: uk.ac.ebi.intact.core/intact-core

@Transient
@Deprecated
/**
 * @deprecated now it is always stored as a simple annotation
 */
public String getPostalAddress() {
  Annotation annot = AnnotatedObjectUtils.findAnnotationByTopicMiOrLabel(this, "postaladdress");
  return annot != null ? annot.getAnnotationText() : null;
}
origin: uk.ac.ebi.intact/intact-core

/**
 * Gets the generic Xref type for an AnnotatedObject class
 * @param clazz an AnnotatedObject class
 * @return the Xref type used in the class
 */
public static Class<? extends Xref> getXrefClassType(Class<? extends AnnotatedObject> clazz)  {
  clazz = CgLibUtil.removeCglibEnhanced(clazz);
  
  PropertyDescriptor propDesc = null;
  try {
    propDesc = new PropertyDescriptor("xrefs", clazz);
  } catch (IntrospectionException e) {
    e.printStackTrace();
  }
  Method method = propDesc.getReadMethod();
  return getParameterizedType(method.getGenericReturnType());
}
origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * Checks if two given annotated objects contain the same set of annotations, xrefs and aliases
 *
 * @param ao1 Annotated object 1
 * @param ao2 Annotated object 2
 * @return if the two annotated objects contain the same set of annnotations, xrefs and aliases
 */
public static boolean containSameCollections(AnnotatedObject ao1, AnnotatedObject ao2) {
  if (!containSameXrefs(ao1, ao2)) {
    return false;
  }
  if (!containSameAnnotations(ao1, ao2)) {
    return false;
  }
  if (!containSameAliases(ao1, ao2)) {
    return false;
  }
  return true;
}
origin: uk.ac.ebi.intact.core/intact-core

public static <X extends Xref> X getPsiMiIdentityXref(AnnotatedObject<X, ?> annotatedObject) {
  if (annotatedObject == null) {
    throw new NullPointerException("annotatedObject should not be null");
  }
  X psiMiXref = null;
  Collection<X> identityXrefs = AnnotatedObjectUtils.searchXrefs(annotatedObject, CvDatabase.PSI_MI_MI_REF, CvXrefQualifier.IDENTITY_MI_REF);
  if (!identityXrefs.isEmpty()) {
    psiMiXref = identityXrefs.iterator().next();
  }
  return psiMiXref;
}
origin: uk.ac.ebi.intact.core/intact-core

public static <X extends Xref> X newXrefInstanceFor(Class<? extends AnnotatedObject> aoClass) {
  Class<X> xrefClass = (Class<X>) AnnotatedObjectUtils.getXrefClassType(aoClass);
  return ClassUtils.newInstance(xrefClass);
}
origin: uk.ac.ebi.intact/intact-core

  public static <A extends Alias> A newAliasInstanceFor(Class<? extends AnnotatedObject> aoClass) {
    Class<A> aliasClass = (Class<A>) AnnotatedObjectUtils.getAliasClassType(aoClass);
    return ClassUtils.newInstance(aliasClass);
  }
}
origin: uk.ac.ebi.intact.core/intact-core

if (log.isDebugEnabled()) log.debug("Populating identifier for: "+cvObject.getShortLabel());
Collection<CvObjectXref> miIdXrefs = AnnotatedObjectUtils.searchXrefs(cvObject, CvDatabase.PSI_MI_MI_REF, CvXrefQualifier.IDENTITY_MI_REF);
  identifier = miIdXrefs.iterator().next().getPrimaryId();
} else {
  Collection<CvObjectXref> idXrefs = AnnotatedObjectUtils.searchXrefsByQualifier(cvObject, CvXrefQualifier.IDENTITY_MI_REF);
origin: uk.ac.ebi.intact.core/intact-core

List<InteractorXref> parents = AnnotatedObjectUtils.searchXrefs(interactor, xrefFilter1);
List<InteractorXref> identities = AnnotatedObjectUtils.searchXrefs(interactor, xrefFilter);
    if (AnnotatedObjectUtils.containTheSameXrefs(xrefFilter, interactor, interactorCandidate)) {
  List<InteractorXref> parentsToCompare = AnnotatedObjectUtils.searchXrefs(possibleMatch, xrefFilter1);
origin: uk.ac.ebi.intact.core/intact-core

/**
 * This method is an alternative equals to the CvObject.equals method, that basically checks
 * on the MI identifiers and then of the short label if the first check returns false
 *
 * @param cv1                     One of the CvObjects
 * @param cv2                     The other CvObject
 * @param includeCollectionsCheck if true, check if the annotations/xrefs/aliases are the same
 * @return True if (A) the MI are the same or (B) the short labels are the same in case A has failed
 * @since 1.9.0
 */
public static boolean areEqual(CvObject cv1, CvObject cv2, boolean includeCollectionsCheck) {
  if (cv1 == null || cv2 == null) {
    return false;
  }
  if (includeCollectionsCheck && AnnotatedObjectUtils.isNewOrManaged(cv1) && AnnotatedObjectUtils.isNewOrManaged(cv2)) {
    if (!AnnotatedObjectUtils.containSameCollections(cv1, cv2)) {
      return false;
    }
  }
  if (cv1.getIdentifier() != null && cv2.getIdentifier() != null) {
    if (!cv1.getIdentifier().equals(cv2.getIdentifier())) {
      return false;
    }
  }
  if (cv1.getShortLabel() == null || cv2.getShortLabel() == null) {
    return false;
  }
  return cv1.getShortLabel().equals(cv2.getShortLabel());
}
origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * Constructor for subclass use only. Ensures that AnnotatedObjects cannot be
 * created without at least a shortLabel and an owner specified.
 *
 * @param shortLabel The memorable label to identify this AnnotatedObject
 *
 * @throws NullPointerException thrown if either parameters are not specified
 */
protected AnnotatedObjectImpl( String shortLabel ) {
  //super call sets creation time data
  super();
  this.shortLabel = AnnotatedObjectUtils.prepareShortLabel( shortLabel );
}
origin: uk.ac.ebi.intact.core/intact-core

public static boolean containSameAliases(AnnotatedObject ao1, AnnotatedObject ao2) {
  return areCollectionEqual(IntactCore.ensureInitializedAliases(ao1), IntactCore.ensureInitializedXrefs(ao2));
}
origin: uk.ac.ebi.intact.core/intact-core-readonly

public static <X extends Xref> X getPsiMiIdentityXref(AnnotatedObject<X, ?> annotatedObject) {
  if (annotatedObject == null) {
    throw new NullPointerException("annotatedObject should not be null");
  }
  X psiMiXref = null;
  Collection<X> identityXrefs = AnnotatedObjectUtils.searchXrefs(annotatedObject, CvDatabase.PSI_MI_MI_REF, CvXrefQualifier.IDENTITY_MI_REF);
  if (!identityXrefs.isEmpty()) {
    psiMiXref = identityXrefs.iterator().next();
  }
  return psiMiXref;
}
origin: uk.ac.ebi.intact/intact-core

public static <X extends Xref> X newXrefInstanceFor(Class<? extends AnnotatedObject> aoClass) {
  Class<X> xrefClass = (Class<X>) AnnotatedObjectUtils.getXrefClassType(aoClass);
  return ClassUtils.newInstance(xrefClass);
}
origin: uk.ac.ebi.intact.core/intact-core-readonly

  public static <A extends Alias> A newAliasInstanceFor(Class<? extends AnnotatedObject> aoClass) {
    Class<A> aliasClass = (Class<A>) AnnotatedObjectUtils.getAliasClassType(aoClass);
    return ClassUtils.newInstance(aliasClass);
  }
}
origin: uk.ac.ebi.intact.core/intact-core

/**
 * Checks if two given annotated objects contain the same set of annotations, xrefs and aliases
 *
 * @param ao1 Annotated object 1
 * @param ao2 Annotated object 2
 * @return if the two annotated objects contain the same set of annnotations, xrefs and aliases
 */
public static boolean containSameCollections(AnnotatedObject ao1, AnnotatedObject ao2) {
  if (!containSameXrefs(ao1, ao2)) {
    return false;
  }
  if (!containSameAnnotations(ao1, ao2)) {
    return false;
  }
  if (!containSameAliases(ao1, ao2)) {
    return false;
  }
  return true;
}
origin: uk.ac.ebi.intact.core/intact-core-readonly

if (log.isDebugEnabled()) log.debug("Populating identifier for: "+cvObject.getShortLabel());
Collection<CvObjectXref> miIdXrefs = AnnotatedObjectUtils.searchXrefs(cvObject, CvDatabase.PSI_MI_MI_REF, CvXrefQualifier.IDENTITY_MI_REF);
  identifier = miIdXrefs.iterator().next().getPrimaryId();
} else {
  Collection<CvObjectXref> idXrefs = AnnotatedObjectUtils.searchXrefsByQualifier(cvObject, CvXrefQualifier.IDENTITY_MI_REF);
origin: uk.ac.ebi.intact.core/intact-core-readonly

List<InteractorXref> parents = AnnotatedObjectUtils.searchXrefs(interactor, xrefFilter1);
List<InteractorXref> identities = AnnotatedObjectUtils.searchXrefs(interactor, xrefFilter);
    if (AnnotatedObjectUtils.containTheSameXrefs(xrefFilter, interactor, interactorCandidate)) {
  List<InteractorXref> parentsToCompare = AnnotatedObjectUtils.searchXrefs(possibleMatch, xrefFilter1);
origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * This method is an alternative equals to the CvObject.equals method, that basically checks
 * on the MI identifiers and then of the short label if the first check returns false
 *
 * @param cv1                     One of the CvObjects
 * @param cv2                     The other CvObject
 * @param includeCollectionsCheck if true, check if the annotations/xrefs/aliases are the same
 * @return True if (A) the MI are the same or (B) the short labels are the same in case A has failed
 * @since 1.9.0
 */
public static boolean areEqual(CvObject cv1, CvObject cv2, boolean includeCollectionsCheck) {
  if (cv1 == null || cv2 == null) {
    return false;
  }
  if (includeCollectionsCheck && AnnotatedObjectUtils.isNewOrManaged(cv1) && AnnotatedObjectUtils.isNewOrManaged(cv2)) {
    if (!AnnotatedObjectUtils.containSameCollections(cv1, cv2)) {
      return false;
    }
  }
  if (cv1.getIdentifier() != null && cv2.getIdentifier() != null) {
    if (!cv1.getIdentifier().equals(cv2.getIdentifier())) {
      return false;
    }
  }
  if (cv1.getShortLabel() == null || cv2.getShortLabel() == null) {
    return false;
  }
  return cv1.getShortLabel().equals(cv2.getShortLabel());
}
origin: uk.ac.ebi.intact.core/intact-core

/**
 * Constructor for subclass use only. Ensures that AnnotatedObjects cannot be
 * created without at least a shortLabel and an owner specified.
 *
 * @param shortLabel The memorable label to identify this AnnotatedObject
 *
 * @throws NullPointerException thrown if either parameters are not specified
 */
protected AnnotatedObjectImpl( String shortLabel ) {
  //super call sets creation time data
  super();
  this.shortLabel = AnnotatedObjectUtils.prepareShortLabel( shortLabel );
}
uk.ac.ebi.intact.model.utilAnnotatedObjectUtils

Javadoc

Util methods for annotatedObject.

Most used methods

  • getAliasClassType
    Gets the generic Xref type for an AnnotatedObject class
  • getXrefClassType
    Gets the generic Xref type for an AnnotatedObject class
  • findAnnotationByTopicMiOrLabel
    Finds an Annotations with a topic that has an MI or label equal to the value provided
  • getParameterizedType
  • prepareShortLabel
    Trims a shortlabel if it is too long to be inserted in the database.
  • searchXrefs
    Retrieve the xrefs from an annotated object that comply with the filter.
  • areCollectionEqual
    Method to compare Annotation, Xref and Aliases collections
  • containSameAliases
  • containSameAnnotations
  • containSameCollections
    Checks if two given annotated objects contain the same set of annotations, xrefs and aliases
  • containSameXrefs
  • containTheSameXrefs
    Check if the passed annotated objects contain the same set of filtered Xrefs.
  • containSameXrefs,
  • containTheSameXrefs,
  • createUniqueString,
  • findParent,
  • isChildrenInitialized,
  • isCvTopicPublic,
  • isNewOrManaged,
  • removeChild,
  • searchXrefsByDatabase,
  • searchXrefsByQualifier

Popular in Java

  • Updating database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • requestLocationUpdates (LocationManager)
  • getResourceAsStream (ClassLoader)
  • Menu (java.awt)
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JPanel (javax.swing)
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now