[OLINGO-366] provide some improvements around streams, singletons and delete requests

This commit is contained in:
fmartelli 2014-07-23 12:55:53 +02:00
parent 1c5b33ea5d
commit 2822fe60e8
86 changed files with 827 additions and 663 deletions

View File

@ -1,24 +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.ext.proxy.api;
public interface EdmStreamType {
EdmStreamValue load();
}

View File

@ -19,28 +19,14 @@
package org.apache.olingo.ext.proxy.api;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
public class EdmStreamValue {
public interface EdmStreamValue {
private final String contentType;
EdmStreamValue load();
private final InputStream stream;
String getContentType();
public EdmStreamValue(final String contentType, final InputStream stream) {
this.contentType = contentType;
this.stream = stream;
}
InputStream getStream();
public String getContentType() {
return contentType;
}
public InputStream getStream() {
return stream;
}
public void close() {
IOUtils.closeQuietly(this.stream);
}
void close();
}

View File

@ -22,4 +22,14 @@ package org.apache.olingo.ext.proxy.api;
* Marker interface for Entity and complex type.
*/
public interface StructuredType extends java.io.Serializable {
/**
* Delete object.
*/
void delete();
/**
* Delete a specific property.
*/
void delete(String name);
}

View File

@ -28,7 +28,7 @@ import java.lang.annotation.Target;
* <tt>getSimpleName()</tt>.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Target(ElementType.METHOD)
public @interface Singleton {
String name();

View File

@ -18,6 +18,7 @@
*/
package org.apache.olingo.ext.proxy.commons;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -43,9 +44,12 @@ import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmOperation;
import org.apache.olingo.commons.api.edm.EdmReturnType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.ext.proxy.AbstractService;
@ -53,16 +57,26 @@ import org.apache.olingo.ext.proxy.api.ComplexCollection;
import org.apache.olingo.ext.proxy.api.ComplexType;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.ext.proxy.api.annotations.Singleton;
import org.apache.olingo.ext.proxy.context.AttachedEntityStatus;
import org.apache.olingo.ext.proxy.context.Context;
import org.apache.olingo.ext.proxy.utils.ClassUtils;
import org.apache.olingo.ext.proxy.utils.CoreUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
abstract class AbstractInvocationHandler implements InvocationHandler {
private static final long serialVersionUID = 358520026931462958L;
/**
* Logger.
*/
protected static final Logger LOG = LoggerFactory.getLogger(AbstractInvocationHandler.class);
protected AbstractService<?> service;
protected AbstractInvocationHandler(final AbstractService<?> service) {
@ -116,7 +130,7 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {typeCollectionRef},
new EntityCollectionInvocationHandler(service, items, typeCollectionRef, targetEntitySetURI,
uri == null ? null : getClient().newURIBuilder(uri.toASCIIString())));
uri == null ? null : getClient().newURIBuilder(uri.toASCIIString())));
}
protected Object getEntitySetProxy(
@ -270,10 +284,10 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
res = Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {ref}, new ComplexCollectionInvocationHandler(
service,
items,
itemRef,
null));
service,
items,
itemRef,
null));
} else {
final List items = new ArrayList();
@ -284,10 +298,10 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
res = Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {PrimitiveCollection.class}, new PrimitiveCollectionInvocationHandler(
service,
items,
null,
null));
service,
items,
null,
null));
}
} else {
if (edmType.isComplexType()) {
@ -342,6 +356,53 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
return res;
}
protected boolean isDeleted(final EntityInvocationHandler handler) {
return getContext().entityContext().getStatus(handler) == AttachedEntityStatus.DELETED;
}
protected static CommonURIBuilder<?> buildEntitySetURI(
final Class<?> ref,
final AbstractService<?> service) {
final String containerNS;
final String entitySetName;
Annotation ann = ref.getAnnotation(EntitySet.class);
if (ann instanceof EntitySet) {
containerNS = EntitySet.class.cast(ann).container();
entitySetName = EntitySet.class.cast(ann).name();
} else {
ann = ref.getAnnotation(Singleton.class);
if (ann instanceof Singleton) {
containerNS = Singleton.class.cast(ann).container();
entitySetName = Singleton.class.cast(ann).name();
} else {
containerNS = null;
entitySetName = null;
}
}
return buildEntitySetURI(containerNS, entitySetName, service);
}
protected static CommonURIBuilder<?> buildEntitySetURI(
final String containerNS, final String entitySetName, final AbstractService<?> service) {
final CommonURIBuilder<?> uriBuilder = service.getClient().newURIBuilder();
final Edm edm = service.getClient().getCachedEdm();
final StringBuilder entitySetSegment = new StringBuilder();
if (StringUtils.isNotBlank(containerNS)) {
final EdmEntityContainer container = edm.getEntityContainer(new FullQualifiedName(containerNS));
if (!container.isDefault()) {
entitySetSegment.append(container.getFullQualifiedName().toString()).append('.');
}
}
entitySetSegment.append(entitySetName);
uriBuilder.appendEntitySetSegment(entitySetSegment.toString());
return uriBuilder;
}
@Override
public boolean equals(final Object obj) {
return EqualsBuilder.reflectionEquals(this, obj);

View File

@ -34,6 +34,7 @@ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.ext.proxy.AbstractService;
import org.apache.olingo.ext.proxy.api.PersistenceManager;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
import org.apache.olingo.ext.proxy.context.AttachedEntity;
import org.apache.olingo.ext.proxy.context.AttachedEntityStatus;
import org.apache.olingo.ext.proxy.context.EntityLinkDesc;
@ -50,7 +51,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
abstract class AbstractPersistenceManager implements PersistenceManager {
@ -92,6 +92,12 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
// remove null values
items.normalize();
for (URI uri : service.getContext().entityContext().getFurtherDeletes()) {
pos++;
queueDelete(uri, null, changes);
items.put(null, pos);
}
final List<ODataRuntimeException> result = new ArrayList<ODataRuntimeException>();
if (!items.isEmpty()) {
result.addAll(doFlush(changes, items));
@ -461,17 +467,31 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
final EntityInvocationHandler handler,
final CommonODataEntity entity,
final PersistenceChanges changeset) {
final URI deleteURI = entity.getEditLink() == null ? handler.getEntityURI() : entity.getEditLink();
changeset.addChange(buildDeleteRequest(deleteURI, handler.getETag(), changeset), handler);
}
private void queueDelete(
final URI deleteURI,
final String etag,
final PersistenceChanges changeset) {
changeset.addChange(buildDeleteRequest(deleteURI, etag, changeset), null);
}
private ODataDeleteRequest buildDeleteRequest(
final URI deleteURI,
final String etag,
final PersistenceChanges changeset) {
LOG.debug("Delete '{}'", deleteURI);
final ODataDeleteRequest req = service.getClient().getCUDRequestFactory().getDeleteRequest(deleteURI);
if (StringUtils.isNotBlank(handler.getETag())) {
req.setIfMatch(handler.getETag());
if (StringUtils.isNotBlank(etag)) {
req.setIfMatch(etag);
}
changeset.addChange(req, handler);
return req;
}
private AttachedEntityStatus resolveNavigationLink(

View File

@ -40,15 +40,12 @@ import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.ext.proxy.api.ComplexCollection;
import org.apache.olingo.ext.proxy.api.EdmStreamType;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.context.EntityUUID;
import org.apache.olingo.ext.proxy.utils.CoreUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
@ -66,16 +63,12 @@ import java.util.Set;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.ext.proxy.api.annotations.ComplexType;
import org.apache.olingo.ext.proxy.context.EntityContext;
public abstract class AbstractStructuredInvocationHandler extends AbstractInvocationHandler {
private static final long serialVersionUID = 2629912294765040037L;
/**
* Logger.
*/
protected static final Logger LOG = LoggerFactory.getLogger(AbstractStructuredInvocationHandler.class);
protected CommonURIBuilder<?> uri;
protected URI baseURI;
@ -106,7 +99,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
protected final Map<String, EdmStreamValue> streamedPropertyChanges = new HashMap<String, EdmStreamValue>();
protected final Map<String, EdmStreamType> streamedPropertyCache = new HashMap<String, EdmStreamType>();
protected final Map<String, EdmStreamValue> streamedPropertyCache = new HashMap<String, EdmStreamValue>();
protected AbstractStructuredInvocationHandler(
final Class<?> typeRef,
@ -235,6 +228,29 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
}
}
public void delete(final String name) {
if (baseURI != null) {
getContext().entityContext().addFurtherDeletes(
getClient().newURIBuilder(baseURI.toASCIIString()).appendPropertySegment(name).build());
}
}
public void delete() {
final EntityContext entityContext = getContext().entityContext();
if (this instanceof EntityInvocationHandler) {
final EntityInvocationHandler handler = EntityInvocationHandler.class.cast(this);
if (entityContext.isAttached(handler)) {
entityContext.setStatus(handler, AttachedEntityStatus.DELETED);
} else {
entityContext.attach(handler, AttachedEntityStatus.DELETED);
}
} else if (baseURI != null) {
entityContext.addFurtherDeletes(baseURI);
}
}
protected void attach() {
attach(AttachedEntityStatus.ATTACHED, false);
}
@ -259,19 +275,20 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
Object res;
Class<?> ref = ClassUtils.getTypeClass(type);
if (ref == EdmStreamType.class) {
if (ref == EdmStreamValue.class) {
if (streamedPropertyCache.containsKey(name)) {
res = streamedPropertyCache.get(name);
} else if (streamedPropertyChanges.containsKey(name)) {
res = new EdmStreamTypeImpl(streamedPropertyChanges.get(name));
res = streamedPropertyChanges.get(name);
} else {
res = Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {EdmStreamType.class}, new EdmStreamTypeHandler(
getClient().newURIBuilder(baseURI.toASCIIString()).appendPropertySegment(name),
new Class<?>[] {EdmStreamValue.class}, new EdmStreamValueHandler(
baseURI == null
? null : getClient().newURIBuilder(baseURI.toASCIIString()).appendPropertySegment(name).build(),
service));
streamedPropertyCache.put(name, EdmStreamType.class.cast(res));
streamedPropertyCache.put(name, EdmStreamValue.class.cast(res));
}
return res;
@ -375,7 +392,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
protected void setPropertyValue(final Property property, final Object value) {
if (EdmPrimitiveTypeKind.Stream.getFullQualifiedName().toString().equalsIgnoreCase(property.type())) {
setStreamedProperty(property, (EdmStreamType) value);
setStreamedProperty(property, (EdmStreamValue) value);
} else {
addPropertyChanges(property.name(), value);
@ -402,7 +419,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
attach(AttachedEntityStatus.CHANGED);
}
private void setStreamedProperty(final Property property, final EdmStreamType input) {
private void setStreamedProperty(final Property property, final EdmStreamValue input) {
final Object obj = streamedPropertyChanges.get(property.name());
if (obj instanceof InputStream) {
IOUtils.closeQuietly((InputStream) obj);
@ -605,7 +622,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
}
public void clearQueryOptions() {
this.uri = getClient().newURIBuilder(baseURI.toASCIIString());
this.uri = baseURI == null ? null : getClient().newURIBuilder(baseURI.toASCIIString());
}
protected abstract void load();

View File

@ -1,36 +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.ext.proxy.commons;
import org.apache.olingo.ext.proxy.api.EdmStreamType;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
public class EdmStreamTypeImpl implements EdmStreamType {
private final EdmStreamValue value;
public EdmStreamTypeImpl(final EdmStreamValue value) {
this.value = value;
}
@Override
public EdmStreamValue load() {
return value;
}
}

View File

@ -20,51 +20,75 @@ package org.apache.olingo.ext.proxy.commons;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.URI;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.ext.proxy.AbstractService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
public class EdmStreamTypeHandler extends AbstractInvocationHandler {
public class EdmStreamValueHandler extends AbstractInvocationHandler {
private static final long serialVersionUID = 2629912294765040047L;
/**
* Logger.
*/
private static final Logger LOG = LoggerFactory.getLogger(EdmStreamTypeHandler.class);
private URI uri;
private CommonURIBuilder<?> uri;
private InputStream stream;
private EdmStreamValue value = null;
private String contentType;
protected EdmStreamTypeHandler(
final CommonURIBuilder<?> uri,
protected EdmStreamValueHandler(
final URI uri,
final AbstractService<?> service) {
super(service);
this.uri = uri;
}
protected EdmStreamValueHandler(
final String contentType,
final InputStream stream,
final URI uri,
final AbstractService<?> service) {
super(service);
this.contentType = contentType;
this.stream = stream;
this.uri = uri;
}
@Override
public Object invoke(Object o, Method method, Object[] args) throws Throwable {
if (isSelfMethod(method, args)) {
return invokeSelfMethod(method, args);
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
if ("load".equals(method.getName())) {
load();
return proxy;
} else {
throw new NoSuchMethodException(method.getName());
if (isSelfMethod(method, args)) {
return invokeSelfMethod(method, args);
} else {
throw new NoSuchMethodException(method.getName());
}
}
}
public EdmStreamValue load() {
if (value == null && this.uri != null) {
public void load() {
if (this.uri != null) {
final ODataRetrieveResponse<InputStream> res =
getClient().getRetrieveRequestFactory().getMediaRequest(this.uri.build()).execute();
value = new EdmStreamValue(res.getContentType(), res.getBody());
getClient().getRetrieveRequestFactory().getMediaRequest(this.uri).execute();
contentType = res.getContentType();
stream = res.getBody();
}
}
return value;
public String getContentType() {
return contentType;
}
public InputStream getStream() {
return stream;
}
public void close() {
IOUtils.closeQuietly(stream);
contentType = null;
stream = null;
}
}

View File

@ -18,6 +18,7 @@
*/
package org.apache.olingo.ext.proxy.commons;
import java.io.InputStream;
import java.io.Serializable;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.olingo.ext.proxy.AbstractService;
@ -27,11 +28,17 @@ import org.apache.olingo.ext.proxy.api.annotations.Singleton;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.URI;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.ext.proxy.api.ComplexCollection;
import org.apache.olingo.ext.proxy.api.ComplexType;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
import org.apache.olingo.ext.proxy.api.EntityCollection;
import org.apache.olingo.ext.proxy.api.EntityType;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.context.EntityUUID;
import org.apache.olingo.ext.proxy.utils.ClassUtils;
public final class EntityContainerInvocationHandler extends AbstractInvocationHandler {
@ -96,26 +103,45 @@ public final class EntityContainerInvocationHandler extends AbstractInvocationHa
} else {
final Class<?> returnType = method.getReturnType();
final EntitySet entitySet = returnType.getAnnotation(EntitySet.class);
if (entitySet == null) {
final Singleton singleton = returnType.getAnnotation(Singleton.class);
if (singleton != null) {
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {returnType},
SingletonInvocationHandler.getInstance(returnType, service));
}
} else {
if (returnType.isAnnotationPresent(EntitySet.class)) {
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {returnType},
EntitySetInvocationHandler.getInstance(returnType, service));
} else if (returnType.isAnnotationPresent(org.apache.olingo.ext.proxy.api.annotations.EntityType.class)) {
return getSingleton(method);
}
throw new NoSuchMethodException(method.getName());
}
}
private Object getSingleton(final Method method) throws IllegalArgumentException {
final Class<?> typeRef = method.getReturnType();
final Singleton singleton = method.getAnnotation(Singleton.class);
final URI uri = buildEntitySetURI(singleton.container(), singleton.name(), service).build();
final EntityUUID uuid = new EntityUUID(uri, typeRef);
LOG.debug("Ask for singleton '{}'", typeRef.getSimpleName());
EntityInvocationHandler handler = getContext().entityContext().getEntity(uuid);
if (handler == null) {
final CommonODataEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName(
typeRef.getAnnotation(Namespace.class).value(), ClassUtils.getEntityTypeName(typeRef)));
handler = EntityInvocationHandler.getInstance(entity, uri, uri, typeRef, service);
} else if (isDeleted(handler)) {
// object deleted
LOG.debug("Singleton '{}' has been deleted", typeRef.getSimpleName());
handler = null;
}
return handler == null
? null
: Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[] {typeRef}, handler);
}
@SuppressWarnings("unchecked")
public <NE extends EntityType> NE newEntityInstance(final Class<NE> ref) {
final EntityInvocationHandler handler = EntityInvocationHandler.getInstance(ref, getService());
@ -160,4 +186,14 @@ public final class EntityContainerInvocationHandler extends AbstractInvocationHa
new Class<?>[] {PrimitiveCollection.class},
new PrimitiveCollectionInvocationHandler<T>(getService(), ref));
}
@SuppressWarnings("unchecked")
public EdmStreamValue newEdmStreamValue(
final String contentType, final InputStream stream) {
return EdmStreamValue.class.cast(Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {EdmStreamValue.class},
new EdmStreamValueHandler(contentType, stream, null, getService())));
}
}

View File

@ -308,7 +308,10 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
}
final ODataRetrieveResponse<InputStream> res = retrieveReq.execute();
this.stream = new EdmStreamValue(res.getContentType(), res.getBody());
this.stream = EdmStreamValue.class.cast(Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {EdmStreamValue.class},
new EdmStreamValueHandler(res.getContentType(), res.getBody(), contentSource, service)));
}
return this.stream;

View File

@ -33,28 +33,20 @@ import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
import org.apache.olingo.ext.proxy.api.AbstractSingleton;
import org.apache.olingo.ext.proxy.api.Search;
import org.apache.olingo.ext.proxy.api.SingleQuery;
import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
import org.apache.olingo.ext.proxy.context.AttachedEntityStatus;
import org.apache.olingo.ext.proxy.context.EntityContext;
import org.apache.olingo.ext.proxy.context.EntityUUID;
import org.apache.olingo.ext.proxy.utils.ClassUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.ext.proxy.AbstractService;
import org.apache.olingo.ext.proxy.api.EntityType;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.Singleton;
class EntitySetInvocationHandler<
T extends EntityType, KEY extends Serializable, EC extends EntityCollection<T>>
@ -63,14 +55,9 @@ class EntitySetInvocationHandler<
private static final long serialVersionUID = 2629912294765040027L;
/**
* Logger.
*/
private static final Logger LOG = LoggerFactory.getLogger(EntitySetInvocationHandler.class);
@SuppressWarnings({"rawtypes", "unchecked"})
static EntitySetInvocationHandler getInstance(final Class<?> ref, final AbstractService<?> service) {
return new EntitySetInvocationHandler(ref, service, buildURI(ref, service));
return new EntitySetInvocationHandler(ref, service, buildEntitySetURI(ref, service));
}
@SuppressWarnings({"rawtypes", "unchecked"})
@ -78,42 +65,6 @@ class EntitySetInvocationHandler<
return new EntitySetInvocationHandler(ref, service, service.getClient().newURIBuilder(uri.toASCIIString()));
}
private static CommonURIBuilder<?> buildURI(
final Class<?> ref,
final AbstractService<?> service) {
final CommonURIBuilder<?> uriBuilder = service.getClient().newURIBuilder();
final Edm edm = service.getClient().getCachedEdm();
final String containerNS;
final String entitySetName;
Annotation ann = ref.getAnnotation(EntitySet.class);
if (ann instanceof EntitySet) {
containerNS = EntitySet.class.cast(ann).container();
entitySetName = EntitySet.class.cast(ann).name();
} else {
ann = ref.getAnnotation(Singleton.class);
if (ann instanceof Singleton) {
containerNS = Singleton.class.cast(ann).container();
entitySetName = Singleton.class.cast(ann).name();
} else {
containerNS = null;
entitySetName = null;
}
}
final StringBuilder entitySetSegment = new StringBuilder();
if (StringUtils.isNotBlank(containerNS)) {
final EdmEntityContainer container = edm.getEntityContainer(new FullQualifiedName(containerNS));
if (!container.isDefault()) {
entitySetSegment.append(container.getFullQualifiedName().toString()).append('.');
}
}
entitySetSegment.append(entitySetName);
uriBuilder.appendEntitySetSegment(entitySetSegment.toString());
return uriBuilder;
}
@SuppressWarnings("unchecked")
protected EntitySetInvocationHandler(
final Class<?> ref,
@ -311,10 +262,6 @@ class EntitySetInvocationHandler<
}
}
private boolean isDeleted(final EntityInvocationHandler handler) {
return getContext().entityContext().getStatus(handler) == AttachedEntityStatus.DELETED;
}
@Override
public EntitySetIterator<T, KEY, EC> iterator() {
return new EntitySetIterator<T, KEY, EC>(getClient().newURIBuilder(this.uri.build().toASCIIString()).build(), this);

View File

@ -74,11 +74,13 @@ public class NonTransactionalPersistenceManagerImpl extends AbstractPersistenceM
response = ((ODataBasicRequest<?>) req).execute();
}
if (response instanceof ODataEntityCreateResponse && response.getStatusCode() == 201) {
if (entry.getValue() != null
&& response instanceof ODataEntityCreateResponse && response.getStatusCode() == 201) {
entry.getValue().setEntity(((ODataEntityCreateResponse<?>) response).getBody());
responses.put(virtualContentID, entry.getValue().getEntityURI());
LOG.debug("Upgrade created object '{}'", entry.getValue());
} else if (response instanceof ODataEntityUpdateResponse && response.getStatusCode() == 200) {
} else if (entry.getValue() != null
&& response instanceof ODataEntityUpdateResponse && response.getStatusCode() == 200) {
entry.getValue().setEntity(((ODataEntityUpdateResponse<?>) response).getBody());
responses.put(virtualContentID, entry.getValue().getEntityURI());
LOG.debug("Upgrade updated object '{}'", entry.getValue());

View File

@ -1,62 +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.ext.proxy.commons;
import java.io.Serializable;
import java.lang.reflect.Method;
import org.apache.olingo.ext.proxy.AbstractService;
import org.apache.olingo.ext.proxy.api.EntityCollection;
import org.apache.olingo.ext.proxy.api.AbstractSingleton;
import org.apache.olingo.ext.proxy.api.EntityType;
public class SingletonInvocationHandler<
T extends EntityType, KEY extends Serializable, EC extends EntityCollection<T>>
extends AbstractInvocationHandler
implements AbstractSingleton<T, KEY, EC> {
private static final long serialVersionUID = 2450269053734776228L;
private final EntitySetInvocationHandler<?, ?, ?> entitySetHandler;
@SuppressWarnings({"rawtypes", "unchecked"})
static SingletonInvocationHandler getInstance(final Class<?> ref, final AbstractService<?> service) {
return new SingletonInvocationHandler(ref, service);
}
@SuppressWarnings({"rawtypes", "unchecked"})
private SingletonInvocationHandler(final Class<?> ref, final AbstractService<?> service) {
super(service);
this.entitySetHandler = EntitySetInvocationHandler.getInstance(ref, service);
}
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
if (isSelfMethod(method, args)) {
return invokeSelfMethod(method, args);
} else {
throw new NoSuchMethodException(method.getName());
}
}
@SuppressWarnings("unchecked")
public T load() {
return (T) this.entitySetHandler.execute().iterator().next();
}
}

View File

@ -18,6 +18,7 @@
*/
package org.apache.olingo.ext.proxy.context;
import java.net.URI;
import org.apache.olingo.ext.proxy.commons.EntityInvocationHandler;
import java.util.ArrayList;
@ -48,6 +49,13 @@ public class EntityContext implements Iterable<AttachedEntity> {
private final Map<EntityInvocationHandler, AttachedEntityStatus> allAttachedEntities =
new LinkedHashMap<EntityInvocationHandler, AttachedEntityStatus>();
/**
* Deletes to be performed excluding entities.
* <br/>
* Attachment order will be maintained.
*/
private final List<URI> furtherDeletes = new ArrayList<URI>();
/**
* Attaches an entity with status <tt>NEW</tt>.
* <br/>
@ -116,6 +124,7 @@ public class EntityContext implements Iterable<AttachedEntity> {
public void detachAll() {
allAttachedEntities.clear();
searchableEntities.clear();
furtherDeletes.clear();
}
/**
@ -197,4 +206,12 @@ public class EntityContext implements Iterable<AttachedEntity> {
}
return res.iterator();
}
public List<URI> getFurtherDeletes() {
return furtherDeletes;
}
public void addFurtherDeletes(final URI uri) {
furtherDeletes.add(uri);
}
}

View File

@ -52,9 +52,7 @@ import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.EdmSingleton;
import org.apache.olingo.commons.api.edm.EdmTerm;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
@ -347,15 +345,6 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
objs.put("container", container);
parseObj(base, pkg, "entitySet", utility.capitalize(entitySet.getName()) + ".java", objs);
}
if (ODataServiceVersion.valueOf(getVersion().toUpperCase()).compareTo(ODataServiceVersion.V40) >= 0) {
for (EdmSingleton singleton : container.getSingletons()) {
objs.clear();
objs.put("singleton", singleton);
objs.put("container", container);
parseObj(base, pkg, "singleton", utility.capitalize(singleton.getName()) + ".java", objs);
}
}
}
}

View File

@ -31,6 +31,7 @@ import org.apache.olingo.ext.proxy.api.ComplexType;
import org.apache.olingo.ext.proxy.api.EntityCollection;
import org.apache.olingo.ext.proxy.api.EntityType;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
#foreach($ns in $namespaces)
import #if($basePackage)${basePackage}.#end${ns}.types.*;
#end
@ -45,8 +46,9 @@ import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.io.InputStream;
import java.util.UUID;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@ -119,4 +121,6 @@ public interface $utility.capitalize($container.Name) extends PersistenceManager
<T extends ComplexType, NEC extends ComplexCollection<T>> NEC newComplexCollection(Class<NEC> ref);
<T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
}

View File

@ -79,7 +79,7 @@ public interface $utility.capitalize($entityType.Name)
#if($keys.contains($property.Name))@Key#end
#if($property.Type.FullQualifiedName.toString().equals("Edm.Stream"))#*
*##set( $returnType = "org.apache.olingo.ext.proxy.api.EdmStreamType" )#*
*##set( $returnType = "org.apache.olingo.ext.proxy.api.EdmStreamValue" )#*
*##else#*
*##set( $returnType = $utility.getJavaType($property.Type, $property.Collection) )#*
*##end

View File

@ -1,48 +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 ${package};
//CHECKSTYLE:OFF (Maven checkstyle)
import org.apache.olingo.ext.proxy.api.AbstractSingleton;
import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
import org.apache.olingo.ext.proxy.api.annotations.Singleton;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKey;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
#foreach($ns in $namespaces)
import #if($basePackage)${basePackage}.#end${ns}.types.*;
#end
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
//CHECKSTYLE:ON (Maven checkstyle)
#parse( "${odataVersion}/singleton.vm" )

View File

@ -28,12 +28,22 @@ public interface $utility.capitalize($complexType.Name)
#set( $complexProps = [] )
#foreach($propertyName in $complexType.PropertyNames)
#set($property = $complexType.getProperty($propertyName))
#set($property = $complexType.getProperty($propertyName))#*
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "$property.Name", type = "$property.Type.FullQualifiedName.toString()", nullable = $property.Nullable)
$utility.getJavaType($property.Type, $property.Collection) get$utility.capitalize($property.Name)();
*##if($property.Type.FullQualifiedName.toString().equals("Edm.Stream"))#*
*##set( $returnType = "org.apache.olingo.ext.proxy.api.EdmStreamValue" )#*
*##else#*
*##set( $returnType = $utility.getJavaType($property.Type, $property.Collection) )#*
*##end
void set$utility.capitalize($property.Name)($utility.getJavaType($property.Type, $property.Collection) _$utility.uncapitalize($property.Name));
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "$property.Name",
type = "$property.Type.FullQualifiedName.toString()",
nullable = $property.Nullable)
$returnType get$utility.capitalize($property.Name)();
void set$utility.capitalize($property.Name)($returnType _$utility.uncapitalize($property.Name));
#if($utility.isComplex($property.Type.FullQualifiedName))#*
*##set( $adding = $complexProps.add($property) )

View File

@ -32,7 +32,13 @@ public interface $utility.capitalize($complexType.Name)
#set( $complexProps = [] )
#set( $contained = [] )
#foreach($propertyName in $complexType.PropertyNames)
#set($property = $complexType.getProperty($propertyName))
#set($property = $complexType.getProperty($propertyName))#*
*##if($property.Type.FullQualifiedName.toString().equals("Edm.Stream"))#*
*##set( $returnType = "org.apache.olingo.ext.proxy.api.EdmStreamValue" )#*
*##else#*
*##set( $returnType = $utility.getJavaType($property.Type, $property.Collection) )#*
*##end
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "$property.Name",
type = "$property.Type.getFullQualifiedName().toString()",
@ -45,9 +51,9 @@ public interface $utility.capitalize($complexType.Name)
unicode = #if($property.isUnicode())$property.isUnicode()#{else}false#end,
collation = "#if($property.getCollation())$property.getCollation()#end",
srid = "#if($property.getSRID())$property.getSRID()#end")
$utility.getJavaType($property.Type, $property.Collection) get$utility.capitalize($property.Name)();
$returnType get$utility.capitalize($property.Name)();
void set$utility.capitalize($property.Name)($utility.getJavaType($property.Type, $property.Collection) _$utility.uncapitalize($property.Name));
void set$utility.capitalize($property.Name)($returnType _$utility.uncapitalize($property.Name));
#if($utility.isComplex($property.Type.FullQualifiedName))#*
*##set( $adding = $complexProps.add($property) )

View File

@ -17,6 +17,9 @@
* under the License.
*#
#foreach($singleton in $container.Singletons)
$utility.capitalize($singleton.Name) get$utility.capitalize($singleton.Name)();
@org.apache.olingo.ext.proxy.api.annotations.Singleton(
name = "$singleton.Name",
container = "${container.Namespace}.${container.Name}")
$utility.getJavaType($singleton.EntityType) get$utility.capitalize($singleton.Name)();
#end

View File

@ -1,30 +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.
*#
#set( $keys = $utility.getEntityKeyType($singleton) )
#if( $keys.size() > 1 )
#set( $type = $utility.getEdmType($singleton).EntityType.Name + "Key" )
#elseif( $keys.size() == 1 )
#set( $type = $keys.values().iterator().next() )
#else
#set( $type = "" )
#end
@org.apache.olingo.ext.proxy.api.annotations.Singleton(name = "$singleton.Name", container = "$container.FullQualifiedName.toString()")
public interface $utility.capitalize($singleton.Name) extends org.apache.olingo.ext.proxy.api.SingleQuery<$utility.getJavaType($singleton.EntityType)>,AbstractSingleton<$utility.getJavaType($singleton.EntityType), $type, $utility.getJavaType($singleton.EntityType)Collection> {
}

View File

@ -373,7 +373,7 @@ public class V4Services extends AbstractServices {
return StringUtils.isBlank(filter) && StringUtils.isBlank(search)
? NumberUtils.isNumber(type)
? super.getEntityInternal(
uriInfo.getRequestUri().toASCIIString(), accept, "People", type, format, null, null)
uriInfo.getRequestUri().toASCIIString(), accept, "People", type, format, null, null)
: super.getEntitySet(accept, "People", type)
: super.getEntitySet(uriInfo, accept, "People", top, skip, format, count, filter, orderby, skiptoken);
}
@ -754,7 +754,7 @@ public class V4Services extends AbstractServices {
return utils.getValue().createResponse(
FSManager.instance(version).readFile(Constants.get(version, ConstantKey.REF)
+ File.separatorChar + filename, utils.getKey()),
+ File.separatorChar + filename, utils.getKey()),
null,
utils.getKey());
} catch (Exception e) {
@ -794,7 +794,7 @@ public class V4Services extends AbstractServices {
final Response response =
getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
accept, entitySetName, entityId, accept, StringUtils.EMPTY, StringUtils.EMPTY);
accept, entitySetName, entityId, accept, StringUtils.EMPTY, StringUtils.EMPTY);
return response.getStatus() >= 400
? super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, changes)
: super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes);
@ -1020,7 +1020,7 @@ public class V4Services extends AbstractServices {
// 1. Fetch the contained entity to be removed
final InputStream entry = FSManager.instance(version).
readFile(containedPath(entityId, containedEntitySetName).
append('(').append(containedEntityId).append(')').toString(), Accept.ATOM);
append('(').append(containedEntityId).append(')').toString(), Accept.ATOM);
final ResWrap<Entity> container = atomDeserializer.toEntity(entry);
// 2. Remove the contained entity
@ -1294,7 +1294,7 @@ public class V4Services extends AbstractServices {
final ResWrap<Property> result = new ResWrap<Property>(
URI.create(Constants.get(version, ConstantKey.ODATA_METADATA_PREFIX)
+ "Microsoft.Test.OData.Services.ODataWCFService.Address"),
+ "Microsoft.Test.OData.Services.ODataWCFService.Address"),
null,
entity.getProperty("address"));
@ -1362,4 +1362,17 @@ public class V4Services extends AbstractServices {
return xml.createResponse(null, null, null, Status.NO_CONTENT);
}
@GET
@Path("/Company/VipCustomer")
public Response getVipCustomer(
@Context final UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
@QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
@QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
return super.getEntityInternal(
uriInfo.getRequestUri().toASCIIString(), accept, "VipCustomer", "1", format, expand, select);
}
}

View File

@ -0,0 +1,7 @@
{
"@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#VipCustomers/$entity",
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Customer",
"@odata.id": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/VipCustomers(PersonID=1)",
"@odata.editLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/VipCustomers(PersonID=1)",
"PersonID": 1
}

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<entry xml:base="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/"
xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data"
xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
xmlns:georss="http://www.georss.org/georss"
xmlns:gml="http://www.opengis.net/gml"
m:context="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#VipCustomers/$entity">
<id>http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/VipCustomers(PersonID=1)</id>
<category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
<link rel="edit" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/VipCustomers(PersonID=1)" />
<link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Customers(PersonID=1)/Parent" />
<link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Customers(PersonID=1)/Orders" />
<link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Customers(PersonID=1)/Company" />
<title />
<updated>2014-03-24T17:03:20Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:PersonID m:type="Int32">1</d:PersonID>
</m:properties>
</content>
</entry>

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v3;
import static org.junit.Assert.assertEquals;

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v3;
//CHECKSTYLE:OFF (Maven checkstyle)

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v3;
//CHECKSTYLE:OFF (Maven checkstyle)

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v3;
//CHECKSTYLE:OFF (Maven checkstyle)

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v3;
//CHECKSTYLE:OFF (Maven checkstyle)

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v3;
import org.apache.commons.io.IOUtils;
@ -25,8 +26,8 @@ import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.olingo.ext.proxy.commons.EdmStreamTypeImpl;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
import static org.apache.olingo.fit.proxy.v3.AbstractTestITCase.container;
import static org.apache.olingo.fit.proxy.v3.AbstractTestITCase.service;
import static org.junit.Assert.assertEquals;
@ -52,7 +53,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
final InputStream input = new ByteArrayInputStream(TO_BE_UPDATED.getBytes());
Car car = container.getCar().getByKey(12);
car.setPhoto(new EdmStreamTypeImpl(new EdmStreamValue("application/octet-stream", input)));
car.setPhoto(container.newEdmStreamValue("application/octet-stream", input));
container.flush();
@ -70,7 +71,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
final String TO_BE_UPDATED = "buffered stream sample (" + System.currentTimeMillis() + ")";
InputStream input = IOUtils.toInputStream(TO_BE_UPDATED);
car.uploadStream(new EdmStreamValue("*/*", input));
car.uploadStream(container.newEdmStreamValue("*/*", input));
container.flush();
@ -89,7 +90,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
InputStream input = IOUtils.toInputStream(TO_BE_UPDATED);
final String DESC = "DESC - " + System.currentTimeMillis();
car.uploadStream(new EdmStreamValue("*/*", input));
car.uploadStream(container.newEdmStreamValue("*/*", input));
car.setDescription(DESC);
container.getCar().add(car);

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v3;
import static org.junit.Assert.assertEquals;

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.ComplexType;
import org.apache.olingo.ext.proxy.api.EntityCollection;
import org.apache.olingo.ext.proxy.api.EntityType;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
import java.io.Serializable;
import java.io.InputStream;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.AstoriaDefaultService")
@ -113,4 +115,6 @@ public interface DefaultContainer extends PersistenceManager {
<T extends ComplexType, NEC extends ComplexCollection<T>> NEC newComplexCollection(Class<NEC> ref);
<T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
}

View File

@ -28,7 +28,11 @@ public interface Aliases
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "AlternativeNames", type = "Edm.String", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "AlternativeNames",
type = "Edm.String",
nullable = false)
org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getAlternativeNames();
void setAlternativeNames(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _alternativeNames);

View File

@ -28,21 +28,33 @@ public interface AuditInfo
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "ModifiedDate", type = "Edm.DateTime", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "ModifiedDate",
type = "Edm.DateTime",
nullable = false)
java.sql.Timestamp getModifiedDate();
void setModifiedDate(java.sql.Timestamp _modifiedDate);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "ModifiedBy", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "ModifiedBy",
type = "Edm.String",
nullable = true)
java.lang.String getModifiedBy();
void setModifiedBy(java.lang.String _modifiedBy);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Concurrency", type = "Microsoft.Test.OData.Services.AstoriaDefaultService.ConcurrencyInfo", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Concurrency",
type = "Microsoft.Test.OData.Services.AstoriaDefaultService.ConcurrencyInfo",
nullable = true)
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ConcurrencyInfo getConcurrency();
void setConcurrency(org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ConcurrencyInfo _concurrency);

View File

@ -59,9 +59,9 @@ public interface BackOrderLine
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getOrderLineStream();
org.apache.olingo.ext.proxy.api.EdmStreamValue getOrderLineStream();
void setOrderLineStream(org.apache.olingo.ext.proxy.api.EdmStreamType _orderLineStream);
void setOrderLineStream(org.apache.olingo.ext.proxy.api.EdmStreamValue _orderLineStream);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderId",

View File

@ -59,9 +59,9 @@ public interface BackOrderLine2
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getOrderLineStream();
org.apache.olingo.ext.proxy.api.EdmStreamValue getOrderLineStream();
void setOrderLineStream(org.apache.olingo.ext.proxy.api.EdmStreamType _orderLineStream);
void setOrderLineStream(org.apache.olingo.ext.proxy.api.EdmStreamValue _orderLineStream);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderId",

View File

@ -55,9 +55,9 @@ public interface Car
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getPhoto();
org.apache.olingo.ext.proxy.api.EdmStreamValue getPhoto();
void setPhoto(org.apache.olingo.ext.proxy.api.EdmStreamType _photo);
void setPhoto(org.apache.olingo.ext.proxy.api.EdmStreamValue _photo);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Video",
@ -78,9 +78,9 @@ public interface Car
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getVideo();
org.apache.olingo.ext.proxy.api.EdmStreamValue getVideo();
void setVideo(org.apache.olingo.ext.proxy.api.EdmStreamType _video);
void setVideo(org.apache.olingo.ext.proxy.api.EdmStreamValue _video);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "VIN",

View File

@ -28,21 +28,33 @@ public interface ComplexToCategory
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Term", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Term",
type = "Edm.String",
nullable = true)
java.lang.String getTerm();
void setTerm(java.lang.String _term);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Scheme", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Scheme",
type = "Edm.String",
nullable = true)
java.lang.String getScheme();
void setScheme(java.lang.String _scheme);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Label", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Label",
type = "Edm.String",
nullable = true)
java.lang.String getLabel();
void setLabel(java.lang.String _label);

