[OLINGO-575] Delete unnecessary casts
This commit is contained in:
parent
9a666bd957
commit
f46364072a
|
@ -36,7 +36,6 @@ import org.apache.olingo.client.api.uri.QueryOption;
|
||||||
import org.apache.olingo.client.api.uri.URIBuilder;
|
import org.apache.olingo.client.api.uri.URIBuilder;
|
||||||
import org.apache.olingo.client.api.uri.URIFilter;
|
import org.apache.olingo.client.api.uri.URIFilter;
|
||||||
import org.apache.olingo.commons.api.domain.ODataAnnotation;
|
import org.apache.olingo.commons.api.domain.ODataAnnotation;
|
||||||
import org.apache.olingo.commons.api.domain.ODataEntity;
|
|
||||||
import org.apache.olingo.ext.proxy.AbstractService;
|
import org.apache.olingo.ext.proxy.AbstractService;
|
||||||
import org.apache.olingo.ext.proxy.api.AbstractTerm;
|
import org.apache.olingo.ext.proxy.api.AbstractTerm;
|
||||||
import org.apache.olingo.ext.proxy.api.EntityType;
|
import org.apache.olingo.ext.proxy.api.EntityType;
|
||||||
|
@ -182,7 +181,7 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
|
||||||
public <ET extends EntityType<?>> boolean addRef(final ET element) {
|
public <ET extends EntityType<?>> boolean addRef(final ET element) {
|
||||||
if (element instanceof Proxy && Proxy.getInvocationHandler(element) instanceof EntityInvocationHandler) {
|
if (element instanceof Proxy && Proxy.getInvocationHandler(element) instanceof EntityInvocationHandler) {
|
||||||
final EntityInvocationHandler handler = EntityInvocationHandler.class.cast(Proxy.getInvocationHandler(element));
|
final EntityInvocationHandler handler = EntityInvocationHandler.class.cast(Proxy.getInvocationHandler(element));
|
||||||
final URI id = ((ODataEntity) handler.getEntity()).getId();
|
final URI id = handler.getEntity().getId();
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +194,7 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refs() {
|
public void refs() {
|
||||||
((URIBuilder) this.uri).appendRefSegment();
|
this.uri.appendRefSegment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.apache.olingo.client.api.uri.URIBuilder;
|
||||||
import org.apache.olingo.commons.api.domain.ODataAnnotation;
|
import org.apache.olingo.commons.api.domain.ODataAnnotation;
|
||||||
import org.apache.olingo.commons.api.domain.ODataEntity;
|
import org.apache.olingo.commons.api.domain.ODataEntity;
|
||||||
import org.apache.olingo.commons.api.domain.ODataEntitySet;
|
import org.apache.olingo.commons.api.domain.ODataEntitySet;
|
||||||
|
import org.apache.olingo.commons.api.domain.ODataSingleton;
|
||||||
import org.apache.olingo.ext.proxy.AbstractService;
|
import org.apache.olingo.ext.proxy.AbstractService;
|
||||||
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
|
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
|
||||||
import org.apache.olingo.ext.proxy.api.AbstractSingleton;
|
import org.apache.olingo.ext.proxy.api.AbstractSingleton;
|
||||||
|
@ -100,7 +101,7 @@ public abstract class AbstractEntityCollectionInvocationHandler<T extends Entity
|
||||||
final List<ODataAnnotation> anns = new ArrayList<ODataAnnotation>();
|
final List<ODataAnnotation> anns = new ArrayList<ODataAnnotation>();
|
||||||
|
|
||||||
if (isSingleton) {
|
if (isSingleton) {
|
||||||
final ODataRetrieveResponse<org.apache.olingo.commons.api.domain.ODataSingleton> res =
|
final ODataRetrieveResponse<ODataSingleton> res =
|
||||||
((ODataClient) getClient()).getRetrieveRequestFactory().getSingletonRequest(uri).execute();
|
((ODataClient) getClient()).getRetrieveRequestFactory().getSingletonRequest(uri).execute();
|
||||||
|
|
||||||
entities.add(res.getBody());
|
entities.add(res.getBody());
|
||||||
|
@ -115,9 +116,7 @@ public abstract class AbstractEntityCollectionInvocationHandler<T extends Entity
|
||||||
final ODataEntitySet entitySet = res.getBody();
|
final ODataEntitySet entitySet = res.getBody();
|
||||||
entities.addAll(entitySet.getEntities());
|
entities.addAll(entitySet.getEntities());
|
||||||
next = entitySet.getNext();
|
next = entitySet.getNext();
|
||||||
if (entitySet instanceof ODataEntitySet) {
|
anns.addAll(entitySet.getAnnotations());
|
||||||
anns.addAll(((ODataEntitySet) entitySet).getAnnotations());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<T> res = new ArrayList<T>(entities.size());
|
final List<T> res = new ArrayList<T>(entities.size());
|
||||||
|
|
|
@ -156,14 +156,12 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
|
||||||
entity.getProperties().clear();
|
entity.getProperties().clear();
|
||||||
CoreUtils.addProperties(service.getClient(), handler.getPropertyChanges(), entity);
|
CoreUtils.addProperties(service.getClient(), handler.getPropertyChanges(), entity);
|
||||||
|
|
||||||
if (entity instanceof ODataEntity) {
|
entity.getAnnotations().clear();
|
||||||
((ODataEntity) entity).getAnnotations().clear();
|
CoreUtils.addAnnotations(service.getClient(), handler.getAnnotations(), entity);
|
||||||
CoreUtils.addAnnotations(service.getClient(), handler.getAnnotations(), (ODataEntity) entity);
|
|
||||||
|
|
||||||
for (Map.Entry<String, AnnotatableInvocationHandler> entry : handler.getPropAnnotatableHandlers().entrySet()) {
|
for (Map.Entry<String, AnnotatableInvocationHandler> entry : handler.getPropAnnotatableHandlers().entrySet()) {
|
||||||
CoreUtils.addAnnotations(service.getClient(),
|
CoreUtils.addAnnotations(service.getClient(),
|
||||||
entry.getValue().getAnnotations(), ((ODataEntity) entity).getProperty(entry.getKey()));
|
entry.getValue().getAnnotations(), entity.getProperty(entry.getKey()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,13 +233,11 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof ODataEntity) {
|
for (Map.Entry<String, AnnotatableInvocationHandler> entry : handler.getNavPropAnnotatableHandlers().entrySet()) {
|
||||||
for (Map.Entry<String, AnnotatableInvocationHandler> entry : handler.getNavPropAnnotatableHandlers().entrySet()) {
|
|
||||||
|
|
||||||
CoreUtils.addAnnotations(service.getClient(),
|
CoreUtils.addAnnotations(service.getClient(),
|
||||||
entry.getValue().getAnnotations(),
|
entry.getValue().getAnnotations(),
|
||||||
(org.apache.olingo.commons.api.domain.ODataLink) entity.getNavigationLink(entry.getKey()));
|
entity.getNavigationLink(entry.getKey()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final AttachedEntityStatus processedStatus = queue(handler, entity, changeset);
|
final AttachedEntityStatus processedStatus = queue(handler, entity, changeset);
|
||||||
|
|
|
@ -633,7 +633,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refs() {
|
public void refs() {
|
||||||
((URIBuilder) this.uri).appendRefSegment();
|
this.uri.appendRefSegment();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearQueryOptions() {
|
public void clearQueryOptions() {
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
@ -51,14 +51,14 @@ public class AnnotatableInvocationHandler extends AbstractInvocationHandler impl
|
||||||
private final AbstractStructuredInvocationHandler targetHandler;
|
private final AbstractStructuredInvocationHandler targetHandler;
|
||||||
|
|
||||||
private final Map<Class<? extends AbstractTerm>, Object> annotations =
|
private final Map<Class<? extends AbstractTerm>, Object> annotations =
|
||||||
new HashMap<Class<? extends AbstractTerm>, Object>();
|
new HashMap<Class<? extends AbstractTerm>, Object>();
|
||||||
|
|
||||||
public AnnotatableInvocationHandler(
|
public AnnotatableInvocationHandler(
|
||||||
final AbstractService<?> service,
|
final AbstractService<?> service,
|
||||||
final String propName,
|
final String propName,
|
||||||
final String navPropName,
|
final String navPropName,
|
||||||
final EntityInvocationHandler entityHandler,
|
final EntityInvocationHandler entityHandler,
|
||||||
final AbstractStructuredInvocationHandler targetHandler) {
|
final AbstractStructuredInvocationHandler targetHandler) {
|
||||||
|
|
||||||
super(service);
|
super(service);
|
||||||
|
|
||||||
|
@ -78,20 +78,16 @@ public class AnnotatableInvocationHandler extends AbstractInvocationHandler impl
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ODataAnnotation> internalAnnotations() {
|
private List<ODataAnnotation> internalAnnotations() {
|
||||||
List<ODataAnnotation> result = Collections.<ODataAnnotation>emptyList();
|
List<ODataAnnotation> result = Collections.<ODataAnnotation> emptyList();
|
||||||
|
|
||||||
if (entityHandler.getEntity() instanceof ODataEntity) {
|
if (targetHandler.getInternal() instanceof ODataEntity) {
|
||||||
if (targetHandler.getInternal() instanceof ODataEntity) {
|
result = propName == null
|
||||||
result = propName == null
|
? ((ODataEntity) targetHandler.getInternal()).getNavigationLink(navPropName).getAnnotations()
|
||||||
? ((org.apache.olingo.commons.api.domain.ODataLink) ((ODataEntity) targetHandler.getInternal()).
|
: ((ODataEntity) targetHandler.getInternal()).getProperty(propName).getAnnotations();
|
||||||
getNavigationLink(navPropName)).getAnnotations()
|
} else if (targetHandler.getInternal() instanceof ODataComplexValue) {
|
||||||
: ((ODataEntity) targetHandler.getInternal()).getProperty(propName).getAnnotations();
|
result = propName == null
|
||||||
} else if (targetHandler.getInternal() instanceof ODataComplexValue) {
|
? ((ODataComplexValue) targetHandler.getInternal()).getNavigationLink(navPropName).getAnnotations()
|
||||||
result = propName == null
|
: ((ODataComplexValue) targetHandler.getInternal()).get(propName).getAnnotations();
|
||||||
? ((org.apache.olingo.commons.api.domain.ODataLink) ((ODataComplexValue) targetHandler.
|
|
||||||
getInternal()).getNavigationLink(navPropName)).getAnnotations()
|
|
||||||
: ((ODataComplexValue) targetHandler.getInternal()).get(propName).getAnnotations();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -113,7 +109,7 @@ public class AnnotatableInvocationHandler extends AbstractInvocationHandler impl
|
||||||
if (item instanceof Proxy) {
|
if (item instanceof Proxy) {
|
||||||
final InvocationHandler handler = Proxy.getInvocationHandler(item);
|
final InvocationHandler handler = Proxy.getInvocationHandler(item);
|
||||||
if ((handler instanceof ComplexInvocationHandler)
|
if ((handler instanceof ComplexInvocationHandler)
|
||||||
&& ((ComplexInvocationHandler) handler).getEntityHandler() == null) {
|
&& ((ComplexInvocationHandler) handler).getEntityHandler() == null) {
|
||||||
((ComplexInvocationHandler) handler).setEntityHandler(entityHandler);
|
((ComplexInvocationHandler) handler).setEntityHandler(entityHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +142,7 @@ public class AnnotatableInvocationHandler extends AbstractInvocationHandler impl
|
||||||
|
|
||||||
if (annotations.containsKey(term)) {
|
if (annotations.containsKey(term)) {
|
||||||
res = annotations.get(term);
|
res = annotations.get(term);
|
||||||
} else if (entityHandler.getEntity() instanceof ODataEntity) {
|
} else {
|
||||||
try {
|
try {
|
||||||
final Term termAnn = term.getAnnotation(Term.class);
|
final Term termAnn = term.getAnnotation(Term.class);
|
||||||
final Namespace namespaceAnn = term.getAnnotation(Namespace.class);
|
final Namespace namespaceAnn = term.getAnnotation(Namespace.class);
|
||||||
|
@ -157,8 +153,8 @@ public class AnnotatableInvocationHandler extends AbstractInvocationHandler impl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res = annotation == null || annotation.hasNullValue()
|
res = annotation == null || annotation.hasNullValue()
|
||||||
? null
|
? null
|
||||||
: CoreUtils.getObjectFromODataValue(annotation.getValue(), null, targetHandler.service);
|
: CoreUtils.getObjectFromODataValue(annotation.getValue(), null, targetHandler.service);
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
annotations.put(term, res);
|
annotations.put(term, res);
|
||||||
}
|
}
|
||||||
|
@ -172,8 +168,6 @@ public class AnnotatableInvocationHandler extends AbstractInvocationHandler impl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Class<? extends AbstractTerm>> readAnnotationTerms() {
|
public Collection<Class<? extends AbstractTerm>> readAnnotationTerms() {
|
||||||
return entityHandler.getEntity() instanceof ODataEntity
|
return CoreUtils.getAnnotationTerms(service, internalAnnotations());
|
||||||
? CoreUtils.getAnnotationTerms(service, internalAnnotations())
|
|
||||||
: Collections.<Class<? extends AbstractTerm>>emptyList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,12 +410,12 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
|
||||||
|
|
||||||
if (annotations.containsKey(term)) {
|
if (annotations.containsKey(term)) {
|
||||||
res = annotations.get(term);
|
res = annotations.get(term);
|
||||||
} else if (getEntity() instanceof ODataEntity) {
|
} else {
|
||||||
try {
|
try {
|
||||||
final Term termAnn = term.getAnnotation(Term.class);
|
final Term termAnn = term.getAnnotation(Term.class);
|
||||||
final Namespace namespaceAnn = term.getAnnotation(Namespace.class);
|
final Namespace namespaceAnn = term.getAnnotation(Namespace.class);
|
||||||
ODataAnnotation annotation = null;
|
ODataAnnotation annotation = null;
|
||||||
for (ODataAnnotation _annotation : ((ODataEntity) getEntity()).getAnnotations()) {
|
for (ODataAnnotation _annotation : getEntity().getAnnotations()) {
|
||||||
if ((namespaceAnn.value() + "." + termAnn.name()).equals(_annotation.getTerm())) {
|
if ((namespaceAnn.value() + "." + termAnn.name()).equals(_annotation.getTerm())) {
|
||||||
annotation = _annotation;
|
annotation = _annotation;
|
||||||
}
|
}
|
||||||
|
@ -436,9 +436,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Class<? extends AbstractTerm>> readAnnotationTerms() {
|
public Collection<Class<? extends AbstractTerm>> readAnnotationTerms() {
|
||||||
return getEntity() instanceof ODataEntity
|
return CoreUtils.getAnnotationTerms(service, getEntity().getAnnotations());
|
||||||
? CoreUtils.getAnnotationTerms(service, ((ODataEntity) getEntity()).getAnnotations())
|
|
||||||
: Collections.<Class<? extends AbstractTerm>> emptyList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -450,7 +448,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
|
||||||
final ODataEntityRequest<ODataEntity> req =
|
final ODataEntityRequest<ODataEntity> req =
|
||||||
getClient().getRetrieveRequestFactory().getEntityRequest(uri.build());
|
getClient().getRetrieveRequestFactory().getEntityRequest(uri.build());
|
||||||
|
|
||||||
req.setPrefer(getClient().newPreferences().includeAnnotations("*"));
|
req.setPrefer(getClient().newPreferences().includeAnnotations("*"));
|
||||||
|
|
||||||
final ODataRetrieveResponse<ODataEntity> res = req.execute();
|
final ODataRetrieveResponse<ODataEntity> res = req.execute();
|
||||||
|
|
||||||
|
@ -492,7 +490,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
|
||||||
|
|
||||||
// use read- instead of get- for .invoke() to distinguish it from entity property getter.
|
// use read- instead of get- for .invoke() to distinguish it from entity property getter.
|
||||||
public String readEntityReferenceID() {
|
public String readEntityReferenceID() {
|
||||||
URI id = getEntity() == null ? null : ((ODataEntity) getEntity()).getId();
|
URI id = getEntity() == null ? null : getEntity().getId();
|
||||||
|
|
||||||
return id == null ? null : id.toASCIIString();
|
return id == null ? null : id.toASCIIString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.Triple;
|
import org.apache.commons.lang3.tuple.Triple;
|
||||||
import org.apache.olingo.client.api.EdmEnabledODataClient;
|
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
|
||||||
import org.apache.olingo.client.api.uri.URIBuilder;
|
import org.apache.olingo.client.api.uri.URIBuilder;
|
||||||
import org.apache.olingo.commons.api.domain.ODataAnnotation;
|
import org.apache.olingo.commons.api.domain.ODataAnnotation;
|
||||||
|
@ -196,14 +195,14 @@ public class EntitySetInvocationHandler<
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Search<T, EC> createSearch() {
|
public Search<T, EC> createSearch() {
|
||||||
return new SearchImpl<T, EC>((EdmEnabledODataClient) getClient(), this.collItemRef, this.baseURI, this);
|
return new SearchImpl<T, EC>(getClient(), this.collItemRef, this.baseURI, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <S extends T, SEC extends EntityCollection<S, ?, ?>> Search<S, SEC> createSearch(final Class<SEC> reference) {
|
public <S extends T, SEC extends EntityCollection<S, ?, ?>> Search<S, SEC> createSearch(final Class<SEC> reference) {
|
||||||
return new SearchImpl<S, SEC>(
|
return new SearchImpl<S, SEC>(
|
||||||
(EdmEnabledODataClient) getClient(),
|
getClient(),
|
||||||
reference,
|
reference,
|
||||||
baseURI,
|
baseURI,
|
||||||
(EntitySetInvocationHandler<S, ?, SEC>) this);
|
(EntitySetInvocationHandler<S, ?, SEC>) this);
|
||||||
|
|
|
@ -46,7 +46,6 @@ import org.apache.olingo.commons.api.domain.ODataComplexValue;
|
||||||
import org.apache.olingo.commons.api.domain.ODataEntity;
|
import org.apache.olingo.commons.api.domain.ODataEntity;
|
||||||
import org.apache.olingo.commons.api.domain.ODataEnumValue;
|
import org.apache.olingo.commons.api.domain.ODataEnumValue;
|
||||||
import org.apache.olingo.commons.api.domain.ODataLink;
|
import org.apache.olingo.commons.api.domain.ODataLink;
|
||||||
import org.apache.olingo.commons.api.domain.ODataObjectFactory;
|
|
||||||
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
|
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
|
||||||
import org.apache.olingo.commons.api.domain.ODataProperty;
|
import org.apache.olingo.commons.api.domain.ODataProperty;
|
||||||
import org.apache.olingo.commons.api.domain.ODataValue;
|
import org.apache.olingo.commons.api.domain.ODataValue;
|
||||||
|
@ -106,8 +105,7 @@ public final class CoreUtils {
|
||||||
if (intType.isPrimitiveType()) {
|
if (intType.isPrimitiveType()) {
|
||||||
value.asCollection().add(getODataValue(client, intType, collectionItem).asPrimitive());
|
value.asCollection().add(getODataValue(client, intType, collectionItem).asPrimitive());
|
||||||
} else if (intType.isEnumType()) {
|
} else if (intType.isEnumType()) {
|
||||||
value.asCollection().add(((org.apache.olingo.commons.api.domain.ODataValue) getODataValue(
|
value.asCollection().add((getODataValue(client, intType, collectionItem)).asEnum());
|
||||||
client, intType, collectionItem)).asEnum());
|
|
||||||
} else if (intType.isComplexType()) {
|
} else if (intType.isComplexType()) {
|
||||||
value.asCollection().add(getODataValue(client, intType, collectionItem).asComplex());
|
value.asCollection().add(getODataValue(client, intType, collectionItem).asComplex());
|
||||||
} else {
|
} else {
|
||||||
|
@ -139,8 +137,7 @@ public final class CoreUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (type.isEnumType()) {
|
} else if (type.isEnumType()) {
|
||||||
value = ((org.apache.olingo.commons.api.domain.ODataObjectFactory) client.getObjectFactory()).
|
value = client.getObjectFactory().newEnumValue(type.getFullQualifiedName().toString(), ((Enum<?>) obj).name());
|
||||||
newEnumValue(type.getFullQualifiedName().toString(), ((Enum<?>) obj).name());
|
|
||||||
} else {
|
} else {
|
||||||
value = client.getObjectFactory().newPrimitiveValueBuilder().setType(type.getPrimitiveTypeKind()).setValue(obj).
|
value = client.getObjectFactory().newPrimitiveValueBuilder().setType(type.getPrimitiveTypeKind()).setValue(obj).
|
||||||
build();
|
build();
|
||||||
|
@ -204,8 +201,7 @@ public final class CoreUtils {
|
||||||
: new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).
|
: new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).
|
||||||
setTypeExpression(type.getFullQualifiedName().toString()).build();
|
setTypeExpression(type.getFullQualifiedName().toString()).build();
|
||||||
|
|
||||||
annotation = new ODataAnnotationImpl(term,
|
annotation = new ODataAnnotationImpl(term, getODataValue(client, valueType, obj));
|
||||||
(org.apache.olingo.commons.api.domain.ODataValue) getODataValue(client, valueType, obj));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return annotation;
|
return annotation;
|
||||||
|
@ -232,8 +228,7 @@ public final class CoreUtils {
|
||||||
} else if (valueType.isComplexType()) {
|
} else if (valueType.isComplexType()) {
|
||||||
property = client.getObjectFactory().newComplexProperty(name, value.asComplex());
|
property = client.getObjectFactory().newComplexProperty(name, value.asComplex());
|
||||||
} else if (valueType.isEnumType()) {
|
} else if (valueType.isEnumType()) {
|
||||||
property = ((ODataObjectFactory) client.getObjectFactory()).newEnumProperty(name,
|
property = client.getObjectFactory().newEnumProperty(name, value.asEnum());
|
||||||
((org.apache.olingo.commons.api.domain.ODataValue) value).asEnum());
|
|
||||||
} else {
|
} else {
|
||||||
throw new UnsupportedOperationException("Usupported object type " + valueType.getFullQualifiedName());
|
throw new UnsupportedOperationException("Usupported object type " + valueType.getFullQualifiedName());
|
||||||
}
|
}
|
||||||
|
@ -273,15 +268,15 @@ public final class CoreUtils {
|
||||||
EdmPrimitiveTypeKind bckCandidate = null;
|
EdmPrimitiveTypeKind bckCandidate = null;
|
||||||
|
|
||||||
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
|
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
|
||||||
final Class<?> target = EdmPrimitiveTypeFactory.getInstance(kind).getDefaultType();
|
final Class<?> target = EdmPrimitiveTypeFactory.getInstance(kind).getDefaultType();
|
||||||
|
|
||||||
if (clazz.equals(target)) {
|
if (clazz.equals(target)) {
|
||||||
return new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).setTypeExpression(kind.toString()).build();
|
return new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).setTypeExpression(kind.toString()).build();
|
||||||
} else if (target.isAssignableFrom(clazz)) {
|
} else if (target.isAssignableFrom(clazz)) {
|
||||||
bckCandidate = kind;
|
bckCandidate = kind;
|
||||||
} else if (target == Timestamp.class && kind == EdmPrimitiveTypeKind.DateTimeOffset) {
|
} else if (target == Timestamp.class && kind == EdmPrimitiveTypeKind.DateTimeOffset) {
|
||||||
bckCandidate = kind;
|
bckCandidate = kind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bckCandidate == null) {
|
if (bckCandidate == null) {
|
||||||
|
@ -297,8 +292,8 @@ public final class CoreUtils {
|
||||||
final ODataEntity entity) {
|
final ODataEntity entity) {
|
||||||
|
|
||||||
for (Map.Entry<String, Object> entry : changes.entrySet()) {
|
for (Map.Entry<String, Object> entry : changes.entrySet()) {
|
||||||
((List<ODataProperty>) entity.getProperties()).add(
|
entity.getProperties()
|
||||||
getODataEntityProperty(client, entity.getTypeName(), entry.getKey(), entry.getValue()));
|
.add(getODataEntityProperty(client, entity.getTypeName(), entry.getKey(), entry.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
@ -73,7 +73,9 @@ public abstract class AbstractBaseTestITCase {
|
||||||
final StringWriter writer = new StringWriter();
|
final StringWriter writer = new StringWriter();
|
||||||
try {
|
try {
|
||||||
getClient().getSerializer(ODataFormat.JSON).write(writer, entity);
|
getClient().getSerializer(ODataFormat.JSON).write(writer, entity);
|
||||||
} catch (final ODataSerializerException e) {}
|
} catch (final ODataSerializerException e) {
|
||||||
|
// Debug
|
||||||
|
}
|
||||||
writer.flush();
|
writer.flush();
|
||||||
LOG.debug(message + "\n{}", writer.toString());
|
LOG.debug(message + "\n{}", writer.toString());
|
||||||
}
|
}
|
||||||
|
@ -84,7 +86,9 @@ public abstract class AbstractBaseTestITCase {
|
||||||
final StringWriter writer = new StringWriter();
|
final StringWriter writer = new StringWriter();
|
||||||
try {
|
try {
|
||||||
getClient().getSerializer(ODataFormat.JSON).write(writer, entitySet);
|
getClient().getSerializer(ODataFormat.JSON).write(writer, entitySet);
|
||||||
} catch (final ODataSerializerException e) {}
|
} catch (final ODataSerializerException e) {
|
||||||
|
// Debug
|
||||||
|
}
|
||||||
writer.flush();
|
writer.flush();
|
||||||
LOG.debug(message + "\n{}", writer.toString());
|
LOG.debug(message + "\n{}", writer.toString());
|
||||||
}
|
}
|
||||||
|
@ -103,14 +107,18 @@ public abstract class AbstractBaseTestITCase {
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
try {
|
try {
|
||||||
getClient().getSerializer(ODataFormat.ATOM).write(writer, getClient().getBinder().getEntity(entity));
|
getClient().getSerializer(ODataFormat.ATOM).write(writer, getClient().getBinder().getEntity(entity));
|
||||||
} catch (final ODataSerializerException e) {}
|
} catch (final ODataSerializerException e) {
|
||||||
|
// Debug
|
||||||
|
}
|
||||||
writer.flush();
|
writer.flush();
|
||||||
LOG.debug(message + " (Atom)\n{}", writer.toString());
|
LOG.debug(message + " (Atom)\n{}", writer.toString());
|
||||||
|
|
||||||
writer = new StringWriter();
|
writer = new StringWriter();
|
||||||
try {
|
try {
|
||||||
getClient().getSerializer(ODataFormat.JSON).write(writer, getClient().getBinder().getEntity(entity));
|
getClient().getSerializer(ODataFormat.JSON).write(writer, getClient().getBinder().getEntity(entity));
|
||||||
} catch (final ODataSerializerException e) {}
|
} catch (final ODataSerializerException e) {
|
||||||
|
// Debug
|
||||||
|
}
|
||||||
writer.flush();
|
writer.flush();
|
||||||
LOG.debug(message + " (JSON)\n{}", writer.toString());
|
LOG.debug(message + " (JSON)\n{}", writer.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,8 +72,9 @@ public interface Customer
|
||||||
fcNSPrefix = "",
|
fcNSPrefix = "",
|
||||||
fcNSURI = "",
|
fcNSURI = "",
|
||||||
fcKeepInContent = false)
|
fcKeepInContent = false)
|
||||||
|
@Override
|
||||||
java.lang.Integer getID();
|
java.lang.Integer getID();
|
||||||
|
@Override
|
||||||
void setID(java.lang.Integer _iD);
|
void setID(java.lang.Integer _iD);
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,8 +96,9 @@ public interface Customer
|
||||||
fcNSPrefix = "",
|
fcNSPrefix = "",
|
||||||
fcNSURI = "",
|
fcNSURI = "",
|
||||||
fcKeepInContent = false)
|
fcKeepInContent = false)
|
||||||
|
@Override
|
||||||
java.lang.String getName();
|
java.lang.String getName();
|
||||||
|
@Override
|
||||||
void setName(java.lang.String _name);
|
void setName(java.lang.String _name);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase {
|
||||||
assertEquals(Boolean.TRUE, style.getComplexValue().get("title").getPrimitiveValue().toCastValue(Boolean.class));
|
assertEquals(Boolean.TRUE, style.getComplexValue().get("title").getPrimitiveValue().toCastValue(Boolean.class));
|
||||||
assertEquals(1, style.getComplexValue().get("order").getPrimitiveValue().toCastValue(Integer.class), 0);
|
assertEquals(1, style.getComplexValue().get("order").getPrimitiveValue().toCastValue(Integer.class), 0);
|
||||||
|
|
||||||
final ODataLink orders = (ODataLink) entity.getNavigationLink("Orders");
|
final ODataLink orders = entity.getNavigationLink("Orders");
|
||||||
assertEquals(1, orders.getAnnotations().size());
|
assertEquals(1, orders.getAnnotations().size());
|
||||||
|
|
||||||
final ODataAnnotation style2 = orders.getAnnotations().get(0);
|
final ODataAnnotation style2 = orders.getAnnotations().get(0);
|
||||||
|
|
|
@ -32,7 +32,6 @@ public class BatchRequestFactoryImpl implements BatchRequestFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ODataBatchRequest getBatchRequest(final String serviceRoot) {
|
public ODataBatchRequest getBatchRequest(final String serviceRoot) {
|
||||||
return new ODataBatchRequestImpl(
|
return new ODataBatchRequestImpl(client, client.newURIBuilder(serviceRoot).appendBatchSegment().build());
|
||||||
(ODataClient) client, client.newURIBuilder(serviceRoot).appendBatchSegment().build());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,6 +245,7 @@ public class CUDRequestFactoryImpl implements CUDRequestFactory {
|
||||||
return new ODataReferenceAddingRequestImpl(client, HttpMethod.POST, targetURI, wrappedPayload);
|
return new ODataReferenceAddingRequestImpl(client, HttpMethod.POST, targetURI, wrappedPayload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ODataReferenceAddingRequest getReferenceSingleChangeRequest(final URI serviceRoot, final URI targetURI,
|
public ODataReferenceAddingRequest getReferenceSingleChangeRequest(final URI serviceRoot, final URI targetURI,
|
||||||
final URI reference) {
|
final URI reference) {
|
||||||
// See OData Protocol 11.4.6.3
|
// See OData Protocol 11.4.6.3
|
||||||
|
|
|
@ -126,12 +126,8 @@ public abstract class AbstractODataInvokeRequest<T extends ODataInvokeResult>
|
||||||
} else if (param.getValue().isCollection()) {
|
} else if (param.getValue().isCollection()) {
|
||||||
property = odataClient.getObjectFactory().
|
property = odataClient.getObjectFactory().
|
||||||
newCollectionProperty(param.getKey(), param.getValue().asCollection());
|
newCollectionProperty(param.getKey(), param.getValue().asCollection());
|
||||||
} else if (param.getValue() instanceof org.apache.olingo.commons.api.domain.ODataValue
|
} else if (param.getValue().isEnum()) {
|
||||||
&& ((org.apache.olingo.commons.api.domain.ODataValue) param.getValue()).isEnum()) {
|
property = odataClient.getObjectFactory().newEnumProperty(param.getKey(), param.getValue().asEnum());
|
||||||
|
|
||||||
property = ((ODataClient) odataClient).getObjectFactory().
|
|
||||||
newEnumProperty(param.getKey(),
|
|
||||||
((org.apache.olingo.commons.api.domain.ODataValue) param.getValue()).asEnum());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property != null) {
|
if (property != null) {
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
@ -34,7 +34,7 @@ import org.apache.olingo.commons.api.format.ODataFormat;
|
||||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||||
|
|
||||||
public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest<ODataDelta>
|
public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest<ODataDelta>
|
||||||
implements ODataDeltaRequest {
|
implements ODataDeltaRequest {
|
||||||
|
|
||||||
public ODataDeltaRequestImpl(final ODataClient odataClient, final URI query) {
|
public ODataDeltaRequestImpl(final ODataClient odataClient, final URI query) {
|
||||||
super(odataClient, query);
|
super(odataClient, query);
|
||||||
|
@ -56,7 +56,7 @@ public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest<ODataDel
|
||||||
private ODataDelta delta = null;
|
private ODataDelta delta = null;
|
||||||
|
|
||||||
private ODataDeltaResponseImpl(final ODataClient odataClient, final HttpClient httpClient,
|
private ODataDeltaResponseImpl(final ODataClient odataClient, final HttpClient httpClient,
|
||||||
final HttpResponse res) {
|
final HttpResponse res) {
|
||||||
|
|
||||||
super(odataClient, httpClient, res);
|
super(odataClient, httpClient, res);
|
||||||
}
|
}
|
||||||
|
@ -65,11 +65,10 @@ public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest<ODataDel
|
||||||
public ODataDelta getBody() {
|
public ODataDelta getBody() {
|
||||||
if (delta == null) {
|
if (delta == null) {
|
||||||
try {
|
try {
|
||||||
final ResWrap<Delta> resource = ((ODataClient) odataClient).
|
final ResWrap<Delta> resource = odataClient.getDeserializer(ODataFormat.fromString(getContentType())).
|
||||||
getDeserializer(ODataFormat.fromString(getContentType())).
|
toDelta(res.getEntity().getContent());
|
||||||
toDelta(res.getEntity().getContent());
|
|
||||||
|
|
||||||
delta = ((ODataClient) odataClient).getBinder().getODataDelta(resource);
|
delta = odataClient.getBinder().getODataDelta(resource);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new HttpClientException(e);
|
throw new HttpClientException(e);
|
||||||
} catch (final ODataDeserializerException e) {
|
} catch (final ODataDeserializerException e) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.olingo.commons.api.domain.ODataSingleton;
|
||||||
public class RetrieveRequestFactoryImpl implements RetrieveRequestFactory {
|
public class RetrieveRequestFactoryImpl implements RetrieveRequestFactory {
|
||||||
|
|
||||||
protected final ODataClient client;
|
protected final ODataClient client;
|
||||||
|
|
||||||
public RetrieveRequestFactoryImpl(final ODataClient client) {
|
public RetrieveRequestFactoryImpl(final ODataClient client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,7 @@ public class RetrieveRequestFactoryImpl implements RetrieveRequestFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XMLMetadataRequest getXMLMetadataRequest(final String serviceRoot) {
|
public XMLMetadataRequest getXMLMetadataRequest(final String serviceRoot) {
|
||||||
return new XMLMetadataRequestImpl(((ODataClient) client),
|
return new XMLMetadataRequestImpl(client, client.newURIBuilder(serviceRoot).appendMetadataSegment().build());
|
||||||
client.newURIBuilder(serviceRoot).appendMetadataSegment().build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
@ -39,8 +39,8 @@ import org.apache.olingo.client.core.edm.xml.SchemaImpl;
|
||||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||||
|
|
||||||
public class XMLMetadataRequestImpl
|
public class XMLMetadataRequestImpl
|
||||||
extends AbstractMetadataRequestImpl<XMLMetadata>
|
extends AbstractMetadataRequestImpl<XMLMetadata>
|
||||||
implements XMLMetadataRequest {
|
implements XMLMetadataRequest {
|
||||||
|
|
||||||
XMLMetadataRequestImpl(final ODataClient odataClient, final URI uri) {
|
XMLMetadataRequestImpl(final ODataClient odataClient, final URI uri) {
|
||||||
super(odataClient, uri);
|
super(odataClient, uri);
|
||||||
|
@ -48,18 +48,18 @@ public class XMLMetadataRequestImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ODataRetrieveResponse<XMLMetadata> execute() {
|
public ODataRetrieveResponse<XMLMetadata> execute() {
|
||||||
final SingleXMLMetadatRequestImpl rootReq = new SingleXMLMetadatRequestImpl((ODataClient) odataClient, uri, null);
|
final SingleXMLMetadatRequestImpl rootReq = new SingleXMLMetadatRequestImpl(odataClient, uri, null);
|
||||||
final ODataRetrieveResponse<XMLMetadata> rootRes = rootReq.execute();
|
final ODataRetrieveResponse<XMLMetadata> rootRes = rootReq.execute();
|
||||||
|
|
||||||
final XMLMetadataResponseImpl response =
|
final XMLMetadataResponseImpl response =
|
||||||
new XMLMetadataResponseImpl(odataClient, httpClient, rootReq.getHttpResponse(), rootRes.getBody());
|
new XMLMetadataResponseImpl(odataClient, httpClient, rootReq.getHttpResponse(), rootRes.getBody());
|
||||||
|
|
||||||
// process external references
|
// process external references
|
||||||
for (Reference reference : rootRes.getBody().getReferences()) {
|
for (Reference reference : rootRes.getBody().getReferences()) {
|
||||||
final SingleXMLMetadatRequestImpl includeReq = new SingleXMLMetadatRequestImpl(
|
final SingleXMLMetadatRequestImpl includeReq = new SingleXMLMetadatRequestImpl(
|
||||||
(ODataClient) odataClient,
|
odataClient,
|
||||||
odataClient.newURIBuilder(uri.resolve(reference.getUri()).toASCIIString()).build(),
|
odataClient.newURIBuilder(uri.resolve(reference.getUri()).toASCIIString()).build(),
|
||||||
uri);
|
uri);
|
||||||
final XMLMetadata includeMetadata = includeReq.execute().getBody();
|
final XMLMetadata includeMetadata = includeReq.execute().getBody();
|
||||||
|
|
||||||
// edmx:Include
|
// edmx:Include
|
||||||
|
@ -86,10 +86,10 @@ public class XMLMetadataRequestImpl
|
||||||
// take into account only when (TargetNamespace was either not provided or matches) and
|
// take into account only when (TargetNamespace was either not provided or matches) and
|
||||||
// (Qualifier was either not provided or matches)
|
// (Qualifier was either not provided or matches)
|
||||||
if ((StringUtils.isBlank(include.getTargetNamespace())
|
if ((StringUtils.isBlank(include.getTargetNamespace())
|
||||||
|| include.getTargetNamespace().equals(
|
|| include.getTargetNamespace().equals(
|
||||||
StringUtils.substringBeforeLast(annotationGroup.getTarget(), ".")))
|
StringUtils.substringBeforeLast(annotationGroup.getTarget(), ".")))
|
||||||
&& (StringUtils.isBlank(include.getQualifier())
|
&& (StringUtils.isBlank(include.getQualifier())
|
||||||
|| include.getQualifier().equals(annotationGroup.getQualifier()))) {
|
|| include.getQualifier().equals(annotationGroup.getQualifier()))) {
|
||||||
|
|
||||||
final AnnotationsImpl toBeIncluded = new AnnotationsImpl();
|
final AnnotationsImpl toBeIncluded = new AnnotationsImpl();
|
||||||
toBeIncluded.setTarget(annotationGroup.getTarget());
|
toBeIncluded.setTarget(annotationGroup.getTarget());
|
||||||
|
@ -128,9 +128,11 @@ public class XMLMetadataRequestImpl
|
||||||
return httpResponse;
|
return httpResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Referenced document's URIs must only have the same scheme, host, and port as the
|
/**
|
||||||
* main metadata document's URI but don't have to start with the service root
|
* Referenced document's URIs must only have the same scheme, host, and port as the
|
||||||
* as all other OData request URIs. */
|
* main metadata document's URI but don't have to start with the service root
|
||||||
|
* as all other OData request URIs.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void checkRequest(final ODataClient odataClient, final HttpUriRequest request) {
|
protected void checkRequest(final ODataClient odataClient, final HttpUriRequest request) {
|
||||||
if (parentURI == null) {
|
if (parentURI == null) {
|
||||||
|
@ -157,7 +159,7 @@ public class XMLMetadataRequestImpl
|
||||||
public XMLMetadata getBody() {
|
public XMLMetadata getBody() {
|
||||||
if (metadata == null) {
|
if (metadata == null) {
|
||||||
try {
|
try {
|
||||||
metadata = ((ODataClient) odataClient).getDeserializer(ODataFormat.XML).toMetadata(getRawResponse());
|
metadata = odataClient.getDeserializer(ODataFormat.XML).toMetadata(getRawResponse());
|
||||||
} finally {
|
} finally {
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
|
@ -173,7 +175,7 @@ public class XMLMetadataRequestImpl
|
||||||
private final XMLMetadata metadata;
|
private final XMLMetadata metadata;
|
||||||
|
|
||||||
private XMLMetadataResponseImpl(final ODataClient odataClient, final HttpClient httpClient,
|
private XMLMetadataResponseImpl(final ODataClient odataClient, final HttpClient httpClient,
|
||||||
final HttpResponse res, final XMLMetadata metadata) {
|
final HttpResponse res, final XMLMetadata metadata) {
|
||||||
|
|
||||||
super(odataClient, httpClient, null);
|
super(odataClient, httpClient, null);
|
||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
@ -95,7 +95,7 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
protected Map<String, EdmSchema> createSchemas() {
|
protected Map<String, EdmSchema> createSchemas() {
|
||||||
final Map<String, EdmSchema> _schemas = new LinkedHashMap<String, EdmSchema>(xmlSchemas.size());
|
final Map<String, EdmSchema> _schemas = new LinkedHashMap<String, EdmSchema>(xmlSchemas.size());
|
||||||
for (Schema schema : xmlSchemas) {
|
for (Schema schema : xmlSchemas) {
|
||||||
_schemas.put(schema.getNamespace(), new EdmSchemaImpl(this, xmlSchemas, schema));
|
_schemas.put(schema.getNamespace(), new EdmSchemaImpl(this, schema));
|
||||||
}
|
}
|
||||||
return _schemas;
|
return _schemas;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
if (schema != null) {
|
if (schema != null) {
|
||||||
final EntityContainer xmlEntityContainer = schema.getDefaultEntityContainer();
|
final EntityContainer xmlEntityContainer = schema.getDefaultEntityContainer();
|
||||||
if (xmlEntityContainer != null) {
|
if (xmlEntityContainer != null) {
|
||||||
result = new EdmEntityContainerImpl(this, containerName, xmlEntityContainer, xmlSchemas);
|
result = new EdmEntityContainerImpl(this, containerName, xmlEntityContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,14 +135,13 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
EdmTypeDefinition result = null;
|
EdmTypeDefinition result = null;
|
||||||
|
|
||||||
final Schema schema = xmlSchemaByNamespace.get(typeDefinitionName.getNamespace());
|
final Schema schema = xmlSchemaByNamespace.get(typeDefinitionName.getNamespace());
|
||||||
if (schema instanceof Schema) {
|
if (schema != null) {
|
||||||
final TypeDefinition xmlTypeDefinition = ((Schema) schema).
|
final TypeDefinition xmlTypeDefinition = schema.
|
||||||
getTypeDefinition(typeDefinitionName.getName());
|
getTypeDefinition(typeDefinitionName.getName());
|
||||||
if (xmlTypeDefinition != null) {
|
if (xmlTypeDefinition != null) {
|
||||||
result = new EdmTypeDefinitionImpl(this, typeDefinitionName, xmlTypeDefinition);
|
result = new EdmTypeDefinitionImpl(this, typeDefinitionName, xmlTypeDefinition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +153,7 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
if (schema != null) {
|
if (schema != null) {
|
||||||
final EntityType xmlEntityType = schema.getEntityType(entityTypeName.getName());
|
final EntityType xmlEntityType = schema.getEntityType(entityTypeName.getName());
|
||||||
if (xmlEntityType != null) {
|
if (xmlEntityType != null) {
|
||||||
result = EdmEntityTypeImpl.getInstance(this, entityTypeName, xmlSchemas, xmlEntityType);
|
result = EdmEntityTypeImpl.getInstance(this, entityTypeName, xmlEntityType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +168,7 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
if (schema != null) {
|
if (schema != null) {
|
||||||
final ComplexType xmlComplexType = schema.getComplexType(complexTypeName.getName());
|
final ComplexType xmlComplexType = schema.getComplexType(complexTypeName.getName());
|
||||||
if (xmlComplexType != null) {
|
if (xmlComplexType != null) {
|
||||||
result = EdmComplexTypeImpl.getInstance(this, complexTypeName, xmlSchemas, xmlComplexType);
|
result = EdmComplexTypeImpl.getInstance(this, complexTypeName, xmlComplexType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,18 +180,16 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
EdmAction result = null;
|
EdmAction result = null;
|
||||||
|
|
||||||
final Schema schema = xmlSchemaByNamespace.get(actionName.getNamespace());
|
final Schema schema = xmlSchemaByNamespace.get(actionName.getNamespace());
|
||||||
if (schema instanceof Schema) {
|
final List<Action> actions = schema.
|
||||||
final List<Action> actions = ((Schema) schema).
|
getActions(actionName.getName());
|
||||||
getActions(actionName.getName());
|
boolean found = false;
|
||||||
boolean found = false;
|
for (final Iterator<Action> itor = actions.iterator(); itor.hasNext() && !found;) {
|
||||||
for (final Iterator<Action> itor = actions.iterator(); itor.hasNext() && !found;) {
|
final Action action = itor.next();
|
||||||
final Action action = itor.next();
|
if (!action.isBound()) {
|
||||||
if (!action.isBound()) {
|
found = true;
|
||||||
found = true;
|
result = EdmActionImpl.getInstance(this, actionName, action);
|
||||||
result = EdmActionImpl.getInstance(this, actionName, action);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,16 +198,14 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
final List<EdmFunction> result = new ArrayList<EdmFunction>();
|
final List<EdmFunction> result = new ArrayList<EdmFunction>();
|
||||||
|
|
||||||
final Schema schema = xmlSchemaByNamespace.get(functionName.getNamespace());
|
final Schema schema = xmlSchemaByNamespace.get(functionName.getNamespace());
|
||||||
if (schema instanceof Schema) {
|
final List<Function> functions = schema.
|
||||||
final List<Function> functions = ((Schema) schema).
|
getFunctions(functionName.getName());
|
||||||
getFunctions(functionName.getName());
|
for (final Iterator<Function> itor = functions.iterator(); itor.hasNext();) {
|
||||||
for (final Iterator<Function> itor = functions.iterator(); itor.hasNext();) {
|
final Function function = itor.next();
|
||||||
final Function function = itor.next();
|
if (!function.isBound()) {
|
||||||
if (!function.isBound()) {
|
result.add(EdmFunctionImpl.getInstance(this, functionName, function));
|
||||||
result.add(EdmFunctionImpl.getInstance(this, functionName, function));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,89 +214,83 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
EdmFunction result = null;
|
EdmFunction result = null;
|
||||||
|
|
||||||
final Schema schema = xmlSchemaByNamespace.get(functionName.getNamespace());
|
final Schema schema = xmlSchemaByNamespace.get(functionName.getNamespace());
|
||||||
if (schema instanceof Schema) {
|
final List<Function> functions = schema.
|
||||||
final List<Function> functions = ((Schema) schema).
|
getFunctions(functionName.getName());
|
||||||
getFunctions(functionName.getName());
|
boolean found = false;
|
||||||
boolean found = false;
|
for (final Iterator<Function> itor = functions.iterator(); itor.hasNext() && !found;) {
|
||||||
for (final Iterator<Function> itor = functions.iterator(); itor.hasNext() && !found;) {
|
final Function function = itor.next();
|
||||||
final Function function = itor.next();
|
if (!function.isBound()) {
|
||||||
if (!function.isBound()) {
|
final Set<String> functionParamNames = new HashSet<String>();
|
||||||
final Set<String> functionParamNames = new HashSet<String>();
|
for (Parameter param : function.getParameters()) {
|
||||||
for (Parameter param : function.getParameters()) {
|
functionParamNames.add(param.getName());
|
||||||
functionParamNames.add(param.getName());
|
|
||||||
}
|
|
||||||
found = parameterNames == null
|
|
||||||
? functionParamNames.isEmpty()
|
|
||||||
: functionParamNames.containsAll(parameterNames);
|
|
||||||
result = EdmFunctionImpl.getInstance(this, functionName, function);
|
|
||||||
}
|
}
|
||||||
|
found = parameterNames == null
|
||||||
|
? functionParamNames.isEmpty()
|
||||||
|
: functionParamNames.containsAll(parameterNames);
|
||||||
|
result = EdmFunctionImpl.getInstance(this, functionName, function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected EdmAction createBoundAction(final FullQualifiedName actionName,
|
protected EdmAction createBoundAction(final FullQualifiedName actionName,
|
||||||
final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection) {
|
final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection) {
|
||||||
|
|
||||||
EdmAction result = null;
|
EdmAction result = null;
|
||||||
|
|
||||||
final Schema schema = xmlSchemaByNamespace.get(actionName.getNamespace());
|
final Schema schema = xmlSchemaByNamespace.get(actionName.getNamespace());
|
||||||
if (schema instanceof Schema) {
|
final List<Action> actions =
|
||||||
final List<Action> actions =
|
schema.getActions(actionName.getName());
|
||||||
((Schema) schema).getActions(actionName.getName());
|
boolean found = false;
|
||||||
boolean found = false;
|
for (final Iterator<Action> itor = actions.iterator(); itor.hasNext() && !found;) {
|
||||||
for (final Iterator<Action> itor = actions.iterator(); itor.hasNext() && !found;) {
|
final Action action = itor.next();
|
||||||
final Action action = itor.next();
|
if (action.isBound()) {
|
||||||
if (action.isBound()) {
|
final EdmTypeInfo boundParam = new EdmTypeInfo.Builder().setEdm(this).
|
||||||
final EdmTypeInfo boundParam = new EdmTypeInfo.Builder().setEdm(this).
|
setTypeExpression(action.getParameters().get(0).getType()).build();
|
||||||
setTypeExpression(action.getParameters().get(0).getType()).build();
|
if (bindingParameterTypeName.equals(boundParam.getFullQualifiedName())
|
||||||
if (bindingParameterTypeName.equals(boundParam.getFullQualifiedName())
|
&& (isBindingParameterCollection == null
|
||||||
&& (isBindingParameterCollection == null
|
|| isBindingParameterCollection.booleanValue() == boundParam.isCollection())) {
|
||||||
|| isBindingParameterCollection.booleanValue() == boundParam.isCollection())) {
|
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
result = EdmActionImpl.getInstance(this, actionName, action);
|
result = EdmActionImpl.getInstance(this, actionName, action);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected EdmFunction createBoundFunction(final FullQualifiedName functionName,
|
protected EdmFunction createBoundFunction(final FullQualifiedName functionName,
|
||||||
final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection,
|
final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection,
|
||||||
final List<String> parameterNames) {
|
final List<String> parameterNames) {
|
||||||
|
|
||||||
EdmFunction result = null;
|
EdmFunction result = null;
|
||||||
|
|
||||||
final Schema schema = xmlSchemaByNamespace.get(functionName.getNamespace());
|
final Schema schema = xmlSchemaByNamespace.get(functionName.getNamespace());
|
||||||
if (schema instanceof Schema) {
|
final List<Function> functions = schema.
|
||||||
final List<Function> functions = ((Schema) schema).
|
getFunctions(functionName.getName());
|
||||||
getFunctions(functionName.getName());
|
boolean found = false;
|
||||||
boolean found = false;
|
for (final Iterator<Function> itor = functions.iterator(); itor.hasNext() && !found;) {
|
||||||
for (final Iterator<Function> itor = functions.iterator(); itor.hasNext() && !found;) {
|
final Function function = itor.next();
|
||||||
final Function function = itor.next();
|
if (function.isBound()) {
|
||||||
if (function.isBound()) {
|
final EdmTypeInfo boundParam = new EdmTypeInfo.Builder().setEdm(this).
|
||||||
final EdmTypeInfo boundParam = new EdmTypeInfo.Builder().setEdm(this).
|
setTypeExpression(function.getParameters().get(0).getType()).build();
|
||||||
setTypeExpression(function.getParameters().get(0).getType()).build();
|
if (bindingParameterTypeName.equals(boundParam.getFullQualifiedName())
|
||||||
if (bindingParameterTypeName.equals(boundParam.getFullQualifiedName())
|
&& (isBindingParameterCollection == null
|
||||||
&& (isBindingParameterCollection == null
|
|| isBindingParameterCollection.booleanValue() == boundParam.isCollection())) {
|
||||||
|| isBindingParameterCollection.booleanValue() == boundParam.isCollection())) {
|
|
||||||
|
|
||||||
final Set<String> functionParamNames = new HashSet<String>();
|
final Set<String> functionParamNames = new HashSet<String>();
|
||||||
for (Parameter param : function.getParameters()) {
|
for (Parameter param : function.getParameters()) {
|
||||||
functionParamNames.add(param.getName());
|
functionParamNames.add(param.getName());
|
||||||
}
|
|
||||||
found = parameterNames == null
|
|
||||||
? functionParamNames.isEmpty()
|
|
||||||
: functionParamNames.containsAll(parameterNames);
|
|
||||||
result = EdmFunctionImpl.getInstance(this, functionName, function);
|
|
||||||
}
|
}
|
||||||
|
found = parameterNames == null
|
||||||
|
? functionParamNames.isEmpty()
|
||||||
|
: functionParamNames.containsAll(parameterNames);
|
||||||
|
result = EdmFunctionImpl.getInstance(this, functionName, function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,13 +299,12 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
EdmTerm result = null;
|
EdmTerm result = null;
|
||||||
|
|
||||||
final Schema schema = xmlSchemaByNamespace.get(termName.getNamespace());
|
final Schema schema = xmlSchemaByNamespace.get(termName.getNamespace());
|
||||||
if (schema instanceof Schema) {
|
if (schema != null) {
|
||||||
final Term term = ((Schema) schema).getTerm(termName.getName());
|
final Term term = schema.getTerm(termName.getName());
|
||||||
if (term != null) {
|
if (term != null) {
|
||||||
result = new EdmTermImpl(this, schema.getNamespace(), term);
|
result = new EdmTermImpl(this, schema.getNamespace(), term);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,12 +313,10 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
EdmAnnotationsImpl result = null;
|
EdmAnnotationsImpl result = null;
|
||||||
|
|
||||||
final Schema schema = xmlSchemaByNamespace.get(targetName.getNamespace());
|
final Schema schema = xmlSchemaByNamespace.get(targetName.getNamespace());
|
||||||
if (schema instanceof Schema) {
|
final Annotations annotationGroup =
|
||||||
final Annotations annotationGroup =
|
schema.getAnnotationGroup(targetName.getName());
|
||||||
((Schema) schema).getAnnotationGroup(targetName.getName());
|
if (annotationGroup != null) {
|
||||||
if (annotationGroup != null) {
|
result = new EdmAnnotationsImpl(this, schemas.get(schema.getNamespace()), annotationGroup);
|
||||||
result = new EdmAnnotationsImpl(this, schemas.get(schema.getNamespace()), annotationGroup);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -341,15 +327,13 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
List<EdmAnnotation> result = null;
|
List<EdmAnnotation> result = null;
|
||||||
|
|
||||||
final Schema schema = xmlSchemaByNamespace.get(annotatedName.getNamespace());
|
final Schema schema = xmlSchemaByNamespace.get(annotatedName.getNamespace());
|
||||||
if (schema instanceof Schema) {
|
final Annotatable annotatable =
|
||||||
final Annotatable annotatable =
|
schema.getAnnotatables().get(annotatedName.getName());
|
||||||
((Schema) schema).getAnnotatables().get(annotatedName.getName());
|
if (annotatable != null && annotatable.getAnnotations() != null) {
|
||||||
if (annotatable != null && annotatable.getAnnotations() != null) {
|
result = new ArrayList<EdmAnnotation>();
|
||||||
result = new ArrayList<EdmAnnotation>();
|
for (Annotation annotation : annotatable.getAnnotations()) {
|
||||||
for (Annotation annotation : annotatable.getAnnotations()) {
|
final EdmTerm term = getTerm(new FullQualifiedName(annotation.getTerm()));
|
||||||
final EdmTerm term = getTerm(new FullQualifiedName(annotation.getTerm()));
|
result.add(new EdmAnnotationImpl(this, annotation));
|
||||||
result.add(new EdmAnnotationImpl(this, annotation));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
@ -22,7 +22,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.ComplexType;
|
import org.apache.olingo.client.api.edm.xml.ComplexType;
|
||||||
import org.apache.olingo.client.api.edm.xml.Schema;
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
||||||
|
@ -41,29 +40,24 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
|
||||||
private EdmAnnotationHelper annotationHelper;
|
private EdmAnnotationHelper annotationHelper;
|
||||||
|
|
||||||
public static EdmComplexTypeImpl getInstance(final Edm edm, final FullQualifiedName fqn,
|
public static EdmComplexTypeImpl getInstance(final Edm edm, final FullQualifiedName fqn,
|
||||||
final List<? extends Schema> xmlSchemas, final ComplexType complexType) {
|
final ComplexType complexType) {
|
||||||
|
|
||||||
FullQualifiedName baseTypeName = null;
|
FullQualifiedName baseTypeName = null;
|
||||||
if (complexType instanceof org.apache.olingo.client.api.edm.xml.ComplexType) {
|
final String baseType = complexType.getBaseType();
|
||||||
final String baseType = ((org.apache.olingo.client.api.edm.xml.ComplexType) complexType).getBaseType();
|
baseTypeName = baseType == null
|
||||||
baseTypeName = baseType == null
|
? null : new EdmTypeInfo.Builder().setTypeExpression(baseType).build().getFullQualifiedName();
|
||||||
? null : new EdmTypeInfo.Builder().setTypeExpression(baseType).build().getFullQualifiedName();
|
final EdmComplexTypeImpl instance = new EdmComplexTypeImpl(edm, fqn, baseTypeName, complexType);
|
||||||
}
|
|
||||||
final EdmComplexTypeImpl instance = new EdmComplexTypeImpl(edm, fqn, baseTypeName, xmlSchemas, complexType);
|
|
||||||
instance.baseType = instance.buildBaseType(baseTypeName);
|
instance.baseType = instance.buildBaseType(baseTypeName);
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
|
private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
|
||||||
final List<? extends Schema> xmlSchemas, final ComplexType complexType) {
|
final ComplexType complexType) {
|
||||||
|
|
||||||
super(edm, fqn, baseTypeName);
|
super(edm, fqn, baseTypeName);
|
||||||
this.typeHelper = new EdmStructuredTypeHelperImpl(edm, getFullQualifiedName(), xmlSchemas, complexType);
|
this.typeHelper = new EdmStructuredTypeHelperImpl(edm, getFullQualifiedName(), complexType);
|
||||||
if (complexType instanceof org.apache.olingo.client.api.edm.xml.ComplexType) {
|
this.annotationHelper = new EdmAnnotationHelperImpl(edm, complexType);
|
||||||
this.annotationHelper = new EdmAnnotationHelperImpl(edm,
|
|
||||||
(org.apache.olingo.client.api.edm.xml.ComplexType) complexType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.olingo.client.api.edm.xml.ActionImport;
|
||||||
import org.apache.olingo.client.api.edm.xml.EntityContainer;
|
import org.apache.olingo.client.api.edm.xml.EntityContainer;
|
||||||
import org.apache.olingo.client.api.edm.xml.EntitySet;
|
import org.apache.olingo.client.api.edm.xml.EntitySet;
|
||||||
import org.apache.olingo.client.api.edm.xml.FunctionImport;
|
import org.apache.olingo.client.api.edm.xml.FunctionImport;
|
||||||
import org.apache.olingo.client.api.edm.xml.Schema;
|
|
||||||
import org.apache.olingo.client.api.edm.xml.Singleton;
|
import org.apache.olingo.client.api.edm.xml.Singleton;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmActionImport;
|
import org.apache.olingo.commons.api.edm.EdmActionImport;
|
||||||
|
@ -46,35 +45,29 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
private EdmAnnotationHelper helper;
|
private EdmAnnotationHelper helper;
|
||||||
|
|
||||||
public EdmEntityContainerImpl(final Edm edm, final FullQualifiedName entityContainerName,
|
public EdmEntityContainerImpl(final Edm edm, final FullQualifiedName entityContainerName,
|
||||||
final EntityContainer xmlEntityContainer, final List<? extends Schema> xmlSchemas) {
|
final EntityContainer xmlEntityContainer) {
|
||||||
|
|
||||||
super(edm, entityContainerName, xmlEntityContainer.getExtends() == null
|
super(edm, entityContainerName, xmlEntityContainer.getExtends() == null
|
||||||
? null : new FullQualifiedName(xmlEntityContainer.getExtends()));
|
? null : new FullQualifiedName(xmlEntityContainer.getExtends()));
|
||||||
|
|
||||||
this.xmlEntityContainer = xmlEntityContainer;
|
this.xmlEntityContainer = xmlEntityContainer;
|
||||||
if (xmlEntityContainer instanceof EntityContainer) {
|
this.helper = new EdmAnnotationHelperImpl(edm, xmlEntityContainer);
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm,
|
|
||||||
(EntityContainer) xmlEntityContainer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDefault() {
|
public boolean isDefault() {
|
||||||
return xmlEntityContainer instanceof EntityContainer
|
return true;
|
||||||
? true
|
|
||||||
: xmlEntityContainer.isDefaultEntityContainer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected EdmSingleton createSingleton(final String singletonName) {
|
protected EdmSingleton createSingleton(final String singletonName) {
|
||||||
final Singleton singleton = ((EntityContainer) xmlEntityContainer).
|
final Singleton singleton = xmlEntityContainer.getSingleton(singletonName);
|
||||||
getSingleton(singletonName);
|
|
||||||
return singleton == null
|
return singleton == null
|
||||||
? null
|
? null
|
||||||
: new EdmSingletonImpl(edm, this, singletonName, new EdmTypeInfo.Builder().
|
: new EdmSingletonImpl(edm, this, singletonName, new EdmTypeInfo.Builder().
|
||||||
setTypeExpression(singleton.getEntityType()).
|
setTypeExpression(singleton.getEntityType()).
|
||||||
setDefaultNamespace(entityContainerName.getNamespace()).
|
setDefaultNamespace(entityContainerName.getNamespace()).
|
||||||
build().getFullQualifiedName(), singleton);
|
build().getFullQualifiedName(), singleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -84,11 +77,8 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
final EntitySet entitySet = xmlEntityContainer.getEntitySet(entitySetName);
|
final EntitySet entitySet = xmlEntityContainer.getEntitySet(entitySetName);
|
||||||
if (entitySet != null) {
|
if (entitySet != null) {
|
||||||
final FullQualifiedName entityType = new EdmTypeInfo.Builder().setTypeExpression(entitySet.getEntityType()).
|
final FullQualifiedName entityType = new EdmTypeInfo.Builder().setTypeExpression(entitySet.getEntityType()).
|
||||||
setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName();
|
setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName();
|
||||||
if (entitySet instanceof EntitySet) {
|
result = new EdmEntitySetImpl(edm, this, entitySetName, entityType, entitySet);
|
||||||
result = new EdmEntitySetImpl(edm, this, entitySetName, entityType,
|
|
||||||
(EntitySet) entitySet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -98,13 +88,10 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
protected EdmActionImport createActionImport(final String actionImportName) {
|
protected EdmActionImport createActionImport(final String actionImportName) {
|
||||||
EdmActionImport result = null;
|
EdmActionImport result = null;
|
||||||
|
|
||||||
if (xmlEntityContainer instanceof EntityContainer) {
|
final ActionImport actionImport = xmlEntityContainer.getActionImport(actionImportName);
|
||||||
final ActionImport actionImport = ((EntityContainer) xmlEntityContainer).
|
if (actionImport != null) {
|
||||||
getActionImport(actionImportName);
|
result = new EdmActionImportImpl(edm, this, actionImportName, actionImport);
|
||||||
if (actionImport != null) {
|
}
|
||||||
result = new EdmActionImportImpl(edm, this, actionImportName, actionImport);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,10 +101,7 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
|
|
||||||
final FunctionImport functionImport = xmlEntityContainer.getFunctionImport(functionImportName);
|
final FunctionImport functionImport = xmlEntityContainer.getFunctionImport(functionImportName);
|
||||||
if (functionImport != null) {
|
if (functionImport != null) {
|
||||||
if (functionImport instanceof org.apache.olingo.client.api.edm.xml.FunctionImport) {
|
result = new EdmFunctionImportImpl(edm, this, functionImportName, functionImport);
|
||||||
result = new EdmFunctionImportImpl(edm, this, functionImportName,
|
|
||||||
(org.apache.olingo.client.api.edm.xml.FunctionImport) functionImport);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -130,15 +114,11 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
for (EntitySet entitySet : localEntitySets) {
|
for (EntitySet entitySet : localEntitySets) {
|
||||||
EdmEntitySet edmSet;
|
EdmEntitySet edmSet;
|
||||||
final FullQualifiedName entityType = new EdmTypeInfo.Builder().setTypeExpression(entitySet.getEntityType()).
|
final FullQualifiedName entityType = new EdmTypeInfo.Builder().setTypeExpression(entitySet.getEntityType()).
|
||||||
setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName();
|
setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName();
|
||||||
if (entitySet instanceof EntitySet) {
|
edmSet = new EdmEntitySetImpl(edm, this, entitySet.getName(), entityType, entitySet);
|
||||||
edmSet = new EdmEntitySetImpl(edm, this, entitySet.getName(), entityType,
|
entitySets.put(edmSet.getName(), edmSet);
|
||||||
(EntitySet) entitySet);
|
|
||||||
entitySets.put(edmSet.getName(), edmSet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -146,22 +126,18 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
final List<? extends FunctionImport> localFunctionImports = xmlEntityContainer.getFunctionImports();
|
final List<? extends FunctionImport> localFunctionImports = xmlEntityContainer.getFunctionImports();
|
||||||
for (FunctionImport functionImport : localFunctionImports) {
|
for (FunctionImport functionImport : localFunctionImports) {
|
||||||
EdmFunctionImport edmFunctionImport;
|
EdmFunctionImport edmFunctionImport;
|
||||||
if (functionImport instanceof org.apache.olingo.client.api.edm.xml.FunctionImport) {
|
edmFunctionImport = new EdmFunctionImportImpl(edm, this, functionImport.getName(), functionImport);
|
||||||
edmFunctionImport = new EdmFunctionImportImpl(edm, this, functionImport.getName(),
|
functionImports.put(edmFunctionImport.getName(), edmFunctionImport);
|
||||||
(org.apache.olingo.client.api.edm.xml.FunctionImport) functionImport);
|
|
||||||
functionImports.put(edmFunctionImport.getName(), edmFunctionImport);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadAllSingletons() {
|
protected void loadAllSingletons() {
|
||||||
final List<Singleton> localSingletons =
|
final List<Singleton> localSingletons = xmlEntityContainer.getSingletons();
|
||||||
((EntityContainer) xmlEntityContainer).getSingletons();
|
|
||||||
if (localSingletons != null) {
|
if (localSingletons != null) {
|
||||||
for (Singleton singleton : localSingletons) {
|
for (Singleton singleton : localSingletons) {
|
||||||
singletons.put(singleton.getName(), new EdmSingletonImpl(edm, this, singleton.getName(),
|
singletons.put(singleton.getName(), new EdmSingletonImpl(edm, this, singleton.getName(),
|
||||||
new EdmTypeInfo.Builder().
|
new EdmTypeInfo.Builder().
|
||||||
setTypeExpression(singleton.getEntityType()).setDefaultNamespace(entityContainerName.getNamespace()).
|
setTypeExpression(singleton.getEntityType()).setDefaultNamespace(entityContainerName.getNamespace()).
|
||||||
build().getFullQualifiedName(), singleton));
|
build().getFullQualifiedName(), singleton));
|
||||||
}
|
}
|
||||||
|
@ -170,16 +146,13 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadAllActionImports() {
|
protected void loadAllActionImports() {
|
||||||
if (xmlEntityContainer instanceof EntityContainer) {
|
final List<ActionImport> localActionImports = xmlEntityContainer.getActionImports();
|
||||||
final List<ActionImport> localActionImports =
|
if (actionImports != null) {
|
||||||
((EntityContainer) xmlEntityContainer).getActionImports();
|
for (ActionImport actionImport : localActionImports) {
|
||||||
if (actionImports != null) {
|
actionImports.put(actionImport.getName(), new EdmActionImportImpl(edm, this, actionImport.getName(),
|
||||||
for (ActionImport actionImport : localActionImports) {
|
actionImport));
|
||||||
actionImports.put(actionImport.getName(),
|
|
||||||
new EdmActionImportImpl(edm, this, actionImport.getName(), actionImport));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -194,7 +167,7 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
return helper == null ? Collections.<EdmAnnotation>emptyList() : helper.getAnnotations();
|
return helper == null ? Collections.<EdmAnnotation> emptyList() : helper.getAnnotations();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.EntityType;
|
import org.apache.olingo.client.api.edm.xml.EntityType;
|
||||||
import org.apache.olingo.client.api.edm.xml.PropertyRef;
|
import org.apache.olingo.client.api.edm.xml.PropertyRef;
|
||||||
import org.apache.olingo.client.api.edm.xml.Schema;
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
||||||
|
@ -44,20 +43,19 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
|
||||||
|
|
||||||
private EdmAnnotationHelper annotationHelper;
|
private EdmAnnotationHelper annotationHelper;
|
||||||
|
|
||||||
public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName fqn,
|
public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName fqn, final EntityType entityType) {
|
||||||
final List<? extends Schema> xmlSchemas, final EntityType entityType) {
|
|
||||||
|
|
||||||
final FullQualifiedName baseTypeName = entityType.getBaseType() == null
|
final FullQualifiedName baseTypeName = entityType.getBaseType() == null
|
||||||
? null
|
? null
|
||||||
: new EdmTypeInfo.Builder().setTypeExpression(entityType.getBaseType()).build().getFullQualifiedName();
|
: new EdmTypeInfo.Builder().setTypeExpression(entityType.getBaseType()).build().getFullQualifiedName();
|
||||||
final EdmEntityTypeImpl instance = new EdmEntityTypeImpl(edm, fqn, baseTypeName, xmlSchemas, entityType);
|
final EdmEntityTypeImpl instance = new EdmEntityTypeImpl(edm, fqn, baseTypeName, entityType);
|
||||||
instance.baseType = instance.buildBaseType(baseTypeName);
|
instance.baseType = instance.buildBaseType(baseTypeName);
|
||||||
|
|
||||||
if (instance.baseType == null) {
|
if (instance.baseType == null) {
|
||||||
instance.entityBaseType = null;
|
instance.entityBaseType = null;
|
||||||
|
|
||||||
final List<EdmKeyPropertyRef> edmKey;
|
final List<EdmKeyPropertyRef> edmKey;
|
||||||
//Abstract EntityTypes do not necessarily have keys
|
// Abstract EntityTypes do not necessarily have keys
|
||||||
if (entityType.isAbstractType() && entityType.getKey() == null) {
|
if (entityType.isAbstractType() && entityType.getKey() == null) {
|
||||||
edmKey = new ArrayList<EdmKeyPropertyRef>();
|
edmKey = new ArrayList<EdmKeyPropertyRef>();
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,14 +74,11 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
|
||||||
}
|
}
|
||||||
|
|
||||||
private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
|
private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
|
||||||
final List<? extends Schema> xmlSchemas, final EntityType entityType) {
|
final EntityType entityType) {
|
||||||
|
|
||||||
super(edm, fqn, baseTypeName, entityType.isHasStream());
|
super(edm, fqn, baseTypeName, entityType.isHasStream());
|
||||||
this.typeHelper = new EdmStructuredTypeHelperImpl(edm, getFullQualifiedName(), xmlSchemas, entityType);
|
this.typeHelper = new EdmStructuredTypeHelperImpl(edm, getFullQualifiedName(), entityType);
|
||||||
if (entityType instanceof EntityType) {
|
this.annotationHelper = new EdmAnnotationHelperImpl(edm, entityType);
|
||||||
this.annotationHelper = new EdmAnnotationHelperImpl(edm,
|
|
||||||
(EntityType) entityType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
@ -44,9 +44,7 @@ public class EdmParameterImpl extends AbstractEdmParameter {
|
||||||
super(edm, parameter.getName(), new FullQualifiedName(parameter.getType()));
|
super(edm, parameter.getName(), new FullQualifiedName(parameter.getType()));
|
||||||
this.parameter = parameter;
|
this.parameter = parameter;
|
||||||
this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(parameter.getType()).build();
|
this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(parameter.getType()).build();
|
||||||
if (parameter instanceof Parameter) {
|
this.helper = new EdmAnnotationHelperImpl(edm, parameter);
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, (Parameter) parameter);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,9 +79,8 @@ public class EdmParameterImpl extends AbstractEdmParameter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SRID getSrid() {
|
public SRID getSrid() {
|
||||||
return (parameter instanceof Parameter)
|
return parameter.getSrid();
|
||||||
? ((Parameter) parameter).getSrid()
|
|
||||||
: null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -93,7 +90,7 @@ public class EdmParameterImpl extends AbstractEdmParameter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
return helper == null ? Collections.<EdmAnnotation>emptyList() : helper.getAnnotations();
|
return helper == null ? Collections.<EdmAnnotation> emptyList() : helper.getAnnotations();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
@ -48,9 +48,7 @@ public class EdmPropertyImpl extends AbstractEdmProperty {
|
||||||
this.structuredTypeName = structuredTypeName;
|
this.structuredTypeName = structuredTypeName;
|
||||||
this.property = property;
|
this.property = property;
|
||||||
this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(property.getType()).build();
|
this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(property.getType()).build();
|
||||||
if (property instanceof Property) {
|
this.helper = new EdmAnnotationHelperImpl(edm, property);
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, (Property) property);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -100,9 +98,7 @@ public class EdmPropertyImpl extends AbstractEdmProperty {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SRID getSrid() {
|
public SRID getSrid() {
|
||||||
return (property instanceof Property)
|
return property.getSrid();
|
||||||
? ((Property) property).getSrid()
|
|
||||||
: null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -117,7 +113,7 @@ public class EdmPropertyImpl extends AbstractEdmProperty {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
return helper == null ? Collections.<EdmAnnotation>emptyList() : helper.getAnnotations();
|
return helper == null ? Collections.<EdmAnnotation> emptyList() : helper.getAnnotations();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,10 +50,8 @@ import org.apache.olingo.commons.core.edm.AbstractEdmSchema;
|
||||||
|
|
||||||
public class EdmSchemaImpl extends AbstractEdmSchema {
|
public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
|
|
||||||
|
|
||||||
private final Edm edm;
|
private final Edm edm;
|
||||||
|
|
||||||
private final List<Schema> xmlSchemas;
|
|
||||||
|
|
||||||
private final Schema schema;
|
private final Schema schema;
|
||||||
|
|
||||||
|
@ -61,12 +59,11 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
|
|
||||||
private List<EdmEntityContainer> entityContainers;
|
private List<EdmEntityContainer> entityContainers;
|
||||||
|
|
||||||
public EdmSchemaImpl(final Edm edm, final List<Schema> xmlSchemas, final Schema schema) {
|
public EdmSchemaImpl(final Edm edm, final Schema schema) {
|
||||||
|
|
||||||
super(schema.getNamespace(), schema.getAlias());
|
super(schema.getNamespace(), schema.getAlias());
|
||||||
|
|
||||||
this.edm = edm;
|
this.edm = edm;
|
||||||
this.xmlSchemas = xmlSchemas;
|
|
||||||
this.schema = schema;
|
this.schema = schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,20 +72,9 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
if (entityContainers == null) {
|
if (entityContainers == null) {
|
||||||
entityContainerByName = new HashMap<FullQualifiedName, EdmEntityContainer>();
|
entityContainerByName = new HashMap<FullQualifiedName, EdmEntityContainer>();
|
||||||
|
|
||||||
if (schema instanceof Schema) {
|
entityContainers = super.getEntityContainers();
|
||||||
entityContainers = super.getEntityContainers();
|
if (getEntityContainer() != null) {
|
||||||
if (getEntityContainer() != null) {
|
entityContainerByName.put(getEntityContainer().getFullQualifiedName(), getEntityContainer());
|
||||||
entityContainerByName.put(getEntityContainer().getFullQualifiedName(), getEntityContainer());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
entityContainers = new ArrayList<EdmEntityContainer>(schema.getEntityContainers().size());
|
|
||||||
for (EntityContainer entityContainer : schema.getEntityContainers()) {
|
|
||||||
final EdmEntityContainer edmContainer = createEntityContainer(entityContainer.getName());
|
|
||||||
if (edmContainer != null) {
|
|
||||||
entityContainers.add(edmContainer);
|
|
||||||
entityContainerByName.put(edmContainer.getFullQualifiedName(), edmContainer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +92,7 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
if (defaultContainer != null) {
|
if (defaultContainer != null) {
|
||||||
final FullQualifiedName entityContainerName =
|
final FullQualifiedName entityContainerName =
|
||||||
new FullQualifiedName(schema.getNamespace(), defaultContainer.getName());
|
new FullQualifiedName(schema.getNamespace(), defaultContainer.getName());
|
||||||
return new EdmEntityContainerImpl(edm, entityContainerName, defaultContainer, xmlSchemas);
|
return new EdmEntityContainerImpl(edm, entityContainerName, defaultContainer);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -123,14 +109,12 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
@Override
|
@Override
|
||||||
protected List<EdmTypeDefinition> createTypeDefinitions() {
|
protected List<EdmTypeDefinition> createTypeDefinitions() {
|
||||||
final List<EdmTypeDefinition> typeDefinitions = new ArrayList<EdmTypeDefinition>();
|
final List<EdmTypeDefinition> typeDefinitions = new ArrayList<EdmTypeDefinition>();
|
||||||
if (schema instanceof Schema) {
|
final List<TypeDefinition> providerTypeDefinitions =
|
||||||
final List<TypeDefinition> providerTypeDefinitions =
|
schema.getTypeDefinitions();
|
||||||
((Schema) schema).getTypeDefinitions();
|
if (providerTypeDefinitions != null) {
|
||||||
if (providerTypeDefinitions != null) {
|
for (TypeDefinition def : providerTypeDefinitions) {
|
||||||
for (TypeDefinition def : providerTypeDefinitions) {
|
typeDefinitions.add(
|
||||||
typeDefinitions.add(
|
new EdmTypeDefinitionImpl(edm, new FullQualifiedName(namespace, def.getName()), def));
|
||||||
new EdmTypeDefinitionImpl(edm, new FullQualifiedName(namespace, def.getName()), def));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return typeDefinitions;
|
return typeDefinitions;
|
||||||
|
@ -156,7 +140,7 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
if (providerEntityTypes != null) {
|
if (providerEntityTypes != null) {
|
||||||
for (EntityType entityType : providerEntityTypes) {
|
for (EntityType entityType : providerEntityTypes) {
|
||||||
entityTypes.add(EdmEntityTypeImpl.getInstance(edm,
|
entityTypes.add(EdmEntityTypeImpl.getInstance(edm,
|
||||||
new FullQualifiedName(namespace, entityType.getName()), xmlSchemas, entityType));
|
new FullQualifiedName(namespace, entityType.getName()), entityType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return entityTypes;
|
return entityTypes;
|
||||||
|
@ -169,7 +153,7 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
if (providerComplexTypes != null) {
|
if (providerComplexTypes != null) {
|
||||||
for (ComplexType complexType : providerComplexTypes) {
|
for (ComplexType complexType : providerComplexTypes) {
|
||||||
complexTypes.add(EdmComplexTypeImpl.getInstance(edm, new FullQualifiedName(namespace, complexType.getName()),
|
complexTypes.add(EdmComplexTypeImpl.getInstance(edm, new FullQualifiedName(namespace, complexType.getName()),
|
||||||
xmlSchemas, complexType));
|
complexType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return complexTypes;
|
return complexTypes;
|
||||||
|
@ -178,12 +162,10 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
@Override
|
@Override
|
||||||
protected List<EdmAction> createActions() {
|
protected List<EdmAction> createActions() {
|
||||||
final List<EdmAction> actions = new ArrayList<EdmAction>();
|
final List<EdmAction> actions = new ArrayList<EdmAction>();
|
||||||
if (schema instanceof Schema) {
|
final List<Action> providerActions = schema.getActions();
|
||||||
final List<Action> providerActions = ((Schema) schema).getActions();
|
if (providerActions != null) {
|
||||||
if (providerActions != null) {
|
for (Action action : providerActions) {
|
||||||
for (Action action : providerActions) {
|
actions.add(EdmActionImpl.getInstance(edm, new FullQualifiedName(namespace, action.getName()), action));
|
||||||
actions.add(EdmActionImpl.getInstance(edm, new FullQualifiedName(namespace, action.getName()), action));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return actions;
|
return actions;
|
||||||
|
@ -192,15 +174,13 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
@Override
|
@Override
|
||||||
protected List<EdmFunction> createFunctions() {
|
protected List<EdmFunction> createFunctions() {
|
||||||
final List<EdmFunction> functions = new ArrayList<EdmFunction>();
|
final List<EdmFunction> functions = new ArrayList<EdmFunction>();
|
||||||
if (schema instanceof Schema) {
|
final List<Function> providerFunctions = schema.getFunctions();
|
||||||
final List<Function> providerFunctions = ((Schema) schema).getFunctions();
|
if (providerFunctions != null) {
|
||||||
if (providerFunctions != null) {
|
for (Function function : providerFunctions) {
|
||||||
for (Function function : providerFunctions) {
|
functions.add(
|
||||||
functions.add(
|
EdmFunctionImpl.getInstance(edm, new FullQualifiedName(namespace, function.getName()), function));
|
||||||
EdmFunctionImpl.getInstance(edm, new FullQualifiedName(namespace, function.getName()), function));
|
|
||||||
}
|
|
||||||
return functions;
|
|
||||||
}
|
}
|
||||||
|
return functions;
|
||||||
}
|
}
|
||||||
return functions;
|
return functions;
|
||||||
}
|
}
|
||||||
|
@ -208,12 +188,10 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
@Override
|
@Override
|
||||||
protected List<EdmTerm> createTerms() {
|
protected List<EdmTerm> createTerms() {
|
||||||
final List<EdmTerm> terms = new ArrayList<EdmTerm>();
|
final List<EdmTerm> terms = new ArrayList<EdmTerm>();
|
||||||
if (schema instanceof Schema) {
|
final List<Term> providerTerms = schema.getTerms();
|
||||||
final List<Term> providerTerms = ((Schema) schema).getTerms();
|
if (providerTerms != null) {
|
||||||
if (providerTerms != null) {
|
for (Term term : providerTerms) {
|
||||||
for (Term term : providerTerms) {
|
terms.add(new EdmTermImpl(edm, getNamespace(), term));
|
||||||
terms.add(new EdmTermImpl(edm, getNamespace(), term));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return terms;
|
return terms;
|
||||||
|
@ -222,13 +200,11 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
@Override
|
@Override
|
||||||
protected List<EdmAnnotations> createAnnotationGroups() {
|
protected List<EdmAnnotations> createAnnotationGroups() {
|
||||||
final List<EdmAnnotations> annotationGroups = new ArrayList<EdmAnnotations>();
|
final List<EdmAnnotations> annotationGroups = new ArrayList<EdmAnnotations>();
|
||||||
if (schema instanceof Schema) {
|
final List<Annotations> providerAnnotations =
|
||||||
final List<Annotations> providerAnnotations =
|
schema.getAnnotationGroups();
|
||||||
((Schema) schema).getAnnotationGroups();
|
if (providerAnnotations != null) {
|
||||||
if (providerAnnotations != null) {
|
for (Annotations annotationGroup : providerAnnotations) {
|
||||||
for (Annotations annotationGroup : providerAnnotations) {
|
annotationGroups.add(new EdmAnnotationsImpl(edm, this, annotationGroup));
|
||||||
annotationGroups.add(new EdmAnnotationsImpl(edm, this, annotationGroup));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return annotationGroups;
|
return annotationGroups;
|
||||||
|
@ -237,13 +213,11 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
@Override
|
@Override
|
||||||
protected List<EdmAnnotation> createAnnotations() {
|
protected List<EdmAnnotation> createAnnotations() {
|
||||||
final List<EdmAnnotation> annotations = new ArrayList<EdmAnnotation>();
|
final List<EdmAnnotation> annotations = new ArrayList<EdmAnnotation>();
|
||||||
if (schema instanceof Schema) {
|
final List<Annotation> providerAnnotations =
|
||||||
final List<Annotation> providerAnnotations =
|
schema.getAnnotations();
|
||||||
((Schema) schema).getAnnotations();
|
if (providerAnnotations != null) {
|
||||||
if (providerAnnotations != null) {
|
for (Annotation annotation : providerAnnotations) {
|
||||||
for (Annotation annotation : providerAnnotations) {
|
annotations.add(new EdmAnnotationImpl(edm, annotation));
|
||||||
annotations.add(new EdmAnnotationImpl(edm, annotation));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return annotations;
|
return annotations;
|
||||||
|
|
|
@ -19,14 +19,12 @@
|
||||||
package org.apache.olingo.client.core.edm;
|
package org.apache.olingo.client.core.edm;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.ComplexType;
|
import org.apache.olingo.client.api.edm.xml.ComplexType;
|
||||||
import org.apache.olingo.client.api.edm.xml.EntityType;
|
import org.apache.olingo.client.api.edm.xml.EntityType;
|
||||||
import org.apache.olingo.client.api.edm.xml.NavigationProperty;
|
import org.apache.olingo.client.api.edm.xml.NavigationProperty;
|
||||||
import org.apache.olingo.client.api.edm.xml.Property;
|
import org.apache.olingo.client.api.edm.xml.Property;
|
||||||
import org.apache.olingo.client.api.edm.xml.Schema;
|
|
||||||
import org.apache.olingo.client.api.edm.xml.StructuralType;
|
import org.apache.olingo.client.api.edm.xml.StructuralType;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
||||||
|
@ -47,7 +45,7 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
||||||
private Map<String, EdmNavigationProperty> navigationProperties;
|
private Map<String, EdmNavigationProperty> navigationProperties;
|
||||||
|
|
||||||
public EdmStructuredTypeHelperImpl(final Edm edm, final FullQualifiedName structuredTypeName,
|
public EdmStructuredTypeHelperImpl(final Edm edm, final FullQualifiedName structuredTypeName,
|
||||||
final List<? extends Schema> xmlSchemas, final StructuralType structuralType) {
|
final StructuralType structuralType) {
|
||||||
|
|
||||||
this.edm = edm;
|
this.edm = edm;
|
||||||
this.structuredTypeName = structuredTypeName;
|
this.structuredTypeName = structuredTypeName;
|
||||||
|
@ -70,11 +68,8 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
||||||
if (navigationProperties == null) {
|
if (navigationProperties == null) {
|
||||||
navigationProperties = new LinkedHashMap<String, EdmNavigationProperty>();
|
navigationProperties = new LinkedHashMap<String, EdmNavigationProperty>();
|
||||||
for (NavigationProperty navigationProperty : structuralType.getNavigationProperties()) {
|
for (NavigationProperty navigationProperty : structuralType.getNavigationProperties()) {
|
||||||
if (navigationProperty instanceof org.apache.olingo.client.api.edm.xml.NavigationProperty) {
|
navigationProperties.put(navigationProperty.getName(), new EdmNavigationPropertyImpl(
|
||||||
navigationProperties.put(navigationProperty.getName(), new EdmNavigationPropertyImpl(
|
edm, structuredTypeName, navigationProperty));
|
||||||
edm, structuredTypeName,
|
|
||||||
(org.apache.olingo.client.api.edm.xml.NavigationProperty) navigationProperty));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return navigationProperties;
|
return navigationProperties;
|
||||||
|
@ -83,9 +78,9 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpenType() {
|
public boolean isOpenType() {
|
||||||
boolean isOpen = false;
|
boolean isOpen = false;
|
||||||
if(structuralType instanceof ComplexType){
|
if (structuralType instanceof ComplexType) {
|
||||||
isOpen = ((ComplexType) structuralType).isOpenType();
|
isOpen = ((ComplexType) structuralType).isOpenType();
|
||||||
}else if(structuralType instanceof EntityType){
|
} else if (structuralType instanceof EntityType) {
|
||||||
isOpen = ((EntityType) structuralType).isOpenType();
|
isOpen = ((EntityType) structuralType).isOpenType();
|
||||||
}
|
}
|
||||||
return isOpen;
|
return isOpen;
|
||||||
|
@ -94,9 +89,9 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
||||||
@Override
|
@Override
|
||||||
public boolean isAbstract() {
|
public boolean isAbstract() {
|
||||||
boolean isAbstract = false;
|
boolean isAbstract = false;
|
||||||
if(structuralType instanceof ComplexType){
|
if (structuralType instanceof ComplexType) {
|
||||||
isAbstract = ((ComplexType) structuralType).isAbstractType();
|
isAbstract = ((ComplexType) structuralType).isAbstractType();
|
||||||
}else if(structuralType instanceof EntityType){
|
} else if (structuralType instanceof EntityType) {
|
||||||
isAbstract = ((EntityType) structuralType).isAbstractType();
|
isAbstract = ((EntityType) structuralType).isAbstractType();
|
||||||
}
|
}
|
||||||
return isAbstract;
|
return isAbstract;
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class ComplexTypeImpl extends AbstractStructuralType implements ComplexTy
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Property getProperty(final String name) {
|
public Property getProperty(final String name) {
|
||||||
return (Property) super.getProperty(name);
|
return super.getProperty(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -84,7 +84,7 @@ public class ComplexTypeImpl extends AbstractStructuralType implements ComplexTy
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigationProperty getNavigationProperty(final String name) {
|
public NavigationProperty getNavigationProperty(final String name) {
|
||||||
return (NavigationProperty) super.getNavigationProperty(name);
|
return super.getNavigationProperty(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class EntityTypeImpl extends AbstractStructuralType implements EntityType
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Property getProperty(final String name) {
|
public Property getProperty(final String name) {
|
||||||
return (Property) super.getProperty(name);
|
return super.getProperty(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -107,7 +107,7 @@ public class EntityTypeImpl extends AbstractStructuralType implements EntityType
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigationProperty getNavigationProperty(final String name) {
|
public NavigationProperty getNavigationProperty(final String name) {
|
||||||
return (NavigationProperty) super.getNavigationProperty(name);
|
return super.getNavigationProperty(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -69,6 +69,6 @@ public class XMLMetadataImpl extends AbstractEdmItem implements XMLMetadata {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Reference> getReferences() {
|
public List<Reference> getReferences() {
|
||||||
return ((Edmx) this.edmx).getReferences();
|
return this.edmx.getReferences();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ public class ProxyWrappingHttpClientFactory implements WrappingHttpClientFactory
|
||||||
this.wrapped = wrapped;
|
this.wrapped = wrapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public DefaultHttpClientFactory getWrappedHttpClientFactory() {
|
public DefaultHttpClientFactory getWrappedHttpClientFactory() {
|
||||||
return this.wrapped;
|
return this.wrapped;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,18 +70,22 @@ public class ClientODataDeserializerImpl implements ClientODataDeserializer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ResWrap<EntitySet> toEntitySet(final InputStream input) throws ODataDeserializerException {
|
public ResWrap<EntitySet> toEntitySet(final InputStream input) throws ODataDeserializerException {
|
||||||
return deserializer.toEntitySet(input);
|
return deserializer.toEntitySet(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ResWrap<Entity> toEntity(final InputStream input) throws ODataDeserializerException {
|
public ResWrap<Entity> toEntity(final InputStream input) throws ODataDeserializerException {
|
||||||
return deserializer.toEntity(input);
|
return deserializer.toEntity(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ResWrap<Property> toProperty(final InputStream input) throws ODataDeserializerException {
|
public ResWrap<Property> toProperty(final InputStream input) throws ODataDeserializerException {
|
||||||
return deserializer.toProperty(input);
|
return deserializer.toProperty(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ODataError toError(final InputStream input) throws ODataDeserializerException {
|
public ODataError toError(final InputStream input) throws ODataDeserializerException {
|
||||||
return deserializer.toError(input);
|
return deserializer.toError(input);
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,11 +118,11 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean add(final ODataEntity entity, final ODataProperty property) {
|
public boolean add(final ODataEntity entity, final ODataProperty property) {
|
||||||
return ((ODataEntity) entity).getProperties().add((ODataProperty) property);
|
return entity.getProperties().add(property);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean add(final ODataEntitySet entitySet, final ODataEntity entity) {
|
protected boolean add(final ODataEntitySet entitySet, final ODataEntity entity) {
|
||||||
return ((ODataEntitySet) entitySet).getEntities().add((ODataEntity) entity);
|
return entitySet.getEntities().add(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -212,8 +212,8 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
entitySet.getEntities().add(getEntity(entity));
|
entitySet.getEntities().add(getEntity(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
entitySet.setDeltaLink(((ODataEntitySet) odataEntitySet).getDeltaLink());
|
entitySet.setDeltaLink(odataEntitySet.getDeltaLink());
|
||||||
annotations((ODataEntitySet) odataEntitySet, entitySet);
|
annotations(odataEntitySet, entitySet);
|
||||||
return entitySet;
|
return entitySet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
for (Link link : linked.getNavigationLinks()) {
|
for (Link link : linked.getNavigationLinks()) {
|
||||||
final ODataLink odataLink = odataLinked.getNavigationLink(link.getTitle());
|
final ODataLink odataLink = odataLinked.getNavigationLink(link.getTitle());
|
||||||
if (!(odataLink instanceof ODataInlineEntity) && !(odataLink instanceof ODataInlineEntitySet)) {
|
if (!(odataLink instanceof ODataInlineEntity) && !(odataLink instanceof ODataInlineEntitySet)) {
|
||||||
annotations((ODataLink) odataLink, link);
|
annotations(odataLink, link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,8 +294,8 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
entity.getProperties().add(getProperty(property));
|
entity.getProperties().add(getProperty(property));
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.setId(((ODataEntity) odataEntity).getId());
|
entity.setId(odataEntity.getId());
|
||||||
annotations((ODataEntity) odataEntity, entity);
|
annotations(odataEntity, entity);
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Property getProperty(final ODataProperty property) {
|
public Property getProperty(final ODataProperty property) {
|
||||||
final ODataProperty _property = (ODataProperty) property;
|
final ODataProperty _property = property;
|
||||||
|
|
||||||
final Property propertyResource = new PropertyImpl();
|
final Property propertyResource = new PropertyImpl();
|
||||||
propertyResource.setName(_property.getName());
|
propertyResource.setName(_property.getName());
|
||||||
|
@ -340,8 +340,9 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
protected Object getValue(final ODataValue value) {
|
protected Object getValue(final ODataValue value) {
|
||||||
Object valueResource = null;
|
Object valueResource = null;
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
valueResource = null;
|
return null;
|
||||||
} else if (value.isEnum()) {
|
}
|
||||||
|
if (value.isEnum()) {
|
||||||
valueResource = value.asEnum().getValue();
|
valueResource = value.asEnum().getValue();
|
||||||
} else if (value.isPrimitive()) {
|
} else if (value.isPrimitive()) {
|
||||||
valueResource = value.asPrimitive().toValue();
|
valueResource = value.asPrimitive().toValue();
|
||||||
|
@ -386,8 +387,8 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final ODataAnnotation odataAnnotation = new ODataAnnotationImpl(annotation.getTerm(),
|
final ODataAnnotation odataAnnotation =
|
||||||
(org.apache.olingo.commons.api.domain.ODataValue) getODataValue(fqn, annotation, null, null));
|
new ODataAnnotationImpl(annotation.getTerm(), getODataValue(fqn, annotation, null, null));
|
||||||
odataAnnotatable.getAnnotations().add(odataAnnotation);
|
odataAnnotatable.getAnnotations().add(odataAnnotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -398,7 +399,9 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
final StringWriter writer = new StringWriter();
|
final StringWriter writer = new StringWriter();
|
||||||
try {
|
try {
|
||||||
client.getSerializer(ODataFormat.JSON).write(writer, resource.getPayload());
|
client.getSerializer(ODataFormat.JSON).write(writer, resource.getPayload());
|
||||||
} catch (final ODataSerializerException e) {}
|
} catch (final ODataSerializerException e) {
|
||||||
|
LOG.debug("EntitySet -> ODataEntitySet:\n{}", writer.toString());
|
||||||
|
}
|
||||||
writer.flush();
|
writer.flush();
|
||||||
LOG.debug("EntitySet -> ODataEntitySet:\n{}", writer.toString());
|
LOG.debug("EntitySet -> ODataEntitySet:\n{}", writer.toString());
|
||||||
}
|
}
|
||||||
|
@ -465,9 +468,9 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (org.apache.olingo.commons.api.domain.ODataLink link : odataLinked.getNavigationLinks()) {
|
for (ODataLink link : odataLinked.getNavigationLinks()) {
|
||||||
if (!(link instanceof ODataInlineEntity) && !(link instanceof ODataInlineEntitySet)) {
|
if (!(link instanceof ODataInlineEntity) && !(link instanceof ODataInlineEntitySet)) {
|
||||||
odataAnnotations(linked.getNavigationLink(link.getName()), (ODataAnnotatable) link);
|
odataAnnotations(linked.getNavigationLink(link.getName()), link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -593,7 +596,9 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
final StringWriter writer = new StringWriter();
|
final StringWriter writer = new StringWriter();
|
||||||
try {
|
try {
|
||||||
client.getSerializer(ODataFormat.JSON).write(writer, resource.getPayload());
|
client.getSerializer(ODataFormat.JSON).write(writer, resource.getPayload());
|
||||||
} catch (final ODataSerializerException e) {}
|
} catch (final ODataSerializerException e) {
|
||||||
|
LOG.debug("EntityResource -> ODataEntity:\n{}", writer.toString());
|
||||||
|
}
|
||||||
writer.flush();
|
writer.flush();
|
||||||
LOG.debug("EntityResource -> ODataEntity:\n{}", writer.toString());
|
LOG.debug("EntityResource -> ODataEntity:\n{}", writer.toString());
|
||||||
}
|
}
|
||||||
|
@ -743,11 +748,11 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
|
|
||||||
ODataValue value = null;
|
ODataValue value = null;
|
||||||
if (valuable.isEnum()) {
|
if (valuable.isEnum()) {
|
||||||
value = ((ODataClient) client).getObjectFactory().newEnumValue(type == null ? null : type.toString(),
|
value = client.getObjectFactory().newEnumValue(type == null ? null : type.toString(),
|
||||||
valuable.asEnum().toString());
|
valuable.asEnum().toString());
|
||||||
} else if (valuable.isComplex()) {
|
} else if (valuable.isComplex()) {
|
||||||
final ODataComplexValue lcValue =
|
final ODataComplexValue lcValue =
|
||||||
((ODataClient) client).getObjectFactory().newComplexValue(type == null ? null : type.toString());
|
client.getObjectFactory().newComplexValue(type == null ? null : type.toString());
|
||||||
|
|
||||||
EdmComplexType edmType = null;
|
EdmComplexType edmType = null;
|
||||||
if (client instanceof EdmEnabledODataClient && type != null) {
|
if (client instanceof EdmEnabledODataClient && type != null) {
|
||||||
|
@ -806,8 +811,8 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
: EdmPrimitiveTypeKind.valueOfFQN(type.toString())).
|
: EdmPrimitiveTypeKind.valueOfFQN(type.toString())).
|
||||||
build();
|
build();
|
||||||
} else if (valuable.isComplex()) {
|
} else if (valuable.isComplex()) {
|
||||||
final ODataComplexValue cValue = (ODataComplexValue) client.getObjectFactory().
|
final ODataComplexValue cValue =
|
||||||
newComplexValue(type == null ? null : type.toString());
|
client.getObjectFactory().newComplexValue(type == null ? null : type.toString());
|
||||||
|
|
||||||
if (!valuable.isNull()) {
|
if (!valuable.isNull()) {
|
||||||
EdmComplexType edmType = null;
|
EdmComplexType edmType = null;
|
||||||
|
@ -853,8 +858,8 @@ public class ODataBinderImpl implements ODataBinder {
|
||||||
final URI next = resource.getPayload().getNext();
|
final URI next = resource.getPayload().getNext();
|
||||||
|
|
||||||
final ODataDelta delta = next == null
|
final ODataDelta delta = next == null
|
||||||
? ((ODataClient) client).getObjectFactory().newDelta()
|
? client.getObjectFactory().newDelta()
|
||||||
: ((ODataClient) client).getObjectFactory().newDelta(URIUtils.getURI(base, next.toASCIIString()));
|
: client.getObjectFactory().newDelta(URIUtils.getURI(base, next.toASCIIString()));
|
||||||
|
|
||||||
if (resource.getPayload().getCount() != null) {
|
if (resource.getPayload().getCount() != null) {
|
||||||
delta.setCount(resource.getPayload().getCount());
|
delta.setCount(resource.getPayload().getCount());
|
||||||
|
|
|
@ -158,18 +158,18 @@ public class ODataReaderImpl implements ODataReader {
|
||||||
@Override
|
@Override
|
||||||
public ODataEntitySet readEntitySet(final InputStream input, final ODataFormat format)
|
public ODataEntitySet readEntitySet(final InputStream input, final ODataFormat format)
|
||||||
throws ODataDeserializerException {
|
throws ODataDeserializerException {
|
||||||
return ((ODataClient) client).getBinder().getODataEntitySet(client.getDeserializer(format).toEntitySet(input));
|
return client.getBinder().getODataEntitySet(client.getDeserializer(format).toEntitySet(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ODataEntity readEntity(final InputStream input, final ODataFormat format)
|
public ODataEntity readEntity(final InputStream input, final ODataFormat format)
|
||||||
throws ODataDeserializerException {
|
throws ODataDeserializerException {
|
||||||
return ((ODataClient) client).getBinder().getODataEntity(client.getDeserializer(format).toEntity(input));
|
return client.getBinder().getODataEntity(client.getDeserializer(format).toEntity(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ODataProperty readProperty(final InputStream input, final ODataFormat format)
|
public ODataProperty readProperty(final InputStream input, final ODataFormat format)
|
||||||
throws ODataDeserializerException {
|
throws ODataDeserializerException {
|
||||||
return ((ODataClient) client).getBinder().getODataProperty(client.getDeserializer(format).toProperty(input));
|
return client.getBinder().getODataProperty(client.getDeserializer(format).toProperty(input));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class ODataWriterImpl implements ODataWriter {
|
||||||
|
|
||||||
return new ByteArrayInputStream(output.toByteArray());
|
return new ByteArrayInputStream(output.toByteArray());
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.closeQuietly(output);
|
IOUtils.closeQuietly(writer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ public class ODataWriterImpl implements ODataWriter {
|
||||||
|
|
||||||
return new ByteArrayInputStream(output.toByteArray());
|
return new ByteArrayInputStream(output.toByteArray());
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.closeQuietly(output);
|
IOUtils.closeQuietly(writer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public class ODataWriterImpl implements ODataWriter {
|
||||||
|
|
||||||
return new ByteArrayInputStream(output.toByteArray());
|
return new ByteArrayInputStream(output.toByteArray());
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.closeQuietly(output);
|
IOUtils.closeQuietly(writer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class ODataWriterImpl implements ODataWriter {
|
||||||
|
|
||||||
return new ByteArrayInputStream(output.toByteArray());
|
return new ByteArrayInputStream(output.toByteArray());
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.closeQuietly(output);
|
IOUtils.closeQuietly(writer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,8 +229,8 @@ public final class URIUtils {
|
||||||
: (obj instanceof Boolean)
|
: (obj instanceof Boolean)
|
||||||
? BooleanUtils.toStringTrueFalse((Boolean) obj)
|
? BooleanUtils.toStringTrueFalse((Boolean) obj)
|
||||||
: (obj instanceof UUID)
|
: (obj instanceof UUID)
|
||||||
? obj.toString()
|
? obj.toString()
|
||||||
|
|
||||||
: (obj instanceof byte[])
|
: (obj instanceof byte[])
|
||||||
? EdmBinary.getInstance().toUriLiteral(Hex.encodeHexString((byte[]) obj))
|
? EdmBinary.getInstance().toUriLiteral(Hex.encodeHexString((byte[]) obj))
|
||||||
: (obj instanceof Timestamp)
|
: (obj instanceof Timestamp)
|
||||||
|
@ -264,7 +264,11 @@ public final class URIUtils {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.warn("While escaping '{}', using toString()", obj, e);
|
LOG.warn("While escaping '{}', using toString()", obj, e);
|
||||||
value = obj.toString();
|
if (obj == null) {
|
||||||
|
value = "null";
|
||||||
|
} else {
|
||||||
|
value = obj.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
@ -346,10 +350,8 @@ public final class URIUtils {
|
||||||
value = param.getValue().asComplex().asJavaMap();
|
value = param.getValue().asComplex().asJavaMap();
|
||||||
} else if (param.getValue().isCollection()) {
|
} else if (param.getValue().isCollection()) {
|
||||||
value = param.getValue().asCollection().asJavaCollection();
|
value = param.getValue().asCollection().asJavaCollection();
|
||||||
} else if (param.getValue() instanceof org.apache.olingo.commons.api.domain.ODataValue
|
} else if (param.getValue().isEnum()) {
|
||||||
&& ((org.apache.olingo.commons.api.domain.ODataValue) param.getValue()).isEnum()) {
|
value = param.getValue().asEnum().toString();
|
||||||
|
|
||||||
value = ((org.apache.olingo.commons.api.domain.ODataValue) param.getValue()).asEnum().toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inlineParams.append(URIUtils.escape(value)).append(',');
|
inlineParams.append(URIUtils.escape(value)).append(',');
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
@ -45,7 +45,6 @@ import org.apache.olingo.commons.api.domain.ODataValue;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
|
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
|
||||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
|
||||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
|
import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
|
||||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
|
import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
|
@ -79,10 +78,10 @@ public class EntityTest extends AbstractTest {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void singleton(final ODataFormat format) throws ODataDeserializerException {
|
private void singleton(final ODataFormat format) throws Exception {
|
||||||
final InputStream input = getClass().getResourceAsStream("VipCustomer." + getSuffix(format));
|
final InputStream input = getClass().getResourceAsStream("VipCustomer." + getSuffix(format));
|
||||||
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
||||||
getClient().getDeserializer(format).toEntity(input));
|
getClient().getDeserializer(format).toEntity(input));
|
||||||
assertNotNull(entity);
|
assertNotNull(entity);
|
||||||
|
|
||||||
assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
|
assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
|
||||||
|
@ -116,15 +115,16 @@ public class EntityTest extends AbstractTest {
|
||||||
|
|
||||||
assertEquals(2, entity.getOperations().size());
|
assertEquals(2, entity.getOperations().size());
|
||||||
assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
|
assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
|
||||||
entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress").getMetadataAnchor());
|
entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress").getMetadataAnchor());
|
||||||
assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
|
assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
|
||||||
entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress").getMetadataAnchor());
|
entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress").getMetadataAnchor());
|
||||||
|
|
||||||
// operations won't get serialized
|
// operations won't get serialized
|
||||||
entity.getOperations().clear();
|
entity.getOperations().clear();
|
||||||
final ODataEntity written = getClient().getBinder().getODataEntity(
|
final ODataEntity written = getClient().getBinder().getODataEntity(
|
||||||
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
||||||
assertEquals(entity, written);
|
assertEquals(entity, written);
|
||||||
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -137,10 +137,10 @@ public class EntityTest extends AbstractTest {
|
||||||
singleton(ODataFormat.JSON_FULL_METADATA);
|
singleton(ODataFormat.JSON_FULL_METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void withEnums(final ODataFormat format) throws ODataDeserializerException {
|
private void withEnums(final ODataFormat format) throws Exception {
|
||||||
final InputStream input = getClass().getResourceAsStream("Products_5." + getSuffix(format));
|
final InputStream input = getClass().getResourceAsStream("Products_5." + getSuffix(format));
|
||||||
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
||||||
getClient().getDeserializer(format).toEntity(input));
|
getClient().getDeserializer(format).toEntity(input));
|
||||||
assertNotNull(entity);
|
assertNotNull(entity);
|
||||||
|
|
||||||
final ODataProperty skinColor = entity.getProperty("SkinColor");
|
final ODataProperty skinColor = entity.getProperty("SkinColor");
|
||||||
|
@ -158,8 +158,9 @@ public class EntityTest extends AbstractTest {
|
||||||
// operations won't get serialized
|
// operations won't get serialized
|
||||||
entity.getOperations().clear();
|
entity.getOperations().clear();
|
||||||
final ODataEntity written = getClient().getBinder().getODataEntity(
|
final ODataEntity written = getClient().getBinder().getODataEntity(
|
||||||
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
||||||
assertEquals(entity, written);
|
assertEquals(entity, written);
|
||||||
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -172,11 +173,11 @@ public class EntityTest extends AbstractTest {
|
||||||
withEnums(ODataFormat.JSON_FULL_METADATA);
|
withEnums(ODataFormat.JSON_FULL_METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void withInlineEntitySet(final ODataFormat format) throws ODataDeserializerException {
|
private void withInlineEntitySet(final ODataFormat format) throws Exception {
|
||||||
final InputStream input = getClass().getResourceAsStream(
|
final InputStream input = getClass().getResourceAsStream(
|
||||||
"Accounts_101_expand_MyPaymentInstruments." + getSuffix(format));
|
"Accounts_101_expand_MyPaymentInstruments." + getSuffix(format));
|
||||||
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
||||||
getClient().getDeserializer(format).toEntity(input));
|
getClient().getDeserializer(format).toEntity(input));
|
||||||
assertNotNull(entity);
|
assertNotNull(entity);
|
||||||
|
|
||||||
final ODataLink instruments = entity.getNavigationLink("MyPaymentInstruments");
|
final ODataLink instruments = entity.getNavigationLink("MyPaymentInstruments");
|
||||||
|
@ -192,8 +193,9 @@ public class EntityTest extends AbstractTest {
|
||||||
// operations won't get serialized
|
// operations won't get serialized
|
||||||
entity.getOperations().clear();
|
entity.getOperations().clear();
|
||||||
final ODataEntity written = getClient().getBinder().getODataEntity(
|
final ODataEntity written = getClient().getBinder().getODataEntity(
|
||||||
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
||||||
assertEquals(entity, written);
|
assertEquals(entity, written);
|
||||||
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -206,11 +208,11 @@ public class EntityTest extends AbstractTest {
|
||||||
withInlineEntitySet(ODataFormat.JSON_FULL_METADATA);
|
withInlineEntitySet(ODataFormat.JSON_FULL_METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mediaEntity(final ODataFormat format) throws ODataDeserializerException {
|
private void mediaEntity(final ODataFormat format) throws Exception {
|
||||||
final InputStream input = getClass().getResourceAsStream(
|
final InputStream input = getClass().getResourceAsStream(
|
||||||
"Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7." + getSuffix(format));
|
"Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7." + getSuffix(format));
|
||||||
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
||||||
getClient().getDeserializer(format).toEntity(input));
|
getClient().getDeserializer(format).toEntity(input));
|
||||||
assertNotNull(entity);
|
assertNotNull(entity);
|
||||||
|
|
||||||
assertTrue(entity.isMediaEntity());
|
assertTrue(entity.isMediaEntity());
|
||||||
|
@ -218,8 +220,9 @@ public class EntityTest extends AbstractTest {
|
||||||
assertEquals("\"8zOOKKvgOtptr4gt8IrnapX3jds=\"", entity.getMediaETag());
|
assertEquals("\"8zOOKKvgOtptr4gt8IrnapX3jds=\"", entity.getMediaETag());
|
||||||
|
|
||||||
final ODataEntity written = getClient().getBinder().getODataEntity(
|
final ODataEntity written = getClient().getBinder().getODataEntity(
|
||||||
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
||||||
assertEquals(entity, written);
|
assertEquals(entity, written);
|
||||||
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -232,10 +235,10 @@ public class EntityTest extends AbstractTest {
|
||||||
mediaEntity(ODataFormat.JSON_FULL_METADATA);
|
mediaEntity(ODataFormat.JSON_FULL_METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void withStream(final ODataFormat format) throws ODataDeserializerException {
|
private void withStream(final ODataFormat format) throws Exception {
|
||||||
final InputStream input = getClass().getResourceAsStream("PersonDetails_1." + getSuffix(format));
|
final InputStream input = getClass().getResourceAsStream("PersonDetails_1." + getSuffix(format));
|
||||||
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
||||||
getClient().getDeserializer(format).toEntity(input));
|
getClient().getDeserializer(format).toEntity(input));
|
||||||
assertNotNull(entity);
|
assertNotNull(entity);
|
||||||
|
|
||||||
assertFalse(entity.isMediaEntity());
|
assertFalse(entity.isMediaEntity());
|
||||||
|
@ -244,8 +247,9 @@ public class EntityTest extends AbstractTest {
|
||||||
assertNotNull(editMedia);
|
assertNotNull(editMedia);
|
||||||
|
|
||||||
final ODataEntity written = getClient().getBinder().getODataEntity(
|
final ODataEntity written = getClient().getBinder().getODataEntity(
|
||||||
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
||||||
assertEquals(entity, written);
|
assertEquals(entity, written);
|
||||||
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -258,17 +262,18 @@ public class EntityTest extends AbstractTest {
|
||||||
withStream(ODataFormat.JSON_FULL_METADATA);
|
withStream(ODataFormat.JSON_FULL_METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ref(final ODataFormat format) throws ODataDeserializerException {
|
private void ref(final ODataFormat format) throws Exception {
|
||||||
final InputStream input = getClass().getResourceAsStream("entityReference." + getSuffix(format));
|
final InputStream input = getClass().getResourceAsStream("entityReference." + getSuffix(format));
|
||||||
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
||||||
getClient().getDeserializer(format).toEntity(input));
|
getClient().getDeserializer(format).toEntity(input));
|
||||||
assertNotNull(entity);
|
assertNotNull(entity);
|
||||||
|
|
||||||
assertNotNull(entity.getId());
|
assertNotNull(entity.getId());
|
||||||
|
|
||||||
final ODataEntity written = getClient().getBinder().getODataEntity(
|
final ODataEntity written = getClient().getBinder().getODataEntity(
|
||||||
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
||||||
assertEquals(entity, written);
|
assertEquals(entity, written);
|
||||||
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -281,10 +286,10 @@ public class EntityTest extends AbstractTest {
|
||||||
ref(ODataFormat.JSON);
|
ref(ODataFormat.JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void complexNavigationProperties(final ODataFormat format) throws ODataDeserializerException {
|
private void complexNavigationProperties(final ODataFormat format) throws Exception {
|
||||||
final InputStream input = getClass().getResourceAsStream("entity.withcomplexnavigation." + getSuffix(format));
|
final InputStream input = getClass().getResourceAsStream("entity.withcomplexnavigation." + getSuffix(format));
|
||||||
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
||||||
getClient().getDeserializer(format).toEntity(input));
|
getClient().getDeserializer(format).toEntity(input));
|
||||||
assertNotNull(entity);
|
assertNotNull(entity);
|
||||||
|
|
||||||
final ODataComplexValue addressValue = entity.getProperty("Address").getComplexValue();
|
final ODataComplexValue addressValue = entity.getProperty("Address").getComplexValue();
|
||||||
|
@ -294,8 +299,9 @@ public class EntityTest extends AbstractTest {
|
||||||
// ETag is not serialized
|
// ETag is not serialized
|
||||||
entity.setETag(null);
|
entity.setETag(null);
|
||||||
final ODataEntity written = getClient().getBinder().getODataEntity(
|
final ODataEntity written = getClient().getBinder().getODataEntity(
|
||||||
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
||||||
assertEquals(entity, written);
|
assertEquals(entity, written);
|
||||||
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -308,10 +314,10 @@ public class EntityTest extends AbstractTest {
|
||||||
complexNavigationProperties(ODataFormat.JSON);
|
complexNavigationProperties(ODataFormat.JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void annotated(final ODataFormat format) throws EdmPrimitiveTypeException, ODataDeserializerException {
|
private void annotated(final ODataFormat format) throws EdmPrimitiveTypeException, Exception {
|
||||||
final InputStream input = getClass().getResourceAsStream("annotated." + getSuffix(format));
|
final InputStream input = getClass().getResourceAsStream("annotated." + getSuffix(format));
|
||||||
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
final ODataEntity entity = getClient().getBinder().getODataEntity(
|
||||||
getClient().getDeserializer(format).toEntity(input));
|
getClient().getDeserializer(format).toEntity(input));
|
||||||
assertNotNull(entity);
|
assertNotNull(entity);
|
||||||
|
|
||||||
assertFalse(entity.getAnnotations().isEmpty());
|
assertFalse(entity.getAnnotations().isEmpty());
|
||||||
|
@ -329,18 +335,19 @@ public class EntityTest extends AbstractTest {
|
||||||
assertTrue(annotation.hasComplexValue());
|
assertTrue(annotation.hasComplexValue());
|
||||||
|
|
||||||
final ODataLink orders = entity.getNavigationLink("Orders");
|
final ODataLink orders = entity.getNavigationLink("Orders");
|
||||||
assertFalse(((org.apache.olingo.commons.api.domain.ODataLink) orders).getAnnotations().isEmpty());
|
assertFalse(orders.getAnnotations().isEmpty());
|
||||||
|
|
||||||
annotation = ((org.apache.olingo.commons.api.domain.ODataLink) orders).getAnnotations().get(0);
|
annotation = orders.getAnnotations().get(0);
|
||||||
assertEquals("com.contoso.display.style", annotation.getTerm());
|
assertEquals("com.contoso.display.style", annotation.getTerm());
|
||||||
assertEquals("com.contoso.display.styleType", annotation.getValue().getTypeName());
|
assertEquals("com.contoso.display.styleType", annotation.getValue().getTypeName());
|
||||||
assertTrue(annotation.hasComplexValue());
|
assertTrue(annotation.hasComplexValue());
|
||||||
assertEquals(2,
|
assertEquals(2,
|
||||||
annotation.getValue().asComplex().get("order").getPrimitiveValue().toCastValue(Integer.class), 0);
|
annotation.getValue().asComplex().get("order").getPrimitiveValue().toCastValue(Integer.class), 0);
|
||||||
|
|
||||||
final ODataEntity written = getClient().getBinder().getODataEntity(
|
final ODataEntity written = getClient().getBinder().getODataEntity(
|
||||||
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
|
||||||
assertEquals(entity, written);
|
assertEquals(entity, written);
|
||||||
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -355,14 +362,15 @@ public class EntityTest extends AbstractTest {
|
||||||
annotated(ODataFormat.JSON);
|
annotated(ODataFormat.JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void derived(final ODataClient client, final ODataFormat format) throws ODataDeserializerException {
|
private void derived(final ODataClient client, final ODataFormat format) throws Exception {
|
||||||
final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));
|
final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));
|
||||||
final ODataEntity entity = client.getBinder().getODataEntity(client.getDeserializer(format).toEntity(input));
|
final ODataEntity entity = client.getBinder().getODataEntity(client.getDeserializer(format).toEntity(input));
|
||||||
assertNotNull(entity);
|
assertNotNull(entity);
|
||||||
|
|
||||||
assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
|
assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
|
||||||
assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
|
assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
|
||||||
((ODataValuable) entity.getProperty("HomeAddress")).getValue().getTypeName());
|
((ODataValuable) entity.getProperty("HomeAddress")).getValue().getTypeName());
|
||||||
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -29,47 +29,4 @@ public interface ODataProperty extends ODataInvokeResult, ODataAnnotatable, ODat
|
||||||
* @return property name.
|
* @return property name.
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns property value.
|
|
||||||
*
|
|
||||||
* @return property value.
|
|
||||||
*/
|
|
||||||
ODataValue getValue();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if has null value.
|
|
||||||
*
|
|
||||||
* @return 'TRUE' if has null value; 'FALSE' otherwise.
|
|
||||||
*/
|
|
||||||
boolean hasNullValue();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if has primitive value.
|
|
||||||
*
|
|
||||||
* @return 'TRUE' if has primitive value; 'FALSE' otherwise.
|
|
||||||
*/
|
|
||||||
boolean hasPrimitiveValue();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets primitive value.
|
|
||||||
*
|
|
||||||
* @return primitive value if exists; null otherwise.
|
|
||||||
*/
|
|
||||||
ODataPrimitiveValue getPrimitiveValue();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if has collection value.
|
|
||||||
*
|
|
||||||
* @return 'TRUE' if has collection value; 'FALSE' otherwise.
|
|
||||||
*/
|
|
||||||
boolean hasCollectionValue();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if has complex value.
|
|
||||||
*
|
|
||||||
* @return 'TRUE' if has complex value; 'FALSE' otherwise.
|
|
||||||
*/
|
|
||||||
boolean hasComplexValue();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,7 +203,7 @@ public class ExpressionVisitorImpl implements ExpressionVisitor<VisitorOperand>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TypedOperand(((Property) currentProperty).getValue(), currentType, currentEdmProperty);
|
return new TypedOperand(currentProperty.getValue(), currentType, currentEdmProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -315,7 +315,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
|
||||||
|
|
||||||
for (Object arrayElement : asCollection) {
|
for (Object arrayElement : asCollection) {
|
||||||
assertTrue(arrayElement instanceof ComplexValue);
|
assertTrue(arrayElement instanceof ComplexValue);
|
||||||
List<Property> castedArrayElement = (List<Property>) ((ComplexValue) arrayElement).getValue();
|
List<Property> castedArrayElement = ((ComplexValue) arrayElement).getValue();
|
||||||
assertEquals(2, castedArrayElement.size());
|
assertEquals(2, castedArrayElement.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
|
||||||
|
|
||||||
Property complexProperty = entity.getProperty("PropertyComp");
|
Property complexProperty = entity.getProperty("PropertyComp");
|
||||||
assertEquals(ValueType.COMPLEX, complexProperty.getValueType());
|
assertEquals(ValueType.COMPLEX, complexProperty.getValueType());
|
||||||
List<Property> complexPropertyValues = (List<Property>) complexProperty.asComplex().getValue();
|
List<Property> complexPropertyValues = complexProperty.asComplex().getValue();
|
||||||
assertEquals(1, complexPropertyValues.size());
|
assertEquals(1, complexPropertyValues.size());
|
||||||
|
|
||||||
Property property = entity.getProperty("CollPropertyComp");
|
Property property = entity.getProperty("CollPropertyComp");
|
||||||
|
@ -352,7 +352,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
|
||||||
|
|
||||||
for (Object arrayElement : asCollection) {
|
for (Object arrayElement : asCollection) {
|
||||||
assertTrue(arrayElement instanceof ComplexValue);
|
assertTrue(arrayElement instanceof ComplexValue);
|
||||||
List<Property> castedArrayElement = (List<Property>) ((ComplexValue) arrayElement).getValue();
|
List<Property> castedArrayElement = ((ComplexValue) arrayElement).getValue();
|
||||||
assertEquals(1, castedArrayElement.size());
|
assertEquals(1, castedArrayElement.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -513,8 +513,9 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
|
||||||
assertEquals("string", defProperty.getValue());
|
assertEquals("string", defProperty.getValue());
|
||||||
|
|
||||||
Property complexProperty = entity.getProperty("PropertyCompMixedEnumDef");
|
Property complexProperty = entity.getProperty("PropertyCompMixedEnumDef");
|
||||||
List<Property> value = (List<Property>) complexProperty.asComplex().getValue();
|
List<Property> value = complexProperty.asComplex().getValue();
|
||||||
assertEquals((short) 2, value.get(0).getValue());
|
assertEquals((short) 2, value.get(0).getValue());
|
||||||
|
stream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -577,7 +578,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
|
||||||
new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
|
new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
|
||||||
List<?> collPropertyComp = entity.getProperty("CollPropertyComp").asCollection();
|
List<?> collPropertyComp = entity.getProperty("CollPropertyComp").asCollection();
|
||||||
assertNull(collPropertyComp.get(0));
|
assertNull(collPropertyComp.get(0));
|
||||||
List<Property> complexPropertyProperties = (List<Property>) ((ComplexValue) collPropertyComp.get(1)).getValue();
|
List<Property> complexPropertyProperties = ((ComplexValue) collPropertyComp.get(1)).getValue();
|
||||||
assertEquals(Short.valueOf((short) 789), complexPropertyProperties.get(0).getValue());
|
assertEquals(Short.valueOf((short) 789), complexPropertyProperties.get(0).getValue());
|
||||||
assertEquals("TEST 3", complexPropertyProperties.get(1).getValue());
|
assertEquals("TEST 3", complexPropertyProperties.get(1).getValue());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue