Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-605

Olingo should support custom types e.g. Geometry by using XmlAdapter from JaxB

    XMLWordPrintableJSON

    Details

      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

       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);
        }
      

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

        Attachments

          Activity

            People

            • Assignee:
              mirbo mibo
              Reporter:
              manuel_b Manuel Blechschmidt
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: