You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Manuel Blechschmidt (JIRA)" <ji...@apache.org> on 2015/05/19 09:51:59 UTC

[jira] [Updated] (OLINGO-605) Olingo should support custom types e.g. Geometry by using XmlAdapter from JaxB

     [ https://issues.apache.org/jira/browse/OLINGO-605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Manuel Blechschmidt updated OLINGO-605:
---------------------------------------
    Description: 
I am currently developing a software where I save GIS coordinates as part of my entities. I want to send these geometries as a string through OData to a client.

Technically I do the following:

OpenGis -> Hibernate Spatial -> JPA -> Olingo -> JavaScript -> OpenLayers

I already have an XmlAdapter that maps my Geometry to WKT. I want to use this as well for Olingo serialization

I copied the following file in my workspace and extended the convertToEdmSimpleType function:

org.apache.olingo.odata2.jpa.processor.core.access.model.JPATypeConvertor

{code:java}
 public static EdmSimpleTypeKind
      ...
    } else if(jpaType.equals(Geometry.class)) {
    	// "OData - JPA Type Converter: Type [class com.vividsolutions.jts.geom.Geometry] not supported"
    	return EdmSimpleTypeKind.String;
    }

    throw ODataJPAModelException.throwException(ODataJPAModelException.TYPE_NOT_SUPPORTED
        .addContent(jpaType.toString()), null);
  }
{code}

This is quick and dirty and it would be nice if there would be a cleaner solution to do so.

  was:
I am currently developing a software where I save GIS coordinates as part of my entities. I want to send these geometries as a string through OData to a client.

Technically I do the following:

OpenGis -> Hibernate Spatial -> JPA -> Olingo -> JavaScript

I already have an XmlAdapter that maps my Geometry to WKT. I want to use this as well for Olingo serialization

I copied the following file in my workspace and extended the convertToEdmSimpleType function:

org.apache.olingo.odata2.jpa.processor.core.access.model.JPATypeConvertor

{code:java}
 public static EdmSimpleTypeKind
      ...
    } else if(jpaType.equals(Geometry.class)) {
    	// "OData - JPA Type Converter: Type [class com.vividsolutions.jts.geom.Geometry] not supported"
    	return EdmSimpleTypeKind.String;
    }

    throw ODataJPAModelException.throwException(ODataJPAModelException.TYPE_NOT_SUPPORTED
        .addContent(jpaType.toString()), null);
  }
{code}

This is quick and dirty and it would be nice if there would be a cleaner solution to do so.


> Olingo should support custom types e.g. Geometry by using XmlAdapter from JaxB
> ------------------------------------------------------------------------------
>
>                 Key: OLINGO-605
>                 URL: https://issues.apache.org/jira/browse/OLINGO-605
>             Project: Olingo
>          Issue Type: New Feature
>          Components: odata2-jpa
>    Affects Versions: V2 2.0.3
>            Reporter: Manuel Blechschmidt
>            Priority: Minor
>              Labels: GIS, custom, spatial, types
>
> I am currently developing a software where I save GIS coordinates as part of my entities. I want to send these geometries as a string through OData to a client.
> Technically I do the following:
> OpenGis -> Hibernate Spatial -> JPA -> Olingo -> JavaScript -> OpenLayers
> I already have an XmlAdapter that maps my Geometry to WKT. I want to use this as well for Olingo serialization
> I copied the following file in my workspace and extended the convertToEdmSimpleType function:
> org.apache.olingo.odata2.jpa.processor.core.access.model.JPATypeConvertor
> {code:java}
>  public static EdmSimpleTypeKind
>       ...
>     } else if(jpaType.equals(Geometry.class)) {
>     	// "OData - JPA Type Converter: Type [class com.vividsolutions.jts.geom.Geometry] not supported"
>     	return EdmSimpleTypeKind.String;
>     }
>     throw ODataJPAModelException.throwException(ODataJPAModelException.TYPE_NOT_SUPPORTED
>         .addContent(jpaType.toString()), null);
>   }
> {code}
> This is quick and dirty and it would be nice if there would be a cleaner solution to do so.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)