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

How to use
getEndDef1
method
in
org.apache.atlas.model.typedef.AtlasRelationshipDef

Best Java code snippets using org.apache.atlas.model.typedef.AtlasRelationshipDef.getEndDef1 (Showing top 20 results out of 315)

origin: org.apache.atlas/atlas-intg

@Override
public boolean equals(Object o) {
  if (this == o)
    return true;
  if (o == null || getClass() != o.getClass())
    return false;
  //AttributeDefs are checked in the super
  if (!super.equals(o))
    return false;
  AtlasRelationshipDef that = (AtlasRelationshipDef) o;
  if (!Objects.equals(relationshipCategory, that.getRelationshipCategory()))
    return false;
  if (!Objects.equals(propagateTags, that.getPropagateTags()))
    return false;
  if (!Objects.equals(endDef1, that.getEndDef1()))
    return false;
  return (Objects.equals(endDef2, that.getEndDef2()));
}
origin: apache/incubator-atlas

@Override
public boolean equals(Object o) {
  if (this == o)
    return true;
  if (o == null || getClass() != o.getClass())
    return false;
  //AttributeDefs are checked in the super
  if (!super.equals(o))
    return false;
  AtlasRelationshipDef that = (AtlasRelationshipDef) o;
  if (!Objects.equals(relationshipCategory, that.getRelationshipCategory()))
    return false;
  if (!Objects.equals(propagateTags, that.getPropagateTags()))
    return false;
  if (!Objects.equals(endDef1, that.getEndDef1()))
    return false;
  return (Objects.equals(endDef2, that.getEndDef2()));
}
origin: org.apache.atlas/atlas-intg

public AtlasRelationshipType(AtlasRelationshipDef relationshipDef) {
  super(relationshipDef);
  AtlasRelationshipEndDef end1Def = relationshipDef != null ? relationshipDef.getEndDef1() : null;
  AtlasRelationshipEndDef end2Def = relationshipDef != null ? relationshipDef.getEndDef2() : null;
  this.relationshipDef       = relationshipDef;
  this.hasLegacyAttributeEnd = (end1Def != null && end1Def.getIsLegacyAttribute()) || (end2Def != null && end2Def.getIsLegacyAttribute());
}
origin: org.apache.atlas/atlas-intg

public AtlasRelationshipDef(AtlasRelationshipDef other) throws AtlasBaseException {
  super(other);
  if (other != null) {
    setRelationshipCategory(other.getRelationshipCategory());
    setPropagateTags(other.getPropagateTags());
    setEndDef1(other.getEndDef1());
    setEndDef2(other.getEndDef2());
  }
}
@Override
origin: apache/incubator-atlas

public AtlasRelationshipDef(AtlasRelationshipDef other) throws AtlasBaseException {
  super(other);
  if (other != null) {
    setRelationshipCategory(other.getRelationshipCategory());
    setPropagateTags(other.getPropagateTags());
    setEndDef1(other.getEndDef1());
    setEndDef2(other.getEndDef2());
  }
}
@Override
origin: apache/atlas

public static Map<String, TypeInfo> get(AtlasTypeRegistry typeRegistry) {
  Map<String, TypeInfo> ret = new HashMap<>();
  for (AtlasRelationshipType relType : typeRegistry.getAllRelationshipTypes()) {
    AtlasRelationshipDef relDef      = relType.getRelationshipDef();
    String               relTypeName = relType.getTypeName();
    add(ret, getKey(relDef.getEndDef1()), relTypeName, relDef.getPropagateTags());
    add(ret, getKey(relDef.getEndDef2()), relTypeName, getEnd2PropagateTag(relDef.getPropagateTags()));
  }
  return ret;
}
origin: apache/atlas

