Merge from masterù

This commit is contained in:
Francesco Chicchiriccò 2014-05-22 12:51:01 +02:00
commit 7a09dd248f
366 changed files with 9802 additions and 2301 deletions

View File

@ -0,0 +1,96 @@
<?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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>olingo-client-proxy-android</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>olingo-ext</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.olingo</groupId>
<artifactId>olingo-client-proxy</artifactId>
<version>${project.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>jarjar-maven-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jarjar</goal>
</goals>
<configuration>
<includes>
<include>org.apache.olingo:olingo-client-proxy-android</include>
<include>org.apache.olingo:olingo-client-proxy</include>
<include>org.apache.olingo:olingo-client-core-android</include>
<include>org.apache.olingo:olingo-client-core</include>
<include>org.apache.olingo:olingo-client-api</include>
<include>org.apache.olingo:olingo-commons-api</include>
<include>org.apache.commons:commons-lang3</include>
<include>org.slf4j:slf4j-api</include>
<include>commons-io:commons-io</include>
<include>commons-beanutils:commons-beanutils</include>
<include>org.apache.httpcomponents:httpclient</include>
<include>org.apache.httpcomponents:httpcore</include>
<include>commons-logging:commons-logging</include>
<include>org.apache.olingo:olingo-commons-core</include>
<include>commons-codec:commons-codec</include>
<include>com.fasterxml.jackson.core:jackson-core</include>
<include>com.fasterxml.jackson.core:jackson-databind</include>
<include>com.fasterxml.jackson.core:jackson-annotations</include>
<include>com.fasterxml.jackson.dataformat:jackson-dataformat-xml</include>
<include>com.fasterxml.jackson.module:jackson-module-jaxb-annotations</include>
<include>org.codehaus.woodstox:stax2-api</include>
<include>javax.xml.stream:stax-api</include>
<include>com.fasterxml:aalto-xml</include>
</includes>
<rules>
<rule>
<pattern>javax.xml.stream.**</pattern>
<result>org.apache.olingo.javax.xml.stream.@1</result>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -51,7 +51,7 @@
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils-core</artifactId>
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>

View File

@ -40,28 +40,26 @@ public final class EntityContainerFactory<C extends CommonEdmEnabledODataClient<
private static final Map<Class<?>, Object> ENTITY_CONTAINERS = new ConcurrentHashMap<Class<?>, Object>();
@SuppressWarnings("unchecked")
private static <C extends CommonEdmEnabledODataClient<?>> EntityContainerFactory<C> getInstance(
final C client, final String serviceRoot) {
if (!FACTORY_PER_SERVICEROOT.containsKey(serviceRoot)) {
final EntityContainerFactory<C> instance = new EntityContainerFactory<C>(client);
FACTORY_PER_SERVICEROOT.put(serviceRoot, instance);
}
private static <C extends CommonEdmEnabledODataClient<?>> EntityContainerFactory<C> getInstance(final C client) {
if (!FACTORY_PER_SERVICEROOT.containsKey(client.getServiceRoot())) {
client.getConfiguration().setDefaultPubFormat(ODataPubFormat.JSON_FULL_METADATA);
final EntityContainerFactory<C> instance = new EntityContainerFactory<C>(client);
FACTORY_PER_SERVICEROOT.put(client.getServiceRoot(), instance);
}
return (EntityContainerFactory<C>) FACTORY_PER_SERVICEROOT.get(serviceRoot);
return (EntityContainerFactory<C>) FACTORY_PER_SERVICEROOT.get(client.getServiceRoot());
}
public static EntityContainerFactory<org.apache.olingo.client.api.v3.EdmEnabledODataClient> getV3(
final String serviceRoot) {
return getInstance(ODataClientFactory.getEdmEnabledV3(serviceRoot), serviceRoot);
return getInstance(ODataClientFactory.getEdmEnabledV3(serviceRoot));
}
public static EntityContainerFactory<org.apache.olingo.client.api.v4.EdmEnabledODataClient> getV4(
final String serviceRoot) {
return getInstance(ODataClientFactory.getEdmEnabledV4(serviceRoot), serviceRoot);
return getInstance(ODataClientFactory.getEdmEnabledV4(serviceRoot));
}
private final CommonEdmEnabledODataClient<?> client;

View File

@ -25,6 +25,8 @@ public interface AbstractOpenType extends Serializable {
void addAdditionalProperty(String name, Object value);
void removeAdditionalProperty(String name);
Object getAdditionalProperty(String name);
Collection<String> getAdditionalPropertyNames();

View File

@ -0,0 +1,24 @@
/*
* 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;
import java.io.Serializable;
public interface AbstractTerm extends Serializable {
}

View File

@ -0,0 +1,34 @@
/*
* 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;
import java.io.Serializable;
import java.util.Collection;
public interface Annotatable extends Serializable {
void addAnnotation(Class<? extends AbstractTerm> term, Object value);
void removeAnnotation(Class<? extends AbstractTerm> term);
Object getAnnotation(Class<? extends AbstractTerm> term);
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
}

View File

@ -0,0 +1,34 @@
/*
* 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.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface AnnotationsForNavigationProperty {
String name();
String type();
}

View File

@ -0,0 +1,34 @@
/*
* 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.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface AnnotationsForProperty {
String name();
String type();
}

View File

@ -16,19 +16,25 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.client.api.communication.request.batch.v4;
package org.apache.olingo.ext.proxy.api.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Batch request payload management.
* Mark POJO as term.
*/
public interface BatchStreamManager
extends org.apache.olingo.client.api.communication.request.batch.BatchStreamManager {
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Inherited
public @interface Term {
/**
* Gets an outside update batch item instance. An outside update item can be submitted embedded into a batch request
* only.
*
* @return ODataOutsideUpdate instance.
*/
ODataOutsideUpdate addOutsideUpdate();
String name();
String type();
String baseTerm() default "";
}

View File

@ -35,17 +35,23 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.olingo.client.api.CommonEdmEnabledODataClient;
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
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.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmOperation;
import org.apache.olingo.commons.api.edm.EdmReturnType;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.ext.proxy.EntityContainerFactory;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.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;
@ -67,11 +73,11 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
}
protected CommonEdmEnabledODataClient<?> getClient() {
return factory == null ? containerHandler.getClient() : factory.getClient();
return factory == null ? containerHandler.getFactory().getClient() : factory.getClient();
}
protected Context getContext() {
return factory == null ? containerHandler.getContext() : factory.getContext();
return factory == null ? containerHandler.getFactory().getContext() : factory.getContext();
}
protected boolean isSelfMethod(final Method method, final Object[] args) {
@ -105,7 +111,7 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
for (CommonODataEntity entityFromSet : entitySet.getEntities()) {
items.add(getEntityProxy(
entityFromSet.getEditLink(), entityFromSet, entityContainerName, null, typeRef, checkInTheContext));
entityFromSet.getEditLink(), entityFromSet, entityContainerName, null, typeRef, null, checkInTheContext));
}
return Proxy.newProxyInstance(
@ -124,17 +130,6 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
EntitySetInvocationHandler.getInstance(typeRef, containerHandler, uri));
}
protected Object getEntityProxy(
final URI entityURI,
final CommonODataEntity entity,
final String entityContainerName,
final URI entitySetURI,
final Class<?> type,
final boolean checkInTheContext) {
return getEntityProxy(entityURI, entity, entityContainerName, entitySetURI, type, null, checkInTheContext);
}
protected Object getEntityProxy(
final URI entityURI,
final CommonODataEntity entity,
@ -154,6 +149,8 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
if (checkInTheContext && getContext().entityContext().isAttached(handler)) {
handler = getContext().entityContext().getEntity(handler.getUUID());
} else {
handler.attach(AttachedEntityStatus.ATTACHED, false);
}
return Proxy.newProxyInstance(
@ -162,6 +159,25 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
handler);
}
@SuppressWarnings("unchecked")
private <RES extends ODataInvokeResult> Class<RES> getResultReference(final EdmReturnType returnType) {
Class<RES> result;
if (returnType == null) {
result = (Class<RES>) ODataNoContent.class;
} else {
if (returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) {
result = (Class<RES>) CommonODataEntitySet.class;
} else if (!returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) {
result = (Class<RES>) CommonODataEntity.class;
} else {
result = (Class<RES>) CommonODataProperty.class;
}
}
return result;
}
protected Object invokeOperation(
final Operation annotation,
final Method method,
@ -199,7 +215,11 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
// 3. invoke
final ODataInvokeResult result = getClient().getInvokeRequestFactory().getInvokeRequest(
target, edmOperation, parameterValues).execute().getBody();
edmOperation instanceof EdmFunction ? HttpMethod.GET : HttpMethod.POST,
target,
getResultReference(edmOperation.getReturnType()),
parameterValues).
execute().getBody();
// 4. process invoke result
if (StringUtils.isBlank(annotation.returnType())) {
@ -227,11 +247,15 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
null,
null,
method.getReturnType(),
null,
false);
}
} else {
return CoreUtils.getValueFromProperty(
getClient(), (CommonODataProperty) result, method.getGenericReturnType(), null);
final CommonODataProperty property = (CommonODataProperty) result;
return property == null || property.hasNullValue()
? null
: CoreUtils.getObjectFromODataValue(
getClient(), property.getValue(), method.getGenericReturnType(), null);
}
}

View File

@ -24,8 +24,12 @@ import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.net.URI;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
@ -33,6 +37,7 @@ import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataLinked;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
@ -58,6 +63,12 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
protected Object internal;
private final Map<String, AnnotatableInvocationHandler> propAnnotatableHandlers =
new HashMap<String, AnnotatableInvocationHandler>();
private final Map<String, AnnotatableInvocationHandler> navPropAnnotatableHandlers =
new HashMap<String, AnnotatableInvocationHandler>();
protected AbstractStructuredInvocationHandler(
final Class<?> typeRef,
final Object internal,
@ -66,7 +77,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
super(containerHandler);
this.internal = internal;
this.typeRef = typeRef;
this.entityHandler = EntityInvocationHandler.class.cast(this);
this.entityHandler = null;
}
protected AbstractStructuredInvocationHandler(
@ -77,15 +88,25 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
super(entityHandler == null ? null : entityHandler.containerHandler);
this.internal = internal;
this.typeRef = typeRef;
this.entityHandler = entityHandler;
// prevent memory leak
this.entityHandler = entityHandler == this ? null : entityHandler;
}
public Object getInternal() {
return internal;
}
public EntityInvocationHandler getEntityHandler() {
return entityHandler;
return entityHandler == null
? this instanceof EntityInvocationHandler
? EntityInvocationHandler.class.cast(this)
: null
: entityHandler;
}
public void setEntityHandler(final EntityInvocationHandler entityHandler) {
this.entityHandler = entityHandler;
// prevents memory leak
this.entityHandler = entityHandler == this ? null : entityHandler;
}
public Class<?> getTypeRef() {
@ -102,14 +123,21 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {returnType},
OperationInvocationHandler.getInstance(entityHandler));
OperationInvocationHandler.getInstance(getEntityHandler()));
} else if ("factory".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
final Class<?> returnType = method.getReturnType();
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {returnType},
ComplexFactoryInvocationHandler.getInstance(entityHandler, this));
ComplexFactoryInvocationHandler.getInstance(getEntityHandler(), this));
} else if ("annotations".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
final Class<?> returnType = method.getReturnType();
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {returnType},
AnnotatationsInvocationHandler.getInstance(getEntityHandler(), this));
} else if (method.getName().startsWith("get")) {
// Assumption: for each getter will always exist a setter and viceversa.
// get method annotation and check if it exists as expected
@ -127,7 +155,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
}
} else {
// if the getter refers to a property .... get property from wrapped entity
res = getPropertyValue(property, getter.getGenericReturnType());
res = getPropertyValue(property.name(), getter.getGenericReturnType());
}
// attach the current handler
@ -163,8 +191,8 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
}
protected void attach() {
if (entityHandler != null && !getContext().entityContext().isAttached(entityHandler)) {
getContext().entityContext().attach(entityHandler, AttachedEntityStatus.ATTACHED);
if (entityHandler != null && !getContext().entityContext().isAttached(getEntityHandler())) {
getContext().entityContext().attach(getEntityHandler(), AttachedEntityStatus.ATTACHED);
}
}
@ -173,12 +201,12 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
}
protected void attach(final AttachedEntityStatus status, final boolean override) {
if (getContext().entityContext().isAttached(entityHandler)) {
if (getContext().entityContext().isAttached(getEntityHandler())) {
if (override) {
getContext().entityContext().setStatus(entityHandler, status);
getContext().entityContext().setStatus(getEntityHandler(), status);
}
} else {
getContext().entityContext().attach(entityHandler, status);
getContext().entityContext().attach(getEntityHandler(), status);
}
}
@ -206,8 +234,9 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
null,
((ODataInlineEntity) link).getEntity(),
property.targetContainer(),
getClient().getURIBuilder(serviceRoot).appendEntitySetSegment(property.targetEntitySet()).build(),
getClient().newURIBuilder().appendEntitySetSegment(property.targetEntitySet()).build(),
type,
null,
false);
} else if (link instanceof ODataInlineEntitySet) {
// return entity set
@ -233,14 +262,18 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
} else if (AbstractEntitySet.class.isAssignableFrom(type)) {
navPropValue = getEntitySetProxy(type, uri);
} else {
final ODataRetrieveResponse<CommonODataEntity> res =
getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute();
final ODataEntityRequest<CommonODataEntity> req = getClient().getRetrieveRequestFactory().getEntityRequest(uri);
if (getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) > 0) {
req.setPrefer(getClient().newPreferences().includeAnnotations("*"));
}
final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
navPropValue = getEntityProxy(
uri,
res.getBody(),
property.targetContainer(),
getClient().getURIBuilder(serviceRoot).appendEntitySetSegment(property.targetEntitySet()).build(),
getClient().newURIBuilder(serviceRoot).appendEntitySetSegment(property.targetEntitySet()).build(),
type,
res.getETag(),
true);
@ -250,25 +283,16 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
return navPropValue;
}
protected abstract Object getPropertyValue(final String name, final Type type);
private Object getPropertyValue(final Property property, final Type type) {
return getPropertyValue(property.name(), type);
}
public void addAdditionalProperty(final String name, final Object value) {
addPropertyChanges(name, value);
attach(AttachedEntityStatus.CHANGED);
}
public Object getAdditionalProperty(final String name) {
return getPropertyValue(name, null);
}
public abstract Collection<String> getAdditionalPropertyNames();
private void setNavigationPropertyValue(final NavigationProperty property, final Object value) {
// 1) attach source entity
if (!getContext().entityContext().isAttached(entityHandler)) {
getContext().entityContext().attach(entityHandler, AttachedEntityStatus.CHANGED);
if (!getContext().entityContext().isAttached(getEntityHandler())) {
getContext().entityContext().attach(getEntityHandler(), AttachedEntityStatus.CHANGED);
}
// 2) attach the target entity handlers
@ -294,11 +318,31 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
addLinkChanges(property, value);
}
protected abstract void setPropertyValue(final Property property, final Object value);
public Map<String, AnnotatableInvocationHandler> getPropAnnotatableHandlers() {
return propAnnotatableHandlers;
}
protected abstract void addPropertyChanges(final String name, final Object value);
public void putPropAnnotatableHandler(final String propName, final AnnotatableInvocationHandler handler) {
propAnnotatableHandlers.put(propName, handler);
}
public Map<String, AnnotatableInvocationHandler> getNavPropAnnotatableHandlers() {
return navPropAnnotatableHandlers;
}
public void putNavPropAnnotatableHandler(final String navPropName, final AnnotatableInvocationHandler handler) {
navPropAnnotatableHandlers.put(navPropName, handler);
}
protected abstract void setPropertyValue(final Property property, final Object value);
protected abstract void addLinkChanges(final NavigationProperty navProp, final Object value);
protected abstract Object getPropertyValue(final String name, final Type type);
public abstract void addAdditionalProperty(final String name, final Object value);
public abstract void removeAdditionalProperty(final String name);
public abstract boolean isChanged();
}

View File