View File

@ -28,14 +28,22 @@ public interface ConcurrencyInfo
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Token", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Token",
type = "Edm.String",
nullable = true)
java.lang.String getToken();
void setToken(java.lang.String _token);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "QueriedDateTime", type = "Edm.DateTime", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "QueriedDateTime",
type = "Edm.DateTime",
nullable = true)
java.sql.Timestamp getQueriedDateTime();
void setQueriedDateTime(java.sql.Timestamp _queriedDateTime);

View File

@ -28,42 +28,66 @@ public interface ContactDetails
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "EmailBag", type = "Edm.String", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "EmailBag",
type = "Edm.String",
nullable = false)
org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmailBag();
void setEmailBag(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emailBag);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "AlternativeNames", type = "Edm.String", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "AlternativeNames",
type = "Edm.String",
nullable = false)
org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getAlternativeNames();
void setAlternativeNames(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _alternativeNames);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "ContactAlias", type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "ContactAlias",
type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases",
nullable = true)
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Aliases getContactAlias();
void setContactAlias(org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Aliases _contactAlias);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomePhone", type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "HomePhone",
type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone",
nullable = true)
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Phone getHomePhone();
void setHomePhone(org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Phone _homePhone);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "WorkPhone", type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "WorkPhone",
type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone",
nullable = true)
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Phone getWorkPhone();
void setWorkPhone(org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Phone _workPhone);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "MobilePhoneBag", type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "MobilePhoneBag",
type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone",
nullable = false)
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.PhoneCollection getMobilePhoneBag();
void setMobilePhoneBag(org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.PhoneCollection _mobilePhoneBag);

