You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/04/30 17:02:59 UTC
[46/50] [abbrv] olingo-odata4 git commit: [OLINGO-564] first step for
common -> client extraction
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
index d2b287c..d38533e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
@@ -32,7 +32,7 @@ import org.apache.olingo.client.core.communication.request.AbstractODataStreamMa
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/AbstractClientEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/AbstractClientEntitySet.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/AbstractClientEntitySet.java
new file mode 100644
index 0000000..d6b81d9
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/AbstractClientEntitySet.java
@@ -0,0 +1,71 @@
+/*
+ * 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.client.core.domain;
+
+import java.net.URI;
+
+import org.apache.olingo.client.api.domain.AbstractClientPayload;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+
+public abstract class AbstractClientEntitySet extends AbstractClientPayload implements ClientEntitySet {
+
+ /**
+ * Link to the next page.
+ */
+ private URI next;
+
+ /**
+ * Number of ODataEntities contained in this entity set.
+ * <br/>
+ * If <tt>$inlinecount</tt> was requested, this value comes from there.
+ */
+ private Integer count;
+
+ /**
+ * Constructor.
+ */
+ public AbstractClientEntitySet() {
+ super(null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param next next link.
+ */
+ public AbstractClientEntitySet(final URI next) {
+ super(null);
+ this.next = next;
+ }
+
+ @Override
+ public URI getNext() {
+ return next;
+ }
+
+ @Override
+ public Integer getCount() {
+ return count;
+ }
+
+ @Override
+ public void setCount(final int count) {
+ this.count = count;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientAnnotationImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientAnnotationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientAnnotationImpl.java
new file mode 100644
index 0000000..0f92445
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientAnnotationImpl.java
@@ -0,0 +1,102 @@
+/*
+ * 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.client.core.domain;
+
+import org.apache.olingo.client.api.domain.ClientAnnotation;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEnumValue;
+import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
+import org.apache.olingo.client.api.domain.ClientValuable;
+import org.apache.olingo.client.api.domain.ClientValue;
+
+public class ClientAnnotationImpl implements ClientAnnotation {
+
+ private final String term;
+
+ private final ClientValuable valuable;
+
+ public ClientAnnotationImpl(final String term, final ClientValue value) {
+ this.term = term;
+ valuable = new ClientValuableImpl(value);
+ }
+
+ @Override
+ public String getTerm() {
+ return term;
+ }
+
+ @Override
+ public ClientValue getValue() {
+ return valuable.getValue();
+ }
+
+ @Override
+ public boolean hasNullValue() {
+ return valuable.hasNullValue();
+ }
+
+ @Override
+ public boolean hasPrimitiveValue() {
+ return valuable.hasPrimitiveValue();
+ }
+
+ @Override
+ public ClientPrimitiveValue getPrimitiveValue() {
+ return valuable.getPrimitiveValue();
+ }
+
+ @Override
+ public boolean hasCollectionValue() {
+ return valuable.hasCollectionValue();
+ }
+
+ @Override
+ public ClientCollectionValue<ClientValue> getCollectionValue() {
+ return valuable.getCollectionValue();
+ }
+
+ @Override
+ public boolean hasComplexValue() {
+ return valuable.hasComplexValue();
+ }
+
+ @Override
+ public ClientComplexValue getComplexValue() {
+ return valuable.getComplexValue();
+ }
+
+ @Override
+ public boolean hasEnumValue() {
+ return valuable.hasEnumValue();
+ }
+
+ @Override
+ public ClientEnumValue getEnumValue() {
+ return valuable.getEnumValue();
+ }
+
+ @Override
+ public String toString() {
+ return "ODataPropertyImpl{"
+ + "term=" + term
+ + ",valuable=" + valuable
+ + '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientCollectionValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientCollectionValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientCollectionValueImpl.java
new file mode 100644
index 0000000..3698060
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientCollectionValueImpl.java
@@ -0,0 +1,124 @@
+/*
+ * 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.client.core.domain;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.olingo.client.api.domain.AbstractClientValue;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientEnumValue;
+import org.apache.olingo.client.api.domain.ClientValue;
+
+public class ClientCollectionValueImpl<OV extends ClientValue> extends AbstractClientValue
+ implements ClientCollectionValue<OV>, ClientValue {
+
+ /**
+ * Constructor.
+ *
+ * @param typeName type name.
+ */
+ public ClientCollectionValueImpl(final String typeName) {
+ super(typeName == null || typeName.startsWith("Collection(") ? typeName : "Collection(" + typeName + ")");
+ }
+
+ @Override
+ public boolean isEnum() {
+ return false;
+ }
+
+ @Override
+ public ClientEnumValue asEnum() {
+ return null;
+ }
+
+ @Override
+ public boolean isComplex() {
+ return false;
+ }
+
+ @Override
+ public Collection<Object> asJavaCollection() {
+ final List<Object> result = new ArrayList<Object>();
+ for (ClientValue value : values) {
+ if (value.isPrimitive()) {
+ result.add(value.asPrimitive().toValue());
+ } else if (value.isComplex()) {
+ result.add(value.asComplex().asJavaMap());
+ } else if (value.isCollection()) {
+ result.add(value.asCollection().asJavaCollection());
+ } else if (value.isEnum()) {
+ result.add(value.asEnum().toString());
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Values.
+ */
+ protected final List<OV> values = new ArrayList<OV>();
+
+ /**
+ * Adds a value to the collection.
+ *
+ * @param value value to be added.
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public ClientCollectionValue<OV> add(final ClientValue value) {
+ values.add((OV) value);
+ return this;
+ }
+
+ /**
+ * Value iterator.
+ *
+ * @return value iterator.
+ */
+ @Override
+ public Iterator<OV> iterator() {
+ return values.iterator();
+ }
+
+ /**
+ * Gets collection size.
+ *
+ * @return collection size.
+ */
+ @Override
+ public int size() {
+ return values.size();
+ }
+
+ /**
+ * Checks if collection is empty.
+ *
+ * @return 'TRUE' if empty; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isEmpty() {
+ return values.isEmpty();
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientComplexValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientComplexValueImpl.java
new file mode 100644
index 0000000..d7550b6
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientComplexValueImpl.java
@@ -0,0 +1,204 @@
+/*
+ * 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.client.core.domain;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.client.api.domain.AbstractClientValue;
+import org.apache.olingo.client.api.domain.ClientAnnotation;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEnumValue;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.client.api.domain.ClientProperty;
+
+public class ClientComplexValueImpl extends AbstractClientValue implements ClientComplexValue {
+
+ /**
+ * Navigation links (might contain in-line entities or entity sets).
+ */
+ private final List<ClientLink> navigationLinks = new ArrayList<ClientLink>();
+
+ /**
+ * Association links.
+ */
+ private final List<ClientLink> associationLinks = new ArrayList<ClientLink>();
+
+ private final List<ClientAnnotation> annotations = new ArrayList<ClientAnnotation>();
+
+ /**
+ * Complex type fields.
+ */
+ private final Map<String, ClientProperty> fields = new LinkedHashMap<String, ClientProperty>();
+
+ /**
+ * Constructor.
+ *
+ * @param typeName type name.
+ */
+ public ClientComplexValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+ @Override
+ public boolean isEnum() {
+ return false;
+ }
+
+ @Override
+ public ClientEnumValue asEnum() {
+ return null;
+ }
+
+ @Override
+ public boolean isComplex() {
+ return true;
+ }
+
+ @Override
+ public boolean addLink(final ClientLink link) {
+ boolean result = false;
+
+ switch (link.getType()) {
+ case ASSOCIATION:
+ result = associationLinks.contains(link) ? false : associationLinks.add(link);
+ break;
+
+ case ENTITY_NAVIGATION:
+ case ENTITY_SET_NAVIGATION:
+ result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
+ break;
+
+ case MEDIA_EDIT:
+ throw new IllegalArgumentException("Complex values cannot have media links!");
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean removeLink(final ClientLink link) {
+ return associationLinks.remove(link) || navigationLinks.remove(link);
+ }
+
+ private ClientLink getLink(final List<ClientLink> links, final String name) {
+ ClientLink result = null;
+ for (ClientLink link : links) {
+ if (name.equals(link.getName())) {
+ result = link;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public ClientLink getNavigationLink(final String name) {
+ return getLink(navigationLinks, name);
+ }
+
+ @Override
+ public List<ClientLink> getNavigationLinks() {
+ return navigationLinks;
+ }
+
+ @Override
+ public ClientLink getAssociationLink(final String name) {
+ return getLink(associationLinks, name);
+ }
+
+ @Override
+ public List<ClientLink> getAssociationLinks() {
+ return associationLinks;
+ }
+
+ @Override
+ public Map<String, Object> asJavaMap() {
+ final Map<String, Object> result = new LinkedHashMap<String, Object>();
+ for (Map.Entry<String, ClientProperty> entry : fields.entrySet()) {
+ Object value = null;
+ if (entry.getValue().hasPrimitiveValue()) {
+ value = entry.getValue().getPrimitiveValue().toValue();
+ } else if (entry.getValue().hasComplexValue()) {
+ value = entry.getValue().getComplexValue().asJavaMap();
+ } else if (entry.getValue().hasCollectionValue()) {
+ value = entry.getValue().getCollectionValue().asJavaCollection();
+ } else if (entry.getValue().hasEnumValue()) {
+ value = entry.getValue().getEnumValue().toString();
+ }
+
+ result.put(entry.getKey(), value);
+ }
+
+ return result;
+ }
+
+ @Override
+ public List<ClientAnnotation> getAnnotations() {
+ return annotations;
+ }
+
+ /**
+ * Adds field to the complex type.
+ *
+ * @param field field to be added.
+ */
+ @Override
+ public ClientComplexValue add(final ClientProperty field) {
+ fields.put(field.getName(), field);
+ return this;
+ }
+
+ /**
+ * Gets field.
+ *
+ * @param name name of the field to be retrieved.
+ * @return requested field.
+ */
+ @Override
+ public ClientProperty get(final String name) {
+ return fields.get(name);
+ }
+
+ /**
+ * Complex property fields iterator.
+ *
+ * @return fields iterator.
+ */
+ @Override
+ public Iterator<ClientProperty> iterator() {
+ return fields.values().iterator();
+ }
+
+ /**
+ * Gets number of fields.
+ *
+ * @return number of fields.
+ */
+ @Override
+ public int size() {
+ return fields.size();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeletedEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeletedEntityImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeletedEntityImpl.java
new file mode 100644
index 0000000..e2d954b
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeletedEntityImpl.java
@@ -0,0 +1,54 @@
+/*
+ * 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.client.core.domain;
+
+import java.net.URI;
+
+import org.apache.olingo.client.api.domain.ClientDeletedEntity;
+import org.apache.olingo.client.api.domain.ClientItem;
+
+public class ClientDeletedEntityImpl extends ClientItem implements ClientDeletedEntity {
+
+ private URI id;
+
+ private Reason reason;
+
+ public ClientDeletedEntityImpl() {
+ super(null);
+ }
+
+ @Override
+ public URI getId() {
+ return id;
+ }
+
+ public void setId(final URI id) {
+ this.id = id;
+ }
+
+ @Override
+ public Reason getReason() {
+ return reason;
+ }
+
+ public void setReason(final Reason reason) {
+ this.reason = reason;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaImpl.java
new file mode 100644
index 0000000..02af157
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaImpl.java
@@ -0,0 +1,60 @@
+/*
+ * 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.client.core.domain;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.client.api.domain.ClientDeletedEntity;
+import org.apache.olingo.client.api.domain.ClientDelta;
+import org.apache.olingo.client.api.domain.ClientDeltaLink;
+
+public class ClientDeltaImpl extends ClientEntitySetImpl implements ClientDelta {
+
+ private final List<ClientDeletedEntity> deletedEntities = new ArrayList<ClientDeletedEntity>();
+
+ private final List<ClientDeltaLink> addedLinks = new ArrayList<ClientDeltaLink>();
+
+ private final List<ClientDeltaLink> deletedLinks = new ArrayList<ClientDeltaLink>();
+
+ public ClientDeltaImpl() {
+ super();
+ }
+
+ public ClientDeltaImpl(final URI next) {
+ super(next);
+ }
+
+ @Override
+ public List<ClientDeletedEntity> getDeletedEntities() {
+ return deletedEntities;
+ }
+
+ @Override
+ public List<ClientDeltaLink> getAddedLinks() {
+ return addedLinks;
+ }
+
+ @Override
+ public List<ClientDeltaLink> getDeletedLinks() {
+ return deletedLinks;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaLinkImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaLinkImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaLinkImpl.java
new file mode 100644
index 0000000..29a1572
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaLinkImpl.java
@@ -0,0 +1,78 @@
+/*
+ * 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.client.core.domain;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.client.api.domain.ClientAnnotation;
+import org.apache.olingo.client.api.domain.ClientDeltaLink;
+import org.apache.olingo.client.api.domain.ClientItem;
+
+public class ClientDeltaLinkImpl extends ClientItem implements ClientDeltaLink {
+
+ private URI source;
+
+ private String relationship;
+
+ private URI target;
+
+ private final List<ClientAnnotation> annotations = new ArrayList<ClientAnnotation>();
+
+ public ClientDeltaLinkImpl() {
+ super(null);
+ }
+
+ @Override
+ public URI getSource() {
+ return source;
+ }
+
+ @Override
+ public void setSource(final URI source) {
+ this.source = source;
+ }
+
+ @Override
+ public String getRelationship() {
+ return relationship;
+ }
+
+ @Override
+ public void setRelationship(final String relationship) {
+ this.relationship = relationship;
+ }
+
+ @Override
+ public URI getTarget() {
+ return target;
+ }
+
+ @Override
+ public void setTarget(final URI target) {
+ this.target = target;
+ }
+
+ @Override
+ public List<ClientAnnotation> getAnnotations() {
+ return annotations;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntityImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntityImpl.java
new file mode 100644
index 0000000..1c0d31b
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntityImpl.java
@@ -0,0 +1,298 @@
+/*
+ * 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.client.core.domain;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.domain.AbstractClientPayload;
+import org.apache.olingo.client.api.domain.ClientAnnotation;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.client.api.domain.ClientOperation;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientSingleton;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+
+public class ClientEntityImpl extends AbstractClientPayload implements ClientEntity, ClientSingleton {
+
+ /**
+ * Entity id.
+ */
+ private URI id;
+ /**
+ * ETag.
+ */
+ private String eTag;
+ /**
+ * Media entity flag.
+ */
+ private boolean mediaEntity = false;
+ /**
+ * In case of media entity, media content type.
+ */
+ private String mediaContentType;
+ /**
+ * In case of media entity, media content source.
+ */
+ private URI mediaContentSource;
+ /**
+ * Media ETag.
+ */
+ private String mediaETag;
+ /**
+ * Edit link.
+ */
+ private URI editLink;
+
+ private final List<ClientProperty> properties = new ArrayList<ClientProperty>();
+
+ private final List<ClientAnnotation> annotations = new ArrayList<ClientAnnotation>();
+
+ private final FullQualifiedName typeName;
+ /**
+ * Navigation links (might contain in-line entities or entity sets).
+ */
+ private final List<ClientLink> navigationLinks = new ArrayList<ClientLink>();
+ /**
+ * Association links.
+ */
+ private final List<ClientLink> associationLinks = new ArrayList<ClientLink>();
+ /**
+ * Media edit links.
+ */
+ private final List<ClientLink> mediaEditLinks = new ArrayList<ClientLink>();
+ /**
+ * Operations (legacy, functions, actions).
+ */
+ private final List<ClientOperation> operations = new ArrayList<ClientOperation>();
+
+ public ClientEntityImpl(final FullQualifiedName typeName) {
+ super(typeName == null ? null : typeName.toString());
+ this.typeName = typeName;
+ }
+
+ @Override
+ public FullQualifiedName getTypeName() {
+ return typeName;
+ }
+
+ @Override
+ public String getETag() {
+ return eTag;
+ }
+
+ @Override
+ public void setETag(final String eTag) {
+ this.eTag = eTag;
+ }
+
+ @Override
+ public ClientOperation getOperation(final String title) {
+ ClientOperation result = null;
+ for (ClientOperation operation : operations) {
+ if (title.equals(operation.getTitle())) {
+ result = operation;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets operations.
+ *
+ * @return operations.
+ */
+ @Override
+ public List<ClientOperation> getOperations() {
+ return operations;
+ }
+
+
+ @Override
+ public ClientProperty getProperty(final String name) {
+ ClientProperty result = null;
+
+ if (StringUtils.isNotBlank(name)) {
+ for (ClientProperty property : getProperties()) {
+ if (name.equals(property.getName())) {
+ result = property;
+ break;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean addLink(final ClientLink link) {
+ boolean result = false;
+
+ switch (link.getType()) {
+ case ASSOCIATION:
+ result = associationLinks.contains(link) ? false : associationLinks.add(link);
+ break;
+
+ case ENTITY_NAVIGATION:
+ case ENTITY_SET_NAVIGATION:
+ result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
+ break;
+
+ case MEDIA_EDIT:
+ result = mediaEditLinks.contains(link) ? false : mediaEditLinks.add(link);
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean removeLink(final ClientLink link) {
+ return associationLinks.remove(link) || navigationLinks.remove(link);
+ }
+
+ private ClientLink getLink(final List<ClientLink> links, final String name) {
+ ClientLink result = null;
+ for (ClientLink link : links) {
+ if (name.equals(link.getName())) {
+ result = link;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public ClientLink getNavigationLink(final String name) {
+ return getLink(navigationLinks, name);
+ }
+
+ @Override
+ public List<ClientLink> getNavigationLinks() {
+ return navigationLinks;
+ }
+
+ @Override
+ public ClientLink getAssociationLink(final String name) {
+ return getLink(associationLinks, name);
+ }
+
+ @Override
+ public List<ClientLink> getAssociationLinks() {
+ return associationLinks;
+ }
+
+ @Override
+ public ClientLink getMediaEditLink(final String name) {
+ return getLink(mediaEditLinks, name);
+ }
+
+ @Override
+ public List<ClientLink> getMediaEditLinks() {
+ return mediaEditLinks;
+ }
+
+ @Override
+ public URI getEditLink() {
+ return editLink;
+ }
+
+ @Override
+ public void setEditLink(final URI editLink) {
+ this.editLink = editLink;
+ }
+
+ @Override
+ public URI getLink() {
+ return super.getLink() == null ? getEditLink() : super.getLink();
+ }
+
+ @Override
+ public boolean isReadOnly() {
+ return super.getLink() != null;
+ }
+
+ @Override
+ public boolean isMediaEntity() {
+ return mediaEntity;
+ }
+
+ @Override
+ public void setMediaEntity(final boolean isMediaEntity) {
+ mediaEntity = isMediaEntity;
+ }
+
+ @Override
+ public String getMediaContentType() {
+ return mediaContentType;
+ }
+
+ @Override
+ public void setMediaContentType(final String mediaContentType) {
+ this.mediaContentType = mediaContentType;
+ }
+
+ @Override
+ public URI getMediaContentSource() {
+ return mediaContentSource;
+ }
+
+ @Override
+ public void setMediaContentSource(final URI mediaContentSource) {
+ this.mediaContentSource = mediaContentSource;
+ }
+
+ @Override
+ public String getMediaETag() {
+ return mediaETag;
+ }
+
+ @Override
+ public void setMediaETag(final String eTag) {
+ mediaETag = eTag;
+ }
+
+ @Override
+ public URI getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(final URI id) {
+ this.id = id;
+ }
+
+ @Override
+ public List<ClientProperty> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public List<ClientAnnotation> getAnnotations() {
+ return annotations;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntitySetImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntitySetImpl.java
new file mode 100644
index 0000000..7d7e646
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntitySetImpl.java
@@ -0,0 +1,65 @@
+/*
+ * 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.client.core.domain;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.client.api.domain.ClientAnnotation;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+
+public class ClientEntitySetImpl extends AbstractClientEntitySet implements ClientEntitySet {
+
+ private URI deltaLink;
+
+ private final List<ClientEntity> entities = new ArrayList<ClientEntity>();
+
+ private final List<ClientAnnotation> annotations = new ArrayList<ClientAnnotation>();
+
+ public ClientEntitySetImpl() {
+ super();
+ }
+
+ public ClientEntitySetImpl(final URI next) {
+ super(next);
+ }
+
+ @Override
+ public List<ClientEntity> getEntities() {
+ return entities;
+ }
+
+ @Override
+ public URI getDeltaLink() {
+ return deltaLink;
+ }
+
+ @Override
+ public void setDeltaLink(final URI deltaLink) {
+ this.deltaLink = deltaLink;
+ }
+
+ @Override
+ public List<ClientAnnotation> getAnnotations() {
+ return annotations;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEnumValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEnumValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEnumValueImpl.java
new file mode 100644
index 0000000..84559c7
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEnumValueImpl.java
@@ -0,0 +1,59 @@
+/*
+ * 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.client.core.domain;
+
+import org.apache.olingo.client.api.domain.AbstractClientValue;
+import org.apache.olingo.client.api.domain.ClientEnumValue;
+
+public class ClientEnumValueImpl extends AbstractClientValue implements ClientEnumValue {
+
+ private final String value;
+
+ public ClientEnumValueImpl(final String typeName, final String value) {
+ super(typeName);
+ this.value = value;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public boolean isEnum() {
+ return true;
+ }
+
+ @Override
+ public ClientEnumValue asEnum() {
+ return this;
+ }
+
+ @Override
+ public boolean isComplex() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return getTypeName() + "'" + getValue() + "'";
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientObjectFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientObjectFactoryImpl.java
new file mode 100644
index 0000000..7bca6c3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientObjectFactoryImpl.java
@@ -0,0 +1,155 @@
+/*
+ * 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.client.core.domain;
+
+import java.net.URI;
+
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientDelta;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientEnumValue;
+import org.apache.olingo.client.api.domain.ClientInlineEntity;
+import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.client.api.domain.ClientLinkType;
+import org.apache.olingo.client.api.domain.ClientObjectFactory;
+import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientSingleton;
+import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+
+public class ClientObjectFactoryImpl implements ClientObjectFactory {
+
+ @Override
+ public ClientInlineEntitySet newDeepInsertEntitySet(final String name, final ClientEntitySet entitySet) {
+ return new ClientInlineEntitySet(null, ClientLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ClientInlineEntity newDeepInsertEntity(final String name, final ClientEntity entity) {
+ return new ClientInlineEntity(null, ClientLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ClientEntitySet newEntitySet() {
+ return new ClientEntitySetImpl();
+ }
+
+ @Override
+ public ClientEntitySet newEntitySet(final URI next) {
+ return new ClientEntitySetImpl(next);
+ }
+
+ @Override
+ public ClientEntity newEntity(final FullQualifiedName typeName) {
+ return new ClientEntityImpl(typeName);
+ }
+
+ @Override
+ public ClientEntity newEntity(final FullQualifiedName typeName, final URI link) {
+ final ClientEntityImpl result = new ClientEntityImpl(typeName);
+ result.setLink(link);
+ return result;
+ }
+
+ @Override
+ public ClientSingleton newSingleton(final FullQualifiedName typeName) {
+ return new ClientEntityImpl(typeName);
+ }
+
+ @Override
+ public ClientLink newEntityNavigationLink(final String name, final URI link) {
+ return new ClientLink.Builder().setURI(link).
+ setType(ClientLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ClientLink newEntitySetNavigationLink(final String name, final URI link) {
+ return new ClientLink.Builder().setURI(link).
+ setType(ClientLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ClientLink newAssociationLink(final String name, final URI link) {
+ return new ClientLink.Builder().setURI(link).
+ setType(ClientLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ClientLink newMediaEditLink(final String name, final URI link) {
+ return new ClientLink.Builder().setURI(link).
+ setType(ClientLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ClientPrimitiveValue.Builder newPrimitiveValueBuilder() {
+ return new ClientPrimitiveValueImpl.BuilderImpl();
+ }
+
+ @Override
+ public ClientEnumValue newEnumValue(final String typeName, final String value) {
+ return new ClientEnumValueImpl(typeName, value);
+ }
+
+ @Override
+ public ClientComplexValue newComplexValue(final String typeName) {
+ return new ClientComplexValueImpl(typeName);
+ }
+
+ @Override
+ public ClientCollectionValue<ClientValue> newCollectionValue(final String typeName) {
+ return new ClientCollectionValueImpl<ClientValue>(typeName);
+ }
+
+ @Override
+ public ClientProperty newPrimitiveProperty(final String name, final ClientPrimitiveValue value) {
+ return new ClientPropertyImpl(name, value);
+ }
+
+ @Override
+ public ClientProperty newComplexProperty(final String name, final ClientComplexValue value) {
+
+ return new ClientPropertyImpl(name, value);
+ }
+
+ @Override
+ public ClientProperty newCollectionProperty(final String name,
+ final ClientCollectionValue<? extends ClientValue> value) {
+
+ return new ClientPropertyImpl(name, value);
+ }
+
+ @Override
+ public ClientProperty newEnumProperty(final String name, final ClientEnumValue value) {
+ return new ClientPropertyImpl(name, value);
+ }
+
+ @Override
+ public ClientDelta newDelta() {
+ return new ClientDeltaImpl();
+ }
+
+ @Override
+ public ClientDelta newDelta(final URI next) {
+ return new ClientDeltaImpl(next);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPrimitiveValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPrimitiveValueImpl.java
new file mode 100644
index 0000000..f8f85d5
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPrimitiveValueImpl.java
@@ -0,0 +1,222 @@
+/*
+ * 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.client.core.domain;
+
+import java.util.UUID;
+
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.client.api.domain.AbstractClientValue;
+import org.apache.olingo.client.api.domain.ClientEnumValue;
+import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
+import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public class ClientPrimitiveValueImpl extends AbstractClientValue implements ClientValue, ClientPrimitiveValue {
+
+ public static class BuilderImpl implements Builder {
+
+ private final ClientPrimitiveValueImpl instance;
+
+ public BuilderImpl() {
+ instance = new ClientPrimitiveValueImpl();
+ }
+
+ @Override
+ public BuilderImpl setType(final EdmType type) {
+ EdmPrimitiveTypeKind primitiveTypeKind = null;
+ if (type != null) {
+ if (type.getKind() != EdmTypeKind.PRIMITIVE) {
+ throw new IllegalArgumentException(String.format("Provided type %s is not primitive", type));
+ }
+ primitiveTypeKind = EdmPrimitiveTypeKind.valueOf(type.getName());
+ }
+ return setType(primitiveTypeKind);
+ }
+
+ @Override
+ public BuilderImpl setType(final EdmPrimitiveTypeKind type) {
+ if (type == EdmPrimitiveTypeKind.Stream) {
+ throw new IllegalArgumentException(String.format(
+ "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
+ }
+ if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.Geometry) {
+ throw new IllegalArgumentException(
+ type + "is not an instantiable type. "
+ + "An entity can declare a property to be of type Geometry. "
+ + "An instance of an entity MUST NOT have a value of type Geometry. "
+ + "Each value MUST be of some subtype.");
+ }
+
+ instance.typeKind = type == null ? EdmPrimitiveTypeKind.String : type;
+ instance.type = EdmPrimitiveTypeFactory.getInstance(instance.typeKind);
+
+ return this;
+ }
+
+ @Override
+ public BuilderImpl setValue(final Object value) {
+ instance.value = value;
+ return this;
+ }
+
+ @Override
+ public ClientPrimitiveValue build() {
+ if (instance.type == null) {
+ setType(EdmPrimitiveTypeKind.String);
+ }
+ return instance;
+ }
+
+ @Override
+ public ClientPrimitiveValue buildBoolean(final Boolean value) {
+ return setType(EdmPrimitiveTypeKind.Boolean).setValue(value).build();
+ }
+
+ @Override
+ public ClientPrimitiveValue buildInt16(final Short value) {
+ return setType(EdmPrimitiveTypeKind.Int16).setValue(value).build();
+ }
+
+ @Override
+ public ClientPrimitiveValue buildInt32(final Integer value) {
+ return setType(EdmPrimitiveTypeKind.Int32).setValue(value).build();
+ }
+
+ @Override
+ public ClientPrimitiveValue buildInt64(final Long value) {
+ return setType(EdmPrimitiveTypeKind.Int64).setValue(value).build();
+ }
+
+ @Override
+ public ClientPrimitiveValue buildSingle(final Float value) {
+ return setType(EdmPrimitiveTypeKind.Single).setValue(value).build();
+ }
+
+ @Override
+ public ClientPrimitiveValue buildDouble(final Double value) {
+ return setType(EdmPrimitiveTypeKind.Double).setValue(value).build();
+ }
+
+ @Override
+ public ClientPrimitiveValue buildString(final String value) {
+ return setType(EdmPrimitiveTypeKind.String).setValue(value).build();
+ }
+
+ @Override
+ public ClientPrimitiveValue buildGuid(final UUID value) {
+ return setType(EdmPrimitiveTypeKind.Guid).setValue(value).build();
+ }
+
+ @Override
+ public ClientPrimitiveValue buildBinary(final byte[] value) {
+ return setType(EdmPrimitiveTypeKind.Binary).setValue(value).build();
+ }
+
+ }
+
+ /**
+ * Type kind.
+ */
+ private EdmPrimitiveTypeKind typeKind;
+
+ /**
+ * Type.
+ */
+ private EdmPrimitiveType type;
+
+ /**
+ * Actual value.
+ */
+ private Object value;
+
+ protected ClientPrimitiveValueImpl() {
+ super(null);
+ }
+
+ @Override
+ public String getTypeName() {
+ return typeKind.getFullQualifiedName().toString();
+ }
+
+ @Override
+ public EdmPrimitiveTypeKind getTypeKind() {
+ return typeKind;
+ }
+
+ @Override
+ public EdmPrimitiveType getType() {
+ return type;
+ }
+
+ @Override
+ public Object toValue() {
+ return value;
+ }
+
+ @Override
+ public <T> T toCastValue(final Class<T> reference) throws EdmPrimitiveTypeException {
+ if (value == null) {
+ return null;
+ } else if (typeKind.isGeospatial()) {
+ return reference.cast(value);
+ } else {
+ // TODO: set facets
+ return type.valueOfString(type.valueToString(value,
+ null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, reference);
+ }
+ }
+
+ @Override
+ public String toString() {
+ if (value == null) {
+ return "";
+ } else if (typeKind.isGeospatial()) {
+ return value.toString();
+ } else {
+ try {
+ // TODO: set facets
+ return type.valueToString(value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ }
+
+ @Override
+ public boolean isEnum() {
+ return false;
+ }
+
+ @Override
+ public ClientEnumValue asEnum() {
+ return null;
+ }
+
+ @Override
+ public boolean isComplex() {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPropertyImpl.java
new file mode 100644
index 0000000..ac1ad1d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPropertyImpl.java
@@ -0,0 +1,163 @@
+/*
+ * 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.client.core.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.olingo.client.api.domain.ClientAnnotatable;
+import org.apache.olingo.client.api.domain.ClientAnnotation;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEnumValue;
+import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientValuable;
+import org.apache.olingo.client.api.domain.ClientValue;
+
+public class ClientPropertyImpl implements ClientProperty, ClientAnnotatable, ClientValuable {
+
+
+ private final List<ClientAnnotation> annotations = new ArrayList<ClientAnnotation>();
+ private final String name;
+ private final ClientValue value;
+ private final ClientValuable valuable;
+
+ public ClientPropertyImpl(final String name, final ClientValue value) {
+ this.name = name;
+ this.value = value;
+ this.valuable = new ClientValuableImpl(value);
+ }
+
+ /**
+ * Returns property name.
+ *
+ * @return property name.
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns property value.
+ *
+ * @return property value.
+ */
+ @Override
+ public ClientValue getValue() {
+ return value;
+ }
+
+ /**
+ * Checks if has null value.
+ *
+ * @return 'TRUE' if has null value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasNullValue() {
+ return value == null || value.isPrimitive() && value.asPrimitive().toValue() == null;
+ }
+
+ /**
+ * Checks if has primitive value.
+ *
+ * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasPrimitiveValue() {
+ return !hasNullValue() && value.isPrimitive();
+ }
+
+ /**
+ * Gets primitive value.
+ *
+ * @return primitive value if exists; null otherwise.
+ */
+ @Override
+ public ClientPrimitiveValue getPrimitiveValue() {
+ return hasPrimitiveValue() ? value.asPrimitive() : null;
+ }
+
+ /**
+ * Checks if has complex value.
+ *
+ * @return 'TRUE' if has complex value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasComplexValue() {
+ return !hasNullValue() && value.isComplex();
+ }
+
+ /**
+ * Checks if has collection value.
+ *
+ * @return 'TRUE' if has collection value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasCollectionValue() {
+ return !hasNullValue() && value.isCollection();
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ @Override
+ public boolean hasEnumValue() {
+ return valuable.hasEnumValue();
+ }
+
+ @Override
+ public ClientEnumValue getEnumValue() {
+ return valuable.getEnumValue();
+ }
+
+ @Override
+ public ClientComplexValue getComplexValue() {
+ return valuable.getComplexValue();
+ }
+
+ @Override
+ public ClientCollectionValue<ClientValue> getCollectionValue() {
+ return valuable.getCollectionValue();
+ }
+
+ @Override
+ public List<ClientAnnotation> getAnnotations() {
+ return annotations;
+ }
+
+ @Override
+ public String toString() {
+ return "ODataPropertyImpl{"
+ + "name=" + getName()
+ + ",valuable=" + valuable
+ + ", annotations=" + annotations
+ + '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientValuableImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientValuableImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientValuableImpl.java
new file mode 100644
index 0000000..ecae20d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientValuableImpl.java
@@ -0,0 +1,111 @@
+/*
+ * 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.client.core.domain;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEnumValue;
+import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
+import org.apache.olingo.client.api.domain.ClientValuable;
+import org.apache.olingo.client.api.domain.ClientValue;
+
+public class ClientValuableImpl implements ClientValuable {
+
+ private final ClientValue value;
+
+ public ClientValuableImpl(final ClientValue value) {
+ this.value = value;
+ }
+
+ @Override
+ public ClientValue getValue() {
+ return value;
+ }
+
+ @Override
+ public boolean hasNullValue() {
+ return value == null;
+ }
+
+ @Override
+ public boolean hasPrimitiveValue() {
+ return !hasNullValue() && value.isPrimitive();
+ }
+
+ @Override
+ public ClientPrimitiveValue getPrimitiveValue() {
+ return hasPrimitiveValue() ? value.asPrimitive() : null;
+ }
+
+ @Override
+ public boolean hasCollectionValue() {
+ return !hasNullValue() && value.isCollection();
+ }
+
+ @Override
+ public ClientCollectionValue<ClientValue> getCollectionValue() {
+ return hasCollectionValue()
+ ? getValue().<ClientValue> asCollection()
+ : null;
+ }
+
+ @Override
+ public boolean hasComplexValue() {
+ return !hasNullValue() && value.isComplex();
+ }
+
+ @Override
+ public ClientComplexValue getComplexValue() {
+ return hasComplexValue()
+ ? getValue().asComplex()
+ : null;
+ }
+
+ @Override
+ public boolean hasEnumValue() {
+ return !hasNullValue() && getValue().isEnum();
+ }
+
+ @Override
+ public ClientEnumValue getEnumValue() {
+ return hasEnumValue()
+ ? getValue().asEnum()
+ : null;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java
index 916c360..a668aaf 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java
@@ -35,7 +35,7 @@ import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.domain.ClientError;
+import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.serialization.ODataDeserializer;
@@ -86,7 +86,7 @@ public class ClientODataDeserializerImpl implements ClientODataDeserializer {
}
@Override
- public ClientError toError(final InputStream input) throws ODataDeserializerException {
+ public ODataError toError(final InputStream input) throws ODataDeserializerException {
return deserializer.toError(input);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
index f38d795..48de8f8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
@@ -44,29 +44,30 @@ import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Linked;
+import org.apache.olingo.commons.api.data.Operation;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.data.Valuable;
import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.domain.ClientAnnotatable;
-import org.apache.olingo.commons.api.domain.ClientAnnotation;
-import org.apache.olingo.commons.api.domain.ClientCollectionValue;
-import org.apache.olingo.commons.api.domain.ClientComplexValue;
-import org.apache.olingo.commons.api.domain.ClientDeletedEntity.Reason;
-import org.apache.olingo.commons.api.domain.ClientDelta;
-import org.apache.olingo.commons.api.domain.ClientDeltaLink;
-import org.apache.olingo.commons.api.domain.ClientEntity;
-import org.apache.olingo.commons.api.domain.ClientEntitySet;
-import org.apache.olingo.commons.api.domain.ClientInlineEntity;
-import org.apache.olingo.commons.api.domain.ClientInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ClientLink;
-import org.apache.olingo.commons.api.domain.ClientLinkType;
-import org.apache.olingo.commons.api.domain.ClientLinked;
-import org.apache.olingo.commons.api.domain.ClientOperation;
-import org.apache.olingo.commons.api.domain.ClientProperty;
-import org.apache.olingo.commons.api.domain.ClientServiceDocument;
-import org.apache.olingo.commons.api.domain.ClientValuable;
-import org.apache.olingo.commons.api.domain.ClientValue;
+import org.apache.olingo.client.api.domain.ClientAnnotatable;
+import org.apache.olingo.client.api.domain.ClientAnnotation;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientDeletedEntity.Reason;
+import org.apache.olingo.client.api.domain.ClientDelta;
+import org.apache.olingo.client.api.domain.ClientDeltaLink;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientInlineEntity;
+import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.client.api.domain.ClientLinkType;
+import org.apache.olingo.client.api.domain.ClientLinked;
+import org.apache.olingo.client.api.domain.ClientOperation;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientServiceDocument;
+import org.apache.olingo.client.api.domain.ClientValuable;
+import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
import org.apache.olingo.commons.api.edm.EdmComplexType;
@@ -87,10 +88,10 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
-import org.apache.olingo.commons.core.domain.ClientAnnotationImpl;
-import org.apache.olingo.commons.core.domain.ClientDeletedEntityImpl;
-import org.apache.olingo.commons.core.domain.ClientDeltaLinkImpl;
-import org.apache.olingo.commons.core.domain.ClientPropertyImpl;
+import org.apache.olingo.client.core.domain.ClientAnnotationImpl;
+import org.apache.olingo.client.core.domain.ClientDeletedEntityImpl;
+import org.apache.olingo.client.core.domain.ClientDeltaLinkImpl;
+import org.apache.olingo.client.core.domain.ClientPropertyImpl;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.core.serialization.ContextURLParser;
@@ -635,8 +636,11 @@ public class ODataBinderImpl implements ODataBinder {
newMediaEditLink(link.getTitle(), URIUtils.getURI(base, link.getHref())));
}
- for (ClientOperation operation : resource.getPayload().getOperations()) {
- operation.setTarget(URIUtils.getURI(base, operation.getTarget()));
+ for (Operation op : resource.getPayload().getOperations()) {
+ ClientOperation operation = new ClientOperation();
+ operation.setTarget(URIUtils.getURI(base, op.getTarget()));
+ operation.setTitle(op.getTitle());
+ operation.setMetadataAnchor(op.getMetadataAnchor());
entity.getOperations().add(operation);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
index 80972be..8f3c8be 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
@@ -33,12 +33,12 @@ import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.domain.ClientEntity;
-import org.apache.olingo.commons.api.domain.ClientEntitySet;
-import org.apache.olingo.commons.api.domain.ClientError;
-import org.apache.olingo.commons.api.domain.ClientProperty;
-import org.apache.olingo.commons.api.domain.ClientServiceDocument;
-import org.apache.olingo.commons.api.domain.ClientValue;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.commons.api.domain.ODataError;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientServiceDocument;
+import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
@@ -80,7 +80,7 @@ public class ODataReaderImpl implements ODataReader {
}
@Override
- public ClientError readError(final InputStream inputStream, final ODataFormat format)
+ public ODataError readError(final InputStream inputStream, final ODataFormat format)
throws ODataDeserializerException {
return client.getDeserializer(format).toError(inputStream);
}
@@ -137,7 +137,7 @@ public class ODataReaderImpl implements ODataReader {
resource.getContextURL(),
resource.getMetadataETag(),
reference.cast(client.getBinder().getODataServiceDocument(resource.getPayload())));
- } else if (ClientError.class.isAssignableFrom(reference)) {
+ } else if (ODataError.class.isAssignableFrom(reference)) {
res = new ResWrap<T>(
(URI) null,
null,
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java
index 8191886..c891f1e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java
@@ -32,9 +32,9 @@ import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.serialization.ODataWriter;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.domain.ClientEntity;
-import org.apache.olingo.commons.api.domain.ClientLink;
-import org.apache.olingo.commons.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
index e1ac9c1..60c8074 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -50,7 +50,7 @@ import org.apache.olingo.client.api.http.WrappingHttpClientFactory;
import org.apache.olingo.client.api.uri.SegmentType;
import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.domain.ClientValue;
+import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.core.edm.primitivetype.EdmBinary;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
index 873b946..5395472 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
@@ -22,8 +22,8 @@ import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.domain.ClientEntity;
-import org.apache.olingo.commons.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index de35c02..7373da6 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -33,15 +33,15 @@ import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.client.core.EdmEnabledODataClientImpl;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.domain.ClientAnnotation;
-import org.apache.olingo.commons.api.domain.ClientComplexValue;
-import org.apache.olingo.commons.api.domain.ClientEntity;
-import org.apache.olingo.commons.api.domain.ClientInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ClientLink;
-import org.apache.olingo.commons.api.domain.ClientLinkType;
-import org.apache.olingo.commons.api.domain.ClientProperty;
-import org.apache.olingo.commons.api.domain.ClientValuable;
-import org.apache.olingo.commons.api.domain.ClientValue;
+import org.apache.olingo.client.api.domain.ClientAnnotation;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.client.api.domain.ClientLinkType;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientValuable;
+import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataFormat;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
index 21b1f82..c0067bc 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.core.v4;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.domain.ClientError;
+import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
import org.junit.Test;
@@ -35,15 +35,15 @@ public class ErrorTest extends AbstractTest {
return v4Client;
}
- private ClientError error(final String name, final ODataFormat format) throws ODataDeserializerException {
- final ClientError error = getClient().getDeserializer(format).toError(
+ private ODataError error(final String name, final ODataFormat format) throws ODataDeserializerException {
+ final ODataError error = getClient().getDeserializer(format).toError(
getClass().getResourceAsStream(name + "." + getSuffix(format)));
assertNotNull(error);
return error;
}
private void simple(final ODataFormat format) throws ODataDeserializerException {
- final ClientError error = error("error", format);
+ final ODataError error = error("error", format);
assertEquals("501", error.getCode());
assertEquals("Unsupported functionality", error.getMessage());
assertEquals("query", error.getTarget());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
index 49c7c38..83c495c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
@@ -35,10 +35,10 @@ import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Delta;
import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.domain.ClientCollectionValue;
-import org.apache.olingo.commons.api.domain.ClientComplexValue;
-import org.apache.olingo.commons.api.domain.ClientEntity;
-import org.apache.olingo.commons.api.domain.ClientValue;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
index 8d359a7..e4778cb 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
@@ -174,7 +174,7 @@ public class MetadataTest extends AbstractTest {
final EdmAnnotation annotation = annotationGroup.getAnnotations().get(0);
assertNotNull(annotation);
assertTrue(annotation.getExpression().isConstant());
- assertEquals("Edm.String", annotation.getExpression().asConstant().getValue().getTypeName());
+ assertEquals("Edm.String", annotation.getExpression().asConstant().getValue().getType());
assertEquals(10, schema.getAnnotationGroups().get(3).getAnnotations().size());
}
@@ -273,7 +273,7 @@ public class MetadataTest extends AbstractTest {
assertNotNull(weight);
assertEquals(EdmInt32.getInstance(), weight.getUnderlyingType());
assertFalse(weight.getAnnotations().isEmpty());
- assertEquals("Kilograms", weight.getAnnotations().get(0).getExpression().asConstant().getValue().toString());
+ assertEquals("Kilograms", weight.getAnnotations().get(0).getExpression().asConstant().getValue().getValue());
}
/**
@@ -332,10 +332,10 @@ public class MetadataTest extends AbstractTest {
assertNotNull(group);
final EdmAnnotation time1 = group.getAnnotations().get(0);
- assertEquals("Edm.TimeOfDay", time1.getExpression().asConstant().getValue().getTypeName());
+ assertEquals("Edm.TimeOfDay", time1.getExpression().asConstant().getValue().getType());
final EdmAnnotation time2 = group.getAnnotations().get(1);
- assertEquals("Edm.TimeOfDay", time2.getExpression().asConstant().getValue().getTypeName());
+ assertEquals("Edm.TimeOfDay", time2.getExpression().asConstant().getValue().getType());
}
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
index 760e8ca..d22bb6f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.core.v4;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.domain.ClientValue;
+import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
index e8daeb8..46e0d22 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
@@ -20,10 +20,10 @@ package org.apache.olingo.client.core.v4;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.domain.ClientCollectionValue;
-import org.apache.olingo.commons.api.domain.ClientComplexValue;
-import org.apache.olingo.commons.api.domain.ClientProperty;
-import org.apache.olingo.commons.api.domain.ClientValue;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
index e025076..1a2de09 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
@@ -22,7 +22,7 @@ import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.domain.ClientServiceDocument;
+import org.apache.olingo.client.api.domain.ClientServiceDocument;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index cec55b3..ba9fd7a 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -18,6 +18,8 @@
*/
package org.apache.olingo.commons.api;
+import org.apache.olingo.commons.api.format.ContentType;
+
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
@@ -302,4 +304,10 @@ public interface Constants {
public static final String CANONICAL_FUNCTION_URIENCODE = "odata.uriEncode";
+ String MEDIA_EDIT_LINK_TYPE = "*/*";
+ String ENTITY_NAVIGATION_LINK_TYPE = ContentType.APPLICATION_ATOM_XML_ENTRY.toContentTypeString();
+ String ENTITY_SET_NAVIGATION_LINK_TYPE = ContentType.APPLICATION_ATOM_XML_FEED.toContentTypeString();
+ String ASSOCIATION_LINK_TYPE = ContentType.APPLICATION_XML.toContentTypeString();
+ String ENTITY_COLLECTION_BINDING_LINK_TYPE = ContentType.APPLICATION_XML.toContentTypeString();
+ String ENTITY_BINDING_LINK_TYPE = ContentType.APPLICATION_XML.toContentTypeString();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/17152920/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java
index a9db524..b6939c0 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java
@@ -18,8 +18,6 @@
*/
package org.apache.olingo.commons.api.data;
-import org.apache.olingo.commons.api.domain.ClientOperation;
-
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
@@ -33,7 +31,7 @@ public class Entity extends Linked {
private Link editLink;
private final List<Link> mediaEditLinks = new ArrayList<Link>();
- private final List<ClientOperation> operations = new ArrayList<ClientOperation>();
+ private final List<Operation> operations = new ArrayList<Operation>();
private final List<Property> properties = new ArrayList<Property>();
@@ -122,7 +120,7 @@ public class Entity extends Linked {
*
* @return operations.
*/
- public List<ClientOperation> getOperations() {
+ public List<Operation> getOperations() {
return operations;
}