When getDataType=xref/mref, get other end of xref

@return referenced entity
@throws UnsupportedOperationException if attribute type is not a reference type
358424
public EntityType getRefEntity() {
    if (!hasRefEntity()) {
      throw new UnsupportedOperationException(
          String.format("getRefEntity not supported for attribute type '%s'", getDataType()));
    }
    return getEntity(REF_ENTITY_TYPE, EntityType.class);
  }
195214
@Override
    public Type getType() {
        ParameterizedType type = (ParameterizedType) field.getGenericType();
        if (type.getActualTypeArguments()[0] instanceof ParameterizedType) {
            ParameterizedType first = (ParameterizedType) type.getActualTypeArguments()[0];
            return first.getRawType();
        } else {
            return type.getActualTypeArguments()[0];
        }
    }
1367144
static String getJunctionTableIndexName(
      EntityType entityType, Attribute attr, Attribute idxAttr) {
    String indexNamePostfix = "_idx";
    int nrAdditionalChars = 1 + indexNamePostfix.length();
    String entityPart =
        generateId(entityType, (MAX_IDENTIFIER_BYTE_LENGTH - nrAdditionalChars) / 3);
    String attrPart = generateId(attr, (MAX_IDENTIFIER_BYTE_LENGTH - nrAdditionalChars) / 3);
    String idxAttrPart = generateId(idxAttr, (MAX_IDENTIFIER_BYTE_LENGTH - nrAdditionalChars) / 3);
    return getQuotedIdentifier(entityPart + '_' + attrPart + '_' + idxAttrPart + indexNamePostfix);
  }
662987
private function getRef()
    {
        $dataTypeName = StringHelper::substring(__CLASS__, strrpos(__CLASS__, '\\') + 1);
        return $this->getCheckedRef(__CLASS__, $dataTypeName);
    }
965274
public Attribute getIdAttribute() {
    Attribute idAttr = getOwnIdAttribute();
    if (idAttr == null) {
      EntityType extend = getExtends();
      if (extend != null) {
        idAttr = extend.getIdAttribute();
      }
    }
    return idAttr;
  }
782056
public BatchArtifactRef<BatchXMLDescriptor> getOrCreateRef()
   {
      List<Node> nodeList = model.get("ref");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new BatchArtifactRefImpl<BatchXMLDescriptor>(this, "ref", model, nodeList.get(0));
      }
      return createRef();
   }
1036124
@PostMapping(
      value = "/{entityTypeId}/{id}/{refAttributeName}",
      params = "_method=GET",
      produces = APPLICATION_JSON_VALUE)
  public Object retrieveEntityAttributePost(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("id") String untypedId,
      @PathVariable("refAttributeName") String refAttributeName,
      @Valid @RequestBody EntityCollectionRequest request) {
    Set<String> attributesSet = toAttributeSet(request.getAttributes());
    Map<String, Set<String>> attributeExpandSet = toExpandMap(request.getExpand());

    return retrieveEntityAttributeInternal(
        entityTypeId, untypedId, refAttributeName, request, attributesSet, attributeExpandSet);
  }
1324749
private static Function<EntityTypeNode, Set<EntityTypeNode>> getDependencies() {
    return entityTypeNode -> {
      // get referenced entities excluding entities of mappedBy attributes
      EntityType entityType = entityTypeNode.getEntityType();
      Set<EntityTypeNode> refEntityMetaSet =
          stream(entityType.getOwnAllAttributes())
              .filter(attribute -> isProcessableAttribute(attribute, entityType))
              .map(attr -> new EntityTypeNode(attr.getRefEntity()))
              .collect(toCollection(HashSet::new));

      EntityType extendsEntityMeta = entityType.getExtends();
      if (extendsEntityMeta != null) {
        refEntityMetaSet.add(new EntityTypeNode(extendsEntityMeta));
      }
      return refEntityMetaSet;
    };
  }