View File

@ -55,9 +55,9 @@ public interface Customer
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getThumbnail();
org.apache.olingo.ext.proxy.api.EdmStreamValue getThumbnail();
void setThumbnail(org.apache.olingo.ext.proxy.api.EdmStreamType _thumbnail);
void setThumbnail(org.apache.olingo.ext.proxy.api.EdmStreamValue _thumbnail);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Video",
@ -78,9 +78,9 @@ public interface Customer
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getVideo();
org.apache.olingo.ext.proxy.api.EdmStreamValue getVideo();
void setVideo(org.apache.olingo.ext.proxy.api.EdmStreamType _video);
void setVideo(org.apache.olingo.ext.proxy.api.EdmStreamValue _video);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "CustomerId",

View File

@ -28,21 +28,33 @@ public interface Dimensions
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Width", type = "Edm.Decimal", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Width",
type = "Edm.Decimal",
nullable = false)
java.math.BigDecimal getWidth();
void setWidth(java.math.BigDecimal _width);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Height", type = "Edm.Decimal", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Height",
type = "Edm.Decimal",
nullable = false)
java.math.BigDecimal getHeight();
void setHeight(java.math.BigDecimal _height);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Depth", type = "Edm.Decimal", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Depth",
type = "Edm.Decimal",
nullable = false)
java.math.BigDecimal getDepth();
void setDepth(java.math.BigDecimal _depth);