private String getRelationshipEdgeLabel(String typeName, String relationshipTypeName) {
  AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(relationshipTypeName);
  AtlasRelationshipDef  relationshipDef  = relationshipType.getRelationshipDef();
  AtlasEntityType       end1Type         = relationshipType.getEnd1Type();
  AtlasEntityType       end2Type         = relationshipType.getEnd2Type();
  Set<String>           vertexTypes      = getTypeAndAllSuperTypes(typeName);
  AtlasAttribute        attribute        = null;
  if (vertexTypes.contains(end1Type.getTypeName())) {
    String attributeName = relationshipDef.getEndDef1().getName();
    attribute = (attributeName != null) ? end1Type.getAttribute(attributeName) : null;
  } else if (vertexTypes.contains(end2Type.getTypeName())) {
    String attributeName = relationshipDef.getEndDef2().getName();
    attribute = (attributeName != null) ? end2Type.getAttribute(attributeName) : null;
  }
  return (attribute != null) ? attribute.getRelationshipEdgeLabel() : null;
}
origin: org.apache.atlas/atlas-repository

  private String getRelationshipEdgeLabel(String typeName, String relationshipTypeName) {
    AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(relationshipTypeName);
    AtlasRelationshipDef  relationshipDef  = relationshipType.getRelationshipDef();
    AtlasEntityType       end1Type         = relationshipType.getEnd1Type();
    AtlasEntityType       end2Type         = relationshipType.getEnd2Type();
    Set<String>           vertexTypes      = getTypeAndAllSuperTypes(typeName);
    AtlasAttribute        attribute        = null;

    if (vertexTypes.contains(end1Type.getTypeName())) {
      String attributeName = relationshipDef.getEndDef1().getName();

      attribute = (attributeName != null) ? end1Type.getAttribute(attributeName) : null;
    } else if (vertexTypes.contains(end2Type.getTypeName())) {
      String attributeName = relationshipDef.getEndDef2().getName();

      attribute = (attributeName != null) ? end2Type.getAttribute(attributeName) : null;
    }

    return (attribute != null) ? attribute.getRelationshipEdgeLabel() : null;
  }
}
origin: apache/incubator-atlas

@Override
public void resolveReferences(AtlasTypeRegistry typeRegistry) throws AtlasBaseException {
  super.resolveReferences(typeRegistry);
  if (relationshipDef == null) {
    throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "relationshipDef is null");
  }
  String end1TypeName = relationshipDef.getEndDef1() != null ? relationshipDef.getEndDef1().getType() : null;
  String end2TypeName = relationshipDef.getEndDef2() != null ? relationshipDef.getEndDef2().getType() : null;
  AtlasType type1 = typeRegistry.getType(end1TypeName);
  AtlasType type2 = typeRegistry.getType(end2TypeName);
  if (type1 instanceof AtlasEntityType) {
    end1Type = (AtlasEntityType) type1;
  } else {
    throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_INVALID_END_TYPE, getTypeName(), end1TypeName);
  }
  if (type2 instanceof AtlasEntityType) {
    end2Type = (AtlasEntityType) type2;
  } else {
    throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_INVALID_END_TYPE, getTypeName(), end2TypeName);
  }
  validateAtlasRelationshipDef(this.relationshipDef);
}
origin: org.apache.atlas/atlas-intg

@Override
void resolveReferences(AtlasTypeRegistry typeRegistry) throws AtlasBaseException {
  super.resolveReferences(typeRegistry);
  if (relationshipDef == null) {
    throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "relationshipDef is null");
  }
  String end1TypeName = relationshipDef.getEndDef1() != null ? relationshipDef.getEndDef1().getType() : null;
  String end2TypeName = relationshipDef.getEndDef2() != null ? relationshipDef.getEndDef2().getType() : null;
  AtlasType type1 = typeRegistry.getType(end1TypeName);
  AtlasType type2 = typeRegistry.getType(end2TypeName);
  if (type1 instanceof AtlasEntityType) {
    end1Type = (AtlasEntityType) type1;
  } else {
    throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_INVALID_END_TYPE, getTypeName(), end1TypeName);
  }
  if (type2 instanceof AtlasEntityType) {
    end2Type = (AtlasEntityType) type2;
  } else {
    throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_INVALID_END_TYPE, getTypeName(), end2TypeName);
  }
  validateAtlasRelationshipDef(relationshipDef);
}
origin: apache/atlas