24733
@SuppressWarnings("unchecked")
  public T getReferenceTargetElement(ModelElementInstance referenceSourceElement) {
    String identifier = getReferenceIdentifier(referenceSourceElement);
    ModelElementInstance referenceTargetElement = referenceSourceElement.getModelInstance().getModelElementById(identifier);
    if (referenceTargetElement != null) {
      try {
        return (T) referenceTargetElement;

      } catch(ClassCastException e) {
        throw new ModelReferenceException("Element " + referenceSourceElement + " references element " + referenceTargetElement + " of wrong type. "
          + "Expecting " + referenceTargetAttribute.getOwningElementType() + " got " + referenceTargetElement.getElementType());
      }
    }
    else {
      return null;
    }
  }
1160196
static Stream<Attribute> getJunctionTableAttributes(EntityType entityType) {
    // return all attributes referencing multiple entities except for one-to-many attributes that
    // are mapped by
    // another attribute
    return getPersistedAttributes(entityType)
        .filter(
            attr ->
                isMultipleReferenceType(attr)
                    && !(attr.getDataType() == ONE_TO_MANY && attr.isMappedBy()));
  }
1360958
public Annotation getRef() {
    if (ArgumentMention_Type.featOkTst && ((ArgumentMention_Type)jcasType).casFeat_ref == null)
      jcasType.jcas.throwFeatMissing("ref", "de.julielab.jules.types.ArgumentMention");
    return (Annotation)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((ArgumentMention_Type)jcasType).casFeatCode_ref)));}
1334318
public Constituent getRef() {
    if (PTBConstituent_Type.featOkTst && ((PTBConstituent_Type)jcasType).casFeat_ref == null)
      jcasType.jcas.throwFeatMissing("ref", "de.julielab.jules.types.PTBConstituent");
    return (Constituent)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((PTBConstituent_Type)jcasType).casFeatCode_ref)));}
256600
protected final JSerializerType getKeySerializerFromType( JType type ) throws UnsupportedTypeException, UnableToCompleteException {
        return getKeySerializerFromType( type, false, false );
    }
1211459
def get_reference(self, rtype: str, label: str):
        

        # We are doing this instead of dictionary access in case we change
        # the storage later to a multidict thingy for optimization.

        reftype = self.data.get(rtype)
        if reftype:
            # The reftype might be "python" or "sphinx" or something else
            # from an Intersphinx registry, not something internal to
            # Kaybee.
            return reftype[label]