View File

@ -58,9 +58,9 @@ public interface DiscontinuedProduct
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getPicture();
org.apache.olingo.ext.proxy.api.EdmStreamValue getPicture();
void setPicture(org.apache.olingo.ext.proxy.api.EdmStreamType _picture);
void setPicture(org.apache.olingo.ext.proxy.api.EdmStreamValue _picture);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductId",

View File

@ -57,9 +57,9 @@ public interface OrderLine
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getOrderLineStream();
org.apache.olingo.ext.proxy.api.EdmStreamValue getOrderLineStream();
void setOrderLineStream(org.apache.olingo.ext.proxy.api.EdmStreamType _orderLineStream);
void setOrderLineStream(org.apache.olingo.ext.proxy.api.EdmStreamValue _orderLineStream);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderId",

View File

@ -28,14 +28,22 @@ public interface Phone
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "PhoneNumber", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "PhoneNumber",
type = "Edm.String",
nullable = true)
java.lang.String getPhoneNumber();
void setPhoneNumber(java.lang.String _phoneNumber);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Extension", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Extension",
type = "Edm.String",
nullable = true)
java.lang.String getExtension();
void setExtension(java.lang.String _extension);

View File

@ -56,9 +56,9 @@ public interface Product
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getPicture();
org.apache.olingo.ext.proxy.api.EdmStreamValue getPicture();
void setPicture(org.apache.olingo.ext.proxy.api.EdmStreamType _picture);
void setPicture(org.apache.olingo.ext.proxy.api.EdmStreamValue _picture);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductId",