@ -0,0 +1,178 @@
/*
* 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.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
import org.apache.olingo.ext.proxy.api.AbstractTerm;
import org.apache.olingo.ext.proxy.api.Annotatable;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.Term;
import org.apache.olingo.ext.proxy.context.AttachedEntityStatus;
import org.apache.olingo.ext.proxy.utils.CoreUtils;
public class AnnotatableInvocationHandler extends AbstractInvocationHandler implements Annotatable {
private static final long serialVersionUID = 3111228269617223332L;
private final String propName;
private final String navPropName;
private final EntityInvocationHandler entityHandler;
private final AbstractStructuredInvocationHandler targetHandler;
private final Map<Class<? extends AbstractTerm>, Object> annotations =
new HashMap<Class<? extends AbstractTerm>, Object>();
public AnnotatableInvocationHandler(
final EntityContainerInvocationHandler containerHandler,
final String propName,
final String navPropName,
final EntityInvocationHandler entityHandler,
final AbstractStructuredInvocationHandler targetHandler) {
super(containerHandler);
this.propName = propName;
this.navPropName = navPropName;
this.entityHandler = entityHandler;
this.targetHandler = targetHandler;
}
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
return invokeSelfMethod(method, args);
}
public Map<Class<? extends AbstractTerm>, Object> getAnnotations() {
return annotations;
}
private List<ODataAnnotation> internalAnnotations() {
List<ODataAnnotation> result = Collections.<ODataAnnotation>emptyList();
if (entityHandler.getEntity() instanceof ODataEntity) {
if (targetHandler.getInternal() instanceof ODataEntity) {
result = propName == null
? ((org.apache.olingo.commons.api.domain.v4.ODataLink) ((ODataEntity) targetHandler.getInternal()).
getNavigationLink(navPropName)).getAnnotations()
: ((ODataEntity) targetHandler.getInternal()).getProperty(propName).getAnnotations();
} else if (targetHandler.getInternal() instanceof ODataLinkedComplexValue) {
result = propName == null
? ((org.apache.olingo.commons.api.domain.v4.ODataLink) ((ODataLinkedComplexValue) targetHandler.
getInternal()).getNavigationLink(navPropName)).getAnnotations()
: ((ODataLinkedComplexValue) targetHandler.getInternal()).get(propName).getAnnotations();
}
}
return result;
}
@Override
public void addAnnotation(final Class<? extends AbstractTerm> term, final Object value) {
this.annotations.put(term, value);
if (value != null) {
Collection<?> coll;
if (Collection.class.isAssignableFrom(value.getClass())) {
coll = Collection.class.cast(value);
} else {
coll = Collections.singleton(value);
}
for (Object item : coll) {
if (item instanceof Proxy) {
final InvocationHandler handler = Proxy.getInvocationHandler(item);
if ((handler instanceof ComplexInvocationHandler)
&& ((ComplexInvocationHandler) handler).getEntityHandler() == null) {
((ComplexInvocationHandler) handler).setEntityHandler(entityHandler);
}
}
}
}
entityHandler.attach(AttachedEntityStatus.CHANGED);
if (navPropName == null) {
targetHandler.putPropAnnotatableHandler(propName, this);
} else {
targetHandler.putNavPropAnnotatableHandler(navPropName, this);
}
}
@Override
public void removeAnnotation(final Class<? extends AbstractTerm> term) {
this.annotations.remove(term);
entityHandler.attach(AttachedEntityStatus.CHANGED);
if (navPropName == null) {
targetHandler.putPropAnnotatableHandler(propName, this);
} else {
targetHandler.putNavPropAnnotatableHandler(navPropName, this);
}
}
@Override
public Object getAnnotation(final Class<? extends AbstractTerm> term) {
Object res = null;
if (annotations.containsKey(term)) {
res = annotations.get(term);
} else if (entityHandler.getEntity() instanceof ODataEntity) {
try {
final Term termAnn = term.getAnnotation(Term.class);
final Namespace namespaceAnn = term.getAnnotation(Namespace.class);
ODataAnnotation annotation = null;
for (ODataAnnotation _annotation : internalAnnotations()) {
if ((namespaceAnn.value() + "." + termAnn.name()).equals(_annotation.getTerm())) {
annotation = _annotation;
}
}
res = annotation == null || annotation.hasNullValue()
? null
: CoreUtils.getObjectFromODataValue(
getClient(), annotation.getValue(), null, targetHandler.getEntityHandler());
if (res != null) {
annotations.put(term, res);
}
} catch (Exception e) {
throw new IllegalArgumentException("Error getting annotation for term '" + term.getName() + "'", e);
}
}
return res;
}
@Override
public Collection<Class<? extends AbstractTerm>> getAnnotationTerms() {
return entityHandler.getEntity() instanceof ODataEntity
? CoreUtils.getAnnotationTerms(internalAnnotations())
: Collections.<Class<? extends AbstractTerm>>emptyList();
}
}

View File

@ -0,0 +1,87 @@
/*
* 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.lang.reflect.Method;
import java.lang.reflect.Proxy;
import org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty;
import org.apache.olingo.ext.proxy.utils.ClassUtils;
public class AnnotatationsInvocationHandler extends AbstractInvocationHandler {
private static final long serialVersionUID = -1993362719908718985L;
private final EntityInvocationHandler entityHandler;
private final AbstractStructuredInvocationHandler targetHandler;
static AnnotatationsInvocationHandler getInstance(
final EntityInvocationHandler entityHandler,
final AbstractStructuredInvocationHandler targetHandler) {
return new AnnotatationsInvocationHandler(
targetHandler == null
? entityHandler == null ? null : entityHandler.containerHandler : targetHandler.containerHandler,
entityHandler,
targetHandler);
}
private AnnotatationsInvocationHandler(
final EntityContainerInvocationHandler containerHandler,
final EntityInvocationHandler entityHandler,
final AbstractStructuredInvocationHandler targetHandler) {
super(containerHandler);
this.targetHandler = targetHandler;
this.entityHandler = entityHandler;
}
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
if (isSelfMethod(method, args)) {
return invokeSelfMethod(method, args);
} else if (method.getName().startsWith("get") && method.getName().endsWith("Annotations")) {
final Method getter = proxy.getClass().getInterfaces()[0].getMethod(method.getName());
String propName = null;
String navPropName = null;
final AnnotationsForProperty annForProp = ClassUtils.getAnnotation(AnnotationsForProperty.class, getter);
if (annForProp == null) {
final AnnotationsForNavigationProperty annForNavProp =
ClassUtils.getAnnotation(AnnotationsForNavigationProperty.class, getter);
if (annForNavProp == null) {
throw new UnsupportedOperationException("Unsupported method " + method.getName());
}
navPropName = annForNavProp.name();
} else {
propName = annForProp.name();
}
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {method.getReturnType()},
new AnnotatableInvocationHandler(containerHandler, propName, navPropName, entityHandler, targetHandler));
} else {
throw new NoSuchMethodException(method.getName());
}
}
}

View File

@ -78,7 +78,10 @@ class ComplexFactoryInvocationHandler extends AbstractInvocationHandler implemen
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {method.getReturnType()},
ComplexInvocationHandler.getInstance(
entityHandler == null
? ComplexInvocationHandler.getInstance(
getClient(), property.name(), method.getReturnType(), containerHandler)
: ComplexInvocationHandler.getInstance(
getClient(), property.name(), method.getReturnType(), entityHandler));
} else {
throw new NoSuchMethodException(method.getName());

View File

@ -18,11 +18,16 @@
*/
package org.apache.olingo.ext.proxy.commons;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.olingo.client.api.CommonEdmEnabledODataClient;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
@ -41,11 +46,9 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
private static final long serialVersionUID = 2629912294765040037L;
public static ComplexInvocationHandler getInstance(
private static Pair<ODataComplexValue<? extends CommonODataProperty>, Class<?>> init(
final CommonEdmEnabledODataClient<?> client,
final String propertyName,
final Class<?> reference,
final EntityInvocationHandler handler) {
final Class<?> reference) {
final Class<?> complexTypeRef;
if (Collection.class.isAssignableFrom(reference)) {
@ -65,7 +68,27 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
final ODataComplexValue<? extends CommonODataProperty> complex =
client.getObjectFactory().newComplexValue(typeName.toString());
return new ComplexInvocationHandler(client, complex, complexTypeRef, handler);
return new ImmutablePair<ODataComplexValue<? extends CommonODataProperty>, Class<?>>(complex, complexTypeRef);
}
public static ComplexInvocationHandler getInstance(
final CommonEdmEnabledODataClient<?> client,
final String propertyName,
final Class<?> reference,
final EntityInvocationHandler handler) {
final Pair<ODataComplexValue<? extends CommonODataProperty>, Class<?>> init = init(client, reference);
return new ComplexInvocationHandler(client, init.getLeft(), init.getRight(), handler);
}
public static ComplexInvocationHandler getInstance(
final CommonEdmEnabledODataClient<?> client,
final String propertyName,
final Class<?> reference,
final EntityContainerInvocationHandler containerHandler) {
final Pair<ODataComplexValue<? extends CommonODataProperty>, Class<?>> init = init(client, reference);
return new ComplexInvocationHandler(client, init.getLeft(), init.getRight(), containerHandler);
}
public static ComplexInvocationHandler getInstance(
@ -79,7 +102,7 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
private final CommonEdmEnabledODataClient<?> client;
public ComplexInvocationHandler(
private ComplexInvocationHandler(
final CommonEdmEnabledODataClient<?> client,
final ODataComplexValue<?> complex,
final Class<?> typeRef,
@ -89,6 +112,16 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
this.client = client;
}
private ComplexInvocationHandler(
final CommonEdmEnabledODataClient<?> client,
final ODataComplexValue<?> complex,
final Class<?> typeRef,
final EntityContainerInvocationHandler containerHandler) {
super(typeRef, complex, containerHandler);
this.client = client;
}
@SuppressWarnings("unchecked")
public ODataComplexValue<CommonODataProperty> getComplex() {
return (ODataComplexValue<CommonODataProperty>) this.internal;
@ -97,20 +130,51 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
@Override
protected Object getPropertyValue(final String name, final Type type) {
try {
return CoreUtils.getValueFromProperty(client, getComplex().get(name), type, entityHandler);
final CommonODataProperty property = getComplex().get(name);
return property == null || property.hasNullValue()
? null
: CoreUtils.getObjectFromODataValue(client, property.getValue(), type, getEntityHandler());
} catch (Exception e) {
throw new IllegalArgumentException("Error getting value for property '" + name + "'", e);
}
}
@Override
@SuppressWarnings("unchecked")
public Collection<String> getAdditionalPropertyNames() {
final Set<String> res = new HashSet<String>();
final Set<String> propertyNames = new HashSet<String>();
for (Method method : typeRef.getMethods()) {
final Annotation ann = method.getAnnotation(Property.class);
if (ann != null) {
final String property = ((Property) ann).name();
propertyNames.add(property);
}
}
for (final Iterator<? extends CommonODataProperty> itor = getComplex().iterator(); itor.hasNext();) {
final CommonODataProperty property = itor.next();
if (!propertyNames.contains(property.getName())) {
res.add(property.getName());
}
}
return res;
}
@Override
protected void setPropertyValue(final Property property, final Object value) {
final FullQualifiedName fqn =
new FullQualifiedName(ClassUtils.getNamespace(typeRef), typeRef.getAnnotation(ComplexType.class).name());
final EdmElement edmProperty = client.getCachedEdm().getComplexType(fqn).getProperty(property.name());
final EdmTypeInfo type = new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).setTypeExpression(
edmProperty.isCollection() ? "Collection(" + property.type() + ")" : property.type()).build();
setPropertyValue(property.name(), type, value);
}
private void setPropertyValue(final String name, final EdmTypeInfo type, final Object value) {
final Object toBeAdded;
if (value == null) {
@ -118,21 +182,16 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
} else if (Collection.class.isAssignableFrom(value.getClass())) {
toBeAdded = new ArrayList<Object>();
for (Object obj : (Collection) value) {
((Collection) toBeAdded).add(obj instanceof Proxy ? Proxy.getInvocationHandler(obj) : obj);
Collection.class.cast(toBeAdded).add(obj);
}
} else if (value instanceof Proxy) {
toBeAdded = Proxy.getInvocationHandler(value);
} else {
toBeAdded = value;
}
final EdmTypeInfo type = new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).setTypeExpression(
edmProperty.isCollection() ? "Collection(" + property.type() + ")" : property.type()).build();
client.getBinder().add(getComplex(), CoreUtils.getODataProperty(client, name, type, toBeAdded));
client.getBinder().add(getComplex(), CoreUtils.getODataProperty(client, property.name(), type, toBeAdded));
if (entityHandler != null && !getContext().entityContext().isAttached(entityHandler)) {
getContext().entityContext().attach(entityHandler, AttachedEntityStatus.CHANGED);
if (getEntityHandler() != null && !getContext().entityContext().isAttached(getEntityHandler())) {
getContext().entityContext().attach(getEntityHandler(), AttachedEntityStatus.CHANGED);
}
}
@ -146,8 +205,18 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
}
@Override
protected void addPropertyChanges(final String name, final Object value) {
// do nothing ....
public void addAdditionalProperty(final String name, final Object value) {
setPropertyValue(name, null, value);
attach(AttachedEntityStatus.CHANGED);
}
@Override
public void removeAdditionalProperty(final String name) {
final CommonODataProperty property = getComplex().get(name);
if (property != null && !property.hasNullValue()) {
setPropertyValue(name, null, null);
attach(AttachedEntityStatus.CHANGED);
}
}
@Override
@ -157,6 +226,6 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
@Override
public boolean isChanged() {
return entityHandler == null ? false : entityHandler.isChanged();
return getEntityHandler() == null ? false : getEntityHandler().isChanged();
}
}

View File

@ -22,10 +22,19 @@ import java.io.Serializable;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
import org.apache.olingo.ext.proxy.api.AbstractTerm;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.Term;
import org.apache.olingo.ext.proxy.utils.CoreUtils;
public class EntityCollectionInvocationHandler<T extends Serializable>
extends AbstractInvocationHandler implements AbstractEntityCollection<T> {
@ -38,6 +47,11 @@ public class EntityCollectionInvocationHandler<T extends Serializable>
private final URI uri;
private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
private final Map<Class<? extends AbstractTerm>, Object> annotationsByTerm =
new HashMap<Class<? extends AbstractTerm>, Object>();
public EntityCollectionInvocationHandler(final EntityContainerInvocationHandler containerHandler,
final Collection<T> items, final Class<?> itemRef) {
@ -54,6 +68,12 @@ public class EntityCollectionInvocationHandler<T extends Serializable>
this.uri = uri;
}
public void setAnnotations(final List<ODataAnnotation> annotations) {
this.annotations.clear();
this.annotationsByTerm.clear();
this.annotations.addAll(annotations);
}
public Class<?> getEntityReference() {
return itemRef;
}
@ -142,4 +162,37 @@ public class EntityCollectionInvocationHandler<T extends Serializable>
public void clear() {
items.clear();
}
public Object getAnnotation(final Class<? extends AbstractTerm> term) {
Object res = null;
if (annotationsByTerm.containsKey(term)) {
res = annotationsByTerm.get(term);
} else {
try {
final Term termAnn = term.getAnnotation(Term.class);
final Namespace namespaceAnn = term.getAnnotation(Namespace.class);
ODataAnnotation annotation = null;
for (ODataAnnotation _annotation : annotations) {
if ((namespaceAnn.value() + "." + termAnn.name()).equals(_annotation.getTerm())) {
annotation = _annotation;
}
}
res = annotation == null || annotation.hasNullValue()
? null
: CoreUtils.getObjectFromODataValue(getClient(), annotation.getValue(), null, null);
if (res != null) {
annotationsByTerm.put(term, res);
}
} catch (Exception e) {
throw new IllegalArgumentException("Error getting annotation for term '" + term.getName() + "'", e);
}
}
return res;
}
public Collection<Class<? extends AbstractTerm>> getAnnotationTerms() {
return CoreUtils.getAnnotationTerms(annotations);
}
}

View File

@ -19,15 +19,19 @@
package org.apache.olingo.ext.proxy.commons;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.net.URI;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
@ -35,30 +39,39 @@ import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataLinked;
import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.format.ODataMediaFormat;
import org.apache.olingo.ext.proxy.api.AbstractTerm;
import org.apache.olingo.ext.proxy.api.Annotatable;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.Term;
import org.apache.olingo.ext.proxy.context.AttachedEntityStatus;
import org.apache.olingo.ext.proxy.context.EntityUUID;
import org.apache.olingo.ext.proxy.utils.CoreUtils;
public class EntityInvocationHandler extends AbstractStructuredInvocationHandler {
public class EntityInvocationHandler extends AbstractStructuredInvocationHandler implements Annotatable {
private static final long serialVersionUID = 2629912294765040037L;
private final URI entityURI;
protected Map<String, Object> propertyChanges = new HashMap<String, Object>();
protected final Map<String, Object> propertyChanges = new HashMap<String, Object>();
protected Map<NavigationProperty, Object> linkChanges = new HashMap<NavigationProperty, Object>();
protected final Map<NavigationProperty, Object> linkChanges = new HashMap<NavigationProperty, Object>();
protected int propertiesTag = 0;
protected int linksTag = 0;
private Map<String, InputStream> streamedPropertyChanges = new HashMap<String, InputStream>();
private final Map<String, InputStream> streamedPropertyChanges = new HashMap<String, InputStream>();
private final Map<Class<? extends AbstractTerm>, Object> annotations =
new HashMap<Class<? extends AbstractTerm>, Object>();
private InputStream stream;
@ -118,11 +131,12 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
getUUID().getType(),
CoreUtils.getKey(getClient(), this, typeRef, entity));
this.streamedPropertyChanges.clear();
this.propertyChanges.clear();
this.linkChanges.clear();
this.streamedPropertyChanges.clear();
this.propertiesTag = 0;
this.linksTag = 0;
this.annotations.clear();
}
public EntityUUID getUUID() {
@ -167,10 +181,20 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
return propertyChanges;
}
@Override
public void addAdditionalProperty(final String name, final Object value) {
propertyChanges.put(name, value);
attach(AttachedEntityStatus.CHANGED);
}
public Map<NavigationProperty, Object> getLinkChanges() {
return linkChanges;
}
public Map<Class<? extends AbstractTerm>, Object> getAnnotations() {
return annotations;
}
private void updatePropertiesTag(final int checkpoint) {
if (checkpoint == propertiesTag) {
propertiesTag = propertyChanges.hashCode();
@ -186,31 +210,61 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
@Override
protected Object getPropertyValue(final String name, final Type type) {
try {
if (!(type instanceof ParameterizedType) && (Class<?>) type == InputStream.class) {
return getStreamedProperty(name);
} else {
final CommonODataProperty property = getEntity().getProperty(name);
Object res;
if (propertyChanges.containsKey(name)) {
res = propertyChanges.get(name);
} else {
res = CoreUtils.getValueFromProperty(getClient(), property, type, this);
res = property == null || property.hasNullValue()
? null
: CoreUtils.getObjectFromODataValue(getClient(), property.getValue(), type, this);
if (res != null) {
addPropertyChanges(name, res);
cacheProperty(name, res);
}
}
return res;
}
} catch (Exception e) {
throw new IllegalArgumentException("Error getting value for property '" + name + "'", e);
}
}
@Override
@SuppressWarnings("unchecked")
public Collection<String> getAdditionalPropertyNames() {
final Set<String> res = new HashSet<String>(propertyChanges.keySet());
final Set<String> propertyNames = new HashSet<String>();
for (Method method : typeRef.getMethods()) {
final Annotation ann = method.getAnnotation(Property.class);
if (ann != null) {
final String property = ((Property) ann).name();
propertyNames.add(property);
// maybe someone could add a normal attribute to the additional set
res.remove(property);
}
}
for (CommonODataProperty property : getEntity().getProperties()) {
if (!propertyNames.contains(property.getName())) {
res.add(property.getName());
}
}
return res;
}
@Override
protected void setPropertyValue(final Property property, final Object value) {
if (property.type().equalsIgnoreCase(EdmPrimitiveTypeKind.Stream.toString())) {
if (EdmPrimitiveTypeKind.Stream.getFullQualifiedName().toString().equalsIgnoreCase(property.type())) {
setStreamedProperty(property, (InputStream) value);
} else {
addPropertyChanges(property.name(), value);
propertyChanges.put(property.name(), value);
if (value != null) {
Collection<?> coll;
@ -269,7 +323,8 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
final String contentType =
StringUtils.isBlank(getEntity().getMediaContentType()) ? "*/*" : getEntity().getMediaContentType();
final ODataMediaRequest retrieveReq = getClient().getRetrieveRequestFactory().getMediaRequest(contentSource);
final ODataMediaRequest retrieveReq = getClient().getRetrieveRequestFactory().
getMediaEntityRequest(contentSource);
retrieveReq.setFormat(ODataMediaFormat.fromFormat(contentType));
this.stream = retrieveReq.execute().getBody();
@ -278,29 +333,27 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
return this.stream;
}
public Object getStreamedProperty(final Property property) {
InputStream res = streamedPropertyChanges.get(property.name());
public Object getStreamedProperty(final String name) {
InputStream res = streamedPropertyChanges.get(name);
try {
if (res == null) {
final URI link = URIUtils.getURI(
getClient().getServiceRoot(),
CoreUtils.getMediaEditLink(property.name(), getEntity()).toASCIIString());
CoreUtils.getMediaEditLink(name, getEntity()).toASCIIString());
final ODataMediaRequest req = getClient().getRetrieveRequestFactory().getMediaRequest(link);
res = req.execute().getBody();
}
} catch (Exception e) {
res = null;
}
return res;
}
private void setStreamedProperty(final Property property, final InputStream input) {
final Object obj = propertyChanges.get(property.name());
final Object obj = streamedPropertyChanges.get(property.name());
if (obj instanceof InputStream) {
IOUtils.closeQuietly((InputStream) obj);
}
@ -320,14 +373,19 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
}
if (navPropValue != null) {
addLinkChanges(property, navPropValue);
cacheLink(property, navPropValue);
}
return navPropValue;
}
@Override
protected void addPropertyChanges(final String name, final Object value) {
public void removeAdditionalProperty(final String name) {
propertyChanges.remove(name);
attach(AttachedEntityStatus.CHANGED);
}
protected void cacheProperty(final String name, final Object value) {
final int checkpoint = propertyChanges.hashCode();
propertyChanges.put(name, value);
updatePropertiesTag(checkpoint);
@ -335,11 +393,84 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
@Override
protected void addLinkChanges(final NavigationProperty navProp, final Object value) {
linkChanges.put(navProp, value);
}
protected void cacheLink(final NavigationProperty navProp, final Object value) {
final int checkpoint = linkChanges.hashCode();
linkChanges.put(navProp, value);
updateLinksTag(checkpoint);
}
@Override
public void addAnnotation(final Class<? extends AbstractTerm> term, final Object value) {
this.annotations.put(term, value);
if (value != null) {
Collection<?> coll;
if (Collection.class.isAssignableFrom(value.getClass())) {
coll = Collection.class.cast(value);
} else {
coll = Collections.singleton(value);
}
for (Object item : coll) {
if (item instanceof Proxy) {
final InvocationHandler handler = Proxy.getInvocationHandler(item);
if ((handler instanceof ComplexInvocationHandler)
&& ((ComplexInvocationHandler) handler).getEntityHandler() == null) {
((ComplexInvocationHandler) handler).setEntityHandler(this);
}
}
}
}
attach(AttachedEntityStatus.CHANGED);
}
@Override
public void removeAnnotation(final Class<? extends AbstractTerm> term) {
this.annotations.remove(term);
attach(AttachedEntityStatus.CHANGED);
}
@Override
public Object getAnnotation(final Class<? extends AbstractTerm> term) {
Object res = null;
if (annotations.containsKey(term)) {
res = annotations.get(term);
} else if (getEntity() instanceof ODataEntity) {
try {
final Term termAnn = term.getAnnotation(Term.class);
final Namespace namespaceAnn = term.getAnnotation(Namespace.class);
ODataAnnotation annotation = null;
for (ODataAnnotation _annotation : ((ODataEntity) getEntity()).getAnnotations()) {
if ((namespaceAnn.value() + "." + termAnn.name()).equals(_annotation.getTerm())) {
annotation = _annotation;
}
}
res = annotation == null || annotation.hasNullValue()
? null
: CoreUtils.getObjectFromODataValue(getClient(), annotation.getValue(), null, this);
if (res != null) {
annotations.put(term, res);
}
} catch (Exception e) {
throw new IllegalArgumentException("Error getting annotation for term '" + term.getName() + "'", e);
}
}
return res;
}
@Override
public Collection<Class<? extends AbstractTerm>> getAnnotationTerms() {
return getEntity() instanceof ODataEntity
? CoreUtils.getAnnotationTerms(((ODataEntity) getEntity()).getAnnotations())
: Collections.<Class<? extends AbstractTerm>>emptyList();
}
@Override
public String toString() {
return uuid.toString();

View File

@ -25,7 +25,6 @@ import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.net.URI;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@ -33,6 +32,10 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.tuple.ImmutableTriple;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
@ -41,6 +44,8 @@ import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ODataValueFormat;
@ -84,8 +89,7 @@ class EntitySetInvocationHandler<
static EntitySetInvocationHandler getInstance(
final Class<?> ref, final EntityContainerInvocationHandler containerHandler, final String entitySetName) {
final CommonURIBuilder<?> uriBuilder = containerHandler.getClient().
getURIBuilder(containerHandler.getFactory().getClient().getServiceRoot());
final CommonURIBuilder<?> uriBuilder = containerHandler.getClient().newURIBuilder();
final StringBuilder entitySetSegment = new StringBuilder();
if (!containerHandler.isDefaultEntityContainer()) {
@ -178,7 +182,7 @@ class EntitySetInvocationHandler<
@Override
public Long count() {
final ODataValueRequest req = getClient().getRetrieveRequestFactory().
getValueRequest(getClient().getURIBuilder(this.uri.toASCIIString()).count().build());
getValueRequest(getClient().newURIBuilder(this.uri.toASCIIString()).count().build());
req.setFormat(ODataValueFormat.TEXT);
return Long.valueOf(req.execute().getBody().asPrimitive().toString());
}
@ -241,7 +245,7 @@ class EntitySetInvocationHandler<
// not yet attached: search against the service
try {
LOG.debug("Search for '{}({})' into the service", typeRef.getSimpleName(), key);
final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(this.uri.toASCIIString());
final CommonURIBuilder<?> uriBuilder = getClient().newURIBuilder(this.uri.toASCIIString());
if (key.getClass().getAnnotation(CompoundKey.class) == null) {
LOG.debug("Append key segment '{}'", key);
@ -253,8 +257,13 @@ class EntitySetInvocationHandler<
LOG.debug("GET {}", uriBuilder.toString());
final ODataRetrieveResponse<CommonODataEntity> res =
getClient().getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()).execute();
final ODataEntityRequest<CommonODataEntity> req =
getClient().getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
if (getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) > 0) {
req.setPrefer(getClient().newPreferences().includeAnnotations("*"));
}
final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
final String etag = res.getETag();
final CommonODataEntity entity = res.getBody();
@ -284,9 +293,12 @@ class EntitySetInvocationHandler<
}
@SuppressWarnings("unchecked")
public <S extends T> Map.Entry<List<S>, URI> fetchPartialEntitySet(final URI uri, final Class<S> typeRef) {
public <S extends T> Triple<List<S>, URI, List<ODataAnnotation>>
fetchPartialEntitySet(final URI uri, final Class<S> typeRef) {
final List<CommonODataEntity> entities = new ArrayList<CommonODataEntity>();
final URI next;
final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
if (isSingleton) {
final ODataRetrieveResponse<org.apache.olingo.commons.api.domain.v4.Singleton> res =
@ -295,12 +307,20 @@ class EntitySetInvocationHandler<
entities.add(res.getBody());
next = null;
} else {
final ODataRetrieveResponse<CommonODataEntitySet> res =
getClient().getRetrieveRequestFactory().getEntitySetRequest(uri).execute();
final ODataEntitySetRequest<CommonODataEntitySet> req =
getClient().getRetrieveRequestFactory().getEntitySetRequest(uri);
if (getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) > 0) {
req.setPrefer(getClient().newPreferences().includeAnnotations("*"));
}
final ODataRetrieveResponse<CommonODataEntitySet> res = req.execute();
final CommonODataEntitySet entitySet = res.getBody();
entities.addAll(entitySet.getEntities());
next = entitySet.getNext();
if (entitySet instanceof ODataEntitySet) {
annotations.addAll(((ODataEntitySet) entitySet).getAnnotations());
}
}
final List<S> items = new ArrayList<S>(entities.size());
@ -317,7 +337,7 @@ class EntitySetInvocationHandler<
handlerInTheContext == null ? handler : handlerInTheContext));
}
return new AbstractMap.SimpleEntry<List<S>, URI>(items, next);
return new ImmutableTriple<List<S>, URI, List<ODataAnnotation>>(items, next, annotations);
}
@SuppressWarnings("unchecked")
@ -325,18 +345,24 @@ class EntitySetInvocationHandler<
final URI entitySetURI, final Class<S> typeRef, final Class<SEC> collTypeRef) {
final List<S> items = new ArrayList<S>();
final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
URI nextURI = entitySetURI;
while (nextURI != null) {
final Map.Entry<List<S>, URI> entitySet = fetchPartialEntitySet(nextURI, typeRef);
nextURI = entitySet.getValue();
items.addAll(entitySet.getKey());
final Triple<List<S>, URI, List<ODataAnnotation>> entitySet = fetchPartialEntitySet(nextURI, typeRef);
items.addAll(entitySet.getLeft());
nextURI = entitySet.getMiddle();
annotations.addAll(entitySet.getRight());
}
final EntityCollectionInvocationHandler<S> entityCollectionHandler =
new EntityCollectionInvocationHandler<S>(containerHandler, items, typeRef, entitySetURI);
entityCollectionHandler.setAnnotations(annotations);
return (SEC) Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {collTypeRef},
new EntityCollectionInvocationHandler<S>(containerHandler, items, typeRef, entitySetURI));
entityCollectionHandler);
}
@Override
@ -350,7 +376,7 @@ class EntitySetInvocationHandler<
final Class<S> ref = (Class<S>) ClassUtils.extractTypeArg(collTypeRef);
final Class<S> oref = (Class<S>) ClassUtils.extractTypeArg(this.collTypeRef);
final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(this.uri.toASCIIString());
final CommonURIBuilder<?> uriBuilder = getClient().newURIBuilder(this.uri.toASCIIString());
final URI entitySetURI;
if (oref.equals(ref)) {
@ -436,6 +462,6 @@ class EntitySetInvocationHandler<
@Override
public EntitySetIterator<T, KEY, EC> iterator() {
return new EntitySetIterator<T, KEY, EC>(getClient().getURIBuilder(this.uri.toASCIIString()).build(), this);
return new EntitySetIterator<T, KEY, EC>(getClient().newURIBuilder(this.uri.toASCIIString()).build(), this);
}
}

View File

@ -23,8 +23,9 @@ import java.net.URI;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
class EntitySetIterator<T extends Serializable, KEY extends Serializable, EC extends AbstractEntityCollection<T>>
@ -50,7 +51,7 @@ class EntitySetIterator<T extends Serializable, KEY extends Serializable, EC ext
} else if (this.next == null) {
res = false;
} else {
goon();
goOn();
res = current.hasNext();
}
return res;
@ -65,7 +66,7 @@ class EntitySetIterator<T extends Serializable, KEY extends Serializable, EC ext
if (this.next == null) {
throw e;
}
goon();
goOn();
res = next();
}
@ -77,9 +78,10 @@ class EntitySetIterator<T extends Serializable, KEY extends Serializable, EC ext
this.current.remove();
}
private void goon() {
final Map.Entry<List<T>, URI> entitySet = esi.fetchPartialEntitySet(this.next, this.esi.getTypeRef());
this.next = entitySet.getValue();
this.current = entitySet.getKey().iterator();
private void goOn() {
final Triple<List<T>, URI, List<ODataAnnotation>> entitySet =
esi.fetchPartialEntitySet(this.next, this.esi.getTypeRef());
this.current = entitySet.getLeft().iterator();
this.next = entitySet.getMiddle();
}
}

View File

@ -150,7 +150,7 @@ public class FilterImpl<T extends Serializable, EC extends AbstractEntityCollect
@Override
public EC getResult() {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(this.baseURI.toASCIIString()).
final CommonURIBuilder<?> uriBuilder = client.newURIBuilder(this.baseURI.toASCIIString()).
appendDerivedEntityTypeSegment(new FullQualifiedName(
ClassUtils.getNamespace(typeRef), ClassUtils.getEntityTypeName(typeRef)).toString());

View File

@ -28,7 +28,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
@ -41,7 +40,7 @@ import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.ext.proxy.utils.ClassUtils;
class OperationInvocationHandler extends AbstractInvocationHandler implements OperationExecutor {
final class OperationInvocationHandler extends AbstractInvocationHandler implements OperationExecutor {
private static final long serialVersionUID = 2629912294765040027L;
@ -146,8 +145,8 @@ class OperationInvocationHandler extends AbstractInvocationHandler implements Op
edmOperation = container.getActionImport(operation.name()).getUnboundAction();
}
final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(getClient().getServiceRoot()).
appendOperationCallSegment(URIUtils.operationImportURISegment(container, edmOperation.getName()));
final CommonURIBuilder<?> uriBuilder = getClient().newURIBuilder().
appendOperationCallSegment(edmOperation.getName());
return new AbstractMap.SimpleEntry<URI, EdmOperation>(uriBuilder.build(), edmOperation);
}

View File

@ -33,7 +33,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
import org.apache.olingo.client.api.communication.request.ODataRequest;
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
import org.apache.olingo.client.api.communication.request.batch.BatchStreamManager;
import org.apache.olingo.client.api.communication.request.batch.BatchManager;
import org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
@ -50,6 +50,7 @@ import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ODataMediaFormat;
import org.apache.olingo.ext.proxy.EntityContainerFactory;
@ -86,7 +87,7 @@ class PersistenceManagerImpl implements PersistenceManager {
factory.getClient().getBatchRequestFactory().getBatchRequest(factory.getClient().getServiceRoot());
((ODataRequest) request).setAccept(factory.getClient().getConfiguration().getDefaultBatchAcceptFormat());
final BatchStreamManager streamManager = (BatchStreamManager) ((ODataStreamedRequest) request).execute();
final BatchManager streamManager = (BatchManager) ((ODataStreamedRequest) request).payloadManager();
final ODataChangeset changeset = streamManager.addChangeset();
@ -109,11 +110,9 @@ class PersistenceManagerImpl implements PersistenceManager {
final ODataBatchResponse response = streamManager.getResponse();
if ((factory.getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0
&& response.getStatusCode() != 202)
|| (factory.getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) > 0
&& response.getStatusCode() != 200)) {
// This should be 202 for service version <= 3.0 and 200 for service version >= 4.0 but it seems that
// many service implementations are not fully compliant with this respect.
if (response.getStatusCode() != 202 && response.getStatusCode() != 200) {
throw new IllegalStateException("Operation failed");
}
@ -154,7 +153,7 @@ class PersistenceManagerImpl implements PersistenceManager {
factory.getContext().detachAll();
}
private void batch(
private AttachedEntityStatus batch(
final EntityInvocationHandler handler,
final CommonODataEntity entity,
final ODataChangeset changeset) {
@ -162,20 +161,21 @@ class PersistenceManagerImpl implements PersistenceManager {
switch (factory.getContext().entityContext().getStatus(handler)) {
case NEW:
batchCreate(handler, entity, changeset);
break;
return AttachedEntityStatus.NEW;
case CHANGED:
batchUpdate(handler, entity, changeset);
break;
return AttachedEntityStatus.CHANGED;
case DELETED:
batchDelete(handler, entity, changeset);
break;
return AttachedEntityStatus.DELETED;
default:
if (handler.isChanged()) {
batchUpdate(handler, entity, changeset);
}
return AttachedEntityStatus.CHANGED;
}
}
@ -186,8 +186,8 @@ class PersistenceManagerImpl implements PersistenceManager {
LOG.debug("Create '{}'", handler);
changeset.addRequest(
factory.getClient().getCUDRequestFactory().getEntityCreateRequest(handler.getEntitySetURI(), entity));
changeset.addRequest(factory.getClient().getCUDRequestFactory().
getEntityCreateRequest(handler.getEntitySetURI(), entity));
}
private void batchUpdateMediaEntity(
@ -199,7 +199,7 @@ class PersistenceManagerImpl implements PersistenceManager {
LOG.debug("Update media entity '{}'", uri);
final ODataMediaEntityUpdateRequest<?> req =
factory.getClient().getStreamedRequestFactory().getMediaEntityUpdateRequest(uri, input);
factory.getClient().getCUDRequestFactory().getMediaEntityUpdateRequest(uri, input);
req.setContentType(StringUtils.isBlank(handler.getEntity().getMediaContentType())
? ODataMediaFormat.WILDCARD.toString()
@ -220,8 +220,7 @@ class PersistenceManagerImpl implements PersistenceManager {
LOG.debug("Update media entity '{}'", uri);
final ODataStreamUpdateRequest req = factory.getClient().
getStreamedRequestFactory().getStreamUpdateRequest(uri, input);
final ODataStreamUpdateRequest req = factory.getClient().getCUDRequestFactory().getStreamUpdateRequest(uri, input);
if (StringUtils.isNotBlank(handler.getETag())) {
req.setIfMatch(handler.getETag());
@ -317,6 +316,16 @@ class PersistenceManagerImpl implements PersistenceManager {
if (AttachedEntityStatus.DELETED != currentStatus) {
entity.getProperties().clear();
CoreUtils.addProperties(factory.getClient(), handler.getPropertyChanges(), entity);
if (entity instanceof ODataEntity) {
((ODataEntity) entity).getAnnotations().clear();
CoreUtils.addAnnotations(factory.getClient(), handler.getAnnotations(), (ODataEntity) entity);
for (Map.Entry<String, AnnotatableInvocationHandler> entry : handler.getPropAnnotatableHandlers().entrySet()) {
CoreUtils.addAnnotations(factory.getClient(),
entry.getValue().getAnnotations(), ((ODataEntity) entity).getProperty(entry.getKey()));
}
}
}
for (Map.Entry<NavigationProperty, Object> property : handler.getLinkChanges().entrySet()) {
@ -325,8 +334,6 @@ class PersistenceManagerImpl implements PersistenceManager {
: ODataLinkType.ENTITY_NAVIGATION;
final Set<EntityInvocationHandler> toBeLinked = new HashSet<EntityInvocationHandler>();
final String serviceRoot = factory.getClient().getServiceRoot();
for (Object proxy : type == ODataLinkType.ENTITY_SET_NAVIGATION
? (Collection) property.getValue() : Collections.singleton(property.getValue())) {
@ -339,7 +346,7 @@ class PersistenceManagerImpl implements PersistenceManager {
if ((status == AttachedEntityStatus.ATTACHED || status == AttachedEntityStatus.LINKED) && !target.isChanged()) {
entity.addLink(buildNavigationLink(
property.getKey().name(),
URIUtils.getURI(serviceRoot, editLink.toASCIIString()), type));
URIUtils.getURI(factory.getClient().getServiceRoot(), editLink.toASCIIString()), type));
} else {
if (!items.contains(target)) {
pos = processEntityContext(target, pos, items, delayedUpdates, changeset);
@ -354,7 +361,7 @@ class PersistenceManagerImpl implements PersistenceManager {
} else if (status == AttachedEntityStatus.CHANGED) {
entity.addLink(buildNavigationLink(
property.getKey().name(),
URIUtils.getURI(serviceRoot, editLink.toASCIIString()), type));
URIUtils.getURI(factory.getClient().getServiceRoot(), editLink.toASCIIString()), type));
} else {
// create the link for the current object
LOG.debug("'{}' from '{}' to (${}) '{}'", type.name(), handler, targetPos, target);
@ -369,23 +376,32 @@ class PersistenceManagerImpl implements PersistenceManager {
}
}
if (entity instanceof ODataEntity) {
for (Map.Entry<String, AnnotatableInvocationHandler> entry
: handler.getNavPropAnnotatableHandlers().entrySet()) {
CoreUtils.addAnnotations(factory.getClient(),
entry.getValue().getAnnotations(),
(org.apache.olingo.commons.api.domain.v4.ODataLink) entity.getNavigationLink(entry.getKey()));
}
}
// insert into the batch
LOG.debug("{}: Insert '{}' into the batch", pos, handler);
batch(handler, entity, changeset);
final AttachedEntityStatus processedStatus = batch(handler, entity, changeset);
items.put(handler, pos);
if (processedStatus != AttachedEntityStatus.DELETED) {
int startingPos = pos;
if (handler.getEntity().isMediaEntity()) {
if (handler.getEntity().isMediaEntity() && handler.isChanged()) {
// update media properties
if (!handler.getPropertyChanges().isEmpty()) {
final URI targetURI = currentStatus == AttachedEntityStatus.NEW
? URI.create("$" + startingPos)
: URIUtils.getURI(
factory.getClient().getServiceRoot(),
handler.getEntity().getEditLink().toASCIIString());
factory.getClient().getServiceRoot(), handler.getEntity().getEditLink().toASCIIString());
batchUpdate(handler, targetURI, entity, changeset);
pos++;
items.put(handler, pos);
@ -419,6 +435,7 @@ class PersistenceManagerImpl implements PersistenceManager {
pos++;
items.put(handler, pos);
}
}
return pos;
}

View File

@ -75,7 +75,7 @@ public class SearchImpl<T extends Serializable, EC extends AbstractEntityCollect
@Override
public EC getResult() {
final URIBuilder uriBuilder = client.getURIBuilder(this.baseURI.toASCIIString()).
final URIBuilder uriBuilder = client.newURIBuilder(this.baseURI.toASCIIString()).
appendDerivedEntityTypeSegment(new FullQualifiedName(
ClassUtils.getNamespace(typeRef), ClassUtils.getEntityTypeName(typeRef)).toString());

View File

@ -101,9 +101,7 @@ public class EntityContext implements Iterable<AttachedEntity> {
* @param entity entity to be detached.
*/
public void detach(final EntityInvocationHandler entity) {
if (searchableEntities.containsKey(entity.getUUID())) {
searchableEntities.remove(entity.getUUID());
}
allAttachedEntities.remove(entity);
}
@ -178,7 +176,8 @@ public class EntityContext implements Iterable<AttachedEntity> {
* @return <tt>true</tt> if is attached; <tt>false</tt> otherwise.
*/
public boolean isAttached(final EntityInvocationHandler entity) {
return allAttachedEntities.containsKey(entity)
return entity == null // avoid attach for null entities (coming from complexes created from container ...)
|| allAttachedEntities.containsKey(entity)
|| (entity.getUUID().getKey() != null && searchableEntities.containsKey(entity.getUUID()));
}

View File

@ -92,7 +92,9 @@ public class EntityUUID implements Serializable {
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this, "tempKey");
return key == null
? HashCodeBuilder.reflectionHashCode(this)
: HashCodeBuilder.reflectionHashCode(this, "tempKey");
}
@Override

View File

@ -43,23 +43,28 @@ import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v4.ODataAnnotatable;
import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmElement;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmTerm;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.domain.v4.ODataAnnotationImpl;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.ext.proxy.api.AbstractTerm;
import org.apache.olingo.ext.proxy.api.annotations.ComplexType;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
import org.apache.olingo.ext.proxy.api.annotations.EnumType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.Term;
import org.apache.olingo.ext.proxy.commons.AbstractStructuredInvocationHandler;
import org.apache.olingo.ext.proxy.commons.ComplexInvocationHandler;
import org.apache.olingo.ext.proxy.commons.EntityInvocationHandler;
@ -106,12 +111,7 @@ public final class CoreUtils {
}
}
} else if (type.isComplexType()) {
Object objHandler;
if (obj instanceof Proxy) {
objHandler = Proxy.getInvocationHandler(obj);
} else {
objHandler = obj;
}
final Object objHandler = Proxy.getInvocationHandler(obj);
if (objHandler instanceof ComplexInvocationHandler) {
value = ((ComplexInvocationHandler) objHandler).getComplex();
@ -121,7 +121,7 @@ public final class CoreUtils {
if (propAnn != null) {
try {
value.asComplex().add(getODataComplexProperty(
client, type.getFullQualifiedName(), propAnn.name(), method.invoke(objHandler)));
client, type.getFullQualifiedName(), propAnn.name(), method.invoke(obj)));
} catch (Exception ignore) {
// ignore value
LOG.warn("Error attaching complex {} for field '{}.{}'",
@ -189,48 +189,59 @@ public final class CoreUtils {
return getODataProperty(client, property, type, obj);
}
public static ODataAnnotation getODataAnnotation(
final CommonEdmEnabledODataClient<?> client, final String term, final EdmType type, final Object obj) {
ODataAnnotation annotation;
if (obj == null) {
annotation = new ODataAnnotationImpl(term, null);
} else {
final EdmTypeInfo valueType = type == null
? guessTypeFromObject(client, obj)
: new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).
setTypeExpression(type.getFullQualifiedName().toString()).build();
annotation = new ODataAnnotationImpl(term,
(org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(client, valueType, obj));
}
return annotation;
}
public static CommonODataProperty getODataProperty(
final CommonEdmEnabledODataClient<?> client, final String name, final EdmTypeInfo type, final Object obj) {
CommonODataProperty oprop;
CommonODataProperty property;
try {
if (obj == null) {
oprop = client.getObjectFactory().newPrimitiveProperty(name, null);
property = client.getObjectFactory().newPrimitiveProperty(name, null);
} else {
final EdmTypeInfo valueType;
if (type == null) {
valueType = guessTypeFromObject(client, obj);
} else {
valueType = type;
}
final EdmTypeInfo valueType = type == null
? guessTypeFromObject(client, obj)
: type;
final ODataValue value = getODataValue(client, valueType, obj);
if (valueType.isCollection()) {
// create collection property
oprop = client.getObjectFactory().newCollectionProperty(name, getODataValue(client, valueType, obj).
asCollection());
property = client.getObjectFactory().newCollectionProperty(name, value.asCollection());
} else if (valueType.isPrimitiveType()) {
// create a primitive property
oprop = client.getObjectFactory().newPrimitiveProperty(name, getODataValue(client, valueType, obj).
asPrimitive());
property = client.getObjectFactory().newPrimitiveProperty(name, value.asPrimitive());
} else if (valueType.isComplexType()) {
// create a complex property
oprop = client.getObjectFactory().newComplexProperty(name, getODataValue(client, valueType, obj).
asComplex());
property = client.getObjectFactory().newComplexProperty(name, value.asComplex());
} else if (valueType.isEnumType()) {
if (client.getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0) {
throw new UnsupportedInV3Exception();
} else {
oprop = ((ODataObjectFactory) client.getObjectFactory()).newEnumProperty(name,
((org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(client, valueType, obj)).
asEnum());
property = ((ODataObjectFactory) client.getObjectFactory()).newEnumProperty(name,
((org.apache.olingo.commons.api.domain.v4.ODataValue) value).asEnum());
}
} else {
throw new UnsupportedOperationException("Usupported object type " + valueType.getFullQualifiedName());
}
}
return oprop;
return property;
} catch (Exception e) {
throw new IllegalStateException(e);
}
@ -287,15 +298,28 @@ public final class CoreUtils {
final Map<String, Object> changes,
final CommonODataEntity entity) {
for (Map.Entry<String, Object> property : changes.entrySet()) {
// if the getter exists and it is annotated as expected then get value/value and add a new property
final CommonODataProperty odataProperty = entity.getProperty(property.getKey());
if (odataProperty != null) {
entity.getProperties().remove(odataProperty);
for (Map.Entry<String, Object> entry : changes.entrySet()) {
((List<CommonODataProperty>) entity.getProperties()).add(
getODataEntityProperty(client, entity.getTypeName(), entry.getKey(), entry.getValue()));
}
}
((List<CommonODataProperty>) entity.getProperties()).add(
getODataEntityProperty(client, entity.getTypeName(), property.getKey(), property.getValue()));
public static void addAnnotations(
final CommonEdmEnabledODataClient<?> client,
final Map<Class<? extends AbstractTerm>, Object> annotations,
final ODataAnnotatable annotatable) {
for (Map.Entry<Class<? extends AbstractTerm>, Object> entry : annotations.entrySet()) {
final Namespace nsAnn = entry.getKey().getAnnotation(Namespace.class);
final Term termAnn = entry.getKey().getAnnotation(Term.class);
final FullQualifiedName termName = new FullQualifiedName(nsAnn.value(), termAnn.name());
final EdmTerm term = client.getCachedEdm().getTerm(termName);
if (term == null) {
LOG.error("Could not find term for class {}", entry.getKey().getName());
} else {
annotatable.getAnnotations().add(getODataAnnotation(
client, term.getFullQualifiedName().toString(), term.getType(), entry.getValue()));
}
}
}
@ -472,9 +496,9 @@ public final class CoreUtils {
}
@SuppressWarnings("unchecked")
public static Object getValueFromProperty(
public static Object getObjectFromODataValue(
final CommonEdmEnabledODataClient<?> client,
final CommonODataProperty property,
final ODataValue value,
final Type typeRef,
final EntityInvocationHandler entityHandler)
throws InstantiationException, IllegalAccessException {
@ -492,59 +516,93 @@ public final class CoreUtils {
final Object res;
if (property == null || property.hasNullValue()) {
if (value == null) {
res = null;
} else if (property.hasComplexValue()) {
} else if (value.isComplex()) {
// complex types supports inheritance in V4, best to re-read actual type
internalRef = getComplexTypeRef(property);
internalRef = getComplexTypeRef(value);
res = Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {internalRef},
ComplexInvocationHandler.getInstance(
client, property.getValue().asComplex(), internalRef, entityHandler));
} else if (property.hasCollectionValue()) {
client, value.asComplex(), internalRef, entityHandler));
} else if (value.isCollection()) {
final ArrayList<Object> collection = new ArrayList<Object>();
final Iterator<ODataValue> collPropItor = property.getValue().asCollection().iterator();
final Iterator<ODataValue> collPropItor = value.asCollection().iterator();
while (collPropItor.hasNext()) {
final ODataValue value = collPropItor.next();
if (value.isPrimitive()) {
collection.add(CoreUtils.primitiveValueToObject(value.asPrimitive(), internalRef));
} else if (value.isComplex()) {
internalRef = getComplexTypeRef(property);
final ODataValue itemValue = collPropItor.next();
if (itemValue.isPrimitive()) {
collection.add(CoreUtils.primitiveValueToObject(itemValue.asPrimitive(), internalRef));
} else if (itemValue.isComplex()) {
internalRef = getComplexTypeRef(value);
final Object collItem = Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {internalRef},
ComplexInvocationHandler.getInstance(
client, value.asComplex(), internalRef, entityHandler));
client, itemValue.asComplex(), internalRef, entityHandler));
collection.add(collItem);
}
}
res = collection;
} else if (property instanceof ODataProperty && ((ODataProperty) property).hasEnumValue()) {
} else if (value instanceof ODataEnumValue) {
if (internalRef == null) {
internalRef = getEnumTypeRef(property);
internalRef = getEnumTypeRef(value);
}
res = enumValueToObject(((ODataProperty) property).getEnumValue(), internalRef);
res = enumValueToObject((ODataEnumValue) value, internalRef);
} else {
res = primitiveValueToObject(property.getPrimitiveValue(), internalRef);
res = primitiveValueToObject(value.asPrimitive(), internalRef);
}
return res;
}
private static Class<?> getEnumTypeRef(final CommonODataProperty property) {
return getTypeRef(property, "META-INF/" + Constants.PROXY_ENUM_CLASS_LIST, EnumType.class);
@SuppressWarnings("unchecked")
public static Collection<Class<? extends AbstractTerm>> getAnnotationTerms(final List<ODataAnnotation> annotations) {
final List<Class<? extends AbstractTerm>> res = new ArrayList<Class<? extends AbstractTerm>>();
for (ODataAnnotation annotation : annotations) {
res.add((Class<? extends AbstractTerm>) getTermTypeRef(annotation));
}
private static Class<?> getComplexTypeRef(final CommonODataProperty property) {
return getTypeRef(property, "META-INF/" + Constants.PROXY_COMPLEX_CLASS_LIST, ComplexType.class);
return res;
}
private static Class<?> getTermTypeRef(final ODataAnnotation annotation) {
try {
final List<String> pkgs = IOUtils.readLines(Thread.currentThread().getContextClassLoader().
getResourceAsStream("META-INF/" + Constants.PROXY_TERM_CLASS_LIST),
Constants.UTF8);
for (String pkg : pkgs) {
final Class<?> clazz = Class.forName(pkg);
final Term term = clazz.getAnnotation(Term.class);
final Namespace ns = clazz.getAnnotation(Namespace.class);
if (ns != null && term != null
&& annotation.getTerm().equals(new FullQualifiedName(ns.value(), term.name()).toString())) {
return clazz;
}
}
} catch (Exception e) {
LOG.warn("Error retrieving class list for {}", Term.class.getName(), e);
}
throw new IllegalArgumentException("Could not find Term class for " + annotation.getTerm());
}
private static Class<?> getEnumTypeRef(final ODataValue value) {
return getTypeRef(value, "META-INF/" + Constants.PROXY_ENUM_CLASS_LIST, EnumType.class);
}
private static Class<?> getComplexTypeRef(final ODataValue value) {
return getTypeRef(value, "META-INF/" + Constants.PROXY_COMPLEX_CLASS_LIST, ComplexType.class);
}
private static Class<?> getTypeRef(
final CommonODataProperty property,
final ODataValue value,
final String proxyClassListFile,
final Class<? extends Annotation> annType) {
@ -554,7 +612,7 @@ public final class CoreUtils {
try {
final List<String> pkgs = IOUtils.readLines(
CoreUtils.class.getClassLoader().getResourceAsStream(proxyClassListFile),
Thread.currentThread().getContextClassLoader().getResourceAsStream(proxyClassListFile),
Constants.UTF8);
for (String pkg : pkgs) {
@ -562,20 +620,19 @@ public final class CoreUtils {
final Annotation ann = clazz.getAnnotation(annType);
final Namespace ns = clazz.getAnnotation(Namespace.class);
if (ns != null && ann != null) {
if (property.getValue().getTypeName().replaceAll("^Collection\\(", "").replaceAll("\\)$", "").equals(
new FullQualifiedName(ns.value(), annType.isAssignableFrom(EnumType.class)
if (ns != null && ann != null
&& value.getTypeName().replaceAll("^Collection\\(", "").replaceAll("\\)$", "").
equals(new FullQualifiedName(ns.value(), annType.isAssignableFrom(EnumType.class)
? EnumType.class.cast(ann).name()
: ComplexType.class.cast(ann).name()).toString())) {
return clazz;
}
}
}
} catch (Exception e) {
LOG.warn("Error retrieving proxy complex class list", e);
LOG.warn("Error retrieving class list for {}", annType.getName(), e);
}
throw new IllegalArgumentException("Provided property '" + property + "' is not complex");
throw new IllegalArgumentException("Provided value '" + value + "' is not annotated as " + annType.getName());
}
private static String firstValidEntityKey(final Class<?> entityTypeRef) {

View File

@ -47,6 +47,7 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
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.velocity.Template;
import org.apache.velocity.VelocityContext;
@ -231,6 +232,7 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
namespaces.add(schema.getNamespace().toLowerCase());
}
final StringBuilder termNames = new StringBuilder();
final StringBuilder complexTypeNames = new StringBuilder();
final StringBuilder enumTypeNames = new StringBuilder();
@ -250,7 +252,14 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
final Map<String, Object> objs = new HashMap<String, Object>();
// write types into types package
for (EdmTerm term : schema.getTerms()) {
final String className = utility.capitalize(term.getName());
termNames.append(typesPkg).append('.').append(className).append('\n');
objs.clear();
objs.put("term", term);
parseObj(typesBaseDir, typesPkg, "term", className + ".java", objs);
}
for (EdmEnumType enumType : schema.getEnumTypes()) {
final String className = utility.capitalize(enumType.getName());
enumTypeNames.append(typesPkg).append('.').append(className).append('\n');
@ -364,6 +373,8 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
}
final File metaInf = mkdir("META-INF");
FileUtils.fileWrite(
metaInf.getPath() + File.separator + Constants.PROXY_TERM_CLASS_LIST, termNames.toString());
FileUtils.fileWrite(
metaInf.getPath() + File.separator + Constants.PROXY_ENUM_CLASS_LIST, enumTypeNames.toString());
FileUtils.fileWrite(

View File

@ -18,10 +18,14 @@
*#
package ${package};
import org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty;
import org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.ComplexType;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.AbstractOpenType;
import org.apache.olingo.ext.proxy.api.Annotatable;
#foreach($ns in $namespaces)
import ${basePackage}.${ns}.*;
import ${basePackage}.${ns}.types.*;

View File

@ -20,6 +20,7 @@ package ${package};
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
import org.apache.olingo.ext.proxy.api.AbstractTerm;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
@ -92,4 +93,8 @@ public interface $utility.capitalize($entityType.Name)Collection extends Abstrac
#end
}
#end
Object getAnnotation(Class<? extends AbstractTerm> term);
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
}

View File

@ -20,6 +20,8 @@
package ${package};
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty;
import org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
@ -28,6 +30,7 @@ import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.ext.proxy.api.Annotatable;
import org.apache.olingo.ext.proxy.api.AbstractOpenType;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
@ -62,7 +65,7 @@ import javax.xml.datatype.Duration;
isAbstract = $entityType.Abstract#if($entityType.getBaseType()),
baseType = "$entityType.getBaseType().getFullQualifiedName().toString()"#end)
public interface $utility.capitalize($entityType.Name)
extends #if( $entityType.getBaseType() )$utility.getJavaType($entityType.getBaseType())#{elseif}( $entityType.isOpenType() )AbstractOpenType#{else}Serializable#end {
extends Annotatable,#if( $entityType.getBaseType() )$utility.getJavaType($entityType.getBaseType())#{elseif}( $entityType.isOpenType() )AbstractOpenType#{else}Serializable#end {
#set( $keys = [] )
#foreach($key in $entityType.KeyPropertyRefs)
@ -198,4 +201,30 @@ public interface $utility.capitalize($entityType.Name)
#end
}
#end
#if( $entityType.baseType )
@Override
#end
Annotations annotations();
interface Annotations #if( $entityType.baseType )
extends ${utility.getJavaType($entityType.getBaseType())}.Annotations#end{
#foreach($propertyName in $entityType.PropertyNames)
#set($property = $entityType.getProperty($propertyName))
@AnnotationsForProperty(name = "$property.Name",
type = "$property.Type.FullQualifiedName.toString()")
Annotatable get$utility.capitalize($property.Name)Annotations();
#end
#foreach($propertyName in $entityType.NavigationPropertyNames)
#set($property = $entityType.getNavigationProperty($propertyName))
#set($type = $utility.getNavigationType($property))
@AnnotationsForNavigationProperty(name = "$property.Name",
type = "$type")
Annotatable get$utility.capitalize($property.Name)Annotations();
#end
}
}

View File

@ -0,0 +1,34 @@
#*
* 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};
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.Term;
import org.apache.olingo.ext.proxy.api.AbstractTerm;
#foreach($ns in $namespaces)
import ${basePackage}.${ns}.*;
import ${basePackage}.${ns}.types.*;
#end
@Namespace("$namespace")
@Term(name = "$term.Name",
type="$term.Type"#if($term.getBaseTerm()),
baseTerm = "$term.getBaseTerm().getFullQualifiedName().toString()"#end)
public interface $utility.capitalize($term.Name) extends AbstractTerm {
}

View File

@ -22,7 +22,7 @@
isAbstract = $complexType.Abstract#if($complexType.getBaseType()),
baseType = "$complexType.getBaseType().getFullQualifiedName().toString()"#end)
public interface $utility.capitalize($complexType.Name)
extends #if($complexType.getBaseType())$utility.getJavaType($complexType.getBaseType().getFullQualifiedName().toString())#{else}Serializable#end {
extends #if($complexType.getBaseType())$utility.getJavaType($complexType.getBaseType().getFullQualifiedName().toString()),#{end}#if( $complexType.isOpenType() )AbstractOpenType,#{end}Serializable {
#set( $complexProps = [] )
#foreach($propertyName in $complexType.PropertyNames)
@ -81,3 +81,29 @@ public interface $utility.capitalize($complexType.Name)
#end
}
#end
#if( $complexType.baseType )
@Override
#end
Annotations annotations();
interface Annotations #if( $complexType.baseType )
extends ${utility.getJavaType($complexType.getBaseType())}.Annotations#end{
#foreach($propertyName in $complexType.PropertyNames)
#set($property = $complexType.getProperty($propertyName))
@AnnotationsForProperty(name = "$property.Name",
type = "$property.Type.FullQualifiedName.toString()")
Annotatable get$utility.capitalize($property.Name)Annotations();
#end
#foreach($propertyName in $complexType.NavigationPropertyNames)
#set($property = $complexType.getNavigationProperty($propertyName))
#set($type = $utility.getNavigationType($property))
@AnnotationsForNavigationProperty(name = "$property.Name",
type = "$type")
Annotatable get$utility.capitalize($property.Name)Annotations();
#end
}

View File

@ -39,5 +39,6 @@
<module>client-core-android</module>
<module>pojogen-maven-plugin</module>
<module>client-proxy</module>
<module>client-proxy-android</module>
</modules>
</project>

View File

@ -182,6 +182,7 @@
<cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
<cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
<!--<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n-->
<cargo.jvmargs>-noverify -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=256m</cargo.jvmargs>
</properties>
<files>

93
fit/src/it/demoV4/pom.xml Normal file
View File

@ -0,0 +1,93 @@
<?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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>pojogen-maven-plugin-v4test</artifactId>
<groupId>org.apache.olingo</groupId>
<version>@project.version@</version>
<name>${project.artifactId}</name>
<description>A simple IT verifying the basic use case of pojogen-maven-plugin.</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<artifactId>pojogen-maven-plugin</artifactId>
<groupId>org.apache.olingo</groupId>
<version>@project.version@</version>
<scope>runtime</scope>
</dependency>
<dependency>
<artifactId>olingo-client-proxy</artifactId>
<groupId>org.apache.olingo</groupId>
<version>@project.version@</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>pojogen-maven-plugin</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
<serviceRootURL>http://localhost:9080/stub/StaticService/V40/Demo.svc</serviceRootURL>
<basePackage>org.apache.olingo.fit.proxy.v4.demo</basePackage>
</configuration>
<id>v4pojoGen</id>
<phase>generate-sources</phase>
<goals>
<goal>v4pojoGen</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,20 @@
/**
* 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.
*/
File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/org/apache/olingo/fit/proxy/v4" );
assert basepkg.isDirectory() && basepkg.listFiles().length>0;

View File

@ -116,7 +116,7 @@ public abstract class AbstractServices {
private static final Pattern REQUEST_PATTERN = Pattern.compile("(.*) (http://.*) HTTP/.*");
private static final Pattern BATCH_REQUEST_REF_PATTERN = Pattern.compile("(.*) ([$].*) HTTP/.*");
private static final Pattern BATCH_REQUEST_REF_PATTERN = Pattern.compile("(.*) ([$]\\d+)(.*) HTTP/.*");
private static final Pattern REF_PATTERN = Pattern.compile("([$]\\d+)");
@ -188,7 +188,7 @@ public abstract class AbstractServices {
protected Response getMetadata(final String filename) {
try {
return xml.createResponse(null, FSManager.instance(version).readFile(filename, Accept.XML), null, Accept.XML);
return xml.createResponse(null, FSManager.instance(version).readRes(filename, Accept.XML), null, Accept.XML);
} catch (Exception e) {
return xml.createFaultResponse(Accept.XML.toString(version), e);
}
@ -284,7 +284,7 @@ public abstract class AbstractServices {
url = matcher.group(2);
method = matcher.group(1);
} else if (matcherRef.find()) {
url = references.get(matcherRef.group(2));
url = references.get(matcherRef.group(2)) + matcherRef.group(3);
method = matcherRef.group(1);
} else {
url = null;
@ -1306,10 +1306,9 @@ public abstract class AbstractServices {
@PathParam("entityId") String entityId) {
try {
final String basePath =
entitySetName + File.separatorChar + Commons.getEntityKey(entityId) + File.separatorChar;
final String basePath = entitySetName + File.separatorChar + Commons.getEntityKey(entityId);
FSManager.instance(version).deleteFile(basePath + Constants.get(version, ConstantKey.ENTITY));
FSManager.instance(version).deleteEntity(basePath);
return xml.createResponse(null, null, null, null, Response.Status.NO_CONTENT);
} catch (Exception e) {

View File

@ -51,7 +51,7 @@ import org.springframework.stereotype.Service;
public class V3ActionOverloading extends V3Services {
public V3ActionOverloading() throws Exception {
super(new Metadata(FSManager.instance(ODataServiceVersion.V30).readFile(
super(new Metadata(FSManager.instance(ODataServiceVersion.V30).readRes(
"actionOverloading" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)),
Accept.XML), ODataServiceVersion.V30));
}

View File

@ -55,7 +55,7 @@ public class V3OpenType extends V3Services {
public V3OpenType() throws Exception {
super(new Metadata(FSManager.instance(ODataServiceVersion.V30).
readFile("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)),
readRes("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)),
Accept.XML), ODataServiceVersion.V30));
}

View File

@ -47,7 +47,7 @@ public class V3PrimitiveKeys extends V3Services {
public Response getMetadata() {
try {
return xml.createResponse(
null, FSManager.instance(version).readFile("primitiveKeysMetadata", Accept.XML), null, Accept.XML);
null, FSManager.instance(version).readRes("primitiveKeysMetadata", Accept.XML), null, Accept.XML);
} catch (Exception e) {
return xml.createFaultResponse(Accept.XML.toString(version), e);
}

View File

@ -156,7 +156,7 @@ public class V3Services extends AbstractServices {
addChangesetItemIntro(chbos, lastContebtID, cboundary);
res = bodyPartRequest(new MimeBodyPart(part.getInputStream()), references);
if (res.getStatus() >= 400) {
if (res == null || res.getStatus() >= 400) {
throw new Exception("Failure processing changeset");
}
@ -258,6 +258,14 @@ public class V3Services extends AbstractServices {
return super.postNewEntity(uriInfo, accept, contentType, prefer, "Login", entity);
}
@DELETE
@Path("/Login({entityId})")
public Response removeLogin(
@PathParam("entityId") String entityId) {
return super.removeEntity("Login", StringUtils.remove(entityId, "'"));
}
/**
* Retrieve links sample.
*

View File

@ -48,17 +48,12 @@ import org.springframework.stereotype.Service;
@Service
@Path("/V40/Demo.svc")
public class V4Demo {
private final Metadata demoMetadata;
private final V4Services services;
public class V4Demo extends V4Services {
public V4Demo() throws Exception {
this.demoMetadata = new Metadata(FSManager.instance(ODataServiceVersion.V40).
readFile("demo" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
Accept.XML), ODataServiceVersion.V40);
this.services = new V4Services(this.demoMetadata);
super(new Metadata(FSManager.instance(ODataServiceVersion.V40).
readRes("demo" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
Accept.XML), ODataServiceVersion.V40));
}
private Response replaceServiceName(final Response response) {
@ -90,13 +85,15 @@ public class V4Demo {
@GET
@Path("/$metadata")
@Produces(MediaType.APPLICATION_XML)
@Override
public Response getMetadata() {
return services.getMetadata(
return super.getMetadata(
"demo" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)));
}
@GET
@Path("/{entitySetName}({entityId})")
@Override
public Response getEntity(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@ -106,25 +103,27 @@ public class V4Demo {
@QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) String expand,
@QueryParam("$select") @DefaultValue(StringUtils.EMPTY) String select) {
return replaceServiceName(services.getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
return replaceServiceName(super.getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
accept, entitySetName, entityId, format, expand, select, false));
}
@GET
@Path("/{entitySetName}({entityId})/$value")
@Override
public Response getMediaEntity(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@PathParam("entitySetName") String entitySetName,
@PathParam("entityId") String entityId) {
return services.getMediaEntity(uriInfo, accept, entitySetName, entityId);
return super.getMediaEntity(uriInfo, accept, entitySetName, entityId);
}
@POST
@Path("/{entitySetName}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
@Override
public Response postNewEntity(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@ -133,13 +132,14 @@ public class V4Demo {
@PathParam("entitySetName") String entitySetName,
final String entity) {
return replaceServiceName(services.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
}
@PATCH
@Path("/{entitySetName}({entityId})")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
@Override
public Response patchEntity(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@ -151,13 +151,14 @@ public class V4Demo {
final String changes) {
return replaceServiceName(
services.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes));
super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes));
}
@PUT
@Produces({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
@Consumes({MediaType.WILDCARD, MediaType.APPLICATION_OCTET_STREAM})
@Path("/{entitySetName}({entityId})/$value")
@Override
public Response replaceMediaEntity(
@Context UriInfo uriInfo,
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
@ -166,6 +167,6 @@ public class V4Demo {
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
String value) {
return services.replaceMediaEntity(uriInfo, prefer, entitySetName, entityId, format, value);
return super.replaceMediaEntity(uriInfo, prefer, entitySetName, entityId, format, value);
}
}

View File

@ -51,7 +51,7 @@ public class V4OpenType extends V4Services {
public V4OpenType() throws Exception {
super(new Metadata(FSManager.instance(ODataServiceVersion.V40).
readFile("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
readRes("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
Accept.XML), ODataServiceVersion.V40));
}

View File

@ -293,7 +293,7 @@ public class V4Services extends AbstractServices {
addChangesetItemIntro(chbos, lastContebtID, cboundary);
res = bodyPartRequest(new MimeBodyPart(part.getInputStream()), references);
if (res.getStatus() >= 400) {
if (res == null || res.getStatus() >= 400) {
throw new Exception("Failure processing changeset");
}
@ -457,7 +457,7 @@ public class V4Services extends AbstractServices {
}
@GET
@Path("/Company/Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount")
@Path("/Company/Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount{paren:[\\(\\)]*}")
public Response functionGetEmployeesCount(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
@ -488,7 +488,7 @@ public class V4Services extends AbstractServices {
}
@POST
@Path("/Company/Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue")
@Path("/Company/Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue{paren:[\\(\\)]*}")
public Response actionIncreaseRevenue(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
@ -562,7 +562,7 @@ public class V4Services extends AbstractServices {
}
@POST
@Path("/Products({entityId})/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight")
@Path("/Products({entityId})/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight{paren:[\\(\\)]*}")
public Response actionAddAccessRight(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
@ -583,11 +583,16 @@ public class V4Services extends AbstractServices {
assert 1 == entry.getProperties().size();
assert entry.getProperty("accessRight") != null;
entry.getProperty("accessRight").setType("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel");
final Property property = entry.getProperty("accessRight");
property.setType("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel");
final ResWrap<AtomPropertyImpl> result = new ResWrap<AtomPropertyImpl>(
URI.create(Constants.get(version, ConstantKey.ODATA_METADATA_PREFIX) + property.getType()),
null, (AtomPropertyImpl) property);
return xml.createResponse(
null,
xml.writeProperty(acceptType, entry.getProperty("accessRight")),
xml.writeProperty(acceptType, result),
null,
acceptType);
} catch (Exception e) {
@ -596,7 +601,7 @@ public class V4Services extends AbstractServices {
}
@POST
@Path("/Customers(PersonID={personId})/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress")
@Path("/Customers(PersonID={personId})/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress{paren:[\\(\\)]*}")
public Response actionResetAddress(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@ -622,7 +627,7 @@ public class V4Services extends AbstractServices {
@GET
@Path("/ProductDetails(ProductID={productId},ProductDetailID={productDetailId})"
+ "/Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct")
+ "/Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct{paren:[\\(\\)]*}")
public Response functionGetRelatedProduct(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@ -634,11 +639,12 @@ public class V4Services extends AbstractServices {
}
@POST
@Path("/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI")
@Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI{paren:[\\(\\)]*}")
public Response actionRefreshDefaultPI(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
@PathParam("entityId") String entityId,
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
final String param) {
@ -649,23 +655,24 @@ public class V4Services extends AbstractServices {
assert 1 == entry.getProperties().size();
assert entry.getProperty("newDate") != null;
return functionGetDefaultPI(accept, format);
return functionGetDefaultPI(accept, entityId, format);
} catch (Exception e) {
return xml.createFaultResponse(accept, e);
}
}
@GET
@Path("/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI")
@Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI{paren:[\\(\\)]*}")
public Response functionGetDefaultPI(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@PathParam("entityId") String entityId,
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
return getContainedEntity(accept, "101", "MyPaymentInstruments", "101901", format);
return getContainedEntity(accept, entityId, "MyPaymentInstruments", entityId+ "901", format);
}
@GET
@Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo")
@Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo{paren:[\\(\\)]*}")
public Response functionGetAccountInfo(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@PathParam("entityId") String entityId,
@ -1269,9 +1276,15 @@ public class V4Services extends AbstractServices {
assert "Microsoft.Test.OData.Services.ODataWCFService.Address".equals(entity.getType());
assert entity.getProperty("address").getValue().isComplex();
final ResWrap<AtomPropertyImpl> result = new ResWrap<AtomPropertyImpl>(
URI.create(Constants.get(version, ConstantKey.ODATA_METADATA_PREFIX)
+ "Microsoft.Test.OData.Services.ODataWCFService.Address"),
null,
(AtomPropertyImpl) entity.getProperty("address"));
return xml.createResponse(
null,
xml.writeProperty(acceptType, entity.getProperty("address")),
xml.writeProperty(acceptType, result),
null,
acceptType);
} catch (Exception e) {
@ -1311,4 +1324,26 @@ public class V4Services extends AbstractServices {
return xml.createFaultResponse(accept, e);
}
}
@POST
@Path("/Products({productId})/Categories/$ref")
public Response createLinked(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
final String entity) {
return xml.createResponse(null, null, null, Status.NO_CONTENT);
}
@DELETE
@Path("/Products({productId})/Categories({categoryId})/$ref")
public Response deleteLinked(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
final String entity) {
return xml.createResponse(null, null, null, Status.NO_CONTENT);
}
}

View File

@ -42,7 +42,7 @@ public class V4Vocabularies {
private final XMLUtilities xml;
public V4Vocabularies() throws Exception {
this.metadata = new Metadata(FSManager.instance(ODataServiceVersion.V40).readFile(
this.metadata = new Metadata(FSManager.instance(ODataServiceVersion.V40).readRes(
"vocabularies-" + Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA), Accept.XML),
ODataServiceVersion.V40);
this.xml = new XMLUtilities(ODataServiceVersion.V40, metadata);
@ -55,7 +55,7 @@ public class V4Vocabularies {
try {
return xml.createResponse(
null,
FSManager.instance(ODataServiceVersion.V40).readFile(
FSManager.instance(ODataServiceVersion.V40).readRes(
"vocabularies-" + Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA), Accept.XML),
null,
Accept.XML);

View File

@ -89,6 +89,7 @@ public class DataBinder {
public JSONEntityImpl toJSONEntity(final AtomEntityImpl atomEntity) {
final JSONEntityImpl jsonEntity = new JSONEntityImpl();
jsonEntity.getAnnotations().addAll(atomEntity.getAnnotations());
BeanUtils.copyProperties(atomEntity, jsonEntity, "baseURI", "properties", "links");
// This shouldn't ever happen, but...
@ -98,12 +99,35 @@ public class DataBinder {
jsonEntity.setBaseURI(atomEntity.getBaseURI() == null ? null : atomEntity.getBaseURI().toASCIIString());
jsonEntity.getOperations().addAll(atomEntity.getOperations());
for (Link link : atomEntity.getMediaEditLinks()) {
final Link jlink = new LinkImpl();
jlink.setHref(link.getHref());
jlink.setTitle(link.getTitle());
jlink.setType(link.getType());
jlink.setRel(link.getRel());
if (link.getInlineEntity() instanceof AtomEntityImpl) {
final Entity inlineEntity = link.getInlineEntity();
if (inlineEntity instanceof AtomEntityImpl) {
jlink.setInlineEntity(toJSONEntity((AtomEntityImpl) link.getInlineEntity()));
}
} else if (link.getInlineEntitySet() instanceof AtomEntitySetImpl) {
final EntitySet inlineEntitySet = link.getInlineEntitySet();
if (inlineEntitySet instanceof AtomEntitySetImpl) {
jlink.setInlineEntitySet(toJSONEntitySet((AtomEntitySetImpl) link.getInlineEntitySet()));
}
}
jsonEntity.getMediaEditLinks().add(jlink);
}
for (Link link : atomEntity.getNavigationLinks()) {
final Link jlink = new LinkImpl();
jlink.setHref(link.getHref());
jlink.setTitle(link.getTitle());
jlink.setType(link.getType());
jlink.setRel(link.getRel());
jlink.getAnnotations().addAll(link.getAnnotations());
if (link.getInlineEntity() instanceof AtomEntityImpl) {
final Entity inlineEntity = link.getInlineEntity();
@ -136,10 +160,33 @@ public class DataBinder {
BeanUtils.copyProperties(jsonEntity, atomEntity, "baseURI", "properties", "links");
atomEntity.setBaseURI(jsonEntity.getBaseURI() == null ? null : jsonEntity.getBaseURI().toASCIIString());
for (Link link : jsonEntity.getMediaEditLinks()) {
final Link alink = new LinkImpl();
alink.setHref(link.getHref());
alink.setTitle(link.getTitle());
alink.setRel(link.getRel());
alink.setType(link.getType());
if (link.getInlineEntity() instanceof JSONEntityImpl) {
final Entity inlineEntity = link.getInlineEntity();
if (inlineEntity instanceof JSONEntityImpl) {
alink.setInlineEntity(toAtomEntity((JSONEntityImpl) link.getInlineEntity()));
}
} else if (link.getInlineEntitySet() instanceof JSONEntitySetImpl) {
final EntitySet inlineEntitySet = link.getInlineEntitySet();
if (inlineEntitySet instanceof JSONEntitySetImpl) {
alink.setInlineEntitySet(toAtomEntitySet((JSONEntitySetImpl) link.getInlineEntitySet()));
}
}
atomEntity.getMediaEditLinks().add(alink);
}
for (Link link : jsonEntity.getNavigationLinks()) {
final Link alink = new LinkImpl();
alink.setHref(link.getHref());
alink.setTitle(link.getTitle());
alink.getAnnotations().addAll(link.getAnnotations());
final NavigationProperty navPropDetails =
metadata.getEntityOrComplexType(jsonEntity.getType()).getNavigationProperty(link.getTitle());
@ -174,6 +221,7 @@ public class DataBinder {
if (navProperties.containsKey(property.getName())) {
final Link alink = new LinkImpl();
alink.setTitle(property.getName());
alink.getAnnotations().addAll(property.getAnnotations());
alink.setType(navProperties.get(property.getName()).isEntitySet()
? Constants.get(version, ConstantKey.ATOM_LINK_FEED)
@ -212,22 +260,23 @@ public class DataBinder {
return atomEntity;
}
public JSONPropertyImpl toJSONProperty(final AtomPropertyImpl atomproperty) {
final JSONPropertyImpl jsonproperty = new JSONPropertyImpl();
BeanUtils.copyProperties(atomproperty, jsonproperty, "value");
public JSONPropertyImpl toJSONProperty(final AtomPropertyImpl atomProperty) {
final JSONPropertyImpl jsonProperty = new JSONPropertyImpl();
BeanUtils.copyProperties(atomProperty, jsonProperty, "value");
jsonProperty.getAnnotations().addAll(atomProperty.getAnnotations());
if (atomproperty.getValue().isComplex()) {
if (atomProperty.getValue().isComplex()) {
final ComplexValueImpl complex = new ComplexValueImpl();
jsonproperty.setValue(complex);
jsonProperty.setValue(complex);
for (Property field : atomproperty.getValue().asComplex().get()) {
for (Property field : atomProperty.getValue().asComplex().get()) {
complex.get().add(toJSONProperty((AtomPropertyImpl) field));
}
} else if (atomproperty.getValue().isCollection()) {
} else if (atomProperty.getValue().isCollection()) {
final CollectionValueImpl collection = new CollectionValueImpl();
jsonproperty.setValue(collection);
jsonProperty.setValue(collection);
for (Value element : atomproperty.getValue().asCollection().get()) {
for (Value element : atomProperty.getValue().asCollection().get()) {
if (element.isComplex()) {
final ComplexValueImpl complex = new ComplexValueImpl();
collection.get().add(complex);
@ -240,15 +289,16 @@ public class DataBinder {
}
}
} else {
jsonproperty.setValue(atomproperty.getValue());
jsonProperty.setValue(atomProperty.getValue());
}
return jsonproperty;
return jsonProperty;
}
public AtomPropertyImpl toAtomProperty(final JSONPropertyImpl jsonProperty, final String entryType) {
final AtomPropertyImpl atomproperty = new AtomPropertyImpl();
atomproperty.setName(jsonProperty.getName());
final AtomPropertyImpl atomProperty = new AtomPropertyImpl();
atomProperty.setName(jsonProperty.getName());
atomProperty.getAnnotations().addAll(jsonProperty.getAnnotations());
final EntityType entityType = entryType == null
? null
@ -260,21 +310,21 @@ public class DataBinder {
|| jsonProperty.getName() == null
|| !jsonProperty.getType().startsWith(EdmPrimitiveType.EDM_NAMESPACE))) {
atomproperty.setType(jsonProperty.getType());
atomProperty.setType(jsonProperty.getType());
} else if (entityType != null) {
atomproperty.setType(entityType.getProperty(jsonProperty.getName()).getType());
atomProperty.setType(entityType.getProperty(jsonProperty.getName()).getType());
}
if (jsonProperty.getValue().isComplex()) {
final ComplexValueImpl complex = new ComplexValueImpl();
atomproperty.setValue(complex);
atomProperty.setValue(complex);
for (Property field : jsonProperty.getValue().asComplex().get()) {
complex.get().add(toAtomProperty((JSONPropertyImpl) field, atomproperty.getType()));
complex.get().add(toAtomProperty((JSONPropertyImpl) field, atomProperty.getType()));
}
} else if (jsonProperty.getValue().isCollection()) {
final CollectionValueImpl collection = new CollectionValueImpl();
atomproperty.setValue(collection);
atomProperty.setValue(collection);
for (Value element : jsonProperty.getValue().asCollection().get()) {
if (element instanceof ComplexValueImpl) {
@ -282,16 +332,16 @@ public class DataBinder {
collection.get().add(complex);
for (Property field : element.asComplex().get()) {
complex.get().add(toAtomProperty((JSONPropertyImpl) field, atomproperty.getType()));
complex.get().add(toAtomProperty((JSONPropertyImpl) field, atomProperty.getType()));
}
} else {
collection.get().add(element);
}
}
} else {
atomproperty.setValue(jsonProperty.getValue());
atomProperty.setValue(jsonProperty.getValue());
}
return atomproperty;
return atomProperty;
}
}

View File

@ -35,6 +35,7 @@ import org.apache.commons.vfs2.FileSelectInfo;
import org.apache.commons.vfs2.FileSelector;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.FileType;
import org.apache.commons.vfs2.VFS;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@ -72,6 +73,18 @@ public class FSManager {
private FSManager(final ODataServiceVersion version) throws Exception {
this.version = version;
fsManager = VFS.getManager();
final FileObject basePath = fsManager.resolveFile(RES_PREFIX + File.separatorChar + version.name());
final String absoluteBaseFolder = basePath.getURL().getPath();
for (FileObject fo : find(basePath, null)) {
if (fo.getType() == FileType.FILE
&& !fo.getName().getBaseName().contains("Metadata")
&& !fo.getName().getBaseName().contains("metadata")) {
final String path = fo.getURL().getPath().replace(absoluteBaseFolder, "//" + version.name());
putInMemory(fo.getContent().getInputStream(), path);
}
}
}
public String getAbsolutePath(final String relativePath, final Accept accept) {
@ -79,7 +92,7 @@ public class FSManager {
+ (accept == null ? "" : accept.getExtension());
}
public FileObject putInMemory(final InputStream is, final String path) throws IOException {
public final FileObject putInMemory(final InputStream is, final String path) throws IOException {
LOG.info("Write in memory {}", path);
final FileObject memObject = fsManager.resolveFile(MEM_PREFIX + path);
@ -126,29 +139,27 @@ public class FSManager {
}
}
public InputStream readFile(final String relativePath) {
return readFile(relativePath, null);
public InputStream readRes(final String relativePath, final Accept accept) {
return readFile(relativePath, accept, RES_PREFIX);
}
public InputStream readFile(final String relativePath, final Accept accept) {
return readFile(relativePath, accept, MEM_PREFIX);
}
public InputStream readFile(final String relativePath) {
return readFile(relativePath, null, MEM_PREFIX);
}
private InputStream readFile(final String relativePath, final Accept accept, final String fs) {
final String path = getAbsolutePath(relativePath, accept);
LOG.info("Read {}", path);
LOG.info("Read {}{}", fs, path);
try {
FileObject fileObject = fsManager.resolveFile(MEM_PREFIX + path);
final FileObject fileObject = fsManager.resolveFile(fs + path);
if (!fileObject.exists()) {
LOG.warn("In-memory path '{}' not found", path);
try {
fileObject = fsManager.resolveFile(RES_PREFIX + path);
fileObject = putInMemory(fileObject.getContent().getInputStream(), path);
} catch (FileSystemException fse) {
LOG.warn("Resource path '{}' not found", path, fse);
}
}
if (!fileObject.exists()) {
throw new NotFoundException();
}
@ -176,13 +187,34 @@ public class FSManager {
}
}
public FileObject resolve(final String path) throws FileSystemException {
FileObject res = fsManager.resolveFile(MEM_PREFIX + path);
public void deleteEntity(final String relativePath) {
final String path = getAbsolutePath(relativePath, null);
LOG.info("Delete {}", path);
if (!res.exists()) {
res = fsManager.resolveFile(RES_PREFIX + path);
try {
final FileObject fileObject = fsManager.resolveFile(MEM_PREFIX + path);
if (fileObject.exists()) {
fileObject.delete(new FileSelector() {
@Override
public boolean includeFile(final FileSelectInfo fileInfo) throws Exception {
return true;
}
@Override
public boolean traverseDescendents(final FileSelectInfo fileInfo) throws Exception {
return true;
}
});
}
} catch (IOException ignore) {
// ignore exception
}
}
public FileObject resolve(final String path) throws FileSystemException {
final FileObject res = fsManager.resolveFile(MEM_PREFIX + path);
if (!res.exists()) {
throw new FileSystemException("Unresolved path " + path);
}
@ -190,11 +222,11 @@ public class FSManager {
return res;
}
public FileObject[] findByExtension(final FileObject fo, final String ext) throws FileSystemException {
public final FileObject[] find(final FileObject fo, final String ext) throws FileSystemException {
return fo.findFiles(new FileSelector() {
@Override
public boolean includeFile(final FileSelectInfo fileInfo) throws Exception {
return fileInfo.getFile().getName().getExtension().equals(ext);
return ext == null ? true : fileInfo.getFile().getName().getExtension().equals(ext);
}
@Override

View File

@ -598,7 +598,7 @@ public class XMLUtilities extends AbstractUtilities {
try {
final FileObject skipToken = fsManager.resolve(skipTokenDirPath);
final FileObject[] files = fsManager.findByExtension(skipToken, Accept.XML.getExtension().substring(1));
final FileObject[] files = fsManager.find(skipToken, Accept.XML.getExtension().substring(1));
for (FileObject file : files) {
count += countFeedElements(fsManager.readFile(

View File

@ -0,0 +1,34 @@
{
"@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts/$entity",
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Account",
"@odata.id": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)",
"@odata.editLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)",
"AccountID": 102,
"Country": "US",
"AccountInfo": {
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
"FirstName": "Alex",
"LastName": "Green",
"MiddleName": "Hood"
},
"MyGiftCard@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyGiftCard/$ref",
"MyGiftCard@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyGiftCard",
"MyPaymentInstruments@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments/$ref",
"MyPaymentInstruments@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments",
"ActiveSubscriptions@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/ActiveSubscriptions/$ref",
"ActiveSubscriptions@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/ActiveSubscriptions",
"AvailableSubscriptionTemplatess@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/AvailableSubscriptionTemplatess/$ref",
"AvailableSubscriptionTemplatess@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/AvailableSubscriptionTemplatess",
"#Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI": {
"title": "Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI",
"target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"
},
"#Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI": {
"title": "Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI",
"target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"
},
"#Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo": {
"title": "Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo",
"target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"
}
}

View File

@ -0,0 +1,55 @@
<?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#Accounts/$entity">
<id>http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)</id>
<category term="#Microsoft.Test.OData.Services.ODataWCFService.Account" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
<link rel="edit" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/MyGiftCard" type="application/atom+xml;type=entry" title="MyGiftCard" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyGiftCard"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/MyPaymentInstruments" type="application/atom+xml;type=feed" title="MyPaymentInstruments" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/ActiveSubscriptions" type="application/atom+xml;type=feed" title="ActiveSubscriptions" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/ActiveSubscriptions"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/AvailableSubscriptionTemplatess" type="application/atom+xml;type=feed" title="AvailableSubscriptionTemplatess" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/AvailableSubscriptionTemplatess"/>
<title/>
<updated>2014-04-14T12:45:00Z</updated>
<author>
<name/>
</author>
<m:action metadata="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"
title="Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"
target="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"/>
<m:action metadata="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"
title="Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"
target="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"/>
<m:action metadata="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"
title="Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"
target="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"/>
<content type="application/xml">
<m:properties>
<d:AccountID m:type="Int32">102</d:AccountID>
<d:Country>US</d:Country>
<d:AccountInfo m:type="#Microsoft.Test.OData.Services.ODataWCFService.AccountInfo">
<d:FirstName>Alex</d:FirstName>
<d:LastName>Green</d:LastName>
<d:MiddleName>Hood</d:MiddleName>
</d:AccountInfo>
</m:properties>
</content>
</entry>

View File

@ -0,0 +1,15 @@
{
"@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts(102)/MyGiftCard/$entity",
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.GiftCard",
"@odata.id": "Accounts(102)/MyGiftCard",
"@odata.editLink": "Accounts(102)/MyGiftCard",
"GiftCardID": 301,
"GiftCardNO": "AAA123A",
"Amount": 19.9,
"ExperationDate@odata.type": "#DateTimeOffset",
"ExperationDate": "2013-12-30T00:00:00Z",
"#Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount": {
"title": "Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount",
"target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyGiftCard/Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount"
}
}

View File

@ -0,0 +1,41 @@
<?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#Accounts(102)/MyGiftCard/$entity">
<category term="#Microsoft.Test.OData.Services.ODataWCFService.GiftCard" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
<id />
<title />
<updated>2014-04-23T13:48:48Z</updated>
<author>
<name />
</author>
<m:action metadata="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount"
title="Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount"
target="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyGiftCard/Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount"/>
<content type="application/xml">
<m:properties>
<d:GiftCardID m:type="Int32">301</d:GiftCardID>
<d:GiftCardNO>AAA123A</d:GiftCardNO>
<d:Amount m:type="Double">19.9</d:Amount>
<d:ExperationDate m:type="DateTimeOffset">2013-12-30T00:00:00Z</d:ExperationDate>
</m:properties>
</content>
</entry>

View File

@ -0,0 +1,16 @@
{
"@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts(102)/MyPaymentInstruments/$entity",
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
"@odata.id": "Accounts(102)/MyPaymentInstruments(102901)",
"@odata.editLink": "Accounts(102)/MyPaymentInstruments(102901)",
"PaymentInstrumentID": 102901,
"FriendlyName": "102 first PI",
"CreatedDate@odata.type": "#DateTimeOffset",
"CreatedDate": "2014-04-09T00:00:00Z",
"TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/TheStoredPI/$ref",
"TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/TheStoredPI",
"BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BillingStatements/$ref",
"BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BillingStatements",
"BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BackupStoredPI/$ref",
"BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BackupStoredPI"
}

View File

@ -0,0 +1,40 @@
<?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#Accounts(102)/MyPaymentInstruments/$entity">
<category term="#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/TheStoredPI"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BillingStatements"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BackupStoredPI"/>
<id/>
<title/>
<updated>2014-04-14T12:47:37Z</updated>
<author>
<name/>
</author>
<content type="application/xml">
<m:properties>
<d:PaymentInstrumentID m:type="Int32">102901</d:PaymentInstrumentID>
<d:FriendlyName>102 first PI</d:FriendlyName>
<d:CreatedDate m:type="DateTimeOffset">2014-04-09T00:00:00Z</d:CreatedDate>
</m:properties>
</content>
</entry>

View File

@ -0,0 +1,16 @@
{
"@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts(102)/MyPaymentInstruments/$entity",
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
"@odata.id": "Accounts(102)/MyPaymentInstruments(102902)",
"@odata.editLink": "Accounts(102)/MyPaymentInstruments(102902)",
"PaymentInstrumentID": 102902,
"FriendlyName": "102 first PI",
"CreatedDate@odata.type": "#DateTimeOffset",
"CreatedDate": "2014-04-09T00:00:00Z",
"TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/TheStoredPI/$ref",
"TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/TheStoredPI",
"BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/BillingStatements/$ref",
"BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/BillingStatements",
"BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/BackupStoredPI/$ref",
"BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/BackupStoredPI"
}

View File

@ -0,0 +1,40 @@
<?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#Accounts(102)/MyPaymentInstruments/$entity">
<category term="#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/TheStoredPI"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/BillingStatements"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/BackupStoredPI"/>
<id/>
<title/>
<updated>2014-04-14T12:47:37Z</updated>
<author>
<name/>
</author>
<content type="application/xml">
<m:properties>
<d:PaymentInstrumentID m:type="Int32">102902</d:PaymentInstrumentID>
<d:FriendlyName>102 first PI</d:FriendlyName>
<d:CreatedDate m:type="DateTimeOffset">2014-04-09T00:00:00Z</d:CreatedDate>
</m:properties>
</content>
</entry>

View File

@ -0,0 +1,62 @@
{
"@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts(102)/MyPaymentInstruments",
"value": [{
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
"@odata.id": "Accounts(102)/MyPaymentInstruments(102901)",
"@odata.editLink": "Accounts(102)/MyPaymentInstruments(102901)",
"PaymentInstrumentID": 102901,
"FriendlyName": "102 first PI",
"CreatedDate@odata.type": "#DateTimeOffset",
"CreatedDate": "2014-04-09T00:00:00Z",
"TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/TheStoredPI/$ref",
"TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/TheStoredPI",
"BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BillingStatements/$ref",
"BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BillingStatements",
"BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BackupStoredPI/$ref",
"BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BackupStoredPI"
}, {
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
"@odata.id": "Accounts(102)/MyPaymentInstruments(102902)",
"@odata.editLink": "Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
"PaymentInstrumentID": 102902,
"FriendlyName": "102 frist credit PI",
"CreatedDate@odata.type": "#DateTimeOffset",
"CreatedDate": "2012-11-01T00:00:00Z",
"CardNumber": "6000000000000000",
"CVV": "234",
"HolderName": "Alex",
"Balance": 100.0,
"ExperationDate@odata.type": "#DateTimeOffset",
"ExperationDate": "2022-11-01T00:00:00Z",
"TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
"TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
"BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
"BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
"BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
"BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
"CreditRecords@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
"CreditRecords@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
}, {
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
"@odata.id": "Accounts(102)/MyPaymentInstruments(102903)",
"@odata.editLink": "Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
"PaymentInstrumentID": 102903,
"FriendlyName": "102 second credit PI",
"CreatedDate@odata.type": "#DateTimeOffset",
"CreatedDate": "2012-11-01T00:00:00Z",
"CardNumber": "8000000000000000",
"CVV": "012",
"HolderName": "James",
"Balance": 300.0,
"ExperationDate@odata.type": "#DateTimeOffset",
"ExperationDate": "2022-10-02T00:00:00Z",
"TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
"TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
"BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
"BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
"BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
"BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
"CreditRecords@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
"CreditRecords@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
}]
}

View File

@ -0,0 +1,95 @@
<?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.
-->
<feed 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#Accounts(102)/MyPaymentInstruments">
<id>http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/MyPaymentInstruments</id>
<title/>
<updated>2014-04-14T12:45:33Z</updated>
<entry>
<category term="#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/TheStoredPI"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BillingStatements"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BackupStoredPI"/>
<id/>
<title/>
<updated>2014-04-14T12:45:33Z</updated>
<author>
<name/>
</author>
<content type="application/xml">
<m:properties>
<d:PaymentInstrumentID m:type="Int32">102901</d:PaymentInstrumentID>
<d:FriendlyName>102 first PI</d:FriendlyName>
<d:CreatedDate m:type="DateTimeOffset">2014-04-09T00:00:00Z</d:CreatedDate>
</m:properties>
</content>
</entry>
<entry>
<category term="#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"/>
<id/>
<title/>
<updated>2014-04-14T12:45:33Z</updated>
<author>
<name/>
</author>
<content type="application/xml">
<m:properties>
<d:PaymentInstrumentID m:type="Int32">102902</d:PaymentInstrumentID>
<d:FriendlyName>102 frist credit PI</d:FriendlyName>
<d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
<d:CardNumber>6000000000000000</d:CardNumber>
<d:CVV>234</d:CVV>
<d:HolderName>Alex</d:HolderName>
<d:Balance m:type="Double">100</d:Balance>
<d:ExperationDate m:type="DateTimeOffset">2022-11-01T00:00:00Z</d:ExperationDate>
</m:properties>
</content>
</entry>
<entry>
<category term="#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"/>
<id/>
<title/>
<updated>2014-04-14T12:45:33Z</updated>
<author>
<name/>
</author>
<content type="application/xml">
<m:properties>
<d:PaymentInstrumentID m:type="Int32">102903</d:PaymentInstrumentID>
<d:FriendlyName>102 second credit PI</d:FriendlyName>
<d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
<d:CardNumber>8000000000000000</d:CardNumber>
<d:CVV>012</d:CVV>
<d:HolderName>James</d:HolderName>
<d:Balance m:type="Double">300</d:Balance>
<d:ExperationDate m:type="DateTimeOffset">2022-10-02T00:00:00Z</d:ExperationDate>
</m:properties>
</content>
</entry>
</feed>

View File

@ -6,6 +6,7 @@
"@Microsoft.Test.OData.Services.ODataWCFService.IsBoss": true,
"PersonID": 2,
"FirstName": "Jill",
"LastName@Microsoft.Test.OData.Services.ODataWCFService.IsBoss": false,
"LastName": "Jones",
"MiddleName": null,
"HomeAddress": null,
@ -31,6 +32,7 @@
"TimeBetweenLastTwoOrders": "PT0.0000002S",
"Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent/$ref",
"Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent",
"Orders@Microsoft.Test.OData.Services.ODataWCFService.IsBoss": false,
"Orders@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders/$ref",
"Orders@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders",
"Company@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company/$ref",

View File

@ -25,7 +25,9 @@
<link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Parent" title="Parent" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent/$ref" type="application/xml"/>
<link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Orders" title="Orders" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders/$ref" type="application/xml"/>
<link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Company" title="Company" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company/$ref" type="application/xml"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/Parent" title="Parent" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent" type="application/atom+xml;type=entry"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/Parent" title="Parent" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent" type="application/atom+xml;type=entry">
<m:annotation term="Microsoft.Test.OData.Services.ODataWCFService.IsBoss" m:type="Boolean">false</m:annotation>
</link>
<link rel="http://docs.oasis-open.org/odata/ns/related/Orders" title="Orders" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders" type="application/atom+xml;type=entry"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/Company" title="Company" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company" type="application/atom+xml;type=entry"/>
<content type="application/xml">
@ -33,6 +35,7 @@
<d:PersonID m:type="Int32">2</d:PersonID>
<d:FirstName>Jill</d:FirstName>
<d:LastName>Jones</d:LastName>
<m:annotation term="Microsoft.Test.OData.Services.ODataWCFService.IsBoss" target="LastName" m:type="Boolean">false</m:annotation>
<d:MiddleName m:null="true"/>
<d:HomeAddress m:null="true"/>
<d:Home m:type="GeographyPoint">

View File

@ -41,6 +41,10 @@
<Property Name="Int" Type="Edm.Int32" Nullable="false"/>
<Property Name="Long" Type="Edm.Int64" Nullable="false"/>
</ComplexType>
<ComplexType Name="AccountInfo" OpenType="true">
<Property Name="FirstName" Type="Edm.String" Nullable="false"/>
<Property Name="LastName" Type="Edm.String" Nullable="false"/>
</ComplexType>
<EntityType Name="Row" OpenType="true">
<Key>
<PropertyRef Name="Id"/>

View File

@ -62,8 +62,6 @@ public abstract class AbstractTestITCase {
protected static String testLargeModelServiceRootURL;
protected static String testAuthServiceRootURL;
protected static EntityContainerFactory<EdmEnabledODataClient> containerFactory;
protected static DefaultContainer container;
@ -76,7 +74,6 @@ public abstract class AbstractTestITCase {
testActionOverloadingServiceRootURL = "http://localhost:9080/stub/StaticService/V30/ActionOverloading.svc";
testOpenTypeServiceRootURL = "http://localhost:9080/stub/StaticService/V30/OpenType.svc";
testLargeModelServiceRootURL = "http://localhost:9080/stub/StaticService/V30/Static.svc/large";
testAuthServiceRootURL = "http://localhost:9080/stub/DefaultService.svc";
containerFactory = EntityContainerFactory.getV3(testStaticServiceRootURL);
containerFactory.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);

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 org.apache.olingo.fit.proxy.v3;
import static org.junit.Assert.assertNotNull;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
import org.apache.olingo.ext.proxy.EntityContainerFactory;
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.
DefaultContainer;
public class AuthEntityRetrieveTestITCase extends EntityRetrieveTestITCase {
@BeforeClass
public static void setupContaner() {
containerFactory = EntityContainerFactory.getV3(testAuthServiceRootURL);
containerFactory.getClient().getConfiguration().
setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
container = containerFactory.getEntityContainer(DefaultContainer.class);
assertNotNull(container);
}
@AfterClass
public static void disableBasicAuth() {
containerFactory = EntityContainerFactory.getV3(testStaticServiceRootURL);
container = containerFactory.getEntityContainer(DefaultContainer.class);
assertNotNull(container);
}
}

View File

@ -116,7 +116,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
Customer actual = readCustomer(container, id);
checkSampleCustomerProfile(actual, id, sampleName);
assertEquals(Integer.valueOf(16), actual.getInfo().getCustomerInfoId());
assertEquals(16, actual.getInfo().getCustomerInfoId(), 0);
container.getCustomer().delete(actual.getCustomerId());
container.flush();

View File

@ -0,0 +1,107 @@
/*
* 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.v3;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Car;
import org.junit.Test;
/**
* This is the unit test class to check media entity retrieve operations.
*/
public class MediaEntityTestITCase extends AbstractTestITCase {
@Test
public void read() throws IOException {
final InputStream is = container.getCar().get(12).getStream();
assertNotNull(is);
IOUtils.closeQuietly(is);
}
@Test
public void updateReadStreamedProperty() throws IOException {
final String TO_BE_UPDATED = "buffered stream sample (" + System.currentTimeMillis() + ")";
final InputStream input = new ByteArrayInputStream(TO_BE_UPDATED.getBytes());
Car car = container.getCar().get(12);
car.setPhoto(input);
container.flush();
car = container.getCar().get(12);
final InputStream is = car.getPhoto();
assertEquals(TO_BE_UPDATED, IOUtils.toString(is));
IOUtils.closeQuietly(is);
}
@Test
public void update() throws IOException {
final Car car = container.getCar().get(14);
assertNotNull(car);
final String TO_BE_UPDATED = "buffered stream sample (" + System.currentTimeMillis() + ")";
InputStream input = IOUtils.toInputStream(TO_BE_UPDATED);
car.setStream(input);
container.flush();
input = container.getCar().get(14).getStream();
assertEquals(TO_BE_UPDATED, IOUtils.toString(input));
IOUtils.closeQuietly(input);
}
@Test
public void create() throws IOException {
Car car = container.getCar().newCar();
final String TO_BE_UPDATED = "buffered stream sample (" + System.currentTimeMillis() + ")";
InputStream input = IOUtils.toInputStream(TO_BE_UPDATED);
final String DESC = "DESC - " + System.currentTimeMillis();
car.setStream(input);
car.setDescription(DESC);
container.flush();
int key = car.getVIN();
assertTrue(key > 0);
containerFactory.getContext().detachAll();
car = container.getCar().get(key);
assertEquals(DESC, car.getDescription());
input = car.getStream();
assertEquals(TO_BE_UPDATED, IOUtils.toString(input));
IOUtils.closeQuietly(input);
container.getCar().delete(key);
container.flush();
assertNull(container.getCar().get(key));
}
}

View File

@ -44,12 +44,13 @@ import org.junit.Test;
*/
public class OpenTypeTestITCase extends AbstractTestITCase {
private static EntityContainerFactory<EdmEnabledODataClient> otcontainerFactory;
private static DefaultContainer otcontainer;
@BeforeClass
public static void initContainer() {
final EntityContainerFactory<EdmEnabledODataClient> otcontainerFactory =
EntityContainerFactory.getV3(testOpenTypeServiceRootURL);
otcontainerFactory = EntityContainerFactory.getV3(testOpenTypeServiceRootURL);
otcontainerFactory.getClient().getConfiguration().
setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
otcontainer = otcontainerFactory.getEntityContainer(DefaultContainer.class);
@ -64,7 +65,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
getAnnotation(EntityType.class).openType());
assertTrue(otcontainer.getRow().newIndexedRow().getClass().getInterfaces()[0].
getAnnotation(EntityType.class).openType());
containerFactory.getContext().detachAll();
otcontainerFactory.getContext().detachAll();
}
@Test
@ -124,7 +125,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
assertTrue(Calendar.class.isAssignableFrom(rowIndex.getAdditionalProperty("aDate").getClass()));
assertEquals(ContactDetails.class, rowIndex.getAdditionalProperty("aContact").getClass().getInterfaces()[0]);
containerFactory.getContext().detachAll();
otcontainerFactory.getContext().detachAll();
otcontainer.getRowIndex().delete(id);
otcontainer.flush();

View File

@ -48,6 +48,8 @@ public abstract class AbstractTestITCase {
protected static String testStaticServiceRootURL;
protected static String testDemoServiceRootURL;
protected static String testKeyAsSegmentServiceRootURL;
protected static String testActionOverloadingServiceRootURL;
@ -65,6 +67,7 @@ public abstract class AbstractTestITCase {
@BeforeClass
public static void setUpODataServiceRoot() throws IOException {
testStaticServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Static.svc";
testDemoServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Demo.svc";
testKeyAsSegmentServiceRootURL = "http://localhost:9080/stub/StaticService/V40/KeyAsSegment.svc";
testActionOverloadingServiceRootURL = "http://localhost:9080/stub/StaticService/V40/ActionOverloading.svc";
testOpenTypeServiceRootURL = "http://localhost:9080/stub/StaticService/V40/OpenType.svc";

View File

@ -0,0 +1,52 @@
/*
* 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;
import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.ext.proxy.EntityContainerFactory;
import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
public class AuthEntityCreateTestITCase extends EntityCreateTestITCase {
private EntityContainerFactory<EdmEnabledODataClient> ecf;
private InMemoryEntities ime;
@Override
public EntityContainerFactory<EdmEnabledODataClient> getContainerFactory() {
if (ecf == null) {
ecf = EntityContainerFactory.getV4(testAuthServiceRootURL);
ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
ecf.getClient().getConfiguration().
setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
}
return ecf;
}
@Override
protected InMemoryEntities getContainer() {
if (ime == null) {
ime = getContainerFactory().getEntityContainer(InMemoryEntities.class);
}
return ime;
}
}

View File

@ -18,8 +18,6 @@
*/
package org.apache.olingo.fit.proxy.v4;
import static org.apache.olingo.fit.proxy.v4.AbstractTestITCase.testKeyAsSegmentServiceRootURL;
import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
@ -32,7 +30,7 @@ public class AuthEntityRetrieveTestITCase extends EntityRetrieveTestITCase {
@Override
protected InMemoryEntities getContainer() {
final EntityContainerFactory<EdmEnabledODataClient> ecf =
EntityContainerFactory.getV4(testKeyAsSegmentServiceRootURL);
EntityContainerFactory.getV4(testAuthServiceRootURL);
ecf.getClient().getConfiguration().setKeyAsSegment(true);
ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
ecf.getClient().getConfiguration().

View File

@ -29,6 +29,9 @@ import java.util.Calendar;
import java.util.Collections;
import java.util.TimeZone;
import org.apache.commons.lang3.RandomUtils;
import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
import org.apache.olingo.ext.proxy.EntityContainerFactory;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color;
@ -53,16 +56,24 @@ import org.junit.Test;
*/
public class EntityCreateTestITCase extends AbstractTestITCase {
public EntityContainerFactory<EdmEnabledODataClient> getContainerFactory() {
return containerFactory;
}
protected InMemoryEntities getContainer() {
return container;
}
@Test
public void createAndDelete() {
createAndDeleteOrder(container);
createAndDeleteOrder(getContainer());
}
@Test
public void createEmployee() {
final Integer id = 101;
final Employee employee = container.getPeople().newEmployee();
final Employee employee = getContainer().getPeople().newEmployee();
employee.setPersonID(id);
employee.setFirstName("Fabio");
employee.setLastName("Martelli");
@ -71,34 +82,34 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
date.clear();
date.set(2011, 3, 4, 9, 0, 0);
employee.setDateHired(date);
Address homeAddress = employee.factory().newHomeAddress();
final Address homeAddress = employee.factory().newHomeAddress();
homeAddress.setCity("Pescara");
homeAddress.setPostalCode("65100");
homeAddress.setStreet("viale Gabriele D'Annunzio 256");
employee.setHomeAddress(homeAddress);
employee.setNumbers(Arrays.asList(new String[] {"3204725072", "08569930"}));
container.flush();
getContainer().flush();
Employee actual = container.getPeople().get(id, Employee.class);
Employee actual = getContainer().getPeople().get(id, Employee.class);
assertNotNull(actual);
assertEquals(id, actual.getPersonID());
assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
containerFactory.getContext().detachAll();
actual = container.getPeople().get(id, Employee.class);
getContainerFactory().getContext().detachAll();
actual = getContainer().getPeople().get(id, Employee.class);
assertNotNull(actual);
assertEquals(id, actual.getPersonID());
assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
container.getPeople().delete(actual.getPersonID());
container.flush();
getContainer().getPeople().delete(actual.getPersonID());
getContainer().flush();
actual = container.getPeople().get(id, Employee.class);;
actual = getContainer().getPeople().get(id, Employee.class);
assertNull(actual);
containerFactory.getContext().detachAll();
actual = container.getPeople().get(id, Employee.class);
getContainerFactory().getContext().detachAll();
actual = getContainer().getPeople().get(id, Employee.class);
assertNull(actual);
}
@ -106,7 +117,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithNavigation() {
final Integer id = 101;
final Customer customer = container.getCustomers().newCustomer();
final Customer customer = getContainer().getCustomers().newCustomer();
customer.setPersonID(id);
customer.setPersonID(id);
customer.setFirstName("Fabio");
@ -120,21 +131,21 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
customer.setHomeAddress(homeAddress);
customer.setNumbers(Arrays.asList(new String[] {"3204725072", "08569930"}));
final OrderCollection orders = container.getOrders().newOrderCollection();
orders.add(container.getOrders().get(8));
final OrderCollection orders = getContainer().getOrders().newOrderCollection();
orders.add(getContainer().getOrders().get(8));
customer.setOrders(orders);
container.flush();
getContainer().flush();
Customer actual = readCustomer(container, id);
assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
assertEquals(1, actual.getOrders().size());
assertEquals(8, actual.getOrders().iterator().next().getOrderID(), 0);
container.getCustomers().delete(actual.getPersonID());
container.flush();
getContainer().getCustomers().delete(actual.getPersonID());
getContainer().flush();
actual = container.getCustomers().get(id);
actual = getContainer().getCustomers().get(id);
assertNull(actual);
}
@ -145,7 +156,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
// -------------------------------
// Create a new order
// -------------------------------
Order order = container.getOrders().newOrder();
Order order = getContainer().getOrders().newOrder();
order.setOrderID(id);
final Calendar orderDate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
@ -160,7 +171,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
// -------------------------------
// Create a new customer
// -------------------------------
final Customer customer = container.getCustomers().newCustomer();
final Customer customer = getContainer().getCustomers().newCustomer();
customer.setPersonID(id);
customer.setPersonID(id);
customer.setFirstName("Fabio");
@ -174,7 +185,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
customer.setHomeAddress(homeAddress);
customer.setNumbers(Arrays.asList(new String[] {"3204725072", "08569930"}));
final OrderCollection orders = container.getOrders().newOrderCollection();
final OrderCollection orders = getContainer().getOrders().newOrderCollection();
orders.add(order);
customer.setOrders(orders);
// -------------------------------
@ -185,7 +196,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
order.setCustomerForOrder(customer);
// -------------------------------
container.flush();
getContainer().flush();
assertEquals(id, order.getOrderID());
assertEquals(id, customer.getPersonID());
@ -195,56 +206,56 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
assertEquals(1, actual.getOrders().size());
assertEquals(id, actual.getOrders().iterator().next().getOrderID());
order = container.getOrders().get(id);
order = getContainer().getOrders().get(id);
assertNotNull(order);
assertEquals(id, order.getCustomerForOrder().getPersonID());
container.getOrders().delete(actual.getOrders());
container.flush();
getContainer().getOrders().delete(actual.getOrders());
getContainer().flush();
order = container.getOrders().get(id);
order = getContainer().getOrders().get(id);
assertNull(order);
actual = readCustomer(container, id);
assertTrue(actual.getOrders().isEmpty());
container.getCustomers().delete(actual.getPersonID());
container.flush();
getContainer().getCustomers().delete(actual.getPersonID());
getContainer().flush();
actual = container.getCustomers().get(id);
actual = getContainer().getCustomers().get(id);
assertNull(actual);
}
@Test
public void multiKey() {
OrderDetail details = container.getOrderDetails().newOrderDetail();
OrderDetail details = getContainer().getOrderDetails().newOrderDetail();
details.setOrderID(8);
details.setProductID(1);
details.setQuantity(100);
details.setUnitPrice(5f);
container.flush();
getContainer().flush();
OrderDetailKey key = new OrderDetailKey();
key.setOrderID(8);
key.setProductID(1);
details = container.getOrderDetails().get(key);
details = getContainer().getOrderDetails().get(key);
assertNotNull(details);
assertEquals(Integer.valueOf(100), details.getQuantity());
assertEquals(8, details.getOrderID(), 0);
assertEquals(1, details.getProductID(), 0);
assertEquals(5f, details.getUnitPrice(), 0);
container.getOrderDetails().delete(key);
container.flush();
getContainer().getOrderDetails().delete(key);
getContainer().flush();
assertNull(container.getOrderDetails().get(key));
assertNull(getContainer().getOrderDetails().get(key));
}
@Test
public void deepInsert() {
Product product = container.getProducts().newProduct();
Product product = getContainer().getProducts().newProduct();
product.setProductID(12);
product.setName("Latte");
product.setQuantityPerUnit("100g Bag");
@ -255,30 +266,30 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
product.setSkinColor(Color.Blue);
product.setCoverColors(Arrays.asList(new Color[] {Color.Red, Color.Green}));
final ProductDetail detail = container.getProductDetails().newProductDetail();
final ProductDetail detail = getContainer().getProductDetails().newProductDetail();
detail.setProductID(product.getProductID());
detail.setProductDetailID(12);
detail.setProductName("LatteHQ");
detail.setDescription("High-Quality Milk");
final ProductDetailCollection detailCollection = container.getProductDetails().newProductDetailCollection();
final ProductDetailCollection detailCollection = getContainer().getProductDetails().newProductDetailCollection();
detailCollection.add(detail);
product.setDetails(detailCollection);
container.flush();
getContainer().flush();
product = container.getProducts().get(12);
product = getContainer().getProducts().get(12);
assertEquals("Latte", product.getName());
assertEquals(12, product.getDetails().iterator().next().getProductDetailID(), 0);
}
@Test
public void contained() {
PaymentInstrumentCollection instruments = container.getAccounts().get(101).getMyPaymentInstruments().getAll();
PaymentInstrumentCollection instruments = getContainer().getAccounts().get(101).getMyPaymentInstruments().getAll();
final int sizeBefore = instruments.size();
final PaymentInstrument instrument = container.getAccounts().get(101).
final PaymentInstrument instrument = getContainer().getAccounts().get(101).
getMyPaymentInstruments().newPaymentInstrument();
final int id = RandomUtils.nextInt(101999, 105000);
@ -286,17 +297,17 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
instrument.setFriendlyName("New one");
instrument.setCreatedDate(Calendar.getInstance());
container.flush();
getContainer().flush();
instruments = container.getAccounts().get(101).getMyPaymentInstruments().getAll();
instruments = getContainer().getAccounts().get(101).getMyPaymentInstruments().getAll();
final int sizeAfter = instruments.size();
assertEquals(sizeBefore + 1, sizeAfter);
container.getAccounts().get(101).getMyPaymentInstruments().delete(id);
getContainer().getAccounts().get(101).getMyPaymentInstruments().delete(id);
container.flush();
getContainer().flush();
instruments = container.getAccounts().get(101).getMyPaymentInstruments().getAll();
instruments = getContainer().getAccounts().get(101).getMyPaymentInstruments().getAll();
final int sizeEnd = instruments.size();
assertEquals(sizeBefore, sizeEnd);
}

View File

@ -0,0 +1,106 @@
/*
* 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;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.InputStream;
import java.util.Calendar;
import java.util.UUID;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.ext.proxy.EntityContainerFactory;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.DemoService;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* This is the unit test class to check media entity retrieve operations.
*/
public class MediaEntityTestITCase extends AbstractTestITCase {
private static DemoService dcontainer;
@BeforeClass
public static void initContainer() {
final EntityContainerFactory<EdmEnabledODataClient> otcontainerFactory =
EntityContainerFactory.getV4(testDemoServiceRootURL);
otcontainerFactory.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
dcontainer = otcontainerFactory.getEntityContainer(DemoService.class);
assertNotNull(dcontainer);
}
@Test
public void read() throws IOException {
final UUID uuid = UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7");
final Advertisement adv = dcontainer.getAdvertisements().get(uuid);
assertTrue(adv.getAirDate() instanceof Calendar);
final InputStream is = adv.getStream();
assertNotNull(is);
IOUtils.closeQuietly(is);
}
@Test
public void update() throws IOException {
final UUID uuid = UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7");
final Advertisement adv = dcontainer.getAdvertisements().get(uuid);
assertNotNull(adv);
final String random = RandomStringUtils.random(124, "abcdefghijklmnopqrstuvwxyz");
adv.setStream(IOUtils.toInputStream(random));
dcontainer.flush();
assertEquals(random, IOUtils.toString(dcontainer.getAdvertisements().get(uuid).getStream()));
}
@Test
public void create() throws IOException {
final String random = RandomStringUtils.random(124, "abcdefghijklmnopqrstuvwxyz");
final Advertisement adv = dcontainer.getAdvertisements().newAdvertisement();
adv.setStream(IOUtils.toInputStream(random));
adv.setAirDate(Calendar.getInstance());
dcontainer.flush();
final UUID uuid = adv.getID();
containerFactory.getContext().detachAll();
assertEquals(random, IOUtils.toString(dcontainer.getAdvertisements().get(uuid).getStream()));
containerFactory.getContext().detachAll();
dcontainer.getAdvertisements().delete(uuid);
dcontainer.flush();
assertNull(dcontainer.getAdvertisements().get(uuid));
}
}

View File

@ -33,6 +33,7 @@ import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.ext.proxy.EntityContainerFactory;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.DefaultContainer;
import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfo;
import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Color;
import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetails;
import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row;
@ -45,12 +46,13 @@ import org.junit.Test;
*/
public class OpenTypeTestITCase extends AbstractTestITCase {
private static EntityContainerFactory<EdmEnabledODataClient> otcontainerFactory;
private static DefaultContainer otcontainer;
@BeforeClass
public static void initContainer() {
final EntityContainerFactory<EdmEnabledODataClient> otcontainerFactory =
EntityContainerFactory.getV4(testOpenTypeServiceRootURL);
otcontainerFactory = EntityContainerFactory.getV4(testOpenTypeServiceRootURL);
otcontainerFactory.getClient().getConfiguration().
setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
otcontainer = otcontainerFactory.getEntityContainer(DefaultContainer.class);
@ -65,7 +67,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
getAnnotation(EntityType.class).openType());
assertTrue(otcontainer.getRow().newIndexedRow().getClass().getInterfaces()[0].
getAnnotation(EntityType.class).openType());
containerFactory.getContext().detachAll();
otcontainerFactory.getContext().detachAll();
}
@Test
@ -115,6 +117,12 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
rowIndex.addAdditionalProperty("aContact", contact);
rowIndex.addAdditionalProperty("aColor", Color.Green);
final AccountInfo ai = otcontainer.complexFactory().newAccountInfo();
ai.setFirstName("Fabio");
ai.setLastName("Martelli");
ai.addAdditionalProperty("email", "fabio.martelli@tirasa.net");
rowIndex.addAdditionalProperty("info", ai);
otcontainer.flush();
rowIndex = otcontainer.getRowIndex().get(id);
@ -127,8 +135,12 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
assertEquals(ContactDetails.class, rowIndex.getAdditionalProperty("aContact").getClass().getInterfaces()[0]);
assertEquals(Color.class, rowIndex.getAdditionalProperty("aColor").getClass());
assertEquals(Color.Green, rowIndex.getAdditionalProperty("aColor"));
assertEquals("Fabio", AccountInfo.class.cast(rowIndex.getAdditionalProperty("info")).getFirstName());
assertEquals("Martelli", AccountInfo.class.cast(rowIndex.getAdditionalProperty("info")).getLastName());
assertEquals("fabio.martelli@tirasa.net", AccountInfo.class.cast(rowIndex.getAdditionalProperty("info")).
getAdditionalProperty("email"));
containerFactory.getContext().detachAll();
otcontainerFactory.getContext().detachAll();
otcontainer.getRowIndex().delete(id);
otcontainer.flush();

View File

@ -19,9 +19,14 @@
package org.apache.olingo.fit.proxy.v4;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.apache.olingo.ext.proxy.api.Annotatable;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.IsBoss;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
import org.junit.Test;
public class SingletonTestITCase extends AbstractTestITCase {
@ -42,4 +47,31 @@ public class SingletonTestITCase extends AbstractTestITCase {
assertEquals(132520L, container.getCompany().get().getRevenue(), 0);
}
@Test
public void readWithAnnotations() {
final Company company = container.getCompany().get();
assertTrue(company.getAnnotationTerms().isEmpty());
final Person boss = container.getBoss().get();
assertEquals(2, boss.getPersonID(), 0);
assertEquals(1, boss.getAnnotationTerms().size());
Object isBoss = boss.getAnnotation(IsBoss.class);
assertTrue(isBoss instanceof Boolean);
assertTrue((Boolean) isBoss);
Annotatable annotations = boss.annotations().getFirstNameAnnotations();
assertTrue(annotations.getAnnotationTerms().isEmpty());
annotations = boss.annotations().getLastNameAnnotations();
isBoss = annotations.getAnnotation(IsBoss.class);
assertTrue(isBoss instanceof Boolean);
assertFalse((Boolean) isBoss);
annotations = boss.annotations().getParentAnnotations();
isBoss = annotations.getAnnotation(IsBoss.class);
assertTrue(isBoss instanceof Boolean);
assertFalse((Boolean) isBoss);
}
}

View File

@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKey;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@EntitySet(name = "Advertisements")
public interface Advertisements
extends AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement, UUID, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AdvertisementCollection> {
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement newAdvertisement();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AdvertisementCollection newAdvertisementCollection();
}

View File

@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKey;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@EntitySet(name = "Categories")
public interface Categories
extends AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Category, Integer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection> {
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Category newCategory();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection newCategoryCollection();
}

View File

@ -0,0 +1,85 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityContainer;
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.Property;
import org.apache.olingo.ext.proxy.api.PersistenceManager;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@Namespace("ODataDemo")
@EntityContainer(name = "DemoService",
namespace = "ODataDemo",
isDefaultEntityContainer = true)
public interface DemoService extends PersistenceManager {
Products getProducts();
Advertisements getAdvertisements();
Persons getPersons();
Categories getCategories();
PersonDetails getPersonDetails();
Suppliers getSuppliers();
ProductDetails getProductDetails();
Operations operations();
public interface Operations {
@Operation(name = "IncreaseSalaries",
type = OperationType.ACTION)
void increaseSalaries(
@Parameter(name = "percentage", type = "Edm.Int32", nullable = false) Integer percentage
);
}
ComplexFactory complexFactory();
interface ComplexFactory {
@Property(name = "Address",
type = "ODataDemo.Address")
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address newAddress();
}
}

View File

@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKey;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@EntitySet(name = "PersonDetails")
public interface PersonDetails
extends AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail, Integer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetailCollection> {
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail newPersonDetail();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetailCollection newPersonDetailCollection();
}

View File

@ -0,0 +1,56 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKey;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@EntitySet(name = "Persons")
public interface Persons
extends AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person, Integer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonCollection> {
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person newPerson();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonCollection newPersonCollection();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Customer newCustomer();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CustomerCollection newCustomerCollection();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Employee newEmployee();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.EmployeeCollection newEmployeeCollection();
}

View File

@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKey;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@EntitySet(name = "ProductDetails")
public interface ProductDetails
extends AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail, Integer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetailCollection> {
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail newProductDetail();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetailCollection newProductDetailCollection();
}

View File

@ -0,0 +1,54 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKey;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@EntitySet(name = "Products")
public interface Products
extends AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product, Integer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection> {
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product newProduct();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection newProductCollection();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProduct newFeaturedProduct();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProductCollection newFeaturedProductCollection();
}

View File

@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKey;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@EntitySet(name = "Suppliers")
public interface Suppliers
extends AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier, Integer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.SupplierCollection> {
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier newSupplier();
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.SupplierCollection newSupplierCollection();
}

View File

@ -1,4 +1,4 @@
#*
/*
* 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
@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*#
#foreach ($service in $services)
$service
#end
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo;

View File

@ -0,0 +1,140 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.ComplexType;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@Namespace("ODataDemo")
@ComplexType(name = "Address",
isOpenType = false,
isAbstract = false)
public interface Address
extends Serializable {
@Property(name = "Street",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "")
String getStreet();
void setStreet(String _street);
@Property(name = "City",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "")
String getCity();
void setCity(String _city);
@Property(name = "State",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "")
String getState();
void setState(String _state);
@Property(name = "ZipCode",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "")
String getZipCode();
void setZipCode(String _zipCode);
@Property(name = "Country",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "")
String getCountry();
void setCountry(String _country);
}

View File

@ -0,0 +1,150 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.ext.proxy.api.AbstractOpenType;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
import org.apache.olingo.client.api.edm.ConcurrencyMode;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@Namespace("ODataDemo")
@EntityType(name = "Advertisement",
openType = false,
hasStream = true,
isAbstract = false)
public interface Advertisement
extends Serializable {
@Key
@Property(name = "ID",
type = "Edm.Guid",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
UUID getID();
void setID(UUID _iD);
@Property(name = "Name",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
String getName();
void setName(String _name);
@Property(name = "AirDate",
type = "Edm.DateTimeOffset",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Calendar getAirDate();
void setAirDate(Calendar _airDate);
@NavigationProperty(name = "FeaturedProduct",
type = "ODataDemo.FeaturedProduct",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "Products",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProduct getFeaturedProduct();
void setFeaturedProduct(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProduct _featuredProduct);
void setStream(java.io.InputStream stream);
java.io.InputStream getStream();
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
public interface AdvertisementCollection extends AbstractEntityCollection<Advertisement> {
}

View File

@ -0,0 +1,124 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.ext.proxy.api.AbstractOpenType;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
import org.apache.olingo.client.api.edm.ConcurrencyMode;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@Namespace("ODataDemo")
@EntityType(name = "Category",
openType = true,
hasStream = false,
isAbstract = false)
public interface Category
extends AbstractOpenType {
@Key
@Property(name = "ID",
type = "Edm.Int32",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Integer getID();
void setID(Integer _iD);
@Property(name = "Name",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
String getName();
void setName(String _name);
@NavigationProperty(name = "Products",
type = "ODataDemo.Product",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "Products",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection getProducts();
void setProducts(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection _products);
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
public interface CategoryCollection extends AbstractEntityCollection<Category> {
}

View File

@ -0,0 +1,148 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.ext.proxy.api.AbstractOpenType;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
import org.apache.olingo.client.api.edm.ConcurrencyMode;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@Namespace("ODataDemo")
@EntityType(name = "Customer",
openType = false,
hasStream = false,
isAbstract = false,
baseType = "ODataDemo.Person")
public interface Customer
extends org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person {
@Key
@Property(name = "ID",
type = "Edm.Int32",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Integer getID();
void setID(Integer _iD);
@Property(name = "Name",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
String getName();
void setName(String _name);
@Property(name = "TotalExpense",
type = "Edm.Decimal",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
BigDecimal getTotalExpense();
void setTotalExpense(BigDecimal _totalExpense);
@NavigationProperty(name = "PersonDetail",
type = "ODataDemo.PersonDetail",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "PersonDetails",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail getPersonDetail();
void setPersonDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail _personDetail);
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
public interface CustomerCollection extends AbstractEntityCollection<Customer> {
}

View File

@ -0,0 +1,194 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.ext.proxy.api.AbstractOpenType;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
import org.apache.olingo.client.api.edm.ConcurrencyMode;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@Namespace("ODataDemo")
@EntityType(name = "Employee",
openType = false,
hasStream = false,
isAbstract = false,
baseType = "ODataDemo.Person")
public interface Employee
extends org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person {
@Key
@Property(name = "ID",
type = "Edm.Int32",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Integer getID();
void setID(Integer _iD);
@Property(name = "Name",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
String getName();
void setName(String _name);
@Property(name = "EmployeeID",
type = "Edm.Int64",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Long getEmployeeID();
void setEmployeeID(Long _employeeID);
@Property(name = "HireDate",
type = "Edm.DateTimeOffset",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Calendar getHireDate();
void setHireDate(Calendar _hireDate);
@Property(name = "Salary",
type = "Edm.Single",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Float getSalary();
void setSalary(Float _salary);
@NavigationProperty(name = "PersonDetail",
type = "ODataDemo.PersonDetail",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "PersonDetails",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail getPersonDetail();
void setPersonDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail _personDetail);
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
public interface EmployeeCollection extends AbstractEntityCollection<Employee> {
}

View File

@ -0,0 +1,276 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.ext.proxy.api.AbstractOpenType;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
import org.apache.olingo.client.api.edm.ConcurrencyMode;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@Namespace("ODataDemo")
@EntityType(name = "FeaturedProduct",
openType = false,
hasStream = false,
isAbstract = false,
baseType = "ODataDemo.Product")
public interface FeaturedProduct
extends org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product {
@Key
@Property(name = "ID",
type = "Edm.Int32",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Integer getID();
void setID(Integer _iD);
@Property(name = "Name",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
String getName();
void setName(String _name);
@Property(name = "Description",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
String getDescription();
void setDescription(String _description);
@Property(name = "ReleaseDate",
type = "Edm.DateTimeOffset",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Calendar getReleaseDate();
void setReleaseDate(Calendar _releaseDate);
@Property(name = "DiscontinuedDate",
type = "Edm.DateTimeOffset",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Calendar getDiscontinuedDate();
void setDiscontinuedDate(Calendar _discontinuedDate);
@Property(name = "Rating",
type = "Edm.Int16",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Short getRating();
void setRating(Short _rating);
@Property(name = "Price",
type = "Edm.Double",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Double getPrice();
void setPrice(Double _price);
@NavigationProperty(name = "Categories",
type = "ODataDemo.Category",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "Categories",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection getCategories();
void setCategories(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection _categories);
@NavigationProperty(name = "Supplier",
type = "ODataDemo.Supplier",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "Suppliers",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier getSupplier();
void setSupplier(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier _supplier);
@NavigationProperty(name = "ProductDetail",
type = "ODataDemo.ProductDetail",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "ProductDetails",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail getProductDetail();
void setProductDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail _productDetail);
@NavigationProperty(name = "Advertisement",
type = "ODataDemo.Advertisement",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "Advertisements",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement getAdvertisement();
void setAdvertisement(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement _advertisement);
@Override
Operations operations();
interface Operations extends org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product.Operations{
}
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
public interface FeaturedProductCollection extends AbstractEntityCollection<FeaturedProduct> {
}

View File

@ -0,0 +1,124 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.ext.proxy.api.AbstractOpenType;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
import org.apache.olingo.client.api.edm.ConcurrencyMode;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@Namespace("ODataDemo")
@EntityType(name = "Person",
openType = false,
hasStream = false,
isAbstract = false)
public interface Person
extends Serializable {
@Key
@Property(name = "ID",
type = "Edm.Int32",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Integer getID();
void setID(Integer _iD);
@Property(name = "Name",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
String getName();
void setName(String _name);
@NavigationProperty(name = "PersonDetail",
type = "ODataDemo.PersonDetail",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "PersonDetails",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail getPersonDetail();
void setPersonDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail _personDetail);
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
public interface PersonCollection extends AbstractEntityCollection<Person> {
}

View File

@ -0,0 +1,224 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.ext.proxy.api.AbstractOpenType;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
import org.apache.olingo.client.api.edm.ConcurrencyMode;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@Namespace("ODataDemo")
@EntityType(name = "PersonDetail",
openType = false,
hasStream = false,
isAbstract = false)
public interface PersonDetail
extends Serializable {
@Key
@Property(name = "PersonID",
type = "Edm.Int32",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Integer getPersonID();
void setPersonID(Integer _personID);
@Property(name = "Age",
type = "Edm.Byte",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Short getAge();
void setAge(Short _age);
@Property(name = "Gender",
type = "Edm.Boolean",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Boolean getGender();
void setGender(Boolean _gender);
@Property(name = "Phone",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
String getPhone();
void setPhone(String _phone);
@Property(name = "Address",
type = "ODataDemo.Address",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address getAddress();
void setAddress(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address _address);
@Property(name = "Photo",
type = "Edm.Stream",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
java.io.InputStream getPhoto();
void setPhoto(java.io.InputStream _photo);
@NavigationProperty(name = "Person",
type = "ODataDemo.Person",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "Persons",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person getPerson();
void setPerson(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person _person);
ComplexFactory factory();
interface ComplexFactory {
@Property(name = "Address",
type = "ODataDemo.Address")
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address newAddress();
}
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
public interface PersonDetailCollection extends AbstractEntityCollection<PersonDetail> {
}

View File

@ -0,0 +1,271 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.ext.proxy.api.AbstractOpenType;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
import org.apache.olingo.client.api.edm.ConcurrencyMode;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@Namespace("ODataDemo")
@EntityType(name = "Product",
openType = false,
hasStream = false,
isAbstract = false)
public interface Product
extends Serializable {
@Key
@Property(name = "ID",
type = "Edm.Int32",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Integer getID();
void setID(Integer _iD);
@Property(name = "Name",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
String getName();
void setName(String _name);
@Property(name = "Description",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
String getDescription();
void setDescription(String _description);
@Property(name = "ReleaseDate",
type = "Edm.DateTimeOffset",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Calendar getReleaseDate();
void setReleaseDate(Calendar _releaseDate);
@Property(name = "DiscontinuedDate",
type = "Edm.DateTimeOffset",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Calendar getDiscontinuedDate();
void setDiscontinuedDate(Calendar _discontinuedDate);
@Property(name = "Rating",
type = "Edm.Int16",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Short getRating();
void setRating(Short _rating);
@Property(name = "Price",
type = "Edm.Double",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Double getPrice();
void setPrice(Double _price);
@NavigationProperty(name = "Categories",
type = "ODataDemo.Category",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "Categories",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection getCategories();
void setCategories(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection _categories);
@NavigationProperty(name = "Supplier",
type = "ODataDemo.Supplier",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "Suppliers",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier getSupplier();
void setSupplier(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier _supplier);
@NavigationProperty(name = "ProductDetail",
type = "ODataDemo.ProductDetail",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "ProductDetails",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail getProductDetail();
void setProductDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail _productDetail);
Operations operations();
interface Operations {
@Operation(name = "Discount",
type = OperationType.ACTION,
returnType = "Edm.Double")
Double discount(
@Parameter(name = "discountPercentage", type = "Edm.Int32", nullable = false) Integer discountPercentage
);
}
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
public interface ProductCollection extends AbstractEntityCollection<Product> {
}

View File

@ -0,0 +1,124 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
import org.apache.olingo.ext.proxy.api.AbstractOpenType;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
import org.apache.olingo.client.api.edm.ConcurrencyMode;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.*;
import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.*;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
import org.apache.olingo.commons.api.edm.geo.MultiLineString;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.Calendar;
import javax.xml.datatype.Duration;
@Namespace("ODataDemo")
@EntityType(name = "ProductDetail",
openType = false,
hasStream = false,
isAbstract = false)
public interface ProductDetail
extends Serializable {
@Key
@Property(name = "ProductID",
type = "Edm.Int32",
nullable = false,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
Integer getProductID();
void setProductID(Integer _productID);
@Property(name = "Details",
type = "Edm.String",
nullable = true,
defaultValue = "",
maxLenght = Integer.MAX_VALUE,
fixedLenght = false,
precision = 0,
scale = 0,
unicode = true,
collation = "",
srid = "",
concurrencyMode = ConcurrencyMode.None,
fcSourcePath = "",
fcTargetPath = "",
fcContentKind = EdmContentKind.text,
fcNSPrefix = "",
fcNSURI = "",
fcKeepInContent = false)
String getDetails();
void setDetails(String _details);
@NavigationProperty(name = "Product",
type = "ODataDemo.Product",
targetSchema = "ODataDemo",
targetContainer = "DemoService",
targetEntitySet = "Products",
containsTarget = false)
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product getProduct();
void setProduct(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product _product);
}

Some files were not shown because too many files have changed in this diff Show More