Repository: olingo-odata4 Updated Branches: refs/heads/master f228204fa -> 946356fb0
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/946356fb/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailCollection.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailCollection.java new file mode 100644 index 0000000..6fe5dc0 --- /dev/null +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailCollection.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.olingo.fit.proxy.v4.demo.odatademo.types; + +import org.apache.olingo.client.api.http.HttpMethod; +import org.apache.olingo.ext.proxy.api.AbstractEntityCollection; +import org.apache.olingo.ext.proxy.api.OperationType; +import org.apache.olingo.ext.proxy.api.annotations.Operation; +import org.apache.olingo.ext.proxy.api.annotations.Parameter; +import org.apache.olingo.fit.proxy.v4.demo.odatademo.*; +import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*; + +import org.apache.olingo.commons.api.edm.geo.Geospatial; +import org.apache.olingo.commons.api.edm.geo.GeospatialCollection; +import org.apache.olingo.commons.api.edm.geo.LineString; +import org.apache.olingo.commons.api.edm.geo.MultiLineString; +import org.apache.olingo.commons.api.edm.geo.MultiPoint; +import org.apache.olingo.commons.api.edm.geo.MultiPolygon; +import org.apache.olingo.commons.api.edm.geo.Point; +import org.apache.olingo.commons.api.edm.geo.Polygon; +import java.math.BigDecimal; +import java.net.URI; +import java.util.UUID; +import java.io.Serializable; +import java.util.Collection; +import java.util.Calendar; +import javax.xml.datatype.Duration; + +public interface ProductDetailCollection extends AbstractEntityCollection<ProductDetail> { +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/946356fb/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Supplier.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Supplier.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Supplier.java new file mode 100644 index 0000000..e458d9f --- /dev/null +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Supplier.java @@ -0,0 +1,201 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.olingo.fit.proxy.v4.demo.odatademo.types; + +import org.apache.olingo.client.api.http.HttpMethod; +import org.apache.olingo.ext.proxy.api.annotations.Namespace; +import org.apache.olingo.ext.proxy.api.annotations.EntityType; +import org.apache.olingo.ext.proxy.api.annotations.Key; +import org.apache.olingo.ext.proxy.api.annotations.KeyRef; +import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty; +import org.apache.olingo.ext.proxy.api.annotations.Property; +import org.apache.olingo.ext.proxy.api.annotations.Operation; +import org.apache.olingo.ext.proxy.api.annotations.Parameter; +import org.apache.olingo.ext.proxy.api.AbstractOpenType; +import org.apache.olingo.ext.proxy.api.OperationType; +import org.apache.olingo.commons.api.edm.constants.EdmContentKind; +import org.apache.olingo.client.api.edm.ConcurrencyMode; +import org.apache.olingo.fit.proxy.v4.demo.odatademo.*; +import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*; + +import org.apache.olingo.commons.api.edm.geo.Geospatial; +import org.apache.olingo.commons.api.edm.geo.GeospatialCollection; +import org.apache.olingo.commons.api.edm.geo.LineString; +import org.apache.olingo.commons.api.edm.geo.MultiLineString; +import org.apache.olingo.commons.api.edm.geo.MultiPoint; +import org.apache.olingo.commons.api.edm.geo.MultiPolygon; +import org.apache.olingo.commons.api.edm.geo.Point; +import org.apache.olingo.commons.api.edm.geo.Polygon; +import java.math.BigDecimal; +import java.net.URI; +import java.util.UUID; +import java.io.Serializable; +import java.util.Collection; +import java.util.Calendar; +import javax.xml.datatype.Duration; + + +@Namespace("ODataDemo") +@EntityType(name = "Supplier", + openType = false, + hasStream = false, + isAbstract = false) +public interface Supplier + extends Serializable { + + + @Key + @Property(name = "ID", + type = "Edm.Int32", + nullable = false, + defaultValue = "", + maxLenght = Integer.MAX_VALUE, + fixedLenght = false, + precision = 0, + scale = 0, + unicode = true, + collation = "", + srid = "", + concurrencyMode = ConcurrencyMode.None, + fcSourcePath = "", + fcTargetPath = "", + fcContentKind = EdmContentKind.text, + fcNSPrefix = "", + fcNSURI = "", + fcKeepInContent = false) + Integer getID(); + + void setID(Integer _iD); + + + @Property(name = "Name", + type = "Edm.String", + nullable = true, + defaultValue = "", + maxLenght = Integer.MAX_VALUE, + fixedLenght = false, + precision = 0, + scale = 0, + unicode = true, + collation = "", + srid = "", + concurrencyMode = ConcurrencyMode.None, + fcSourcePath = "", + fcTargetPath = "", + fcContentKind = EdmContentKind.text, + fcNSPrefix = "", + fcNSURI = "", + fcKeepInContent = false) + String getName(); + + void setName(String _name); + + + @Property(name = "Address", + type = "ODataDemo.Address", + nullable = true, + defaultValue = "", + maxLenght = Integer.MAX_VALUE, + fixedLenght = false, + precision = 0, + scale = 0, + unicode = true, + collation = "", + srid = "", + concurrencyMode = ConcurrencyMode.None, + fcSourcePath = "", + fcTargetPath = "", + fcContentKind = EdmContentKind.text, + fcNSPrefix = "", + fcNSURI = "", + fcKeepInContent = false) + org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address getAddress(); + + void setAddress(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address _address); + + + @Property(name = "Location", + type = "Edm.GeographyPoint", + nullable = true, + defaultValue = "", + maxLenght = Integer.MAX_VALUE, + fixedLenght = false, + precision = 0, + scale = 0, + unicode = true, + collation = "", + srid = "", + concurrencyMode = ConcurrencyMode.None, + fcSourcePath = "", + fcTargetPath = "", + fcContentKind = EdmContentKind.text, + fcNSPrefix = "", + fcNSURI = "", + fcKeepInContent = false) + Point getLocation(); + + void setLocation(Point _location); + + + @Property(name = "Concurrency", + type = "Edm.Int32", + nullable = false, + defaultValue = "", + maxLenght = Integer.MAX_VALUE, + fixedLenght = false, + precision = 0, + scale = 0, + unicode = true, + collation = "", + srid = "", + concurrencyMode = ConcurrencyMode.None, + fcSourcePath = "", + fcTargetPath = "", + fcContentKind = EdmContentKind.text, + fcNSPrefix = "", + fcNSURI = "", + fcKeepInContent = false) + Integer getConcurrency(); + + void setConcurrency(Integer _concurrency); + + + + @NavigationProperty(name = "Products", + type = "ODataDemo.Product", + targetSchema = "ODataDemo", + targetContainer = "DemoService", + targetEntitySet = "Products", + containsTarget = false) + org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection getProducts(); + + void setProducts(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection _products); + + + + ComplexFactory factory(); + + interface ComplexFactory { + @Property(name = "Address", + type = "ODataDemo.Address") + org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address newAddress(); + + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/946356fb/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierCollection.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierCollection.java new file mode 100644 index 0000000..a354606 --- /dev/null +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierCollection.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.olingo.fit.proxy.v4.demo.odatademo.types; + +import org.apache.olingo.client.api.http.HttpMethod; +import org.apache.olingo.ext.proxy.api.AbstractEntityCollection; +import org.apache.olingo.ext.proxy.api.OperationType; +import org.apache.olingo.ext.proxy.api.annotations.Operation; +import org.apache.olingo.ext.proxy.api.annotations.Parameter; +import org.apache.olingo.fit.proxy.v4.demo.odatademo.*; +import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*; + +import org.apache.olingo.commons.api.edm.geo.Geospatial; +import org.apache.olingo.commons.api.edm.geo.GeospatialCollection; +import org.apache.olingo.commons.api.edm.geo.LineString; +import org.apache.olingo.commons.api.edm.geo.MultiLineString; +import org.apache.olingo.commons.api.edm.geo.MultiPoint; +import org.apache.olingo.commons.api.edm.geo.MultiPolygon; +import org.apache.olingo.commons.api.edm.geo.Point; +import org.apache.olingo.commons.api.edm.geo.Polygon; +import java.math.BigDecimal; +import java.net.URI; +import java.util.UUID; +import java.io.Serializable; +import java.util.Collection; +import java.util.Calendar; +import javax.xml.datatype.Duration; + +public interface SupplierCollection extends AbstractEntityCollection<Supplier> { +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/946356fb/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/package-info.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/package-info.java new file mode 100644 index 0000000..9c9e0b7 --- /dev/null +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/package-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.olingo.fit.proxy.v4.demo.odatademo.types; + http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/946356fb/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java index 716d9b3..78f05a7 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java @@ -116,6 +116,17 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> { } protected void serverLinks(final Linked linked, final JsonGenerator jgen) throws IOException { + if (linked instanceof JSONEntityImpl) { + for (Link link : ((JSONEntityImpl) linked).getMediaEditLinks()) { + if (StringUtils.isNotBlank(link.getHref())) { + jgen.writeStringField( + link.getTitle() + StringUtils.prependIfMissing( + version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK), "@"), + link.getHref()); + } + } + } + for (Link link : linked.getAssociationLinks()) { if (StringUtils.isNotBlank(link.getHref())) { jgen.writeStringField( http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/946356fb/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 6e079b4..0047b4d 100644 --- a/pom.xml +++ b/pom.xml @@ -415,7 +415,7 @@ <failOnViolation>true</failOnViolation> <violationSeverity>warning</violationSeverity> <!-- fit autogenerated (via pojogen plugin) resources --> - <excludes>**/fit/proxy/v4/staticservice/**/*.java, **/fit/proxy/v3/staticservice/**/*.java, **/fit/proxy/v3/actionoverloading/**/*.java, **/fit/proxy/v3/primitivekeys/**/*.java, **/fit/proxy/v3/opentype/**/*.java, **/fit/proxy/v4/opentype/**/*.java</excludes> + <excludes>**/fit/proxy/v4/staticservice/**/*.java, **/fit/proxy/v3/staticservice/**/*.java, **/fit/proxy/v3/actionoverloading/**/*.java, **/fit/proxy/v3/primitivekeys/**/*.java, **/fit/proxy/v3/opentype/**/*.java, **/fit/proxy/v4/opentype/**/*.java, **/fit/proxy/v4/demo/**/*.java</excludes> </configuration> </plugin> <plugin>