View File

@ -25,7 +25,9 @@ import org.apache.olingo.ext.proxy.api.ComplexType;
import org.apache.olingo.ext.proxy.api.EntityCollection;
import org.apache.olingo.ext.proxy.api.EntityType;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
import java.io.Serializable;
import java.io.InputStream;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV3")
@ -57,4 +59,6 @@ public interface DefaultContainer extends PersistenceManager {
<T extends ComplexType, NEC extends ComplexCollection<T>> NEC newComplexCollection(Class<NEC> ref);
<T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
}

View File

@ -28,84 +28,132 @@ public interface ContactDetails
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstContacted", type = "Edm.Binary", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "FirstContacted",
type = "Edm.Binary",
nullable = true)
byte[] getFirstContacted();
void setFirstContacted(byte[] _firstContacted);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastContacted", type = "Edm.DateTimeOffset", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "LastContacted",
type = "Edm.DateTimeOffset",
nullable = false)
java.sql.Timestamp getLastContacted();
void setLastContacted(java.sql.Timestamp _lastContacted);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Contacted", type = "Edm.DateTime", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Contacted",
type = "Edm.DateTime",
nullable = false)
java.sql.Timestamp getContacted();
void setContacted(java.sql.Timestamp _contacted);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "GUID", type = "Edm.Guid", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "GUID",
type = "Edm.Guid",
nullable = false)
java.util.UUID getGUID();
void setGUID(java.util.UUID _gUID);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "PreferedContactTime", type = "Edm.Time", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "PreferedContactTime",
type = "Edm.Time",
nullable = false)
java.math.BigDecimal getPreferedContactTime();
void setPreferedContactTime(java.math.BigDecimal _preferedContactTime);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Byte", type = "Edm.Byte", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Byte",
type = "Edm.Byte",
nullable = false)
java.lang.Short getByte();
void setByte(java.lang.Short _byte);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "SignedByte", type = "Edm.SByte", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "SignedByte",
type = "Edm.SByte",
nullable = false)
java.lang.Byte getSignedByte();
void setSignedByte(java.lang.Byte _signedByte);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Double", type = "Edm.Double", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Double",
type = "Edm.Double",
nullable = false)
java.lang.Double getDouble();
void setDouble(java.lang.Double _double);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Single", type = "Edm.Single", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Single",
type = "Edm.Single",
nullable = false)
java.lang.Float getSingle();
void setSingle(java.lang.Float _single);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Short", type = "Edm.Int16", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Short",
type = "Edm.Int16",
nullable = false)
java.lang.Short getShort();
void setShort(java.lang.Short _short);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Int", type = "Edm.Int32", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Int",
type = "Edm.Int32",
nullable = false)
java.lang.Integer getInt();
void setInt(java.lang.Integer _int);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Long", type = "Edm.Int64", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Long",
type = "Edm.Int64",
nullable = false)
java.lang.Long getLong();
void setLong(java.lang.Long _long);

