olingo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jordi Cabré (JIRA) <j...@apache.org>
Subject [jira] [Commented] (OLINGO-1217) Open Type is not populated
Date Mon, 18 Dec 2017 20:14:00 GMT

    [ https://issues.apache.org/jira/browse/OLINGO-1217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16295614#comment-16295614
] 

Jordi Cabré commented on OLINGO-1217:
-------------------------------------

I've just realized that _MetadataDocumentXmlSerializer_ class is currently not serializing
this *OpenType* item. Current code is:

{code:java}

private void appendEntityTypes(final XMLStreamWriter writer, final List<EdmEntityType>
entityTypes)
      throws XMLStreamException {
    for (EdmEntityType entityType : entityTypes) {
      writer.writeStartElement(XML_ENTITY_TYPE);
      writer.writeAttribute(XML_NAME, entityType.getName());

      if (entityType.hasStream()) {
        writer.writeAttribute(XML_HAS_STREAM, "" + entityType.hasStream());
      }

      if (entityType.getBaseType() != null) {
        writer.writeAttribute(XML_BASE_TYPE, getAliasedFullQualifiedName(entityType.getBaseType(),
false));
      }

      if (entityType.isAbstract()) {
        writer.writeAttribute(ABSTRACT, TRUE);
      }

      appendKey(writer, entityType);

      appendProperties(writer, entityType);

      appendNavigationProperties(writer, entityType);

      appendAnnotations(writer, entityType);

      writer.writeEndElement();
    }
  }
{code}

So it seems that there's no code that serializes an OPEN_TYPE attribute...


> Open Type is not populated
> --------------------------
>
>                 Key: OLINGO-1217
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1217
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-server
>    Affects Versions: (Java) V4 4.4.0
>         Environment: Olingo service running in Wildfly/11
>            Reporter: Jordi Cabré
>
> I've modeled a single open entity type like:
> {code:java}
> public CsdlEntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException
> {
>     if (ET_RESOURCE.equals(entityTypeName)) {
>         return new CsdlEntityType()
>             .setName(ET_RESOURCE.getName())
>             .setKey(Arrays.asList(new CsdlPropertyRef().setName("Id")))
>             .setOpenType(true)
>             .setProperties(
>                 Arrays.asList(
>                     new CsdlProperty().setName("Id").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName())
> 		)
> 	    );
>     }
>     return null;
> }
> {code}
> As you can see this *Resource* type has a single *Id* property and the other ones are
_dynamic_ properties.
> I've launched this request to my server:
> {noformat}
> http://localhost:8080/olingo/odata/Resources?$apply=groupby((propertyX,Id))
> {noformat}
> So, I'm grouping resources by a _dynamic_ property *propertyX*. I'm getting this message:
> {code:javascript}
> {
>     "error": {
>         "code": null,
>         "message": "The property '', used in a query expression, is not defined in type
'propertyX'."
>     }
> }
> {code}
> Metadata (
> {noformat}
> http://localhost:8080/olingo/odata/$metadata
> {noformat}
> )
> {code:xml}
> <?xml version='1.0' encoding='UTF-8'?>
> <edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
>     <edmx:DataServices>
>         <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="swiller.odata.sample">
>             <EntityType Name="Resource">
>                 <Key>
>                     <PropertyRef Name="Id"/>
>                 </Key>
>                 <Property Name="Id" Type="Edm.String"/>
>                 <Property Name="TimeStamp" Type="Edm.Date"/>
>                 <Property Name="ModifiedTimeStamp" Type="Edm.Date"/>
>                 <Property Name="Price" Type="Edm.Decimal" Scale="2"/>
>             </EntityType>
>             <EntityContainer Name="Container">
>                 <EntitySet Name="Resources" EntityType="swiller.odata.sample.Resource"/>
>             </EntityContainer>
>         </Schema>
>     </edmx:DataServices>
> </edmx:Edmx>
> {code}
> Despite of I've set the `Resource` entity type is an open type, this is not populated
on metadata.
> Any ideas?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message