Repository: olingo-odata4 Updated Branches: refs/heads/master 0b05798cd -> 118b779bc
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java deleted file mode 100644 index edf4366..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.commons.core.data; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -/** - * A single entry, represented via JSON. - */ -@JsonSerialize(using = JSONEntrySerializer.class) -@JsonDeserialize(using = JSONEntryDeserializer.class) -public class JSONEntryImpl extends AbstractEntry { - - private static final long serialVersionUID = -5275365545400797758L; - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java deleted file mode 100644 index a5c2c33..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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.commons.core.data; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import java.io.IOException; -import java.net.URI; -import org.apache.commons.lang3.StringUtils; -import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.data.Entry; -import org.apache.olingo.commons.api.data.Link; -import org.apache.olingo.commons.api.data.Property; -import org.apache.olingo.commons.api.domain.ODataOperation; -import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; -import org.apache.olingo.commons.core.edm.EdmTypeInfo; - -/** - * Writes out JSON string from an entry. - */ -public class JSONEntrySerializer extends AbstractJsonSerializer<JSONEntryImpl> { - - @Override - protected void doSerialize(final JSONEntryImpl entry, final JsonGenerator jgen, final SerializerProvider provider) - throws IOException, JsonProcessingException { - - doContainerSerialize(new ResWrap<JSONEntryImpl>((URI) null, null, entry), jgen, provider); - } - - @Override - protected void doContainerSerialize( - final ResWrap<JSONEntryImpl> container, final JsonGenerator jgen, final SerializerProvider provider) - throws IOException, JsonProcessingException { - - final Entry entry = container.getPayload(); - - jgen.writeStartObject(); - - if (serverMode) { - if (container.getContextURL() != null) { - jgen.writeStringField(version.compareTo(ODataServiceVersion.V40) >= 0 - ? Constants.JSON_CONTEXT : Constants.JSON_METADATA, - container.getContextURL().getURI().toASCIIString()); - } - if (version.compareTo(ODataServiceVersion.V40) >= 0 && StringUtils.isNotBlank(container.getMetadataETag())) { - jgen.writeStringField(Constants.JSON_METADATA_ETAG, container.getMetadataETag()); - } - - if (StringUtils.isNotBlank(entry.getETag())) { - jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_ETAG), entry.getETag()); - } - } - - if (StringUtils.isNotBlank(entry.getType())) { - jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_TYPE), - new EdmTypeInfo.Builder().setTypeExpression(entry.getType()).build().external(version)); - } - - if (entry.getId() != null) { - jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_ID), entry.getId()); - } - - for (Property property : entry.getProperties()) { - property(jgen, property, property.getName()); - } - - if (serverMode && entry.getEditLink() != null && StringUtils.isNotBlank(entry.getEditLink().getHref())) { - final URI link = URI.create(entry.getEditLink().getHref()); - final String editLink = link.isAbsolute() ? link.toASCIIString() - : URI.create(entry.getBaseURI() + "/" + link.toASCIIString()).normalize().toASCIIString(); - - jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK), editLink); - } - - links(entry, jgen); - - for (Link link : entry.getMediaEditLinks()) { - if (link.getTitle() == null) { - jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK), link.getHref()); - } - - if (link.getInlineEntry() != null) { - jgen.writeObjectField(link.getTitle(), link.getInlineEntry()); - } - if (link.getInlineFeed() != null) { - jgen.writeArrayFieldStart(link.getTitle()); - for (Entry subEntry : link.getInlineFeed().getEntries()) { - jgen.writeObject(subEntry); - } - jgen.writeEndArray(); - } - } - - if (serverMode) { - for (ODataOperation operation : entry.getOperations()) { - jgen.writeObjectFieldStart("#" + StringUtils.substringAfterLast(operation.getMetadataAnchor(), "#")); - jgen.writeStringField(Constants.ATTR_TITLE, operation.getTitle()); - jgen.writeStringField(Constants.ATTR_TARGET, operation.getTarget().toASCIIString()); - jgen.writeEndObject(); - } - } - - jgen.writeEndObject(); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java deleted file mode 100644 index a9f80c4..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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.commons.core.data; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import java.io.IOException; -import java.net.URI; -import java.util.Iterator; -import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.data.ResWrap; - -/** - * Reads JSON string into a feed. - * <br/> - * If metadata information is available, the corresponding entry fields and content will be populated. - */ -public class JSONFeedDeserializer extends AbstractJsonDeserializer<JSONFeedImpl> { - - @Override - protected ResWrap<JSONFeedImpl> doDeserialize(final JsonParser parser, final DeserializationContext ctxt) - throws IOException, JsonProcessingException { - - final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser); - - if (!tree.has(Constants.VALUE)) { - return null; - } - - final JSONFeedImpl feed = new JSONFeedImpl(); - - final URI contextURL; - if (tree.hasNonNull(Constants.JSON_CONTEXT)) { - contextURL = URI.create(tree.get(Constants.JSON_CONTEXT).textValue()); - tree.remove(Constants.JSON_CONTEXT); - } else if (tree.hasNonNull(Constants.JSON_METADATA)) { - contextURL = URI.create(tree.get(Constants.JSON_METADATA).textValue()); - tree.remove(Constants.JSON_METADATA); - } else { - contextURL = null; - } - feed.setMetadataContextURL(contextURL); - - final String metadataETag; - if (tree.hasNonNull(Constants.JSON_METADATA_ETAG)) { - metadataETag = tree.get(Constants.JSON_METADATA_ETAG).textValue(); - tree.remove(Constants.JSON_METADATA_ETAG); - } else { - metadataETag = null; - } - - if (tree.hasNonNull(Constants.JSON_COUNT)) { - feed.setCount(tree.get(Constants.JSON_COUNT).asInt()); - } - if (tree.hasNonNull(Constants.JSON_NEXT_LINK)) { - feed.setNext(URI.create(tree.get(Constants.JSON_NEXT_LINK).textValue())); - } - - if (tree.hasNonNull(Constants.VALUE)) { - for (final Iterator<JsonNode> itor = tree.get(Constants.VALUE).iterator(); itor.hasNext();) { - feed.getEntries().add( - itor.next().traverse(parser.getCodec()).<ResWrap<JSONEntryImpl>>readValueAs( - new TypeReference<JSONEntryImpl>() { - }).getPayload()); - } - } - - return new ResWrap<JSONFeedImpl>(contextURL, metadataETag, feed); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java deleted file mode 100644 index 02ce871..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.commons.core.data; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import org.apache.olingo.commons.api.data.Entry; -import org.apache.olingo.commons.api.data.Feed; -import org.apache.olingo.commons.api.Constants; - -/** - * List of entries, represented via JSON. - * - * @see JSONEntry - */ -@JsonDeserialize(using = JSONFeedDeserializer.class) -@JsonSerialize(using = JSONFeedSerializer.class) -public class JSONFeedImpl extends AbstractPayloadObject implements Feed { - - private static final long serialVersionUID = -3576372289800799417L; - - private URI metadataContextURL; - - private String id; - - private Integer count; - - private final List<Entry> entries = new ArrayList<Entry>(); - - private String next; - - @Override - public URI getBaseURI() { - URI baseURI = null; - if (metadataContextURL != null) { - final String metadataURI = metadataContextURL.toASCIIString(); - baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA))); - } - - return baseURI; - } - - public void setMetadataContextURL(final URI metadataContextURL) { - this.metadataContextURL = metadataContextURL; - } - - @Override - public String getId() { - return id; - } - - public void setId(final String id) { - this.id = id; - } - - @Override - public Integer getCount() { - return count; - } - - @Override - public void setCount(final Integer count) { - this.count = count; - } - - @Override - public List<Entry> getEntries() { - return entries; - } - - @Override - public void setNext(final URI next) { - this.next = next == null ? null : next.toASCIIString(); - } - - @Override - public URI getNext() { - return next == null ? null : URI.create(next); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java deleted file mode 100644 index 457b34c..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.commons.core.data; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import java.io.IOException; -import java.net.URI; -import org.apache.commons.lang3.StringUtils; -import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.data.Entry; -import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; - -public class JSONFeedSerializer extends AbstractJsonSerializer<JSONFeedImpl> { - - @Override - protected void doSerialize( - final JSONFeedImpl feed, final JsonGenerator jgen, final SerializerProvider provider) - throws IOException, JsonProcessingException { - - doContainerSerialize(new ResWrap<JSONFeedImpl>((URI) null, null, feed), jgen, provider); - } - - @Override - protected void doContainerSerialize( - final ResWrap<JSONFeedImpl> container, final JsonGenerator jgen, final SerializerProvider provider) - throws IOException, JsonProcessingException { - - final JSONFeedImpl feed = container.getPayload(); - - jgen.writeStartObject(); - - if (serverMode) { - if (container.getContextURL() != null) { - jgen.writeStringField(version.compareTo(ODataServiceVersion.V40) >= 0 - ? Constants.JSON_CONTEXT : Constants.JSON_METADATA, - container.getContextURL().getURI().toASCIIString()); - } - - if (version.compareTo(ODataServiceVersion.V40) >= 0 && StringUtils.isNotBlank(container.getMetadataETag())) { - jgen.writeStringField( - Constants.JSON_METADATA_ETAG, - container.getMetadataETag()); - } - } - - if (feed.getId() != null) { - jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_ID), feed.getId()); - } - if (feed.getCount() != null) { - jgen.writeNumberField(Constants.JSON_COUNT, feed.getCount()); - } - if (feed.getNext() != null) { - jgen.writeStringField(Constants.JSON_NEXT_LINK, feed.getNext().toASCIIString()); - } - - jgen.writeArrayFieldStart(Constants.VALUE); - for (Entry entry : feed.getEntries()) { - jgen.writeObject(entry); - } - - jgen.writeEndArray(); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java index 85fabdc..bb865d1 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java @@ -18,8 +18,8 @@ */ package org.apache.olingo.commons.core.data; -import org.apache.olingo.commons.api.data.Entry; -import org.apache.olingo.commons.api.data.Feed; +import org.apache.olingo.commons.api.data.Entity; +import org.apache.olingo.commons.api.data.EntitySet; import org.apache.olingo.commons.api.data.Link; public class LinkImpl extends AbstractPayloadObject implements Link { @@ -36,9 +36,9 @@ public class LinkImpl extends AbstractPayloadObject implements Link { private String mediaETag; - private Entry entry; + private Entity entity; - private Feed feed; + private EntitySet entitySet; @Override public String getTitle() { @@ -91,22 +91,22 @@ public class LinkImpl extends AbstractPayloadObject implements Link { } @Override - public Entry getInlineEntry() { - return entry; + public Entity getInlineEntity() { + return entity; } @Override - public void setInlineEntry(final Entry entry) { - this.entry = entry; + public void setInlineEntity(final Entity entity) { + this.entity = entity; } @Override - public Feed getInlineFeed() { - return feed; + public EntitySet getInlineEntitySet() { + return entitySet; } @Override - public void setInlineFeed(final Feed feed) { - this.feed = feed; + public void setInlineEntitySet(final EntitySet entitySet) { + this.entitySet = entitySet; } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java index 8651b4b..a6a75b8 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java @@ -55,6 +55,12 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> { protected String jsonNavigationLink; + protected String jsonCount; + + protected String jsonNextLink; + + protected String jsonDeltaLink; + protected String jsonError; protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt) @@ -82,6 +88,9 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> { jsonMediaETag = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG); jsonAssociationLink = version.getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK); jsonNavigationLink = version.getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK); + jsonCount = version.getJSONMap().get(ODataServiceVersion.JSON_COUNT); + jsonNextLink = version.getJSONMap().get(ODataServiceVersion.JSON_NEXT_LINK); + jsonDeltaLink = version.getJSONMap().get(ODataServiceVersion.JSON_DELTA_LINK); jsonError = version.getJSONMap().get(ODataServiceVersion.JSON_ERROR); return doDeserialize(jp, ctxt); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/JSONLinkCollectionImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/JSONLinkCollectionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/JSONLinkCollectionImpl.java index b0bd6e0..edf871b 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/JSONLinkCollectionImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/JSONLinkCollectionImpl.java @@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.data.v3.LinkCollection; import org.apache.olingo.commons.core.data.AbstractPayloadObject; /** - * Link from an entry, represented via JSON. + * Link from an entity, represented via JSON. */ public class JSONLinkCollectionImpl extends AbstractPayloadObject implements LinkCollection { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java index 253b1a1..3152b3d 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java @@ -69,7 +69,7 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement private URI editLink; /** - * Navigation links (might contain in-line entities or feeds). + * Navigation links (might contain in-line entities or entity sets). */ private final List<ODataLink> navigationLinks = new ArrayList<ODataLink>(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java index b2f7dc8..1396bce 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java @@ -32,8 +32,9 @@ public abstract class AbstractODataEntitySet extends AbstractODataPayload implem private URI next; /** - * Number of ODataEntities contained in this feed. If <tt>$inlinecount</tt> was requested, this value comes from - * there. + * Number of ODataEntities contained in this entity set. + * <br/> + * If <tt>$inlinecount</tt> was requested, this value comes from there. */ private Integer count; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java index 9eed8c5..07ae0da 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java @@ -34,7 +34,7 @@ public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProper private static final long serialVersionUID = 1143925901934898802L; /** - * Navigation links (might contain in-line entities or feeds). + * Navigation links (might contain in-line entities or entity sets). */ private final List<ODataLink> navigationLinks = new ArrayList<ODataLink>(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java index e14879e..2e398f5 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java @@ -23,7 +23,6 @@ import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.EdmException; import org.apache.olingo.commons.api.edm.EdmNavigationProperty; import org.apache.olingo.commons.api.edm.EdmStructuredType; -import org.apache.olingo.commons.api.edm.EdmType; import org.apache.olingo.commons.api.edm.FullQualifiedName; public abstract class AbstractEdmNavigationProperty extends EdmElementImpl implements EdmNavigationProperty { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java index 29eed4a..f584868 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java @@ -22,9 +22,9 @@ import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.reflect.Type; import java.net.URI; -import org.apache.olingo.commons.api.data.Entry; +import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.data.Feed; +import org.apache.olingo.commons.api.data.EntitySet; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.format.ODataPubFormat; @@ -32,11 +32,11 @@ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; import org.apache.olingo.commons.api.op.CommonODataDeserializer; import org.apache.olingo.commons.core.data.AtomDeserializer; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.core.data.AtomEntryImpl; -import org.apache.olingo.commons.core.data.AtomFeedImpl; +import org.apache.olingo.commons.core.data.AtomEntityImpl; +import org.apache.olingo.commons.core.data.AtomEntitySetImpl; import org.apache.olingo.commons.core.data.AtomPropertyImpl; -import org.apache.olingo.commons.core.data.JSONEntryImpl; -import org.apache.olingo.commons.core.data.JSONFeedImpl; +import org.apache.olingo.commons.core.data.JSONEntityImpl; +import org.apache.olingo.commons.core.data.JSONEntitySetImpl; import org.apache.olingo.commons.core.data.JSONODataErrorImpl; import org.apache.olingo.commons.core.data.JSONPropertyImpl; import org.apache.olingo.commons.core.data.XMLODataErrorImpl; @@ -54,17 +54,17 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl } @Override - public ResWrap<Feed> toFeed(final InputStream input, final ODataPubFormat format) { + public ResWrap<EntitySet> toEntitySet(final InputStream input, final ODataPubFormat format) { return format == ODataPubFormat.ATOM - ? this.<Feed, AtomFeedImpl>atom(input, AtomFeedImpl.class) - : this.<Feed, JSONFeedImpl>json(input, JSONFeedImpl.class); + ? this.<EntitySet, AtomEntitySetImpl>atom(input, AtomEntitySetImpl.class) + : this.<EntitySet, JSONEntitySetImpl>json(input, JSONEntitySetImpl.class); } @Override - public ResWrap<Entry> toEntry(final InputStream input, final ODataPubFormat format) { + public ResWrap<Entity> toEntity(final InputStream input, final ODataPubFormat format) { return format == ODataPubFormat.ATOM - ? this.<Entry, AtomEntryImpl>atom(input, AtomEntryImpl.class) - : this.<Entry, JSONEntryImpl>json(input, JSONEntryImpl.class); + ? this.<Entity, AtomEntityImpl>atom(input, AtomEntityImpl.class) + : this.<Entity, JSONEntityImpl>json(input, JSONEntityImpl.class); } @Override http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataSerializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataSerializer.java index 6ce1fbf..32b9e99 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataSerializer.java @@ -25,19 +25,19 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.data.Entry; -import org.apache.olingo.commons.api.data.Feed; +import org.apache.olingo.commons.api.data.Entity; +import org.apache.olingo.commons.api.data.EntitySet; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; import org.apache.olingo.commons.api.op.ODataSerializer; -import org.apache.olingo.commons.core.data.AtomEntryImpl; -import org.apache.olingo.commons.core.data.AtomFeedImpl; +import org.apache.olingo.commons.core.data.AtomEntityImpl; +import org.apache.olingo.commons.core.data.AtomEntitySetImpl; import org.apache.olingo.commons.core.data.AtomPropertyImpl; import org.apache.olingo.commons.core.data.AtomSerializer; -import org.apache.olingo.commons.core.data.JSONEntryImpl; -import org.apache.olingo.commons.core.data.JSONFeedImpl; +import org.apache.olingo.commons.core.data.JSONEntityImpl; +import org.apache.olingo.commons.core.data.JSONEntitySetImpl; import org.apache.olingo.commons.core.data.JSONPropertyImpl; public abstract class AbstractODataSerializer extends AbstractJacksonTool implements ODataSerializer { @@ -53,30 +53,30 @@ public abstract class AbstractODataSerializer extends AbstractJacksonTool implem } @Override - public void feed(final Feed obj, final OutputStream out) { - feed(obj, new OutputStreamWriter(out)); + public void entitySet(final EntitySet obj, final OutputStream out) { + entitySet(obj, new OutputStreamWriter(out)); } @Override - public void feed(final Feed obj, final Writer writer) { - if (obj instanceof AtomFeedImpl) { - atom((AtomFeedImpl) obj, writer); + public void entitySet(final EntitySet obj, final Writer writer) { + if (obj instanceof AtomEntitySetImpl) { + atom((AtomEntitySetImpl) obj, writer); } else { - json((JSONFeedImpl) obj, writer); + json((JSONEntitySetImpl) obj, writer); } } @Override - public void entry(final Entry obj, final OutputStream out) { - entry(obj, new OutputStreamWriter(out)); + public void entity(final Entity obj, final OutputStream out) { + entity(obj, new OutputStreamWriter(out)); } @Override - public void entry(final Entry obj, final Writer writer) { - if (obj instanceof AtomEntryImpl) { - atom((AtomEntryImpl) obj, writer); + public void entity(final Entity obj, final Writer writer) { + if (obj instanceof AtomEntityImpl) { + atom((AtomEntityImpl) obj, writer); } else { - json((JSONEntryImpl) obj, writer); + json((JSONEntityImpl) obj, writer); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ResourceFactory.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ResourceFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ResourceFactory.java index e585b2d..a2efe34 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ResourceFactory.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ResourceFactory.java @@ -18,62 +18,62 @@ */ package org.apache.olingo.commons.core.op; -import org.apache.olingo.commons.api.data.Entry; -import org.apache.olingo.commons.api.data.Feed; +import org.apache.olingo.commons.api.data.Entity; +import org.apache.olingo.commons.api.data.EntitySet; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.format.ODataPubFormat; -import org.apache.olingo.commons.core.data.AtomEntryImpl; -import org.apache.olingo.commons.core.data.AtomFeedImpl; +import org.apache.olingo.commons.core.data.AtomEntityImpl; +import org.apache.olingo.commons.core.data.AtomEntitySetImpl; import org.apache.olingo.commons.core.data.AtomPropertyImpl; -import org.apache.olingo.commons.core.data.JSONEntryImpl; -import org.apache.olingo.commons.core.data.JSONFeedImpl; +import org.apache.olingo.commons.core.data.JSONEntityImpl; +import org.apache.olingo.commons.core.data.JSONEntitySetImpl; import org.apache.olingo.commons.core.data.JSONPropertyImpl; public class ResourceFactory { /** - * Gets a new instance of <tt>Feed</tt>. + * Gets a new instance of <tt>EntitySet</tt>. * * @param resourceClass reference class. - * @return <tt>Feed</tt> object. + * @return {@link EntitySet} object. */ - public static Feed newFeed(final Class<? extends Feed> resourceClass) { - Feed result = null; + public static EntitySet newEntitySet(final Class<? extends EntitySet> resourceClass) { + EntitySet result = null; - if (AtomFeedImpl.class.equals(resourceClass)) { - result = new AtomFeedImpl(); + if (AtomEntitySetImpl.class.equals(resourceClass)) { + result = new AtomEntitySetImpl(); } - if (JSONFeedImpl.class.equals(resourceClass)) { - result = new JSONFeedImpl(); + if (JSONEntitySetImpl.class.equals(resourceClass)) { + result = new JSONEntitySetImpl(); } return result; } /** - * Gets a new instance of <tt>Entry</tt>. + * Gets a new instance of <tt>Entity</tt>. * * @param resourceClass reference class. - * @return <tt>Entry</tt> object. + * @return {@link Entity} object. */ - public static Entry newEntry(final Class<? extends Entry> resourceClass) { - Entry result = null; - if (AtomEntryImpl.class.equals(resourceClass)) { - result = new AtomEntryImpl(); + public static Entity newEntity(final Class<? extends Entity> resourceClass) { + Entity result = null; + if (AtomEntityImpl.class.equals(resourceClass)) { + result = new AtomEntityImpl(); } - if (JSONEntryImpl.class.equals(resourceClass)) { - result = new JSONEntryImpl(); + if (JSONEntityImpl.class.equals(resourceClass)) { + result = new JSONEntityImpl(); } return result; } - public static Property newProperty(final Class<? extends Entry> resourceClass) { + public static Property newProperty(final Class<? extends Entity> resourceClass) { Property result = null; - if (AtomEntryImpl.class.equals(resourceClass)) { + if (AtomEntityImpl.class.equals(resourceClass)) { result = new AtomPropertyImpl(); } - if (JSONEntryImpl.class.equals(resourceClass)) { + if (JSONEntityImpl.class.equals(resourceClass)) { result = new JSONPropertyImpl(); } @@ -81,45 +81,45 @@ public class ResourceFactory { } /** - * Gets feed reference class from the given format. + * Gets entity set reference class from the given format. * * @param isXML whether it is JSON or XML / Atom * @return resource reference class. */ - public static Class<? extends Feed> feedClassForFormat(final boolean isXML) { - return isXML ? AtomFeedImpl.class : JSONFeedImpl.class; + public static Class<? extends EntitySet> entitySetClassForFormat(final boolean isXML) { + return isXML ? AtomEntitySetImpl.class : JSONEntitySetImpl.class; } /** - * Gets entry reference class from the given format. + * Gets entity reference class from the given format. * * @param isXML whether it is JSON or XML / Atom * @return resource reference class. */ - public static Class<? extends Entry> entryClassForFormat(final boolean isXML) { - return isXML ? AtomEntryImpl.class : JSONEntryImpl.class; + public static Class<? extends Entity> entityClassForFormat(final boolean isXML) { + return isXML ? AtomEntityImpl.class : JSONEntityImpl.class; } /** - * Gets <tt>Entry</tt> object from feed resource. + * Gets <tt>Entity</tt> object from entity set resource. * - * @param resourceClass feed reference class. - * @return <tt>Entry</tt> object. + * @param resourceClass entity set reference class. + * @return {@link Entity} object. */ - public static Class<? extends Entry> entryClassForFeed(final Class<? extends Feed> resourceClass) { - Class<? extends Entry> result = null; + public static Class<? extends Entity> entityClassForEntitySet(final Class<? extends EntitySet> resourceClass) { + Class<? extends Entity> result = null; - if (AtomFeedImpl.class.equals(resourceClass)) { - result = AtomEntryImpl.class; + if (AtomEntitySetImpl.class.equals(resourceClass)) { + result = AtomEntityImpl.class; } - if (JSONFeedImpl.class.equals(resourceClass)) { - result = JSONEntryImpl.class; + if (JSONEntitySetImpl.class.equals(resourceClass)) { + result = JSONEntityImpl.class; } return result; } - public static ODataPubFormat formatForEntryClass(final Class<? extends Entry> reference) { - return reference.equals(AtomEntryImpl.class) ? ODataPubFormat.ATOM : ODataPubFormat.JSON; + public static ODataPubFormat formatForEntityClass(final Class<? extends Entity> reference) { + return reference.equals(AtomEntityImpl.class) ? ODataPubFormat.ATOM : ODataPubFormat.JSON; } }
