mirror of
https://github.com/apache/olingo-odata4.git
synced 2025-03-06 16:49:09 +00:00
[OLINGO-260] Instance annotations test
This commit is contained in:
parent
4a1d5ab343
commit
f59a8fb30c
@ -63,10 +63,10 @@ public final class EntityContainerFactory<C extends CommonEdmEnabledODataClient<
|
||||
final C client, final String serviceRoot) {
|
||||
|
||||
if (!FACTORY_PER_SERVICEROOT.containsKey(serviceRoot)) {
|
||||
client.getConfiguration().setDefaultPubFormat(ODataPubFormat.JSON_FULL_METADATA);
|
||||
final EntityContainerFactory<C> instance = new EntityContainerFactory<C>(client, serviceRoot);
|
||||
FACTORY_PER_SERVICEROOT.put(serviceRoot, instance);
|
||||
}
|
||||
client.getConfiguration().setDefaultPubFormat(ODataPubFormat.JSON_FULL_METADATA);
|
||||
|
||||
return (EntityContainerFactory<C>) FACTORY_PER_SERVICEROOT.get(serviceRoot);
|
||||
}
|
||||
|
@ -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 AbstractAnnotatable 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();
|
||||
|
||||
}
|
@ -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();
|
||||
|
@ -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,10 @@
|
||||
* 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.ext.proxy.api;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface AbstractTerm extends Serializable {
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Mark POJO as term.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
@Inherited
|
||||
public @interface Term {
|
||||
|
||||
String name();
|
||||
|
||||
String type();
|
||||
|
||||
String baseTerm() default "";
|
||||
}
|
@ -224,7 +224,10 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
|
||||
false);
|
||||
}
|
||||
} else {
|
||||
return CoreUtils.getValueFromProperty(client, (CommonODataProperty) result, method.getGenericReturnType(), null);
|
||||
final CommonODataProperty property = (CommonODataProperty) result;
|
||||
return property == null || property.hasNullValue()
|
||||
? null
|
||||
: CoreUtils.getObjectFromODataValue(client, property.getValue(), method.getGenericReturnType(), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.olingo.client.api.CommonEdmEnabledODataClient;
|
||||
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;
|
||||
@ -35,6 +36,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.EntityContainerFactory;
|
||||
import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
|
||||
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
|
||||
@ -141,7 +143,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
|
||||
@ -246,8 +248,12 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
|
||||
} else if (AbstractEntitySet.class.isAssignableFrom(type)) {
|
||||
navPropValue = getEntitySetProxy(type, uri);
|
||||
} else {
|
||||
final ODataRetrieveResponse<CommonODataEntity> res =
|
||||
client.getRetrieveRequestFactory().getEntityRequest(uri).execute();
|
||||
final ODataEntityRequest<CommonODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uri);
|
||||
if (client.getServiceVersion().compareTo(ODataServiceVersion.V30) > 0) {
|
||||
req.setPrefer(client.newPreferences().includeAnnotations("*"));
|
||||
}
|
||||
|
||||
final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
|
||||
|
||||
navPropValue = getEntityProxy(
|
||||
uri,
|
||||
@ -265,15 +271,16 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
|
||||
|
||||
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 void removeAdditionalProperty(final String name) {
|
||||
removePropertyChanges(name);
|
||||
attach(AttachedEntityStatus.CHANGED);
|
||||
}
|
||||
|
||||
public Object getAdditionalProperty(final String name) {
|
||||
return getPropertyValue(name, null);
|
||||
}
|
||||
@ -313,6 +320,8 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
|
||||
|
||||
protected abstract void addPropertyChanges(final String name, final Object value);
|
||||
|
||||
protected abstract void removePropertyChanges(final String name);
|
||||
|
||||
protected abstract void addLinkChanges(final NavigationProperty navProp, final Object value);
|
||||
|
||||
public abstract boolean isChanged();
|
||||
|
@ -99,7 +99,10 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
|
||||
@Override
|
||||
protected Object getPropertyValue(final String name, final Type type) {
|
||||
try {
|
||||
return CoreUtils.getValueFromProperty(client, getComplex().get(name), type, getEntityHandler());
|
||||
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);
|
||||
}
|
||||
@ -174,6 +177,11 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
|
||||
// do nothing ....
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void removePropertyChanges(final String name) {
|
||||
// do nothing ....
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addLinkChanges(final NavigationProperty navProp, final Object value) {
|
||||
// do nothing ....
|
||||
|
@ -51,6 +51,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;
|
||||
@ -240,10 +241,10 @@ class ContainerImpl implements Container {
|
||||
client.getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0
|
||||
? ((org.apache.olingo.client.api.v3.EdmEnabledODataClient) client).getCUDRequestFactory().
|
||||
getEntityUpdateRequest(handler.getEntityURI(),
|
||||
org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
|
||||
org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
|
||||
: ((org.apache.olingo.client.api.v4.EdmEnabledODataClient) client).getCUDRequestFactory().
|
||||
getEntityUpdateRequest(handler.getEntityURI(),
|
||||
org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
|
||||
org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
|
||||
|
||||
req.setPrefer(new ODataPreferences(client.getServiceVersion()).returnContent());
|
||||
|
||||
@ -266,10 +267,10 @@ class ContainerImpl implements Container {
|
||||
client.getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0
|
||||
? ((org.apache.olingo.client.api.v3.EdmEnabledODataClient) client).getCUDRequestFactory().
|
||||
getEntityUpdateRequest(uri,
|
||||
org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
|
||||
org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
|
||||
: ((org.apache.olingo.client.api.v4.EdmEnabledODataClient) client).getCUDRequestFactory().
|
||||
getEntityUpdateRequest(uri,
|
||||
org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
|
||||
org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
|
||||
|
||||
req.setPrefer(new ODataPreferences(client.getServiceVersion()).returnContent());
|
||||
|
||||
@ -316,6 +317,11 @@ class ContainerImpl implements Container {
|
||||
if (AttachedEntityStatus.DELETED != currentStatus) {
|
||||
entity.getProperties().clear();
|
||||
CoreUtils.addProperties(client, handler.getPropertyChanges(), entity);
|
||||
|
||||
if (entity instanceof ODataEntity) {
|
||||
((ODataEntity) entity).getAnnotations().clear();
|
||||
CoreUtils.addAnnotations(client, handler.getAnnotations(), (ODataEntity) entity);
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<NavigationProperty, Object> property : handler.getLinkChanges().entrySet()) {
|
||||
@ -395,7 +401,7 @@ class ContainerImpl implements Container {
|
||||
final URI targetURI = currentStatus == AttachedEntityStatus.NEW
|
||||
? URI.create("$" + startingPos + "/$value")
|
||||
: URIUtils.getURI(
|
||||
factory.getServiceRoot(), handler.getEntity().getEditLink().toASCIIString() + "/$value");
|
||||
factory.getServiceRoot(), handler.getEntity().getEditLink().toASCIIString() + "/$value");
|
||||
|
||||
batchUpdateMediaEntity(handler, targetURI, handler.getStreamChanges(), changeset);
|
||||
|
||||
@ -408,8 +414,8 @@ class ContainerImpl implements Container {
|
||||
for (Map.Entry<String, InputStream> streamedChanges : handler.getStreamedPropertyChanges().entrySet()) {
|
||||
final URI targetURI = currentStatus == AttachedEntityStatus.NEW
|
||||
? URI.create("$" + startingPos) : URIUtils.getURI(
|
||||
factory.getServiceRoot(),
|
||||
CoreUtils.getMediaEditLink(streamedChanges.getKey(), entity).toASCIIString());
|
||||
factory.getServiceRoot(),
|
||||
CoreUtils.getMediaEditLink(streamedChanges.getKey(), entity).toASCIIString());
|
||||
|
||||
batchUpdateMediaResource(handler, targetURI, streamedChanges.getValue(), changeset);
|
||||
|
||||
|
@ -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(client, 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);
|
||||
}
|
||||
}
|
||||
|
@ -39,11 +39,16 @@ 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.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;
|
||||
@ -54,15 +59,18 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
|
||||
|
||||
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;
|
||||
|
||||
@ -127,6 +135,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
|
||||
this.linkChanges.clear();
|
||||
this.propertiesTag = 0;
|
||||
this.linksTag = 0;
|
||||
this.annotations.clear();
|
||||
}
|
||||
|
||||
public EntityUUID getUUID() {
|
||||
@ -175,6 +184,10 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
|
||||
return linkChanges;
|
||||
}
|
||||
|
||||
public Map<Class<? extends AbstractTerm>, Object> getAnnotations() {
|
||||
return annotations;
|
||||
}
|
||||
|
||||
private void updatePropertiesTag(final int checkpoint) {
|
||||
if (checkpoint == propertiesTag) {
|
||||
propertiesTag = propertyChanges.hashCode();
|
||||
@ -199,10 +212,12 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
|
||||
if (propertyChanges.containsKey(name)) {
|
||||
res = propertyChanges.get(name);
|
||||
} else {
|
||||
res = CoreUtils.getValueFromProperty(client, property, type, this);
|
||||
res = property == null || property.hasNullValue()
|
||||
? null
|
||||
: CoreUtils.getObjectFromODataValue(client, property.getValue(), type, this);
|
||||
|
||||
if (res != null) {
|
||||
chacheProperty(name, res);
|
||||
cacheProperty(name, res);
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,15 +253,14 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void setPropertyValue(final Property property, final Object value) {
|
||||
if (property.type().equalsIgnoreCase("Edm." + EdmPrimitiveTypeKind.Stream.toString())) {
|
||||
if (EdmPrimitiveTypeKind.Stream.getFullQualifiedName().toString().equalsIgnoreCase(property.type())) {
|
||||
setStreamedProperty(property, (InputStream) value);
|
||||
} else {
|
||||
addPropertyChanges(property.name(), value);
|
||||
|
||||
if (value != null) {
|
||||
final Collection<?> coll;
|
||||
Collection<?> coll;
|
||||
if (Collection.class.isAssignableFrom(value.getClass())) {
|
||||
coll = Collection.class.cast(value);
|
||||
} else {
|
||||
@ -364,7 +378,12 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
|
||||
propertyChanges.put(name, value);
|
||||
}
|
||||
|
||||
protected void chacheProperty(final String name, final Object value) {
|
||||
@Override
|
||||
protected void removePropertyChanges(final String name) {
|
||||
propertyChanges.remove(name);
|
||||
}
|
||||
|
||||
protected void cacheProperty(final String name, final Object value) {
|
||||
final int checkpoint = propertyChanges.hashCode();
|
||||
propertyChanges.put(name, value);
|
||||
updatePropertiesTag(checkpoint);
|
||||
@ -381,6 +400,70 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
|
||||
updateLinksTag(checkpoint);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public void removeAnnotation(final Class<? extends AbstractTerm> term) {
|
||||
this.annotations.remove(term);
|
||||
}
|
||||
|
||||
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(client, 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;
|
||||
}
|
||||
|
||||
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();
|
||||
|
@ -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;
|
||||
@ -254,8 +259,13 @@ class EntitySetInvocationHandler<
|
||||
|
||||
LOG.debug("GET {}", uriBuilder.toString());
|
||||
|
||||
final ODataRetrieveResponse<CommonODataEntity> res =
|
||||
client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()).execute();
|
||||
final ODataEntityRequest<CommonODataEntity> req =
|
||||
client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
|
||||
if (client.getServiceVersion().compareTo(ODataServiceVersion.V30) > 0) {
|
||||
req.setPrefer(client.newPreferences().includeAnnotations("*"));
|
||||
}
|
||||
|
||||
final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
|
||||
|
||||
final String etag = res.getETag();
|
||||
final CommonODataEntity entity = res.getBody();
|
||||
@ -282,9 +292,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 =
|
||||
@ -293,12 +306,20 @@ class EntitySetInvocationHandler<
|
||||
entities.add(res.getBody());
|
||||
next = null;
|
||||
} else {
|
||||
final ODataRetrieveResponse<CommonODataEntitySet> res =
|
||||
client.getRetrieveRequestFactory().getEntitySetRequest(uri).execute();
|
||||
final ODataEntitySetRequest<CommonODataEntitySet> req =
|
||||
client.getRetrieveRequestFactory().getEntitySetRequest(uri);
|
||||
if (client.getServiceVersion().compareTo(ODataServiceVersion.V30) > 0) {
|
||||
req.setPrefer(client.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());
|
||||
@ -316,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")
|
||||
@ -324,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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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.ODataAnnotation;
|
||||
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
|
||||
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;
|
||||
@ -189,48 +194,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 +303,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(), property.getKey(), property.getValue()));
|
||||
getODataEntityProperty(client, entity.getTypeName(), entry.getKey(), entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
public static void addAnnotations(
|
||||
final CommonEdmEnabledODataClient<?> client,
|
||||
final Map<Class<? extends AbstractTerm>, Object> annotations,
|
||||
final ODataEntity entity) {
|
||||
|
||||
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 {
|
||||
entity.getAnnotations().add(getODataAnnotation(
|
||||
client, term.getFullQualifiedName().toString(), term.getType(), entry.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -426,7 +455,7 @@ public final class CoreUtils {
|
||||
Thread.currentThread().getContextClassLoader(),
|
||||
new Class<?>[] {getter.getReturnType()},
|
||||
ComplexInvocationHandler.getInstance(
|
||||
client, property.getName(), getter.getReturnType(), null));
|
||||
client, property.getName(), getter.getReturnType(), null));
|
||||
|
||||
populate(client, complex, Property.class, property.getValue().asComplex().iterator());
|
||||
setPropertyValue(bean, getter, complex);
|
||||
@ -451,7 +480,7 @@ public final class CoreUtils {
|
||||
Thread.currentThread().getContextClassLoader(),
|
||||
new Class<?>[] {collItemClass},
|
||||
ComplexInvocationHandler.getInstance(
|
||||
client, property.getName(), collItemClass, null));
|
||||
client, property.getName(), collItemClass, null));
|
||||
|
||||
populate(client, collItem, Property.class, value.asComplex().iterator());
|
||||
collection.add(collItem);
|
||||
@ -467,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 {
|
||||
@ -487,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));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
private static Class<?> getComplexTypeRef(final CommonODataProperty property) {
|
||||
return getTypeRef(property, "META-INF/" + Constants.PROXY_COMPLEX_CLASS_LIST, ComplexType.class);
|
||||
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) {
|
||||
|
||||
@ -549,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) {
|
||||
@ -557,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)
|
||||
? EnumType.class.cast(ann).name()
|
||||
: ComplexType.class.cast(ann).name()).toString())) {
|
||||
return clazz;
|
||||
}
|
||||
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) {
|
||||
|
@ -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');
|
||||
@ -275,7 +284,7 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
|
||||
|| edm.getEntityType(complex.getBaseType().getFullQualifiedName()).
|
||||
getNavigationProperty(navPropName) == null)
|
||||
&& navProp.containsTarget()) {
|
||||
|
||||
|
||||
objs.clear();
|
||||
objs.put("navProp", navProp);
|
||||
parseObj(base, pkg, "containedEntitySet",
|
||||
@ -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(
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -28,6 +28,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.AbstractAnnotatable;
|
||||
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 +63,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 AbstractAnnotatable,#if( $entityType.getBaseType() )$utility.getJavaType($entityType.getBaseType())#{elseif}( $entityType.isOpenType() )AbstractOpenType#{else}Serializable#end {
|
||||
|
||||
#set( $keys = [] )
|
||||
#foreach($key in $entityType.KeyPropertyRefs)
|
||||
|
34
ext/pojogen-maven-plugin/src/main/resources/term.vm
Normal file
34
ext/pojogen-maven-plugin/src/main/resources/term.vm
Normal 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 {
|
||||
}
|
@ -20,8 +20,12 @@ package org.apache.olingo.fit.proxy.v4;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
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 +46,18 @@ 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());
|
||||
final Object isBoss = boss.getAnnotation(IsBoss.class);
|
||||
assertTrue(isBoss instanceof Boolean);
|
||||
assertTrue((Boolean) isBoss);
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface Account
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface AccountCollection extends AbstractEntityCollection<Account> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface Asset
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface AssetCollection extends AbstractEntityCollection<Asset> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface Club
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface ClubCollection extends AbstractEntityCollection<Club> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface Company
|
||||
extends AbstractOpenType {
|
||||
extends AbstractAnnotatable,AbstractOpenType {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface CompanyCollection extends AbstractEntityCollection<Company> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -58,7 +59,7 @@ import javax.xml.datatype.Duration;
|
||||
isAbstract = false,
|
||||
baseType = "Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument")
|
||||
public interface CreditCardPI
|
||||
extends org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument {
|
||||
extends AbstractAnnotatable,org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface CreditCardPICollection extends AbstractEntityCollection<CreditCardPI> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface CreditRecord
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface CreditRecordCollection extends AbstractEntityCollection<CreditRecord> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -58,7 +59,7 @@ import javax.xml.datatype.Duration;
|
||||
isAbstract = false,
|
||||
baseType = "Microsoft.Test.OData.Services.ODataWCFService.Person")
|
||||
public interface Customer
|
||||
extends org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person {
|
||||
extends AbstractAnnotatable,org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface CustomerCollection extends AbstractEntityCollection<Customer> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface Department
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface DepartmentCollection extends AbstractEntityCollection<Department> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -58,7 +59,7 @@ import javax.xml.datatype.Duration;
|
||||
isAbstract = false,
|
||||
baseType = "Microsoft.Test.OData.Services.ODataWCFService.Person")
|
||||
public interface Employee
|
||||
extends org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person {
|
||||
extends AbstractAnnotatable,org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface EmployeeCollection extends AbstractEntityCollection<Employee> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface GiftCard
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface GiftCardCollection extends AbstractEntityCollection<GiftCard> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
|
||||
|
||||
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;
|
||||
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.*;
|
||||
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.*;
|
||||
|
||||
@Namespace("Microsoft.Test.OData.Services.ODataWCFService")
|
||||
@Term(name = "IsBoss",
|
||||
type="Edm.Boolean")
|
||||
public interface IsBoss extends AbstractTerm {
|
||||
}
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface LabourUnion
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface LabourUnionCollection extends AbstractEntityCollection<LabourUnion> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface Order
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface OrderCollection extends AbstractEntityCollection<Order> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface OrderDetail
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface OrderDetailCollection extends AbstractEntityCollection<OrderDetail> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface PaymentInstrument
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface PaymentInstrumentCollection extends AbstractEntityCollection<PaymentInstrument> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface Person
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface PersonCollection extends AbstractEntityCollection<Person> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface Product
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -56,4 +57,8 @@ public interface ProductCollection extends AbstractEntityCollection<Product> {
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface ProductDetail
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface ProductDetailCollection extends AbstractEntityCollection<ProductDetail> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface ProductReview
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface ProductReviewCollection extends AbstractEntityCollection<ProductReview> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -58,7 +59,7 @@ import javax.xml.datatype.Duration;
|
||||
isAbstract = false,
|
||||
baseType = "Microsoft.Test.OData.Services.ODataWCFService.Company")
|
||||
public interface PublicCompany
|
||||
extends org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company {
|
||||
extends AbstractAnnotatable,org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface PublicCompanyCollection extends AbstractEntityCollection<PublicCompany> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface Statement
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface StatementCollection extends AbstractEntityCollection<Statement> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface StoredPI
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface StoredPICollection extends AbstractEntityCollection<StoredPI> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -27,6 +27,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.AbstractAnnotatable;
|
||||
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;
|
||||
@ -57,7 +58,7 @@ import javax.xml.datatype.Duration;
|
||||
hasStream = false,
|
||||
isAbstract = false)
|
||||
public interface Subscription
|
||||
extends Serializable {
|
||||
extends AbstractAnnotatable,Serializable {
|
||||
|
||||
|
||||
@Key
|
||||
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.servic
|
||||
|
||||
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;
|
||||
@ -43,4 +44,8 @@ import java.util.Calendar;
|
||||
import javax.xml.datatype.Duration;
|
||||
|
||||
public interface SubscriptionCollection extends AbstractEntityCollection<Subscription> {
|
||||
|
||||
Object getAnnotation(Class<? extends AbstractTerm> term);
|
||||
|
||||
Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.IsBoss
|
@ -35,6 +35,8 @@ public interface Constants {
|
||||
|
||||
public final static Integer DEFAULT_SCALE = 25;
|
||||
|
||||
public final static String PROXY_TERM_CLASS_LIST = "org.apache.olingo.ext.proxy.term";
|
||||
|
||||
public final static String PROXY_ENUM_CLASS_LIST = "org.apache.olingo.ext.proxy.enum";
|
||||
|
||||
public final static String PROXY_COMPLEX_CLASS_LIST = "org.apache.olingo.ext.proxy.complex";
|
||||
|
Loading…
x
Reference in New Issue
Block a user