private PropagateTags getRelationshipTagPropagation(AtlasVertex fromVertex, AtlasVertex toVertex, AtlasRelationship relationship) {
  AtlasRelationshipType   relationshipType = typeRegistry.getRelationshipTypeByName(relationship.getTypeName());
  AtlasRelationshipEndDef endDef1          = relationshipType.getRelationshipDef().getEndDef1();
  AtlasRelationshipEndDef endDef2          = relationshipType.getRelationshipDef().getEndDef2();
  Set<String>             fromVertexTypes  = getTypeAndAllSuperTypes(getTypeName(fromVertex));
  Set<String>             toVertexTypes    = getTypeAndAllSuperTypes(getTypeName(toVertex));
  PropagateTags           ret              = relationshipType.getRelationshipDef().getPropagateTags();
  // relationshipDef is defined as end1 (hive_db) and end2 (hive_table) and tagPropagation = ONE_TO_TWO
  // relationship edge exists from [hive_table --> hive_db]
  // swap the tagPropagation property for such cases.
  if (fromVertexTypes.contains(endDef2.getType()) && toVertexTypes.contains(endDef1.getType())) {
    if (ret == ONE_TO_TWO) {
      ret = TWO_TO_ONE;
    } else if (ret == TWO_TO_ONE) {
      ret = ONE_TO_TWO;
    }
  }
  return ret;
}
origin: org.apache.atlas/atlas-repository

private PropagateTags getRelationshipTagPropagation(AtlasVertex fromVertex, AtlasVertex toVertex, AtlasRelationship relationship) {
  AtlasRelationshipType   relationshipType = typeRegistry.getRelationshipTypeByName(relationship.getTypeName());
  AtlasRelationshipEndDef endDef1          = relationshipType.getRelationshipDef().getEndDef1();
  AtlasRelationshipEndDef endDef2          = relationshipType.getRelationshipDef().getEndDef2();
  Set<String>             fromVertexTypes  = getTypeAndAllSuperTypes(getTypeName(fromVertex));
  Set<String>             toVertexTypes    = getTypeAndAllSuperTypes(getTypeName(toVertex));
  PropagateTags           ret              = relationshipType.getRelationshipDef().getPropagateTags();
  // relationshipDef is defined as end1 (hive_db) and end2 (hive_table) and tagPropagation = ONE_TO_TWO
  // relationship edge exists from [hive_table --> hive_db]
  // swap the tagPropagation property for such cases.
  if (fromVertexTypes.contains(endDef2.getType()) && toVertexTypes.contains(endDef1.getType())) {
    if (ret == ONE_TO_TWO) {
      ret = TWO_TO_ONE;
    } else if (ret == TWO_TO_ONE) {
      ret = ONE_TO_TWO;
    }
  }
  return ret;
}
origin: apache/atlas

  private int getLegacyAttributeCount() {
    int count = 0;
    for (AtlasRelationshipType rt : typeRegistry.getAllRelationshipTypes()) {
      AtlasRelationshipDef rd = rt.getRelationshipDef();
      if(rd.getEndDef1().getIsLegacyAttribute()) {
        count++;
      }

      if(rd.getEndDef2().getIsLegacyAttribute()) {
        count++;
      }
    }

    return count;
  }
}
origin: org.apache.atlas/atlas-repository

  private int getLegacyAttributeCount() {
    int count = 0;
    for (AtlasRelationshipType rt : typeRegistry.getAllRelationshipTypes()) {
      AtlasRelationshipDef rd = rt.getRelationshipDef();
      if(rd.getEndDef1().getIsLegacyAttribute()) {
        count++;
      }

      if(rd.getEndDef2().getIsLegacyAttribute()) {
        count++;
      }
    }

    return count;
  }
}
origin: org.apache.atlas/atlas-intg