View File

@ -25,7 +25,9 @@ import org.apache.olingo.ext.proxy.api.ComplexType;
import org.apache.olingo.ext.proxy.api.EntityCollection;
import org.apache.olingo.ext.proxy.api.EntityType;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
import java.io.Serializable;
import java.io.InputStream;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.PrimitiveKeysService")
@ -83,4 +85,6 @@ public interface TestContext extends PersistenceManager {
<T extends ComplexType, NEC extends ComplexCollection<T>> NEC newComplexCollection(Class<NEC> ref);
<T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
}

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.ComplexType;
import org.apache.olingo.ext.proxy.api.EntityCollection;
import org.apache.olingo.ext.proxy.api.EntityType;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
import java.io.Serializable;
import java.io.InputStream;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.AstoriaDefaultService")
@ -151,4 +153,6 @@ public interface DefaultContainer extends PersistenceManager {
<T extends ComplexType, NEC extends ComplexCollection<T>> NEC newComplexCollection(Class<NEC> ref);
<T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
}

View File

@ -28,7 +28,11 @@ public interface Aliases
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "AlternativeNames", type = "Edm.String", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "AlternativeNames",
type = "Edm.String",
nullable = false)
org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getAlternativeNames();
void setAlternativeNames(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _alternativeNames);

View File

@ -28,21 +28,33 @@ public interface AuditInfo
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "ModifiedDate", type = "Edm.DateTime", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "ModifiedDate",
type = "Edm.DateTime",
nullable = false)
java.sql.Timestamp getModifiedDate();
void setModifiedDate(java.sql.Timestamp _modifiedDate);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "ModifiedBy", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "ModifiedBy",
type = "Edm.String",
nullable = true)
java.lang.String getModifiedBy();
void setModifiedBy(java.lang.String _modifiedBy);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Concurrency", type = "Microsoft.Test.OData.Services.AstoriaDefaultService.ConcurrencyInfo", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Concurrency",
type = "Microsoft.Test.OData.Services.AstoriaDefaultService.ConcurrencyInfo",
nullable = true)
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ConcurrencyInfo getConcurrency();
void setConcurrency(org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ConcurrencyInfo _concurrency);

View File

@ -59,9 +59,9 @@ public interface BackOrderLine
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getOrderLineStream();
org.apache.olingo.ext.proxy.api.EdmStreamValue getOrderLineStream();
void setOrderLineStream(org.apache.olingo.ext.proxy.api.EdmStreamType _orderLineStream);
void setOrderLineStream(org.apache.olingo.ext.proxy.api.EdmStreamValue _orderLineStream);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderId",

View File

@ -59,9 +59,9 @@ public interface BackOrderLine2
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getOrderLineStream();
org.apache.olingo.ext.proxy.api.EdmStreamValue getOrderLineStream();
void setOrderLineStream(org.apache.olingo.ext.proxy.api.EdmStreamType _orderLineStream);
void setOrderLineStream(org.apache.olingo.ext.proxy.api.EdmStreamValue _orderLineStream);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderId",

View File

@ -55,9 +55,9 @@ public interface Car
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getPhoto();
org.apache.olingo.ext.proxy.api.EdmStreamValue getPhoto();
void setPhoto(org.apache.olingo.ext.proxy.api.EdmStreamType _photo);
void setPhoto(org.apache.olingo.ext.proxy.api.EdmStreamValue _photo);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Video",
@ -78,9 +78,9 @@ public interface Car
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getVideo();
org.apache.olingo.ext.proxy.api.EdmStreamValue getVideo();
void setVideo(org.apache.olingo.ext.proxy.api.EdmStreamType _video);
void setVideo(org.apache.olingo.ext.proxy.api.EdmStreamValue _video);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "VIN",

