M Carissimi created OLINGO-145:
----------------------------------

             Summary: Write feed with ComplexType properties
                 Key: OLINGO-145
                 URL: https://issues.apache.org/jira/browse/OLINGO-145
             Project: Olingo
          Issue Type: Question
    Affects Versions: V2 1.0.0
            Reporter: M Carissimi


Hello,
I have a web application which exposes an OData web service containing Entity 
Types with simple and complex properties.

My EdmProvider creates a complex type as follow
{code}
      ComplexType myNumberComplexType = new ComplexType();
      myNumberComplexType.setName("NumberAndUnits");
      List<Property> myComplexTypeProps = new ArrayList<Property>();
      Property myNumber = new 
SimpleProperty().setName("Number").setType(EdmSimpleTypeKind.Double);
      myComplexTypeProps.add(myNumber);
      Property myUnit = new 
SimpleProperty().setName("Unit").setType(EdmSimpleTypeKind.String);
      myComplexTypeProps.add(myUnit);
      myNumberComplexType.setProperties(myComplexTypeProps);
      complexTypes.add(myNumberComplexType);
{code}

This is shown on the metadata as
{code}
<ComplexType Name="NumberAndUnits">
<Property Name="Number" Type="Edm.Int32"/>
<Property Name="Unit" Type="Edm.String"/>
</ComplexType>
{code}

Entity Types using the complex type are shown on the metadata as follow
{code}
<EntityType Name="PR_D_WELL_A">
...
<Property Name="OIL" Type="esys_producer.NumberAndUnits" Nullable="true"/>
</EntityType>
{code}

My ODataSingleProcessor uses the EntityProvider.writeEntry() method to create 
the ODataResponse for method readEntity(). Similarly, method 
EntityProvider.writeFeed() is used to create the ODataResponse for method 
readEntitySet(). In both cases the data to populate the entry (or feed) is 
contained in a Map<String,Object> and in turn the values for the  properties 
using complex types are contained in a Map<String,Object>. Tje code used to 
create the maps is as follow
{code}
        Map<String, Object> myComplexProps = new HashMap<String, Object>();
        // set double type
        Double myDoubleValue = null;
        if (!isNullOrEmpty(myAttrValue))
        {
          myDoubleValue = Double.valueOf(myAttrValue);
        }
        myComplexProps.put("Number", myDoubleValue);
        myComplexProps.put("Unit", "Sm3");
        myProps.put(myAttrName, myComplexProps);
{code}

Whenever I try to load a feed for an entity type containing the complex type, I 
get a message saying "An exception occurred.". I have added my own ErrorDebug 
and ErrorCallback to enable debugging and to print out error messages, but no 
additional information is given.

Can you please suggest how I can resolve this issue?



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to