private void addRelationshipEdgeDirection() {
  AtlasRelationshipEndDef endDef1 = relationshipDef.getEndDef1();
  AtlasRelationshipEndDef endDef2 = relationshipDef.getEndDef2();
  if (StringUtils.equals(endDef1.getType(), endDef2.getType()) &&
      StringUtils.equals(endDef1.getName(), endDef2.getName())) {
    AtlasAttribute endAttribute = end1Type.getRelationshipAttribute(endDef1.getName());
    endAttribute.setRelationshipEdgeDirection(BOTH);
  } else {
    AtlasAttribute end1Attribute = end1Type.getRelationshipAttribute(endDef1.getName());
    AtlasAttribute end2Attribute = end2Type.getRelationshipAttribute(endDef2.getName());
    //default relationship edge direction is end1 (out) -> end2 (in)
    AtlasRelationshipEdgeDirection end1Direction = OUT;
    AtlasRelationshipEdgeDirection end2Direction = IN;
    if (endDef1.getIsLegacyAttribute() && endDef2.getIsLegacyAttribute()) {
      end2Direction = OUT;
    } else if (!endDef1.getIsLegacyAttribute() && endDef2.getIsLegacyAttribute()) {
      end1Direction = IN;
      end2Direction = OUT;
    }
    end1Attribute.setRelationshipEdgeDirection(end1Direction);
    end2Attribute.setRelationshipEdgeDirection(end2Direction);
  }
}
origin: apache/incubator-atlas

private void addRelationshipEdgeDirection() {
  AtlasRelationshipEndDef endDef1       = relationshipDef.getEndDef1();
  AtlasRelationshipEndDef endDef2       = relationshipDef.getEndDef2();
  AtlasAttribute          end1Attribute = end1Type.getRelationshipAttribute(endDef1.getName());
  AtlasAttribute          end2Attribute = end2Type.getRelationshipAttribute(endDef2.getName());
  //default relationship edge direction is end1 (out) -> end2 (in)
  AtlasRelationshipEdgeDirection end1Direction = OUT;
  AtlasRelationshipEdgeDirection end2Direction = IN;
  if (endDef1.getIsLegacyAttribute() && endDef2.getIsLegacyAttribute()) {
    end2Direction = OUT;
  } else if (!endDef1.getIsLegacyAttribute() && endDef2.getIsLegacyAttribute()) {
    end1Direction = IN;
    end2Direction = OUT;
  }
  end1Attribute.setRelationshipEdgeDirection(end1Direction);
  end2Attribute.setRelationshipEdgeDirection(end2Direction);
}
origin: org.apache.atlas/atlas-repository

public static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex) {
  vertex.setProperty(Constants.RELATIONSHIPTYPE_END1_KEY, AtlasType.toJson(relationshipDef.getEndDef1()));
  vertex.setProperty(Constants.RELATIONSHIPTYPE_END2_KEY, AtlasType.toJson(relationshipDef.getEndDef2()));
  // default the relationship category to association if it has not been specified.
  String relationshipCategory = RelationshipCategory.ASSOCIATION.name();
  if (relationshipDef.getRelationshipCategory()!=null) {
    relationshipCategory =relationshipDef.getRelationshipCategory().name();
  }
  // Update RelationshipCategory
  vertex.setProperty(Constants.RELATIONSHIPTYPE_CATEGORY_KEY, relationshipCategory);
  if (relationshipDef.getPropagateTags() == null) {
    vertex.setProperty(Constants.RELATIONSHIPTYPE_TAG_PROPAGATION_KEY, AtlasRelationshipDef.PropagateTags.NONE.name());
  } else {
    vertex.setProperty(Constants.RELATIONSHIPTYPE_TAG_PROPAGATION_KEY, relationshipDef.getPropagateTags().name());
  }
}
origin: apache/atlas

public static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex) {
  vertex.setProperty(Constants.RELATIONSHIPTYPE_END1_KEY, AtlasType.toJson(relationshipDef.getEndDef1()));
  vertex.setProperty(Constants.RELATIONSHIPTYPE_END2_KEY, AtlasType.toJson(relationshipDef.getEndDef2()));
  // default the relationship category to association if it has not been specified.
  String relationshipCategory = RelationshipCategory.ASSOCIATION.name();
  if (relationshipDef.getRelationshipCategory()!=null) {
    relationshipCategory =relationshipDef.getRelationshipCategory().name();
  }
  // Update RelationshipCategory
  vertex.setProperty(Constants.RELATIONSHIPTYPE_CATEGORY_KEY, relationshipCategory);
  if (relationshipDef.getPropagateTags() == null) {
    vertex.setProperty(Constants.RELATIONSHIPTYPE_TAG_PROPAGATION_KEY, AtlasRelationshipDef.PropagateTags.NONE.name());
  } else {
    vertex.setProperty(Constants.RELATIONSHIPTYPE_TAG_PROPAGATION_KEY, relationshipDef.getPropagateTags().name());
  }
}
origin: org.apache.atlas/atlas-intg