View File

@ -28,21 +28,33 @@ public interface ComplexToCategory
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Term", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Term",
type = "Edm.String",
nullable = true)
java.lang.String getTerm();
void setTerm(java.lang.String _term);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Scheme", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Scheme",
type = "Edm.String",
nullable = true)
java.lang.String getScheme();
void setScheme(java.lang.String _scheme);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Label", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Label",
type = "Edm.String",
nullable = true)
java.lang.String getLabel();
void setLabel(java.lang.String _label);

View File

@ -28,98 +28,154 @@ public interface ComplexWithAllPrimitiveTypes
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Binary", type = "Edm.Binary", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Binary",
type = "Edm.Binary",
nullable = true)
byte[] getBinary();
void setBinary(byte[] _binary);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Boolean", type = "Edm.Boolean", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Boolean",
type = "Edm.Boolean",
nullable = false)
java.lang.Boolean getBoolean();
void setBoolean(java.lang.Boolean _boolean);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Byte", type = "Edm.Byte", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Byte",
type = "Edm.Byte",
nullable = false)
java.lang.Short getByte();
void setByte(java.lang.Short _byte);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "DateTime", type = "Edm.DateTime", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "DateTime",
type = "Edm.DateTime",
nullable = false)
java.sql.Timestamp getDateTime();
void setDateTime(java.sql.Timestamp _dateTime);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Decimal", type = "Edm.Decimal", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Decimal",
type = "Edm.Decimal",
nullable = false)
java.math.BigDecimal getDecimal();
void setDecimal(java.math.BigDecimal _decimal);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Double", type = "Edm.Double", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Double",
type = "Edm.Double",
nullable = false)
java.lang.Double getDouble();
void setDouble(java.lang.Double _double);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Int16", type = "Edm.Int16", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Int16",
type = "Edm.Int16",
nullable = false)
java.lang.Short getInt16();
void setInt16(java.lang.Short _int16);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Int32", type = "Edm.Int32", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Int32",
type = "Edm.Int32",
nullable = false)
java.lang.Integer getInt32();
void setInt32(java.lang.Integer _int32);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Int64", type = "Edm.Int64", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Int64",
type = "Edm.Int64",
nullable = false)
java.lang.Long getInt64();
void setInt64(java.lang.Long _int64);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "SByte", type = "Edm.SByte", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "SByte",
type = "Edm.SByte",
nullable = false)
java.lang.Byte getSByte();
void setSByte(java.lang.Byte _sByte);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "String", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "String",
type = "Edm.String",
nullable = true)
java.lang.String getString();
void setString(java.lang.String _string);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Single", type = "Edm.Single", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Single",
type = "Edm.Single",
nullable = false)
java.lang.Float getSingle();
void setSingle(java.lang.Float _single);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "GeographyPoint", type = "Edm.GeographyPoint", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "GeographyPoint",
type = "Edm.GeographyPoint",
nullable = true)
org.apache.olingo.commons.api.edm.geo.Point getGeographyPoint();
void setGeographyPoint(org.apache.olingo.commons.api.edm.geo.Point _geographyPoint);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "GeometryPoint", type = "Edm.GeometryPoint", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "GeometryPoint",
type = "Edm.GeometryPoint",
nullable = true)
org.apache.olingo.commons.api.edm.geo.Point getGeometryPoint();
void setGeometryPoint(org.apache.olingo.commons.api.edm.geo.Point _geometryPoint);

View File

@ -28,14 +28,22 @@ public interface ConcurrencyInfo
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Token", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Token",
type = "Edm.String",
nullable = true)
java.lang.String getToken();
void setToken(java.lang.String _token);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "QueriedDateTime", type = "Edm.DateTime", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "QueriedDateTime",
type = "Edm.DateTime",
nullable = true)
java.sql.Timestamp getQueriedDateTime();
void setQueriedDateTime(java.sql.Timestamp _queriedDateTime);

View File

@ -28,42 +28,66 @@ public interface ContactDetails
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "EmailBag", type = "Edm.String", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "EmailBag",
type = "Edm.String",
nullable = false)
org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmailBag();
void setEmailBag(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emailBag);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "AlternativeNames", type = "Edm.String", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "AlternativeNames",
type = "Edm.String",
nullable = false)
org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getAlternativeNames();
void setAlternativeNames(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _alternativeNames);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "ContactAlias", type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "ContactAlias",
type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases",
nullable = true)
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Aliases getContactAlias();
void setContactAlias(org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Aliases _contactAlias);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomePhone", type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "HomePhone",
type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone",
nullable = true)
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Phone getHomePhone();
void setHomePhone(org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Phone _homePhone);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "WorkPhone", type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "WorkPhone",
type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone",
nullable = true)
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Phone getWorkPhone();
void setWorkPhone(org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Phone _workPhone);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "MobilePhoneBag", type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "MobilePhoneBag",
type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone",
nullable = false)
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.PhoneCollection getMobilePhoneBag();
void setMobilePhoneBag(org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.PhoneCollection _mobilePhoneBag);

View File

@ -55,9 +55,9 @@ public interface Customer
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getThumbnail();
org.apache.olingo.ext.proxy.api.EdmStreamValue getThumbnail();
void setThumbnail(org.apache.olingo.ext.proxy.api.EdmStreamType _thumbnail);
void setThumbnail(org.apache.olingo.ext.proxy.api.EdmStreamValue _thumbnail);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Video",
@ -78,9 +78,9 @@ public interface Customer
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getVideo();
org.apache.olingo.ext.proxy.api.EdmStreamValue getVideo();
void setVideo(org.apache.olingo.ext.proxy.api.EdmStreamType _video);
void setVideo(org.apache.olingo.ext.proxy.api.EdmStreamValue _video);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "CustomerId",

View File

@ -28,21 +28,33 @@ public interface Dimensions
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Width", type = "Edm.Decimal", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Width",
type = "Edm.Decimal",
nullable = false)
java.math.BigDecimal getWidth();
void setWidth(java.math.BigDecimal _width);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Height", type = "Edm.Decimal", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Height",
type = "Edm.Decimal",
nullable = false)
java.math.BigDecimal getHeight();
void setHeight(java.math.BigDecimal _height);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Depth", type = "Edm.Decimal", nullable = false)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Depth",
type = "Edm.Decimal",
nullable = false)
java.math.BigDecimal getDepth();
void setDepth(java.math.BigDecimal _depth);

View File

@ -58,9 +58,9 @@ public interface DiscontinuedProduct
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getPicture();
org.apache.olingo.ext.proxy.api.EdmStreamValue getPicture();
void setPicture(org.apache.olingo.ext.proxy.api.EdmStreamType _picture);
void setPicture(org.apache.olingo.ext.proxy.api.EdmStreamValue _picture);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductId",

View File

@ -56,9 +56,9 @@ public interface OrderLine
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getOrderLineStream();
org.apache.olingo.ext.proxy.api.EdmStreamValue getOrderLineStream();
void setOrderLineStream(org.apache.olingo.ext.proxy.api.EdmStreamType _orderLineStream);
void setOrderLineStream(org.apache.olingo.ext.proxy.api.EdmStreamValue _orderLineStream);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderId",

View File

@ -28,14 +28,22 @@ public interface Phone
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "PhoneNumber", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "PhoneNumber",
type = "Edm.String",
nullable = true)
java.lang.String getPhoneNumber();
void setPhoneNumber(java.lang.String _phoneNumber);
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "Extension", type = "Edm.String", nullable = true)
@org.apache.olingo.ext.proxy.api.annotations.Property(
name = "Extension",
type = "Edm.String",
nullable = true)
java.lang.String getExtension();
void setExtension(java.lang.String _extension);

View File