586728
public Type getType(DocumentResolver definitionDocumentResolver) {
        Type type;
        if (property instanceof RefProperty) {
            RefProperty refProperty = (RefProperty) property;
            if (refProperty.getRefFormat() == RefFormat.RELATIVE)
                type = new ObjectType(refProperty.getTitle(), null); // FIXME : Workaround for https://github.com/swagger-api/swagger-parser/issues/177
            else
                type = new RefType(definitionDocumentResolver.apply(refProperty.getSimpleRef()), new ObjectType(refProperty.getSimpleRef(), null /* FIXME, not used for now */));
        } else if (property instanceof ArrayProperty) {
            ArrayProperty arrayProperty = (ArrayProperty) property;
            Property items = arrayProperty.getItems();
            if (items == null)
                type = new ArrayType(arrayProperty.getTitle(), new ObjectType(null, null)); // FIXME : Workaround for Swagger parser issue with composed models (https://github.com/Swagger2Markup/swagger2markup/issues/150)
            else {
                Type arrayType = new PropertyAdapter(items).getType(definitionDocumentResolver);
                if (arrayType == null)
                    type = new ArrayType(arrayProperty.getTitle(), new ObjectType(null, null)); // FIXME : Workaround for Swagger parser issue with composed models (https://github.com/Swagger2Markup/swagger2markup/issues/150)
                else
                    type = new ArrayType(arrayProperty.getTitle(), new PropertyAdapter(items).getType(definitionDocumentResolver));
            }
        } else if (property instanceof MapProperty) {
            MapProperty mapProperty = (MapProperty) property;
            Property additionalProperties = mapProperty.getAdditionalProperties();
            if (additionalProperties == null)
                type = new MapType(mapProperty.getTitle(), new ObjectType(null, null)); // FIXME : Workaround for Swagger parser issue with composed models (https://github.com/Swagger2Markup/swagger2markup/issues/150)
            else
                type = new MapType(mapProperty.getTitle(), new PropertyAdapter(additionalProperties).getType(definitionDocumentResolver));
        } else if (property instanceof StringProperty) {
            StringProperty stringProperty = (StringProperty) property;
            List<String> enums = stringProperty.getEnum();
            if (CollectionUtils.isNotEmpty(enums)) {
                type = new EnumType(stringProperty.getTitle(), enums);
            } else if (isNotBlank(stringProperty.getFormat())) {
                type = new BasicType(stringProperty.getType(), stringProperty.getTitle(), stringProperty.getFormat());
            } else {
                type = new BasicType(stringProperty.getType(), stringProperty.getTitle());
            }
        } else if (property instanceof ObjectProperty) {
            type = new ObjectType(property.getTitle(), ((ObjectProperty) property).getProperties());
        } else if (property instanceof IntegerProperty) {
            IntegerProperty integerProperty = (IntegerProperty) property;
            List<Integer> enums = integerProperty.getEnum();
            if (CollectionUtils.isNotEmpty(enums)) {
                // first, convert integer enum values to strings
                List<String> enumValuesAsString = enums.stream().map(String::valueOf).collect(Collectors.toList());
                type = new EnumType(integerProperty.getTitle(), enumValuesAsString);
            } else if (isNotBlank(integerProperty.getFormat())) {
                type = new BasicType(integerProperty.getType(), integerProperty.getTitle(), integerProperty.getFormat());
            } else {
                type = new BasicType(property.getType(), property.getTitle());
            }
        } else {
            if (property.getType() == null) {
                return null;
            } else if (isNotBlank(property.getFormat())) {
                type = new BasicType(property.getType(), property.getTitle(), property.getFormat());
            } else {
                type = new BasicType(property.getType(), property.getTitle());
            }
        }
        return type;
    }
415439
@Override
    public Metamodel getMetamodel()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "getMetamodel : " + this);
        throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
    }
86901
public function getPHP() {

        $result = '';

        // The type
        switch ($this->getType()) {
            case XMLDB_KEY_PRIMARY:
                $result .= 'XMLDB_KEY_PRIMARY' . ', ';
                break;
            case XMLDB_KEY_UNIQUE:
                $result .= 'XMLDB_KEY_UNIQUE' . ', ';
                break;
            case XMLDB_KEY_FOREIGN:
                $result .= 'XMLDB_KEY_FOREIGN' . ', ';
                break;
            case XMLDB_KEY_FOREIGN_UNIQUE:
                $result .= 'XMLDB_KEY_FOREIGN_UNIQUE' . ', ';
                break;
        }
        // The fields
        $keyfields = $this->getFields();
        if (!empty($keyfields)) {
            $result .= "['".  implode("', '", $keyfields) . "']";
        } else {
            $result .= 'null';
        }
        // The FKs attributes
        if ($this->getType() == XMLDB_KEY_FOREIGN ||
            $this->getType() == XMLDB_KEY_FOREIGN_UNIQUE) {
            // The reftable
            $reftable = $this->getRefTable();
            if (!empty($reftable)) {
                $result .= ", '" . $reftable . "', ";
            } else {
                $result .= 'null, ';
            }
            // The reffields
            $reffields = $this->getRefFields();
            if (!empty($reffields)) {
                $result .= "['".  implode("', '", $reffields) . "']";
            } else {
                $result .= 'null';
            }
        }
        // Return result
        return $result;
    }