@Override
void resolveReferencesPhase2(AtlasTypeRegistry typeRegistry) throws AtlasBaseException {
  super.resolveReferencesPhase2(typeRegistry);
  AtlasRelationshipEndDef endDef1           = relationshipDef.getEndDef1();
  AtlasRelationshipEndDef endDef2           = relationshipDef.getEndDef2();
  String                  relationshipLabel = null;
  // if legacyLabel is not specified at both ends, use relationshipDef name as relationship label.
  // if legacyLabel is specified in any one end, use it as the relationship label for both ends (legacy case).
  // if legacyLabel is specified at both ends use the respective end's legacyLabel as relationship label (legacy case).
  if (!endDef1.getIsLegacyAttribute() && !endDef2.getIsLegacyAttribute()) {
    relationshipLabel = relationshipDef.getRelationshipLabel();
  } else if (endDef1.getIsLegacyAttribute() && !endDef2.getIsLegacyAttribute()) {
    relationshipLabel = getLegacyEdgeLabel(end1Type, endDef1.getName());
  } else if (!endDef1.getIsLegacyAttribute() && endDef2.getIsLegacyAttribute()) {
    relationshipLabel = getLegacyEdgeLabel(end2Type, endDef2.getName());
  }
  addRelationshipAttributeToEndType(endDef1, end1Type, end2Type.getTypeName(), typeRegistry, relationshipLabel);
  addRelationshipAttributeToEndType(endDef2, end2Type, end1Type.getTypeName(), typeRegistry, relationshipLabel);
  // add relationship edge direction information
  addRelationshipEdgeDirection();
}
origin: apache/incubator-atlas

@Override
public void resolveReferencesPhase2(AtlasTypeRegistry typeRegistry) throws AtlasBaseException {
  super.resolveReferencesPhase2(typeRegistry);
  AtlasRelationshipEndDef endDef1           = relationshipDef.getEndDef1();
  AtlasRelationshipEndDef endDef2           = relationshipDef.getEndDef2();
  String                  relationshipLabel = null;
  // if legacyLabel is not specified at both ends, use relationshipDef name as relationship label.
  // if legacyLabel is specified in any one end, use it as the relationship label for both ends (legacy case).
  // if legacyLabel is specified at both ends use the respective end's legacyLabel as relationship label (legacy case).
  if (!endDef1.getIsLegacyAttribute() && !endDef2.getIsLegacyAttribute()) {
    relationshipLabel = relationshipDef.getRelationshipLabel();
  } else if (endDef1.getIsLegacyAttribute() && !endDef2.getIsLegacyAttribute()) {
    relationshipLabel = getLegacyEdgeLabel(end1Type, endDef1.getName());
  } else if (!endDef1.getIsLegacyAttribute() && endDef2.getIsLegacyAttribute()) {
    relationshipLabel = getLegacyEdgeLabel(end2Type, endDef2.getName());
  }
  addRelationshipAttributeToEndType(endDef1, end1Type, end2Type.getTypeName(), typeRegistry, relationshipLabel);
  addRelationshipAttributeToEndType(endDef2, end2Type, end1Type.getTypeName(), typeRegistry, relationshipLabel);
  // add relationship edge direction information
  addRelationshipEdgeDirection();
}
org.apache.atlas.model.typedefAtlasRelationshipDefgetEndDef1

Popular methods of AtlasRelationshipDef

  • getEndDef2
  • <init>
  • getPropagateTags
  • getName
  • getRelationshipCategory
  • getRelationshipLabel
  • toString
  • getGuid
  • setAttributeDefs
  • setEndDef1
  • setEndDef2
  • setPropagateTags
  • setEndDef2,
  • setPropagateTags,
  • setRelationshipCategory

Popular in Java

  • Reactive rest calls using spring rest template
  • getResourceAsStream (ClassLoader)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (Timer)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top 17 PhpStorm Plugins
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