@ -57,9 +57,9 @@ public interface Product
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getPicture();
org.apache.olingo.ext.proxy.api.EdmStreamValue getPicture();
void setPicture(org.apache.olingo.ext.proxy.api.EdmStreamType _picture);
void setPicture(org.apache.olingo.ext.proxy.api.EdmStreamValue _picture);
@Key
@org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductId",

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4;
import static org.junit.Assert.assertEquals;
@ -38,7 +39,6 @@ import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.ext.proxy.AbstractService;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
import org.apache.olingo.ext.proxy.commons.EdmStreamTypeImpl;
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.DefaultContainer;
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetailsCollection;
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.PhoneCollection;
@ -210,10 +210,20 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
service.getContext().detachAll();
// Delete order ...
// (1) Delete by key (see EntityCreateTestITCase)
getContainer().getOrders().delete(1105);
assertNull(getContainer().getOrders().getByKey(1105));
service.getContext().detachAll(); // detach to show the second delete case
// (2) Delete by object (see EntityCreateTestITCase)
getContainer().getOrders().delete(getContainer().getOrders().getByKey(1105));
actual = getContainer().getOrders().getByKey(1105);
assertNull(actual);
assertNull(getContainer().getOrders().getByKey(1105));
// (3) Delete by invoking delete method on the object itself
service.getContext().detachAll(); // detach to show the third delete case
getContainer().getOrders().getByKey(1105).delete();
assertNull(getContainer().getOrders().getByKey(1105));
getContainer().flush();
@ -255,8 +265,7 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
final PersonDetail personDetail = dcontainer.getPersonDetails().getByKey(1); // NO HTTP Request
// 1 HTTP Request to add an Edm.Stream property value about MediaEditLink Photo
personDetail.setPhoto(
new EdmStreamTypeImpl(new EdmStreamValue("application/octet-stream", IOUtils.toInputStream(random))));
personDetail.setPhoto(dcontainer.newEdmStreamValue("application/octet-stream", IOUtils.toInputStream(random)));
dcontainer.flush();
@ -362,4 +371,9 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
// Not supported by the test service BTW generates a single request as expected:
// <service root>/Orders(1)/CustomerForOrder/Emails
}
@Test
public void workingWithSingletons() {
assertNotNull(container.getCompany().getVipCustomer().load().getPersonID());
}
}

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4;
import static org.junit.Assert.assertEquals;

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4;
import static org.junit.Assert.assertEquals;

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4;
import static org.junit.Assert.assertEquals;

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4;
import static org.junit.Assert.assertNotNull;

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4;
//CHECKSTYLE:OFF (Maven checkstyle)

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4;
//CHECKSTYLE:OFF (Maven checkstyle)

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4;
import static org.junit.Assert.assertEquals;
@ -81,7 +82,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
final UUID uuid = UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7");
final Advertisement adv = getContainer().getAdvertisements().getByKey(uuid);
final String random = RandomStringUtils.random(124, "abcdefghijklmnopqrstuvwxyz");
adv.uploadStream(new EdmStreamValue("application/octet-stream", IOUtils.toInputStream(random)));
adv.uploadStream(getContainer().newEdmStreamValue("application/octet-stream", IOUtils.toInputStream(random)));
getContainer().flush();
assertEquals(random,
IOUtils.toString(getContainer().getAdvertisements().getByKey(uuid).loadStream().getStream()));
@ -93,7 +94,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
final String random = RandomStringUtils.random(124, "abcdefghijklmnopqrstuvwxyz");
final Advertisement adv = getContainer().newEntityInstance(Advertisement.class);
adv.uploadStream(new EdmStreamValue("application/octet-stream", IOUtils.toInputStream(random)));
adv.uploadStream(getContainer().newEdmStreamValue("application/octet-stream", IOUtils.toInputStream(random)));
adv.setAirDate(new Timestamp(Calendar.getInstance().getTimeInMillis()));
getContainer().getAdvertisements().add(adv);

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4;
import static org.junit.Assert.assertEquals;

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.ComplexType;
import org.apache.olingo.ext.proxy.api.EntityCollection;
import org.apache.olingo.ext.proxy.api.EntityType;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
import java.io.Serializable;
import java.io.InputStream;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
@ -73,4 +75,6 @@ public interface DemoService extends PersistenceManager {
<T extends ComplexType, NEC extends ComplexCollection<T>> NEC newComplexCollection(Class<NEC> ref);
<T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
}

View File

@ -170,9 +170,9 @@ public interface PersonDetail
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.ext.proxy.api.EdmStreamType getPhoto();
org.apache.olingo.ext.proxy.api.EdmStreamValue getPhoto();
void setPhoto(org.apache.olingo.ext.proxy.api.EdmStreamType _photo);
void setPhoto(org.apache.olingo.ext.proxy.api.EdmStreamValue _photo);
@org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Person",

View File

@ -25,7 +25,9 @@ import org.apache.olingo.ext.proxy.api.ComplexType;
import org.apache.olingo.ext.proxy.api.EntityCollection;
import org.apache.olingo.ext.proxy.api.EntityType;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
import java.io.Serializable;
import java.io.InputStream;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
@ -56,4 +58,6 @@ public interface DefaultContainer extends PersistenceManager {
<T extends ComplexType, NEC extends ComplexCollection<T>> NEC newComplexCollection(Class<NEC> ref);
<T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
}

View File

@ -1,29 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
//CHECKSTYLE:OFF (Maven checkstyle)
import org.apache.olingo.ext.proxy.api.AbstractSingleton;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Singleton(name = "Boss", container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
public interface Boss extends org.apache.olingo.ext.proxy.api.SingleQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person>,AbstractSingleton<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection> {
}

View File

@ -1,29 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
//CHECKSTYLE:OFF (Maven checkstyle)
import org.apache.olingo.ext.proxy.api.AbstractSingleton;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Singleton(name = "Company", container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
public interface Company extends org.apache.olingo.ext.proxy.api.SingleQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company>,AbstractSingleton<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCollection> {
}

View File

@ -1,29 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
//CHECKSTYLE:OFF (Maven checkstyle)
import org.apache.olingo.ext.proxy.api.AbstractSingleton;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Singleton(name = "DefaultStoredPI", container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
public interface DefaultStoredPI extends org.apache.olingo.ext.proxy.api.SingleQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI>,AbstractSingleton<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPICollection> {
}

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.ComplexType;
import org.apache.olingo.ext.proxy.api.EntityCollection;
import org.apache.olingo.ext.proxy.api.EntityType;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
import java.io.Serializable;
import java.io.InputStream;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
@ -61,17 +63,35 @@ public interface InMemoryEntities extends PersistenceManager {
PublicCompany getPublicCompany();
@org.apache.olingo.ext.proxy.api.annotations.Singleton(
name = "PublicCompany",
container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company getPublicCompany();
DefaultStoredPI getDefaultStoredPI();
@org.apache.olingo.ext.proxy.api.annotations.Singleton(
name = "DefaultStoredPI",
container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI getDefaultStoredPI();
VipCustomer getVipCustomer();
@org.apache.olingo.ext.proxy.api.annotations.Singleton(
name = "VipCustomer",
container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer getVipCustomer();
Company getCompany();
@org.apache.olingo.ext.proxy.api.annotations.Singleton(
name = "Company",
container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company getCompany();
Boss getBoss();
@org.apache.olingo.ext.proxy.api.annotations.Singleton(
name = "Boss",
container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person getBoss();
LabourUnion getLabourUnion();
@org.apache.olingo.ext.proxy.api.annotations.Singleton(
name = "LabourUnion",
container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion getLabourUnion();
Operations operations();
@ -161,4 +181,6 @@ public interface InMemoryEntities extends PersistenceManager {
<T extends ComplexType, NEC extends ComplexCollection<T>> NEC newComplexCollection(Class<NEC> ref);
<T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
}

View File

@ -1,29 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
//CHECKSTYLE:OFF (Maven checkstyle)
import org.apache.olingo.ext.proxy.api.AbstractSingleton;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Singleton(name = "LabourUnion", container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
public interface LabourUnion extends org.apache.olingo.ext.proxy.api.SingleQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion>,AbstractSingleton<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnionCollection> {
}

View File

@ -1,29 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
//CHECKSTYLE:OFF (Maven checkstyle)
import org.apache.olingo.ext.proxy.api.AbstractSingleton;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Singleton(name = "PublicCompany", container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
public interface PublicCompany extends org.apache.olingo.ext.proxy.api.SingleQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company>,AbstractSingleton<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCollection> {
}

View File

@ -1,29 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
//CHECKSTYLE:OFF (Maven checkstyle)
import org.apache.olingo.ext.proxy.api.AbstractSingleton;
//CHECKSTYLE:ON (Maven checkstyle)
@org.apache.olingo.ext.proxy.api.annotations.Singleton(name = "VipCustomer", container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
public interface VipCustomer extends org.apache.olingo.ext.proxy.api.SingleQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer>,AbstractSingleton<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection> {
}